[Treepkg-commits] r115 - in trunk: bin test treepkg

scm-commit@wald.intevation.org scm-commit at wald.intevation.org
Wed Jul 30 21:00:44 CEST 2008


Author: bh
Date: 2008-07-30 21:00:31 +0200 (Wed, 30 Jul 2008)
New Revision: 115

Modified:
   trunk/bin/runtreepkg.py
   trunk/test/test_packager.py
   trunk/treepkg/packager.py
Log:
Add runtreepkg.py command line option --no-svn-update to inhibit updates
of the working copies.  This can be useful if e.g. the svn server is
down.  Adapt the test cases.


Modified: trunk/bin/runtreepkg.py
===================================================================
--- trunk/bin/runtreepkg.py	2008-07-08 15:39:34 UTC (rev 114)
+++ trunk/bin/runtreepkg.py	2008-07-30 19:00:31 UTC (rev 115)
@@ -1,5 +1,5 @@
 #! /usr/bin/python2.4
-# Copyright (C) 2007 by Intevation GmbH
+# Copyright (C) 2007, 2008 by Intevation GmbH
 # Authors:
 # Bernhard Herzog <bh at intevation.de>
 #
@@ -36,6 +36,9 @@
     parser.add_option("--revision",
                       help=("SVN revision to update to before attempting"
                             " to package."))
+    parser.add_option("--no-svn-update", action="store_true",
+                      help=("Do not update the SVN workingcopy before"
+                            " attempting to package."))
     return parser.parse_args()
 
 def main():
@@ -59,6 +62,7 @@
         group = PackagerGroup([create_package_track(**opts)
                                for opts in packager_opts],
                               revision=options.revision,
+                              do_svn_update=not options.no_svn_update,
                               **treepkg_opts)
         if options.once:
             group.check_package_tracks()

Modified: trunk/test/test_packager.py
===================================================================
--- trunk/test/test_packager.py	2008-07-08 15:39:34 UTC (rev 114)
+++ trunk/test/test_packager.py	2008-07-30 19:00:31 UTC (rev 115)
@@ -187,7 +187,7 @@
         self.do_stop = do_stop
         self.instructions_file = instructions_file
 
-    def package_if_updated(self, revision):
+    def package_if_updated(self, revision, do_svn_update=True):
         if self.do_stop:
             writefile(self.instructions_file, "stop")
         if self.do_package:

Modified: trunk/treepkg/packager.py
===================================================================
--- trunk/treepkg/packager.py	2008-07-08 15:39:34 UTC (rev 114)
+++ trunk/treepkg/packager.py	2008-07-30 19:00:31 UTC (rev 115)
@@ -437,9 +437,13 @@
         env["DEBEMAIL"] = self.deb_email
         return env
 
-    def package_if_updated(self, revision=None):
-        """Checks if the checkout changed and returns a new packager if so"""
-        self.update_checkout(revision=revision)
+    def package_if_updated(self, revision=None, do_svn_update=True):
+        """Returns a new packager if the working copy has not been packaged yet.
+        If do_svn_update is true -- the default -- update the working
+        copy to the the revision specified with the revision parameter
+        or if revision is None, the latest revision in the repository."""
+        if do_svn_update:
+            self.update_checkout(revision=revision)
         current_revision = self.last_changed_revision()
         logging.info("New revision is %d", current_revision)
         if current_revision not in self.get_revision_numbers():
@@ -516,10 +520,11 @@
 class PackagerGroup(object):
 
     def __init__(self, package_tracks, check_interval, revision=None,
-                 instructions_file=None):
+                 instructions_file=None, do_svn_update=True):
         self.package_tracks = package_tracks
         self.check_interval = check_interval
         self.revision = revision
+        self.do_svn_update = do_svn_update
         self.instructions_file = instructions_file
         self.instructions_file_removed = False
         self.sort_tracks()
@@ -596,7 +601,8 @@
             repeat = False
             for track in self.package_tracks:
                 try:
-                    packager = track.package_if_updated(revision=self.revision)
+                    packager = track.package_if_updated(revision=self.revision,
+                                              do_svn_update=self.do_svn_update)
                     if packager:
                         packager.package()
                         repeat = self.install_dependencies(track, packager)



More information about the Treepkg-commits mailing list