diff options
author | Zac Medico <zmedico@gentoo.org> | 2007-05-22 13:19:38 +0000 |
---|---|---|
committer | Zac Medico <zmedico@gentoo.org> | 2007-05-22 13:19:38 +0000 |
commit | 50c0a9e34c0ec837b1c21bef5b6e27a7a9334eec (patch) | |
tree | 17e1ce0ad4925bfdf9525166e04a6ec2a7e0710b | |
parent | In fetch(), don't try to parse digests unless the "O" variable is defined. (t... (diff) | |
download | portage-50c0a9e34c0ec837b1c21bef5b6e27a7a9334eec.tar.gz portage-50c0a9e34c0ec837b1c21bef5b6e27a7a9334eec.tar.bz2 portage-50c0a9e34c0ec837b1c21bef5b6e27a7a9334eec.zip |
For bug #179008, just use metadata.dtd directly from $DISTDIR. (trunk r6561:6562)
svn path=/main/branches/2.1.2/; revision=6576
-rwxr-xr-x | bin/repoman | 27 |
1 files changed, 13 insertions, 14 deletions
diff --git a/bin/repoman b/bin/repoman index 3eef5c29d..3f7414c9a 100755 --- a/bin/repoman +++ b/bin/repoman @@ -635,6 +635,7 @@ for x in qacats: stats[x]=0 fails[x]=[] xmllint_capable = False +metadata_dtd = os.path.join(repoman_settings["DISTDIR"], 'metadata.dtd') if getstatusoutput('which xmllint')[0] != 0: print red("!!! xmllint not found. Can't check metadata.xml.\n") if "--xmlparse" in myoptions or repolevel==3: @@ -647,7 +648,7 @@ else: try: # if it's been over a week since fetching (or the system clock is fscked), grab an updated copy of metadata.dtd # clock is fscked or it's been a week. time to grab a new one. - ct=os.stat(portage.CACHE_PATH + '/metadata.dtd')[ST_CTIME] + ct = os.stat(metadata_dtd)[ST_CTIME] if abs(time.time() - ct) > (60*60*24*7): # don't trap the exception, we're watching for errno 2 (file not found), anything else is a bug. backup_exists=1 @@ -663,18 +664,16 @@ else: print print green("***")+" the local copy of metadata.dtd needs to be refetched, doing that now" print + val = 0 try: - if os.path.exists(repoman_settings["DISTDIR"]+'/metadata.dtd'): - os.remove(repoman_settings["DISTDIR"]+'/metadata.dtd') + try: + os.unlink(metadata_dtd) + except OSError, e: + if e.errno != errno.ENOENT: + raise + del e val=portage.fetch(['http://www.gentoo.org/dtd/metadata.dtd'],repoman_settings,fetchonly=0, \ try_mirrors=0) - if val: - if backup_exists: - os.remove(portage.CACHE_PATH+'/metadata.dtd') - shutil.copy(repoman_settings["DISTDIR"]+'/metadata.dtd',portage.CACHE_PATH+'/metadata.dtd') - os.chown(portage.CACHE_PATH+'/metadata.dtd',os.getuid(),portage.portage_gid) - os.chmod(portage.CACHE_PATH+'/metadata.dtd',0664) - except SystemExit, e: raise # Need to propogate this @@ -939,10 +938,10 @@ for x in scanlist: else: #Only carry out if in package directory or check forced if xmllint_capable: - st=getstatusoutput("xmllint --nonet --noout --dtdvalid %s/metadata.dtd %s/metadata.xml" % (portage.CACHE_PATH, checkdir)) - if st[0] != 0: - for z in st[1].split("\n"): - print red("!!! ")+z + st = spawn(["xmllint", "--nonet", "--noout", "--nowarning", "--dtdvalid", + metadata_dtd, os.path.join(checkdir, "metadata.xml")]) + if st != os.EX_OK: + print red("!!! metadata.xml is invalid") stats["metadata.bad"]+=1 fails["metadata.bad"].append(x+"/metadata.xml") |