[Treepkg-commits] r389 - in branches/treepkg-status: bin treepkg
scm-commit@wald.intevation.org
scm-commit at wald.intevation.org
Wed Jul 28 13:38:01 CEST 2010
Author: bricks
Date: 2010-07-28 13:38:00 +0200 (Wed, 28 Jul 2010)
New Revision: 389
Modified:
branches/treepkg-status/bin/publishdebianpackages.py
branches/treepkg-status/treepkg/publish.py
Log:
only rsync specified architectures from cachedir to publishdir
Modified: branches/treepkg-status/bin/publishdebianpackages.py
===================================================================
--- branches/treepkg-status/bin/publishdebianpackages.py 2010-07-28 08:38:50 UTC (rev 388)
+++ branches/treepkg-status/bin/publishdebianpackages.py 2010-07-28 11:38:00 UTC (rev 389)
@@ -11,7 +11,6 @@
import os
import os.path
-import re
import sys
import shlex
@@ -28,8 +27,6 @@
from treepkg.info.data import Package
from treepkg.info.data import CacheDb
-EMPTY = re.compile(r'\s*')
-
config_desc = ["distribution", "section", "num_newest",
"build_user", "build_host", "build_listpackages",
"publish_user", "publish_host",
@@ -230,13 +227,14 @@
section = config["section"]
architectures = config["architectures"]
- allarchs = copy_to_cachedir(config, track, revision, quiet, architectures)
- for arch in allarchs:
- copy_to_publishdir(config, dist, section, arch, quiet)
+ copy_to_cachedir(config, track, revision, quiet, architectures)
+ for arch in architectures:
+ copy_arch_to_publishdir(config, dist, section, get_binary_arch(arch),
+ quiet)
# update apt archive
if config["after_upload_hook"] and \
- not EMPTY.match(config["after_upload_hook"]):
+ len((config["after_upload_hook"][0]).strip()) > 0:
if not quiet:
print "running after upload hook"
call(config["after_upload_hook"])
Modified: branches/treepkg-status/treepkg/publish.py
===================================================================
--- branches/treepkg-status/treepkg/publish.py 2010-07-28 08:38:50 UTC (rev 388)
+++ branches/treepkg-status/treepkg/publish.py 2010-07-28 11:38:00 UTC (rev 389)
@@ -9,6 +9,7 @@
import os.path
+import util
from treepkg.run import call, capture_output
from treepkg.cmdexpand import cmdexpand
@@ -32,6 +33,46 @@
prefix.extend(["ssh", "%s@%s" % (user, host)])
return prefix
+def copy_arch_to_publishdir(variables, dist, section, arch=None, quiet=False,
+ create=True):
+ if not arch:
+ cachedir = variables["cachedir"]
+ else:
+ cachedir = os.path.join(variables["cachedir"], arch)
+
+ # if cachedir does not exist rsync will fail therefore
+ # it must be created or skipped. if it is created remote
+ # content will be deleted
+ if not os.path.exists(cachedir):
+ if create:
+ util.ensure_directory(cachedir)
+ else:
+ return
+
+ destdir = os.path.join(variables["publish_dir"], dist, section)
+ remote_destdir = destdir
+ if variables["publish_host"]:
+ remote_destdir = (("%(publish_user)s@%(publish_host)s:" % variables)
+ + remote_destdir)
+ runremote = prefix_for_remote_command(variables["publish_user"],
+ variables["publish_host"])
+
+ call(cmdexpand("@runremote mkdir --parents $destdir",
+ runremote=runremote, destdir=destdir, **variables))
+ rsync_flags = []
+ if variables["publish_remove_old_packages"]:
+ rsync_flags.append("--delete")
+ if quiet:
+ rsync_flags.append("--quiet")
+ cmd = cmdexpand("rsync @rsync_flags -r --perms --times --omit-dir-times"
+ " $cachedir $remote_destdir/",
+ rsync_flags=rsync_flags, remote_destdir=remote_destdir,
+ cachedir=cachedir)
+ #print "rsync cmd: %s" % cmd
+ call(cmd)
+
+
+
def copy_to_publishdir(variables, dist, section, arch=None, quiet=False):
if not arch:
destdir = os.path.join(variables["publish_dir"], dist, section)
More information about the Treepkg-commits
mailing list