From: "Zac Medico" <zmedico@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] proj/portage:master commit in: repoman/lib/repoman/
Date: Sat, 22 Sep 2018 09:44:49 +0000 (UTC) [thread overview]
Message-ID: <1537604594.4ff4e4200b984a88109b10de9e82b20451751aee.zmedico@gentoo> (raw)
commit: 4ff4e4200b984a88109b10de9e82b20451751aee
Author: Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Thu Sep 20 20:35:42 2018 +0000
Commit: Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Sat Sep 22 08:23:14 2018 +0000
URL: https://gitweb.gentoo.org/proj/portage.git/commit/?id=4ff4e420
repoman: regen thick manifest after copyright update (bug 656698)
Bug: https://bugs.gentoo.org/656698
repoman/lib/repoman/actions.py | 40 ++++++++++++++++++++++++++++++++++++++-
repoman/lib/repoman/copyrights.py | 10 ++++++++++
2 files changed, 49 insertions(+), 1 deletion(-)
diff --git a/repoman/lib/repoman/actions.py b/repoman/lib/repoman/actions.py
index 8e23322c8..9fe5f722e 100644
--- a/repoman/lib/repoman/actions.py
+++ b/repoman/lib/repoman/actions.py
@@ -151,10 +151,17 @@ the whole commit message to abort.
# Update copyright for new and changed files
year = time.strftime('%Y', time.gmtime())
+ updated_copyright = []
for fn in chain(mynew, mychanged):
if fn.endswith('.diff') or fn.endswith('.patch'):
continue
- update_copyright(fn, year, pretend=self.options.pretend)
+ if update_copyright(fn, year, pretend=self.options.pretend):
+ updated_copyright.append(fn)
+
+ if updated_copyright and not (
+ self.options.pretend or self.repo_settings.repo_config.thin_manifest):
+ for cp in sorted(self._vcs_files_to_cps(iter(updated_copyright))):
+ self._manifest_gen(cp)
myupdates, broken_changelog_manifests = self.changelogs(
myupdates, mymanifests, myremoved, mychanged, myautoadd,
@@ -230,6 +237,37 @@ the whole commit message to abort.
"\"If everyone were like you, I'd be out of business!\"\n")
return
+ def _vcs_files_to_cps(self, vcs_file_iter):
+ """
+ Iterate over the given modified file paths returned from the vcs,
+ and return a frozenset containing category/pn strings for each
+ modified package.
+
+ @param vcs_file_iter: file paths from vcs module
+ @type iter
+ @rtype: frozenset
+ @return: category/pn strings for each package.
+ """
+ return vcs_files_to_cps(
+ vcs_file_iter,
+ self.repo_settings.repodir,
+ self.scanner.repolevel,
+ self.scanner.reposplit,
+ self.scanner.categories)
+
+ def _manifest_gen(self, cp):
+ """
+ Generate manifest for a cp.
+
+ @param cp: category/pn string
+ @type str
+ @rtype: bool
+ @return: True if successful, False otherwise
+ """
+ self.repoman_settings["O"] = os.path.join(self.repo_settings.repodir, cp)
+ return not digestgen(
+ mysettings=self.repoman_settings,
+ myportdb=self.repo_settings.portdb)
def _suggest(self):
print()
diff --git a/repoman/lib/repoman/copyrights.py b/repoman/lib/repoman/copyrights.py
index 1eaaab660..275dcbc3f 100644
--- a/repoman/lib/repoman/copyrights.py
+++ b/repoman/lib/repoman/copyrights.py
@@ -67,6 +67,15 @@ def update_copyright(fn_path, year, pretend=False):
Files are read and written in binary mode, so that this function
will work correctly with files encoded in any character set, as
long as the copyright statements consist of plain ASCII.
+
+ @param fn_path: file path
+ @type str
+ @param year: current year
+ @type str
+ @param pretend: pretend mode
+ @type bool
+ @rtype: bool
+ @return: True if copyright update was needed, False otherwise
"""
try:
@@ -120,3 +129,4 @@ def update_copyright(fn_path, year, pretend=False):
else:
util.apply_stat_permissions(fn_path, fn_stat)
fn_hdl.close()
+ return difflines > 3
next reply other threads:[~2018-09-22 9:44 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-09-22 9:44 Zac Medico [this message]
-- strict thread matches above, loose matches on Subject: below --
2021-03-31 6:34 [gentoo-commits] proj/portage:master commit in: repoman/lib/repoman/ Zac Medico
2021-03-31 6:28 Zac Medico
2021-03-28 22:59 Zac Medico
2021-03-28 18:48 Zac Medico
2020-08-16 0:43 Zac Medico
2020-08-15 23:56 Zac Medico
2020-03-23 22:02 Zac Medico
2019-12-03 23:18 Zac Medico
2019-12-03 23:07 Zac Medico
2019-05-26 4:29 Zac Medico
2018-10-27 23:39 Zac Medico
2018-09-30 20:38 Mike Gilbert
2018-09-30 20:38 Mike Gilbert
2018-08-16 20:05 Michał Górny
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1537604594.4ff4e4200b984a88109b10de9e82b20451751aee.zmedico@gentoo \
--to=zmedico@gentoo.org \
--cc=gentoo-commits@lists.gentoo.org \
--cc=gentoo-dev@lists.gentoo.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox