archive = os.path.join(options['archive-dir'], conf.lstrip('/'))
if options['use-rcs'] == 'yes':
dispatch_conf.rcs_archive(archive, conf, md5_match_hash[conf], '')
- dispatch_conf.rcs_archive_post_process(archive)
+ if md5_match_hash[conf]:
+ dispatch_conf.rcs_archive_post_process(archive)
else:
dispatch_conf.file_archive(archive, conf, md5_match_hash[conf], '')
- dispatch_conf.file_archive_post_process(archive)
+ if md5_match_hash[conf]:
+ dispatch_conf.file_archive_post_process(archive)
# run
if len(sys.argv) > 1:
else:
newconf = conf['new']
- same_file = len(commands.getoutput (DIFF_CONTENTS % (conf ['current'], newconf))) == 0
- same_cvs = len(commands.getoutput (DIFF_CVS_INTERP % (conf ['current'], newconf))) == 0
- same_wsc = len(commands.getoutput (DIFF_WSCOMMENTS % (conf ['current'], newconf))) == 0
+ mystatus, myoutput = commands.getstatusoutput(
+ DIFF_CONTENTS % (conf ['current'], newconf))
+ same_file = 0 == len(myoutput)
+ if mystatus >> 8 == 2:
+ # Binary files differ
+ same_cvs = False
+ same_wsc = False
+ else:
+ same_cvs = 0 == len(commands.getoutput(
+ DIFF_CVS_INTERP % (conf ['current'], newconf)))
+ same_wsc = 0 == len(commands.getoutput(
+ DIFF_WSCOMMENTS % (conf ['current'], newconf)))
# Do options permit?
same_cvs = same_cvs and self.options['replace-cvs'] == 'yes'
self.configdict["pkg"]["PORT_ENV_FILE"] = infodir+"/environment"
myre = re.compile('^[A-Z]+$')
+ null_byte = "\0"
for filename in listdir(infodir,filesonly=1,EmptyOnError=1):
if myre.match(filename):
try:
- mydata = string.strip(open(infodir+"/"+filename).read())
+ file_path = os.path.join(infodir, filename)
+ mydata = open(file_path).read().strip()
if len(mydata) < 2048 or filename == "USE":
+ if null_byte in mydata:
+ writemsg("!!! Null byte found in metadata " + \
+ "file: '%s'\n" % file_path, noiselevel=-1)
+ continue
if filename == "USE":
binpkg_flags = "-* " + mydata
self.configdict["pkg"][filename] = binpkg_flags
dblink(self.cat, v, destroot, self.settings,
vartree=self.vartree))
+ collisions = []
+
print green("*")+" checking "+str(len(myfilelist))+" files for package collisions"
for f in myfilelist:
nocheck = False
isowned = True
break
if not isowned:
- print "existing file "+ f +" is not owned by this package"
+ collisions.append(f)
+ print "existing file "+f+" is not owned by this package"
stopmerge=True
if collision_ignore:
if f in collision_ignore:
self.unmerge(ldpath_mtimes=prev_mtimes)
self.delete()
self.unlockdb()
+ print
+ print "Searching all installed packages for file collisions..."
+ print "Press Ctrl-C to Stop"
+ print
+ """ Note: The isowner calls result in a stat call for *every*
+ single installed file, since the inode numbers are used to work
+ around the problem of ambiguous paths caused by symlinked files
+ and/or directories. Though it is slow, it is as accurate as
+ possible."""
+ found_owner = False
+ for cpv in self.vartree.dbapi.cpv_all():
+ cat, pkg = catsplit(cpv)
+ mylink = dblink(cat, pkg, destroot, self.settings,
+ vartree=self.vartree)
+ mycollisions = []
+ for f in collisions:
+ if mylink.isowner(f, destroot):
+ mycollisions.append(f)
+ if mycollisions:
+ found_owner = True
+ print " * %s:" % cpv
+ print
+ for f in mycollisions:
+ print " '%s'" % \
+ os.path.join(destroot, f.lstrip(os.path.sep))
+ print
+ if not found_owner:
+ print "None of the installed packages claim the above file(s)."
+ print
sys.exit(1)
try:
os.chdir(mycwd)