summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorZac Medico <zmedico@gentoo.org>2009-03-11 07:36:49 +0000
committerZac Medico <zmedico@gentoo.org>2009-03-11 07:36:49 +0000
commitb8cfb8afa265cc07f22ac52eea16b8b18dbc1f36 (patch)
tree4c3a23457b36e6c9cab1201f9a4ab3af83c8e2b6
parent308b4b74fb2cd285516d6ffa7af4904946b95b3c (diff)
downloadportage-b8cfb8afa265cc07f22ac52eea16b8b18dbc1f36.tar.gz
portage-b8cfb8afa265cc07f22ac52eea16b8b18dbc1f36.tar.bz2
portage-b8cfb8afa265cc07f22ac52eea16b8b18dbc1f36.zip
Make manifest mode with --force option cause existing digests to be replaced
for any files that exist in ${DISTDIR}. This provides an alternative to ebuild --force manifest for updating existing distfiles digests. Digests are assumed to be corect for files that do not exist in ${DISTDIR} since the user could simply remove the whole Manifest if they wanted to regenerate digests for all files (and it's safer to regenerate as few as possible because it's less probably that a valid digest will get replaced by an invalid one). (trunk r12802) svn path=/main/branches/2.1.6/; revision=13036
-rwxr-xr-xbin/repoman39
-rw-r--r--man/repoman.111
2 files changed, 49 insertions, 1 deletions
diff --git a/bin/repoman b/bin/repoman
index 7bb507d98..ad5c51f83 100755
--- a/bin/repoman
+++ b/bin/repoman
@@ -799,11 +799,50 @@ for x in scanlist:
if options.mode == "manifest" or \
options.mode in ('commit', 'fix') and not options.pretend:
+ auto_assumed = set()
+ fetchlist_dict = portage.FetchlistDict(checkdir,
+ repoman_settings, portdb)
+ if options.mode == 'manifest' and options.force:
+ portage._doebuild_manifest_exempt_depend += 1
+ try:
+ distdir = repoman_settings['DISTDIR']
+ mf = portage.manifest.Manifest(checkdir, distdir,
+ fetchlist_dict=fetchlist_dict)
+ mf.create(requiredDistfiles=None,
+ assumeDistHashesAlways=True)
+ for distfiles in fetchlist_dict.itervalues():
+ for distfile in distfiles:
+ if os.path.isfile(os.path.join(distdir, distfile)):
+ mf.fhashdict['DIST'].pop(distfile, None)
+ else:
+ auto_assumed.add(distfile)
+ mf.write()
+ finally:
+ portage._doebuild_manifest_exempt_depend -= 1
+
repoman_settings["O"] = checkdir
if not portage.digestgen([], repoman_settings, myportdb=portdb):
print "Unable to generate manifest."
dofail = 1
if options.mode == "manifest":
+ if not dofail and options.force and auto_assumed and \
+ 'assume-digests' in repoman_settings.features:
+ # Show which digests were assumed despite the --force option
+ # being given. This output will already have been shown by
+ # digestgen() if assume-digests is not enabled, so only show
+ # it here if assume-digests is enabled.
+ pkgs = list(fetchlist_dict)
+ pkgs.sort()
+ portage.writemsg_stdout(" digest.assumed" + \
+ portage.output.colorize("WARN",
+ str(len(auto_assumed)).rjust(18)) + "\n")
+ for cpv in pkgs:
+ fetchmap = fetchlist_dict[cpv]
+ pf = portage.catsplit(cpv)[1]
+ for distfile in sorted(fetchmap):
+ if distfile in auto_assumed:
+ portage.writemsg_stdout(
+ " %s::%s\n" % (pf, distfile))
continue
elif dofail:
sys.exit(1)
diff --git a/man/repoman.1 b/man/repoman.1
index df9d6b07f..cca390aaf 100644
--- a/man/repoman.1
+++ b/man/repoman.1
@@ -18,6 +18,14 @@ Force commit to proceed, regardless of QA issues. For convenience, this option
causes the most time consuming QA checks to be skipped. The commit message will
include an indication that this option has been enabled, together with the
usual portage version stamp.
+
+When used together with \fBmanifest\fR mode, \fB--force\fR causes existing
+digests to be replaced for any files that exist in ${DISTDIR}.
+Existing digests are assumed to be correct for files that would otherwise
+have to be downloaded in order to recompute digests. \fBWARNING:\fR When
+replacing existing digests, it is the user's responsibility to ensure that
+files contained in ${DISTDIR} have the correct identities. Especially beware
+of partially downloaded files.
.TP
\fB-q\fR, \fB--quiet\fR
Be less verbose about extraneous info
@@ -69,7 +77,8 @@ Scan directory tree for QA issues (short listing)
Fix simple QA issues (stray digests, missing digests)
.TP
.B manifest
-Generate a Manifest (fetches files if necessary)
+Generate a Manifest (fetches distfiles if necessary). See the \fB\-\-force\fR
+option if you would like to replace existing distfiles digests.
.TP
.B commit
Scan directory tree for QA issues; if OK, commit via cvs