Gentoo Archives: gentoo-commits

From: Brian Dolbec <brian.dolbec@×××××.com>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] proj/portage:repoman commit in: pym/repoman/
Date: Wed, 01 Oct 2014 23:02:40
Message-Id: 1412204293.051d7a600b8e41a7eff7ce08fca9e44012a1f01b.dol-sen@gentoo
1 commit: 051d7a600b8e41a7eff7ce08fca9e44012a1f01b
2 Author: Tom Wijsman <tomwij <AT> gentoo <DOT> org>
3 AuthorDate: Tue Jun 3 11:28:44 2014 +0000
4 Commit: Brian Dolbec <brian.dolbec <AT> gmail <DOT> com>
5 CommitDate: Wed Oct 1 22:58:13 2014 +0000
6 URL: http://sources.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=051d7a60
7
8 repoman/main.py: Refactor "RepoMan Sez"
9
10 ---
11 pym/repoman/main.py | 27 ++++++++++-----------------
12 pym/repoman/utilities.py | 8 ++++++--
13 2 files changed, 16 insertions(+), 19 deletions(-)
14
15 diff --git a/pym/repoman/main.py b/pym/repoman/main.py
16 index 5f21e7a..3b5296b 100755
17 --- a/pym/repoman/main.py
18 +++ b/pym/repoman/main.py
19 @@ -973,25 +973,21 @@ if options.mode != 'commit':
20 if dofull:
21 print(bold("Note: type \"repoman full\" for a complete listing."))
22 if dowarn and not dofail:
23 - print(
24 - green("RepoMan sez:"),
25 + utilities.repoman_sez(
26 "\"You're only giving me a partial QA payment?\n"
27 " I'll take it this time, but I'm not happy.\"")
28 elif not dofail:
29 - print(
30 - green("RepoMan sez:"),
31 + utilities.repoman_sez(
32 "\"If everyone were like you, I'd be out of business!\"")
33 elif dofail:
34 print(bad("Please fix these important QA issues first."))
35 - print(
36 - green("RepoMan sez:"),
37 + utilities.repoman_sez(
38 "\"Make your QA payment on time"
39 " and you'll never see the likes of me.\"\n")
40 sys.exit(1)
41 else:
42 if dofail and can_force and options.force and not options.pretend:
43 - print(
44 - green("RepoMan sez:"),
45 + utilities.repoman_sez(
46 " \"You want to commit even with these QA issues?\n"
47 " I'll take it this time, but I'm not happy.\"\n")
48 elif dofail:
49 @@ -1000,15 +996,13 @@ else:
50 "The --force option has been disabled"
51 " due to extraordinary issues."))
52 print(bad("Please fix these important QA issues first."))
53 - print(
54 - green("RepoMan sez:"),
55 + utilities.repoman_sez(
56 "\"Make your QA payment on time"
57 " and you'll never see the likes of me.\"\n")
58 sys.exit(1)
59
60 if options.pretend:
61 - print(
62 - green("RepoMan sez:"),
63 + utilities.repoman_sez(
64 "\"So, you want to play it safe. Good call.\"\n")
65
66 myunadded = []
67 @@ -1187,7 +1181,8 @@ else:
68
69 if vcs_settings.vcs:
70 if not (mychanged or mynew or myremoved or (vcs_settings.vcs == "hg" and mydeleted)):
71 - print(green("RepoMan sez:"), "\"Doing nothing is not always good for QA.\"")
72 + utilities.repoman_sez(
73 + "\"Doing nothing is not always good for QA.\"")
74 print()
75 print("(Didn't find any changed files...)")
76 print()
77 @@ -1588,8 +1583,7 @@ else:
78 portage.util.write_atomic(x, b''.join(mylines), mode='wb')
79
80 if repolevel == 1:
81 - print(
82 - green("RepoMan sez:"),
83 + utilities.repoman_sez(
84 "\"You're rather crazy... "
85 "doing the entire repository.\"\n")
86
87 @@ -1706,7 +1700,6 @@ else:
88 "repoman was too scared"
89 " by not seeing any familiar version control file"
90 " that he forgot to commit anything")
91 - print(
92 - green("RepoMan sez:"),
93 + utilities.repoman_sez(
94 "\"If everyone were like you, I'd be out of business!\"\n")
95 sys.exit(0)
96
97 diff --git a/pym/repoman/utilities.py b/pym/repoman/utilities.py
98 index b7b3945..b19d4e1 100644
99 --- a/pym/repoman/utilities.py
100 +++ b/pym/repoman/utilities.py
101 @@ -39,9 +39,10 @@ from portage import shutil
102 from portage import _encodings
103 from portage import _unicode_decode
104 from portage import _unicode_encode
105 +from portage import util
106 from portage.localization import _
107 from portage.process import find_binary
108 -from portage import util
109 +from portage.output import green
110
111 from repoman.copyrights import update_copyright, update_copyright_year
112
113 @@ -126,7 +127,6 @@ def FindPackagesToScan(settings, startdir, reposplit):
114 path = os.path.join(startdir, cat)
115 if not os.path.isdir(path):
116 continue
117 - pkgdirs = os.listdir(path)
118 scanlist.extend(AddPackagesInDir(path))
119 elif repolevel == 2: # category level, startdir = catdir
120 # We only want 1 segment of the directory,
121 @@ -586,3 +586,7 @@ def UpdateChangeLog(
122 except OSError:
123 pass
124 return None
125 +
126 +
127 +def repoman_sez(msg):
128 + print (green("RepoMan sez:"), msg)