import sys, os
sys.path.insert(0, os.environ['HOME']+'/pld-ftp-admin/modules')
-from ftptree import FtpTree
+import ftptree
from common import checkdir
import ftpio
print "%s tree already locked" % sys.argv[2]
sys.exit(1)
-# We don't 'try' as in move.py cause these functions don't force exit
-srctree=FtpTree(sys.argv[1], loadall=True)
-dsttree=FtpTree(sys.argv[2])
-srctree.mark4moving(sys.argv[3:])
+try:
+ srctree=ftptree.FtpTree(sys.argv[1], loadall=True)
+ dsttree=ftptree.FtpTree(sys.argv[2])
+ srctree.mark4moving(sys.argv[3:])
+except ftptree.SomeError:
+ # In case of problems we need to unlock the trees before exiting
+ ftpio.unlock(sys.argv[1])
+ ftpio.unlock(sys.argv[2])
+ sys.exit(1)
+# We don't 'try' as in move.py cause this function doesn't force exit
srctree.testmove(dsttree)
ftpio.unlock(sys.argv[1])
def perror(msg):
global errnum
errnum=errnum+1
- print msg
+ print 'ERR: ' + msg
def pwarning(msg):
- print msg
+ print 'WARN: ' + msg
def rm(file):
os.remove(file)
self.loadedpkgs[pkgname]=Pkg(pkgname, self)
markfunction(self.loadedpkgs[pkgname])
else:
- perror(pkgname+" was not found in source tree")
+ perror('%s not found in source tree' % pkgname)
bailoutonerror()
def __checkbuild(self):
for pkg in self.marked4moving:
for bid in pkg.build.keys():
if requests.has_key(bid) and not requests[bid].find('?') == -1:
- perror("Building of package %s (buildid %s) not finished" % (pkg,bid))
+ perror("%s (buildid %s) building not finished" % (pkg,bid))
def __checkarchs(self, dsttree):
for pkg in self.marked4moving:
if len(pkg.files.keys()) <= 1:
- perror('Package %s has only src.rpm built' % pkg)
+ perror('%s has only src.rpm built' % pkg)
continue
otherpkgnames=self.__find_other_pkgs(pkg, dsttree)
if otherpkgnames: # check if we're not removing some archs
if arch not in pkg.files.keys():
missingarchs.append(arch)
if missingarchs:
- perror('Moving %s would remove archs: %s' %
+ perror('%s moving would remove archs: %s' %
(pkg, missingarchs))
else: # warn if a package isn't built for all archs
- pass
+ if (config.separate_noarch and 'noarch' in pkg.files.keys() and
+ len(pkg.files.keys())==2):
+ continue
+ elif len(pkg.files.keys()) != len(config.ftp_archs):
+ missingarchs=[]
+ for arch in config.ftp_archs:
+ if arch not in pkg.files.keys():
+ missingarchs.append(arch)
+ pwarning('%s not built for archs: %s' %
+ (pkg, missingarchs))
def __rmolderfromsrc(self):
for pkg in self.marked4moving: