Gentoo Archives: gentoo-portage-dev

From: Mike Gilbert <floppym@g.o>
To: gentoo-portage-dev@l.g.o
Subject: [gentoo-portage-dev] [PATCH 1/2] repoman: normalize newline handling in get_commit_footer
Date: Sun, 30 Sep 2018 16:27:18
Message-Id: 20180930162713.6235-1-floppym@gentoo.org
1 Start with an empty string, and add a newline character at the start
2 of each sucessive line. This simplifies the logic needed to add a new
3 line to the footer.
4
5 Signed-off-by: Mike Gilbert <floppym@g.o>
6 ---
7 repoman/lib/repoman/actions.py | 10 +++++-----
8 1 file changed, 5 insertions(+), 5 deletions(-)
9
10 diff --git a/repoman/lib/repoman/actions.py b/repoman/lib/repoman/actions.py
11 index 9fe5f722e..3cf6f7081 100644
12 --- a/repoman/lib/repoman/actions.py
13 +++ b/repoman/lib/repoman/actions.py
14 @@ -419,7 +419,7 @@ the whole commit message to abort.
15 portage_version = "Unknown"
16
17 # Common part of commit footer
18 - commit_footer = "\n"
19 + commit_footer = ""
20 for tag, bug in chain(
21 (('Bug', x) for x in self.options.bug),
22 (('Closes', x) for x in self.options.closes)):
23 @@ -439,14 +439,14 @@ the whole commit message to abort.
24 elif (purl.scheme == 'http' and
25 purl.netloc in self.https_bugtrackers):
26 bug = urlunsplit(('https',) + purl[1:])
27 - commit_footer += "%s: %s\n" % (tag, bug)
28 + commit_footer += "\n%s: %s" % (tag, bug)
29
30 if dco_sob:
31 - commit_footer += "Signed-off-by: %s\n" % (dco_sob, )
32 + commit_footer += "\nSigned-off-by: %s" % (dco_sob, )
33
34 # Use new footer only for git (see bug #438364).
35 if self.vcs_settings.vcs in ["git"]:
36 - commit_footer += "Package-Manager: Portage-%s, Repoman-%s" % (
37 + commit_footer += "\nPackage-Manager: Portage-%s, Repoman-%s" % (
38 portage.VERSION, VERSION)
39 if report_options:
40 commit_footer += "\nRepoMan-Options: " + " ".join(report_options)
41 @@ -458,7 +458,7 @@ the whole commit message to abort.
42 unameout += platform.processor()
43 else:
44 unameout += platform.machine()
45 - commit_footer += "(Portage version: %s/%s/%s" % \
46 + commit_footer += "\n(Portage version: %s/%s/%s" % \
47 (portage_version, self.vcs_settings.vcs, unameout)
48 if report_options:
49 commit_footer += ", RepoMan options: " + " ".join(report_options)
50 --
51 2.19.0

Replies