from ftptree import FtpTree, Pkg
import ftpio
-os.umask(022)
+os.umask(0o022)
def rm(file):
os.remove(file)
sm.close()
def move_noarch(f, arch, rpmfile, dstpkg):
- if dstpkg.noarch_arch.has_key(rpmfile):
+ if rpmfile in dstpkg.noarch_arch:
os.system("LC_ALL=C rpm -qlp %s | LC_ALL=C sort > %s/files.new" %
(incoming_dir + arch + '/' + rpmfile, tmpdir))
os.system("rpm -qRp %s | LC_ALL=C sort | LC_ALL=C uniq > %s/reqs.new" %
(incoming_dir + arch + '/' + rpmfile, noarchcachedir, rpmfile))
os.system("rpm -qRp %s | LC_ALL=C sort | LC_ALL=C uniq > %s/%s.reqlist" %
(incoming_dir + arch + '/' + rpmfile, noarchcachedir, rpmfile))
- if not dstpkg.files.has_key(arch):
+ if arch not in dstpkg.files:
f.write("file:noarch:%s\ninfo:noarch_arch:%s:%s\n" % (rpmfile, rpmfile, arch))
mv(incoming_dir + arch + '/' + rpmfile, default_to + 'noarch/RPMS')
dstpkg = BasePkg(`srcpkg`, ftptree)
- if dstpkg.files.has_key(arch):
+ if arch in dstpkg.files:
ftpio.log("files from %s for arch %s already present in %s; removing older files" % (`srcpkg`, arch, ftptree))
for rpmfile in dstpkg.files[arch]:
if is_debuginfo(rpmfile):
dstfile = default_to + arch + '/RPMS'
try:
rm(dstfile + '/' + rpmfile)
- except OSError, e:
+ except OSError as e:
l = "Removing %s problem: %s" % (dstfile + '/' + rpmfile, e)
ftpio.log(l)
print(l)
if rpmfile[-11:] == '.noarch.rpm' and config.separate_noarch:
move_noarch(f, arch, rpmfile, dstpkg)
else:
- if not dstpkg.files.has_key(arch):
+ if arch not in dstpkg.files:
f.write("file:%s:%s\n" % (arch, rpmfile))
srcfile = incoming_dir + arch + '/' + rpmfile
try:
mv(srcfile, dstfile)
- except OSError, e:
+ except OSError as e:
l = "Moving %s to %s problem: %s" % (srcfile, dstfile, e)
ftpio.log(l)
print(l)