[Treepkg-commits] r368 - branches/treepkg-status/bin
scm-commit@wald.intevation.org
scm-commit at wald.intevation.org
Thu Jul 22 12:17:43 CEST 2010
Author: bricks
Date: 2010-07-22 12:17:42 +0200 (Thu, 22 Jul 2010)
New Revision: 368
Modified:
branches/treepkg-status/bin/publishdebianpackages.py
Log:
copy binary-all packages in all binary-xyz dirs
Modified: branches/treepkg-status/bin/publishdebianpackages.py
===================================================================
--- branches/treepkg-status/bin/publishdebianpackages.py 2010-07-21 15:52:15 UTC (rev 367)
+++ branches/treepkg-status/bin/publishdebianpackages.py 2010-07-22 10:17:42 UTC (rev 368)
@@ -73,7 +73,7 @@
#runremote=runremote,
runremote="",
**variables)).splitlines()
- treepkginfo = TreepkgInfo.fromxml(xml)
+ return TreepkgInfo.fromxml(xml)
def get_binary_arch(arch):
if not arch == "source":
@@ -86,46 +86,61 @@
if not os.path.isfile(destpackage):
return True
destmd5sum = md5sum(destpackage)
- return destmd5sum == packagemd5sum
+ return (destmd5sum != packagemd5sum)
+def copy_to_destdir(package, dir, arch, subdir):
+ scp_flags = []
+ destdir = os.path.join(dir, arch, subdir)
+ print "package: %s, destdir: %s" % (package.name, destdir)
+ md5sum = ""
+ for checksum in package.checksums:
+ if checksum.type == "md5":
+ md5sum = checksum.checksum
+ break
+ # update only if the packages differ
+ if check_package_is_new(package.name, destdir, md5sum):
+ pass
+ # scp the packages to the cache dir
+ #call(cmdexpand("scp -p @scp_flags $file $cachedir/", file=package.path,
+ # scp_flags=scp_flags, cachedir=destdir))
+
def copy_to_cache(variables, track, revision, quiet, architectures=None):
- scp_flags = []
+ cachedir = variables["cachedir"]
if quiet:
scp_flags.append("-q")
treepkginfo = get_treepkg_info(variables)
- treepkgroot = treepkginfo.root
- binaryarchs = []
+ allowedarchs = set([]) # contains all wanted architectures (incl. source)
+ allarchs = set([]) # contains all present architectures (incl. source)
+ binaryallpackages = []
# change e.g. armel in binary-armel
- for arch in architectures:
- binaryarchs.append(get_binary_arch(arch))
- # add binary-all to requested packages
- if not binaryarchs is None:
- binaryarchs.append("binary-all")
-
- for track in treepkgroot.tracks:
- files = []
+ if not architectures is None:
+ for arch in architectures:
+ allowedarchs.append(get_binary_arch(arch))
+
+ for track in treepkginfo.tracks:
for rev in track.revisions:
for package in rev.packages:
- # only copy requested archs (+ all)
- if not binaryarchs is None and \
- not package.arch in binaryarchs:
+ # handle binary-all
+ if package.arch == "binary-all":
+ # add trackname for subdir name
+ package.tackname = track.name
+ binaryallpackages.append(package)
break
- destdir = os.path.join(variables["cachedir"],
- package.arch,
- track.name)
- print "package: %s, destdir: %s" % (package.name, destdir)
- md5sum = ""
- for checksum in package.checksums:
- if checksum.type == "md5":
- md5sum = checksum.checksum
- break
- # update only if the packages differ
- if check_package_is_new(package.name, destdir, md5sum):
- files.append(package.path)
- # scp the packages of a track to the cache dir
- #call(cmdexpand("scp -p @scp_flags @files $cachedir/", files=files,
- # scp_flags=scp_flagsd, cachedir=destdir))
+ allarchs.append(package.arch)
+ # only copy requested archs
+ if len(allowedarchs) == 0 or \
+ package.arch in allowedarchs:
+ copy_to_destdir(package, cachedir, package.arch, track.name)
+ # copy binary-all packages
+ if len(allowedarchs) == 0:
+ binallarchs = allarchs - set(["source"])
+ else:
+ binallarchs = allowedarchs & allarchs - set(["source"])
+ for package in binaryallpackages:
+ for arch in binallarchs:
+ copy_to_destdir(package, cachedir, arch, package.trackname)
+
def publish_packages_arch(variables, track, revision, dist, section,
quiet, architectures):
copy_to_cache(variables, track, revision, quiet, architectures)
More information about the Treepkg-commits
mailing list