[Pkg-bazaar-commits] r146 ./bzr-builddeb/people/jdw/merge_upstream: Add a -F option to allow specifying source packages to import in a file.

James Westby jw+debian at jameswestby.net
Sun Jul 8 19:47:41 UTC 2007


------------------------------------------------------------
revno: 146
committer: James Westby <jw+debian at jameswestby.net>
branch nick: merge_upstream
timestamp: Sun 2007-07-08 20:47:41 +0100
message:
  Add a -F option to allow specifying source packages to import in a file.
modified:
  __init__.py
-------------- next part --------------
=== modified file '__init__.py'
--- a/__init__.py	2007-07-08 13:50:27 +0000
+++ b/__init__.py	2007-07-08 19:47:41 +0000
@@ -28,6 +28,8 @@
 from bzrlib.errors import BzrCommandError
 from bzrlib.option import Option
 from bzrlib.trace import info, warning
+from bzrlib.transport import get_transport
+from bzrlib import urlutils
 from bzrlib.workingtree import WorkingTree
 
 from builder import (DebBuild,
@@ -387,6 +389,12 @@
   any source packages on the command line, and if you omit the
   --to option then the name of the package as passed to --snapshot
   will be used as the branch name.
+
+  In addition to the above choices you can specify a file
+  (possibly remote) that contains a list of source packages (.dsc
+  files) to import. Each line is taken to be a URI or path to
+  import. The sources specified in the file are used in addition
+  to those specified by other methods.
   """
 
   takes_args = ['files*']
@@ -394,13 +402,24 @@
   to_opt = Option('to', help="The branch to import to.", type=str)
   snapshot_opt = Option('snapshot', help="Retrieve source packages from "
                         "snapshot.debian.net.", type=str)
-
-  takes_options = [to_opt, snapshot_opt]
-
-  def run(self, files_list, to=None, snapshot=None):
+  filename_opt = Option('file', help="File containing URIs of source "
+                        "packages to import.", type=str, argname="filename",
+                        short_name='F')
+
+  takes_options = [to_opt, snapshot_opt, filename_opt]
+
+  def run(self, files_list, to=None, snapshot=None, filename=None):
     from import_dsc import DscImporter, SnapshotImporter
     if files_list is None:
       files_list = []
+    if filename is not None:
+      if isinstance(filename, unicode):
+        filename = filename.encode('utf-8')
+      base_dir, path = urlutils.split(filename)
+      sources_file = get_transport(base_dir).get(path)
+      for line in sources_file:
+        line.strip()
+        files_list.append(line)
     if snapshot is None:
       if len(files_list) < 1:
         raise BzrCommandError("You must give the location of at least one "



More information about the Pkg-bazaar-commits mailing list