From 9b00920ed0506af67a89da1eee076f571af0764d Mon Sep 17 00:00:00 2001 From: Mariusz Mazur Date: Tue, 23 Nov 2004 21:55:15 +0000 Subject: [PATCH] - don't force me to specify packages from cmd line - by default try to move those marked from www iface - one more shell script replaced; just one to go Changed files: bin/check-move.sh -> 1.3 bin/pfa-mvpkg -> 1.6 bin/pfa-testmvpkg -> 1.1 modules/ftptree.py -> 1.5 --- bin/check-move.sh | 41 ----------------------------------------- bin/pfa-mvpkg | 4 ++-- bin/pfa-testmvpkg | 22 ++++++++++++++++++++++ modules/ftptree.py | 8 ++++++-- 4 files changed, 30 insertions(+), 45 deletions(-) delete mode 100755 bin/check-move.sh create mode 100755 bin/pfa-testmvpkg diff --git a/bin/check-move.sh b/bin/check-move.sh deleted file mode 100755 index abcda94..0000000 --- a/bin/check-move.sh +++ /dev/null @@ -1,41 +0,0 @@ -#!/bin/sh - -. ~/pld-ftp-admin/scripts/functions - -if [ "$#" -lt "3" ]; then - echo "Not enough parametrs given" - echo "check-build.sh tree package1 [package2...]" - exit -fi - -if [ ! -d "$FTP_DIR/$1" ]; then - echo "$FTP_DIR/$1 does not exist" - exit -fi - -if [ ! -d "$FTP_DIR/$1" ]; then - echo "$FTP_DIR/$2 does not exist" - exit -fi - -# we set $trees and $pkglist -srctree=$1 -dsttree=$2 -shift 2 - -init_pkglist "$srctree" "$*" - -if [ "$errnum" != "0" ]; then - echo "$errnum error(s) encountered... aborting" - exit -fi - -check_buildids "$srctree" - -check_built_archs - -if [ "$errnum" != "0" ]; then - echo "$errnum error(s) encountered... move will fail" - exit -fi - diff --git a/bin/pfa-mvpkg b/bin/pfa-mvpkg index 7c00917..8c17ac3 100644 --- a/bin/pfa-mvpkg +++ b/bin/pfa-mvpkg @@ -6,9 +6,9 @@ sys.path.insert(0, os.environ['HOME']+'/pld-ftp-admin/modules') from ftptree import FtpTree from common import checkdir -if len(sys.argv) < 4: +if len(sys.argv) < 3: print "Not enough parameters given" - print "move.py src-tree dst-tree package1 [package2...]" + print "move.py src-tree dst-tree [package1, package2, ...]" sys.exit(1) checkdir(sys.argv[1]) diff --git a/bin/pfa-testmvpkg b/bin/pfa-testmvpkg new file mode 100755 index 0000000..3c0f123 --- /dev/null +++ b/bin/pfa-testmvpkg @@ -0,0 +1,22 @@ +#!/usr/bin/env python +# vi: encoding=utf-8 ts=8 sts=4 sw=4 et + +import sys, os +sys.path.insert(0, os.environ['HOME']+'/pld-ftp-admin/modules') +from ftptree import FtpTree +from common import checkdir + +if len(sys.argv) < 3: + print "Not enough parameters given" + print "move.py src-tree dst-tree [package1, package2, ...]" + sys.exit(1) + +checkdir(sys.argv[1]) +checkdir(sys.argv[2]) + +srctree=FtpTree(sys.argv[1], loadall=True) +dsttree=FtpTree(sys.argv[2]) +srctree.mark4moving(sys.argv[3:]) + +srctree.testmove(dsttree) + diff --git a/modules/ftptree.py b/modules/ftptree.py index 630a1d4..c944d14 100644 --- a/modules/ftptree.py +++ b/modules/ftptree.py @@ -101,7 +101,7 @@ class Pkg: movedany=False for arch in self.file.keys(): if arch in dsttree[self.name].file.keys(): - pinfo("Arch %s for package %s is already present in dest tree; removing from srctree" % (arch, self.name)) + pinfo("Arch %s for %s is already present in dest tree; removing from srctree" % (arch, self.name)) for rpm in self.file[arch]: rm(self.tree.basedir+'/'+arch+'/RPMS/'+rpm) else: @@ -150,6 +150,10 @@ class FtpTree: def keys(self): return self.pkgnames + def testmove(self, dsttree): + self.__checkbuild() + self.__checkarchs(dsttree) + def movepkgs(self, dsttree): self.__checkbuild() bailoutonerror() @@ -229,7 +233,7 @@ class FtpTree: if arch not in pkg.file.keys(): missingarchs.append(arch) if missingarchs: - perror('Moving pkg %s would remove archs: %s' % (pkg, missingarchs)) + perror('Moving %s would remove archs: %s' % (pkg, missingarchs)) def __rmolderfromsrc(self): for pkg in self.marked4moving: -- 2.44.0