gns-deb-diff

automate the documentation of the differences between gNewSense and Debian.
git clone git://git.ricketyspace.net/gns-deb-diff.git
Log | Files | Refs

commit 28b33ad545d0444a0477473eaf17f79af483216c
parent a972297166fc685fd5a80ad23fe094441e58a0cf
Author: rsiddharth <s@ricketyspace.net>
Date:   Sun, 30 Oct 2016 00:57:04 +0000

Add `slurp_all_gns_readmes` function.

* gd_diff.py (slurp_all_gns_readmes): New function.
* tests/files/small-parkes-pkgs.list: New file.
* tests/test_gd_diff.py (test_slurp_all_gns_readmes): Test function for
`slurp_all_gns_readmes`.

Diffstat:
gd_diff.py | 17+++++++++++++++++
tests/files/small-parkes-pkgs.list | 20++++++++++++++++++++
tests/test_gd_diff.py | 14++++++++++++++
3 files changed, 51 insertions(+), 0 deletions(-)

diff --git a/gd_diff.py b/gd_diff.py @@ -113,3 +113,20 @@ def slurp_gns_readme(release, pkg, local_dir): print("README.gNewSense not found for package {}".format(pkg), file=sys.stderr) return False + + +def slurp_all_gns_readmes(release, pkgs, local_dir): + """Read and save all README.gNewSense for `pkgs` in `release`. + + The README.gNewSense files gets saved under `local_dir`/`release` + + Returns list of packages in `pkgs` that does not have README.gNewSense. + """ + pkgs_noreadmes = [] + for pkg in pkgs: + slurped = slurp_gns_readme(release, pkg, local_dir) + + if(not slurped): + pkgs_noreadmes.append(pkg) + + return pkgs_noreadmes diff --git a/tests/files/small-parkes-pkgs.list b/tests/files/small-parkes-pkgs.list @@ -0,0 +1,19 @@ +antlr +apt +apt-setup +db4.7 +db4.8 + debian-cd +debian-edu +debian-installer +debian-installer-launcher +debootstrap +desktop-base + pkg-with-no-readme +doc-linux +doc-linux-hr +doc-linux-it +doc-linux-ja + another-pkgs-no-readme +doc-linux-pl +enscript+ \ No newline at end of file diff --git a/tests/test_gd_diff.py b/tests/test_gd_diff.py @@ -23,6 +23,7 @@ class TestGdDiff(object): def setup(self): """Setup method for this class.""" self.pkgs_file = 'tests/files/parkes-pkgs.list' + self.small_pkgs_file = 'tests/files/small-parkes-pkgs.list' self.pkgs_file_ne = 'tests/nonexistent-file.list' self.gns_pkgs_dir = 'tests/gns-pkgs' self.stderr_orig = sys.stderr @@ -129,6 +130,19 @@ class TestGdDiff(object): assert not path.exists(gns_readme_file) + def test_slurp_all_gns_readmes(self): + pkgs = get_packages(self.small_pkgs_file) + + # expected packages with no readmes + expected_pkgs_noreadmes = [ + 'pkg-with-no-readme', + 'another-pkgs-no-readme', + ] + + pkgs_noreadmes = slurp_all_gns_readmes('parkes', pkgs, self.gns_pkgs_dir) + assert_equal(pkgs_noreadmes, expected_pkgs_noreadmes) + + def teardown(self): """Teardown method for this class.""" if(path.exists(self.gns_pkgs_dir)):