Mercurial > treepkg
changeset 252:2e0b373414b8
Make bin/listpackages.py ignore revisions that have not been built
successfully, unless the revision has been explicitly selected. Add a
test case for this.
author | Bernhard Herzog <bh@intevation.de> |
---|---|
date | Tue, 14 Apr 2009 09:41:59 +0000 |
parents | 243f206574cb |
children | 7d932fac1055 |
files | bin/listpackages.py test/test_listpackages.py |
diffstat | 2 files changed, 46 insertions(+), 7 deletions(-) [+] |
line wrap: on
line diff
--- a/bin/listpackages.py Thu Apr 09 18:59:44 2009 +0000 +++ b/bin/listpackages.py Tue Apr 14 09:41:59 2009 +0000 @@ -65,7 +65,13 @@ revisions = sorted(revisions, key=lambda r: r.status.start, reverse=True) if main_rev is None: - revpkg = revisions[0] + filtered = [revpkg for revpkg in revisions + if revpkg.status.status.finished + and not revpkg.status.status.error] + if filtered: + revpkg = filtered[0] + else: + revpkg = None else: # iterate in reverse, so that we pick up the newest revision # packager with the desired revision first if rules_rev is None
--- a/test/test_listpackages.py Thu Apr 09 18:59:44 2009 +0000 +++ b/test/test_listpackages.py Tue Apr 14 09:41:59 2009 +0000 @@ -30,19 +30,29 @@ package_dirs = [] for revision in revisions: - rev, rules_rev = revision status = RevisionStatus(None) - status.binary_package_created() + if len(revision) == 2: + rev, rules_rev = revision + status.binary_package_created() + else: + rev, rules_rev, status_name = revision + getattr(status, status_name)() + status.start = start_time status.stop = start_time + build_duration start_time += check_interval + if status.status.finished and not status.status.error: + src_files = [(template % (rev,), "") for template in src_templates] + bin_files = [(template % (rev,), "") for template in bin_templates] + else: + src_files = [] + bin_files = [] + package_dirs.append(("%s-%s" % (rev, rules_rev), [("status", "".join(status.serialize())), - ("src", [(template % (rev,), "") - for template in src_templates]), - ("binary", [(template % (rev,), "") - for template in bin_templates])])) + ("src", src_files), + ("binary", bin_files)])) return (track, [("pkg", package_dirs)]) @@ -162,6 +172,29 @@ """) +class TestListPackagesTrackNoRevisionWithIncompleteBuilds(ListPackagesTest): + + track_files = [package_track_files("kdepim", "1.0.1", + ["kdepim", "kleopatra"], + [(702432, 47), + (704195, 31, "error")])] + + def test_listpackages_source(self): + self.check_cmd(["--track=kdepim", "--source"], + """\ +kdepim/pkg/702432-47/src/kdepim_1.0.1.702432-1.diff.gz +kdepim/pkg/702432-47/src/kdepim_1.0.1.702432-1.dsc +kdepim/pkg/702432-47/src/kdepim_1.0.1.702432.orig.tar.gz +""") + + def test_listpackages_binary(self): + self.check_cmd(["--track=kdepim", "--binary"], + """\ +kdepim/pkg/702432-47/binary/kdepim_1.0.1.702432-1_i386.deb +kdepim/pkg/702432-47/binary/kleopatra_1.0.1.702432-1_i386.deb +""") + + class TestListPackagesNoTrackNoRevision(ListPackagesTest): track_files = [package_track_files("kdepim", "1.0.1",