Gentoo Archives: gentoo-portage-dev

From: Zac Medico <zmedico@g.o>
To: gentoo-portage-dev@l.g.o
Cc: Zac Medico <zmedico@g.o>
Subject: [gentoo-portage-dev] [PATCH] repoman: regen thick manifest after copyright update (bug 656698)
Date: Thu, 20 Sep 2018 20:39:45
Message-Id: 20180920203918.14248-1-zmedico@gentoo.org
1 Bug: https://bugs.gentoo.org/656698
2 ---
3 repoman/lib/repoman/actions.py | 14 +++++++++++++-
4 repoman/lib/repoman/copyrights.py | 10 ++++++++++
5 2 files changed, 23 insertions(+), 1 deletion(-)
6
7 diff --git a/repoman/lib/repoman/actions.py b/repoman/lib/repoman/actions.py
8 index 8e23322c8..05c63b824 100644
9 --- a/repoman/lib/repoman/actions.py
10 +++ b/repoman/lib/repoman/actions.py
11 @@ -151,10 +151,22 @@ the whole commit message to abort.
12
13 # Update copyright for new and changed files
14 year = time.strftime('%Y', time.gmtime())
15 + updated_copyright = []
16 for fn in chain(mynew, mychanged):
17 if fn.endswith('.diff') or fn.endswith('.patch'):
18 continue
19 - update_copyright(fn, year, pretend=self.options.pretend)
20 + if update_copyright(fn, year, pretend=self.options.pretend):
21 + updated_copyright.append(fn)
22 +
23 + if updated_copyright and not self.repo_settings.repo_config.thin_manifest:
24 + for x in sorted(vcs_files_to_cps(
25 + iter(updated_copyright),
26 + self.repo_settings.repodir,
27 + self.scanner.repolevel,
28 + self.scanner.reposplit,
29 + self.scanner.categories)):
30 + self.repoman_settings["O"] = os.path.join(self.repo_settings.repodir, x)
31 + digestgen(mysettings=self.repoman_settings, myportdb=self.repo_settings.portdb)
32
33 myupdates, broken_changelog_manifests = self.changelogs(
34 myupdates, mymanifests, myremoved, mychanged, myautoadd,
35 diff --git a/repoman/lib/repoman/copyrights.py b/repoman/lib/repoman/copyrights.py
36 index 1eaaab660..275dcbc3f 100644
37 --- a/repoman/lib/repoman/copyrights.py
38 +++ b/repoman/lib/repoman/copyrights.py
39 @@ -67,6 +67,15 @@ def update_copyright(fn_path, year, pretend=False):
40 Files are read and written in binary mode, so that this function
41 will work correctly with files encoded in any character set, as
42 long as the copyright statements consist of plain ASCII.
43 +
44 + @param fn_path: file path
45 + @type str
46 + @param year: current year
47 + @type str
48 + @param pretend: pretend mode
49 + @type bool
50 + @rtype: bool
51 + @return: True if copyright update was needed, False otherwise
52 """
53
54 try:
55 @@ -120,3 +129,4 @@ def update_copyright(fn_path, year, pretend=False):
56 else:
57 util.apply_stat_permissions(fn_path, fn_stat)
58 fn_hdl.close()
59 + return difflines > 3
60 --
61 2.16.4