Gentoo Archives: gentoo-commits

From: Zac Medico <zmedico@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] proj/portage:master commit in: repoman/bin/, repoman/lib/repoman/modules/commit/, repoman/lib/repoman/
Date: Sat, 27 Oct 2018 21:29:28
Message-Id: 1540675664.91a9c2da33802f1f71e669bffc7ce940b9f6d450.zmedico@gentoo
1 commit: 91a9c2da33802f1f71e669bffc7ce940b9f6d450
2 Author: Zac Medico <zmedico <AT> gentoo <DOT> org>
3 AuthorDate: Sat Oct 27 20:42:16 2018 +0000
4 Commit: Zac Medico <zmedico <AT> gentoo <DOT> org>
5 CommitDate: Sat Oct 27 21:27:44 2018 +0000
6 URL: https://gitweb.gentoo.org/proj/portage.git/commit/?id=91a9c2da
7
8 repoman: fix exit code for manifest mode (bug 588752)
9
10 When manifest generation fails, report "manifest.bad" violations.
11
12 Reported-by: Lars Wendler <polynomial-c <AT> gentoo.org>
13 Bug: https://bugs.gentoo.org/588752
14 Signed-off-by: Zac Medico <zmedico <AT> gentoo.org>
15
16 repoman/bin/repoman | 2 +-
17 repoman/lib/repoman/main.py | 9 +++++----
18 repoman/lib/repoman/modules/commit/manifest.py | 11 ++++-------
19 repoman/lib/repoman/scanner.py | 3 ++-
20 4 files changed, 12 insertions(+), 13 deletions(-)
21
22 diff --git a/repoman/bin/repoman b/repoman/bin/repoman
23 index 873987f33..7f6187f12 100755
24 --- a/repoman/bin/repoman
25 +++ b/repoman/bin/repoman
26 @@ -42,7 +42,7 @@ from portage.util._eventloop.global_event_loop import global_event_loop
27 from repoman.main import repoman_main
28
29 try:
30 - repoman_main(sys.argv[1:])
31 + sys.exit(repoman_main(sys.argv[1:]))
32 except IOError as e:
33 if e.errno == errno.EACCES:
34 print("\nRepoman: Need user access")
35
36 diff --git a/repoman/lib/repoman/main.py b/repoman/lib/repoman/main.py
37 index 81e2ff61e..731e8eae2 100755
38 --- a/repoman/lib/repoman/main.py
39 +++ b/repoman/lib/repoman/main.py
40 @@ -133,10 +133,6 @@ def repoman_main(argv):
41 'full': options.mode != 'full',
42 }
43
44 - # early out for manifest generation
45 - if options.mode == "manifest":
46 - sys.exit(result['fail'])
47 -
48 for x in qadata.qacats:
49 if x not in vcs_settings.qatracker.fails:
50 continue
51 @@ -182,6 +178,11 @@ def repoman_main(argv):
52
53 style_file.flush()
54 del console_writer, f, style_file
55 +
56 + # early out for manifest generation
57 + if options.mode == "manifest":
58 + return 1 if result['fail'] else 0
59 +
60 qa_output = qa_output.getvalue()
61 qa_output = qa_output.splitlines(True)
62
63
64 diff --git a/repoman/lib/repoman/modules/commit/manifest.py b/repoman/lib/repoman/modules/commit/manifest.py
65 index b338a5b40..573710a62 100644
66 --- a/repoman/lib/repoman/modules/commit/manifest.py
67 +++ b/repoman/lib/repoman/modules/commit/manifest.py
68 @@ -30,7 +30,8 @@ class Manifest(object):
69 '''Perform a manifest generation for the pkg
70
71 @param checkdir: the current package directory
72 - @returns: dictionary
73 + @rtype: bool
74 + @return: True if successful, False otherwise
75 '''
76 self.generated_manifest = False
77 failed = False
78 @@ -51,7 +52,7 @@ class Manifest(object):
79
80 if not self.generated_manifest:
81 writemsg_level(
82 - "Unable to generate manifest.",
83 + "!!! Unable to generate manifest for '%s'.\n" % (checkdir,),
84 level=logging.ERROR, noiselevel=-1)
85 failed = True
86
87 @@ -75,11 +76,7 @@ class Manifest(object):
88 if distfile in self.auto_assumed:
89 portage.writemsg_stdout(
90 " %s::%s\n" % (pf, distfile))
91 - # continue, skip remaining main loop code
92 - return True
93 - elif failed:
94 - sys.exit(1)
95 - return False
96 + return not failed
97
98 def _discard_dist_digests(self, checkdir, fetchlist_dict):
99 '''Discard DIST digests for files that exist in DISTDIR
100
101 diff --git a/repoman/lib/repoman/scanner.py b/repoman/lib/repoman/scanner.py
102 index c456bbde9..1b3242a51 100644
103 --- a/repoman/lib/repoman/scanner.py
104 +++ b/repoman/lib/repoman/scanner.py
105 @@ -290,7 +290,8 @@ class Scanner(object):
106 self.vcs_settings.status.check(checkdir, checkdir_relative, xpkg)
107
108 if self.generate_manifest:
109 - manifest.Manifest(**self.kwargs).update_manifest(checkdir)
110 + if not manifest.Manifest(**self.kwargs).update_manifest(checkdir):
111 + self.qatracker.add_error("manifest.bad", os.path.join(xpkg, 'Manifest'))
112 if self.options.mode == 'manifest':
113 continue
114 checkdirlist = os.listdir(checkdir)