CVS: src/si/extras entitycheck.py,1.16,1.17 package_locations,1.11,1.12
Mats Wichmann <[email protected]>
| Newsgroups | gmane.linux.lsb.implementation |
|---|---|
| Message-ID | <[email protected]> |
Update of /cvsroot/lsb/src/si/extras
In directory sc8-pr-cvs1:/tmp/cvs-serv16747
Modified Files:
entitycheck.py package_locations
Log Message:
Some more tweaking. Now we get a separate report on file retreival
activities, including if there are entities that don't appear in
the package_locations file
Index: entitycheck.py
===================================================================
RCS file: /cvsroot/lsb/src/si/extras/entitycheck.py,v
retrieving revision 1.16
retrieving revision 1.17
diff -C2 -r1.16 -r1.17
*** entitycheck.py 7 Jan 2003 04:28:15 -0000 1.16
--- entitycheck.py 8 Jan 2003 00:02:56 -0000 1.17
***************
*** 118,122 ****
self.md5sum = "%02x"*len(s) % tuple(map(ord, s))
! def fetch(self, locations, file, fallback, destination):
"""retrieve a missing or bad file.
Calls urllib.urlretrieve() up to three times to retrieve to
--- 118,122 ----
self.md5sum = "%02x"*len(s) % tuple(map(ord, s))
! def fetch(self, locations, fallback, destination):
"""retrieve a missing or bad file.
Calls urllib.urlretrieve() up to three times to retrieve to
***************
*** 125,136 ****
"""
global initial_text
for loc in locations:
if self.name != loc.name: continue
pkgpath = "%s/%s" % (destination, self.file)
- initial_text = "%s ->" % self.name
print initial_text,
sys.stdout.flush() # force text to be displayed
- message = ""
# try up to three times to fetch the file
if dry_run:
--- 125,136 ----
"""
global initial_text
+ message = "not found"
for loc in locations:
+ initial_text = "%s ->" % self.name
if self.name != loc.name: continue
pkgpath = "%s/%s" % (destination, self.file)
print initial_text,
sys.stdout.flush() # force text to be displayed
# try up to three times to fetch the file
if dry_run:
***************
*** 276,281 ****
print "Package entities found:", len(fnd_pkg)
print "Patch entities found:", len(fnd_pat)
-
- if noisy:
dump_coll(miss_pkg, "Packages not found:")
dump_coll(miss_pat, "Patches not found:")
--- 276,279 ----
***************
*** 288,291 ****
--- 286,305 ----
return 0
+ def fetch_report(retrieved, missed, missing):
+ """Generate file fetch report. Split from regular report
+ because we want report to show, then the fetch attempt,
+ then the fetch report.
+ Global "noisy" controls whether there's any output
+ Return non-zero on fatal error (missing files or bad sums)
+ """
+ if noisy:
+ print "Updated %s packages" % retrieved
+ dump_coll(missed, "Packages which failed to retrieve:")
+ dump_coll(missing, "Entities missing:")
+ if missed or missing:
+ return 1
+ else:
+ return 0
+
def readmd5(md5sum_file):
"""Read and parse a checksum file.
***************
*** 316,332 ****
"""
locations = parse_locations(file)
! total = 0; actual = 0
missed = []
global initial_text
for pkg in missing_packages:
! rv = pkg.fetch(locations, file, fallback, destination)
! if rv != 'skipped':
! total = total + 1
if rv == 'completed':
! actual = actual + 1
if rv == 'retrieval failed':
! missed.append(pkg.name)
! return (actual, total, missed)
!
# Main program:
--- 330,348 ----
"""
locations = parse_locations(file)
! retrieved = 0
missed = []
+ missing = []
global initial_text
for pkg in missing_packages:
! rv = pkg.fetch(locations, fallback, destination)
if rv == 'completed':
! retrieved = retrieved + 1
if rv == 'retrieval failed':
! missed.append(pkg)
! if rv == 'not found':
! # should not happen, but we track so we can catch where
! # an entity is defined but not listed in package_locations
! missing.append(pkg)
! return (retrieved, missed, missing)
# Main program:
***************
*** 354,358 ****
extras = extras + check_extra(patch_path, found_patches)
! bad_packages = bad_patches = None
if check_sums:
checksums = readmd5(md5sum_file)
--- 370,375 ----
extras = extras + check_extra(patch_path, found_patches)
! bad_packages = None
! bad_patches = None
if check_sums:
checksums = readmd5(md5sum_file)
***************
*** 360,373 ****
bad_patches = check_checksums(found_patches, checksums)
! exitcode = report(found_packages, found_patches,
! missing_packages, missing_patches, extras,
! bad_packages, bad_patches)
# go fetch files if needed
! # note: this will try to fetch patches with bad sums, which will fail (for now)
! if fetch_files and bad_packages:
! retrieve_packages(bad_packages, update_file, fallback_url, package_path)
! if fetch_files and missing_packages:
! retrieve_packages(missing_packages, update_file, fallback_url, package_path)
# quit non-zero if any entities were missing
--- 377,400 ----
bad_patches = check_checksums(found_patches, checksums)
! # tell us what happened
! exitcode = report(found_packages, found_patches, missing_packages,
! missing_patches, extras, bad_packages, bad_patches)
# go fetch files if needed
! if fetch_files:
! retrieved = 0
! missed = missing = []
! if bad_packages:
! retrieved, missed, missing = retrieve_packages(bad_packages,
! update_file, fallback_url, package_path)
! if missing_packages:
! r2, m2, x2 = retrieve_packages(missing_packages,
! update_file, fallback_url, package_path)
! retrieved = retrieved + r2
! missed = missed + m2
! missing = missing + x2
!
! # tell us what happened on the fetch
! exitcode = exitcode + fetch_report(retrieved, missed, missing)
# quit non-zero if any entities were missing
Index: package_locations
===================================================================
RCS file: /cvsroot/lsb/src/si/extras/package_locations,v
retrieving revision 1.11
retrieving revision 1.12
diff -C2 -r1.11 -r1.12
*** package_locations 20 Dec 2002 23:23:33 -0000 1.11
--- package_locations 8 Jan 2003 00:02:56 -0000 1.12
***************
*** 4,8 ****
binutils ftp://ftp.gnu.org/gnu/binutils None
bin86 http://www.cix.co.uk/~mayday/dev86 None // current: 0.16.9 == unstable
! bison ftp://ftp.gnu.org/gnu/bison None
bzip2 ftp://sources.redhat.com/pub/bzip2/v102 None
cpio ftp://ftp.gnu.org/gnu/cpio None
--- 4,8 ----
binutils ftp://ftp.gnu.org/gnu/binutils None
bin86 http://www.cix.co.uk/~mayday/dev86 None // current: 0.16.9 == unstable
! xison ftp://ftp.gnu.org/gnu/bison None
bzip2 ftp://sources.redhat.com/pub/bzip2/v102 None
cpio ftp://ftp.gnu.org/gnu/cpio None