1 |
commit: 5d91183c50d57d7ddb06721a64f2ae6f95b6aeea |
2 |
Author: Brian Dolbec <dolsen <AT> gentoo <DOT> org> |
3 |
AuthorDate: Sat Sep 19 02:59:11 2015 +0000 |
4 |
Commit: Brian Dolbec <dolsen <AT> gentoo <DOT> org> |
5 |
CommitDate: Mon Sep 21 23:42:46 2015 +0000 |
6 |
URL: https://gitweb.gentoo.org/proj/portage.git/commit/?id=5d91183c |
7 |
|
8 |
repoman/actions.py: Split out the commit footer to a function |
9 |
|
10 |
pym/repoman/actions.py | 95 ++++++++++++++++++++++++++------------------------ |
11 |
1 file changed, 49 insertions(+), 46 deletions(-) |
12 |
|
13 |
diff --git a/pym/repoman/actions.py b/pym/repoman/actions.py |
14 |
index 1f70815..e9bf147 100644 |
15 |
--- a/pym/repoman/actions.py |
16 |
+++ b/pym/repoman/actions.py |
17 |
@@ -133,53 +133,8 @@ class Actions(object): |
18 |
sys.exit(1) |
19 |
commitmessage = commitmessage.rstrip() |
20 |
changelog_msg = commitmessage |
21 |
- portage_version = getattr(portage, "VERSION", None) |
22 |
- gpg_key = self.repoman_settings.get("PORTAGE_GPG_KEY", "") |
23 |
- dco_sob = self.repoman_settings.get("DCO_SIGNED_OFF_BY", "") |
24 |
- if portage_version is None: |
25 |
- sys.stderr.write("Failed to insert portage version in message!\n") |
26 |
- sys.stderr.flush() |
27 |
- portage_version = "Unknown" |
28 |
- |
29 |
- report_options = [] |
30 |
- if self.options.force: |
31 |
- report_options.append("--force") |
32 |
- if self.options.ignore_arches: |
33 |
- report_options.append("--ignore-arches") |
34 |
- if self.scanner.include_arches is not None: |
35 |
- report_options.append( |
36 |
- "--include-arches=\"%s\"" % |
37 |
- " ".join(sorted(self.scanner.include_arches))) |
38 |
- |
39 |
- if self.vcs_settings.vcs == "git": |
40 |
- # Use new footer only for git (see bug #438364). |
41 |
- commit_footer = "\n\nPackage-Manager: portage-%s" % portage_version |
42 |
- if report_options: |
43 |
- commit_footer += "\nRepoMan-Options: " + " ".join(report_options) |
44 |
- if self.repo_settings.sign_manifests: |
45 |
- commit_footer += "\nManifest-Sign-Key: %s" % (gpg_key, ) |
46 |
- if dco_sob: |
47 |
- commit_footer += "\nSigned-off-by: %s" % (dco_sob, ) |
48 |
- else: |
49 |
- unameout = platform.system() + " " |
50 |
- if platform.system() in ["Darwin", "SunOS"]: |
51 |
- unameout += platform.processor() |
52 |
- else: |
53 |
- unameout += platform.machine() |
54 |
- commit_footer = "\n\n" |
55 |
- if dco_sob: |
56 |
- commit_footer += "Signed-off-by: %s\n" % (dco_sob, ) |
57 |
- commit_footer += "(Portage version: %s/%s/%s" % \ |
58 |
- (portage_version, self.vcs_settings.vcs, unameout) |
59 |
- if report_options: |
60 |
- commit_footer += ", RepoMan options: " + " ".join(report_options) |
61 |
- if self.repo_settings.sign_manifests: |
62 |
- commit_footer += ", signed Manifest commit with key %s" % \ |
63 |
- (gpg_key, ) |
64 |
- else: |
65 |
- commit_footer += ", unsigned Manifest commit" |
66 |
- commit_footer += ")" |
67 |
|
68 |
+ commit_footer = self.get_commit_footer() |
69 |
commitmessage += commit_footer |
70 |
|
71 |
broken_changelog_manifests = [] |
72 |
@@ -797,3 +752,51 @@ class Actions(object): |
73 |
expansion = {} |
74 |
return (mynew, mychanged, myremoved, no_expansion, expansion) |
75 |
|
76 |
+ |
77 |
+ def get_commit_footer(self): |
78 |
+ portage_version = getattr(portage, "VERSION", None) |
79 |
+ gpg_key = self.repoman_settings.get("PORTAGE_GPG_KEY", "") |
80 |
+ dco_sob = self.repoman_settings.get("DCO_SIGNED_OFF_BY", "") |
81 |
+ report_options = [] |
82 |
+ if self.options.force: |
83 |
+ report_options.append("--force") |
84 |
+ if self.options.ignore_arches: |
85 |
+ report_options.append("--ignore-arches") |
86 |
+ if self.scanner.include_arches is not None: |
87 |
+ report_options.append( |
88 |
+ "--include-arches=\"%s\"" % |
89 |
+ " ".join(sorted(self.scanner.include_arches))) |
90 |
+ |
91 |
+ if portage_version is None: |
92 |
+ sys.stderr.write("Failed to insert portage version in message!\n") |
93 |
+ sys.stderr.flush() |
94 |
+ portage_version = "Unknown" |
95 |
+ # Use new footer only for git (see bug #438364). |
96 |
+ if self.vcs_settings.vcs in ["git"]: |
97 |
+ commit_footer = "\n\nPackage-Manager: portage-%s" % portage_version |
98 |
+ if report_options: |
99 |
+ commit_footer += "\nRepoMan-Options: " + " ".join(report_options) |
100 |
+ if self.repo_settings.sign_manifests: |
101 |
+ commit_footer += "\nManifest-Sign-Key: %s" % (gpg_key, ) |
102 |
+ if dco_sob: |
103 |
+ commit_footer += "\nSigned-off-by: %s" % (dco_sob, ) |
104 |
+ else: |
105 |
+ unameout = platform.system() + " " |
106 |
+ if platform.system() in ["Darwin", "SunOS"]: |
107 |
+ unameout += platform.processor() |
108 |
+ else: |
109 |
+ unameout += platform.machine() |
110 |
+ commit_footer = "\n\n" |
111 |
+ if dco_sob: |
112 |
+ commit_footer += "Signed-off-by: %s\n" % (dco_sob, ) |
113 |
+ commit_footer += "(Portage version: %s/%s/%s" % \ |
114 |
+ (portage_version, self.vcs_settings.vcs, unameout) |
115 |
+ if report_options: |
116 |
+ commit_footer += ", RepoMan options: " + " ".join(report_options) |
117 |
+ if self.repo_settings.sign_manifests: |
118 |
+ commit_footer += ", signed Manifest commit with key %s" % \ |
119 |
+ (gpg_key, ) |
120 |
+ else: |
121 |
+ commit_footer += ", unsigned Manifest commit" |
122 |
+ commit_footer += ")" |
123 |
+ return commit_footer |