[Pkg-bazaar-maint] builddeb error on uncommitted changes..

James Westby jw+debian at jameswestby.net
Tue Jul 10 19:17:35 UTC 2007


On (11/07/07 04:39), Robert Collins wrote:
> I'm not sure what this is about; I have a working tree, there are no
> unknowns at all. Just uncommitted changes.

Yeah, that's why I was confused by Reinhard's comment. I have just
committed the change at the end of the mail. Is this a satisfactory
resolution for you?

Thanks,

James


=== modified file 'README'
--- README	2007-06-18 22:07:21 +0000
+++ README	2007-07-10 17:05:56 +0000
@@ -203,6 +203,11 @@
 Others
 ######
 
+  * ``working-tree = True``
+
+    Always build the working tree, rather than the last revision committed
+    to the branch.
+
   * ``ignore-unknowns = True``
 
     Don't count unknown files in the tree as changes, and so allow the build

=== modified file '__init__.py'
--- __init__.py	2007-06-17 22:01:12 +0000
+++ __init__.py	2007-07-10 17:02:44 +0000
@@ -33,10 +33,11 @@
                      )
 from config import DebBuildConfig
 from errors import (ChangedError,
+                    UnknownsInTree,
                     StopBuild,
                     )
 from properties import BuildProperties
-from util import goto_branch, find_changelog, is_clean
+from util import goto_branch, find_changelog
 
 dont_purge_opt = Option('dont-purge',
     help="Don't purge the build directory after building")
@@ -221,13 +222,20 @@
             builder = "dpkg-buildpackage -uc -us -rfakeroot"
 
     if not working_tree:
+      working_tree = config.working_tree
+
+    if not working_tree:
       b = tree.branch
       rev_id = b.last_revision()
       info("Building branch from revision %s", rev_id)
       t = b.repository.revision_tree(rev_id)
-      if not ignore_changes and not is_clean(t, tree, ignore_unknowns):
-        raise ChangedError
+      if not ignore_changes:
+        changes = tree.changes_from(t)
+        if changes.has_changed():
+          raise ChangedError
     else:
+      if not ignore_unknowns and len(list(tree.unknowns())) > 0:
+        raise UnknownsInTree
       info("Building using working tree")
       t = tree
 

=== modified file 'config.py'
--- config.py	2007-06-18 21:12:43 +0000
+++ config.py	2007-07-10 17:04:51 +0000
@@ -219,6 +219,9 @@
   ignore_unknowns = _bool_property('ignore-unknowns',
                          "Build even when the tree has unknowns")
 
+  working_tree = _bool_property('working-tree',
+                         "Always build the working tree.")
+
   native = _bool_property('native', "Build a native package")
 
   split = _bool_property('split', "Split a full source package")

=== modified file 'debian/changelog'
--- debian/changelog	2007-07-08 19:23:05 +0000
+++ debian/changelog	2007-07-10 19:15:41 +0000
@@ -3,8 +3,10 @@
   * Remove any 'debian/' directory from the upstream tarball in merge mode,
     so that the branch contains all of the files that will appear there.
   * Allow the changelog entries to have no author information.
+  * Add a working-tree option to the configuration files that if set always
+    builds the working tree rather than the last revision in the branch. 
 
- -- James Westby <jw+debian at jameswestby.net>  Mon, 25 Jun 2007 08:23:34 +0100
+ -- James Westby <jw+debian at jameswestby.net>  Tue, 10 Jul 2007 20:15:13 +0100
 
 bzr-builddeb (0.17) unstable; urgency=low
 

=== modified file 'errors.py'
--- errors.py	2007-06-18 21:57:14 +0000
+++ errors.py	2007-07-10 17:10:20 +0000
@@ -29,11 +29,26 @@
     self.message = message
 
 class ChangedError(DebianError):
-  _fmt = """There are modified files in the working tree. Either commit the 
-  changes, use --working to build the working tree, or --ignore-changes
-  to override this and build the branch without the changes in the working 
-  tree. Use bzr status to see the changes"""
-
+  _fmt = ("There are modified files in the working tree. Either commit the "
+         "changes, use --working to build the working tree, or "
+         "--ignore-changes to override this and build the branch without "
+         "the changes in the working tree. Use bzr status to see the changes. "
+         "To disable this check and always build the working tree see the "
+         "documentation of the working-tree configuration option in the README. "
+         )
+
+  def __init__(self):
+    DebianError.__init__(self, None)
+
+class UnknownsInTree(DebianError):
+  _fmt = ("There are unknown files in the working tree. The build will not "
+         "continue as you may want these files included in the build. If you "
+         "do want them then use 'bzr add' to add them to the tree. If you do "
+         "not then use the '--ignore-unknowns' option to 'builddeb'. To disable "
+         "this check then see the documentation of the 'ignore-unkowns' "
+         "configuration option in the README."
+         )
+ 
   def __init__(self):
     DebianError.__init__(self, None)
 

=== modified file 'util.py'
--- util.py	2007-07-08 19:23:05 +0000
+++ util.py	2007-07-10 16:53:49 +0000
@@ -47,18 +47,6 @@
       shutil.copy(path, todir)
 
 
-def is_clean(oldtree, newtree, ignore_unknowns=False):
-  """Return True if there are no uncommited changes or unknown files.
-  
-  If ignore_unknowns is True then unknown files do not count as changes."""
-
-  changes = newtree.changes_from(oldtree)
-  if changes.has_changed():
-    return False
-  if not ignore_unknowns and len(list(newtree.unknowns())) > 0:
-    return False
-  return True
-
 def goto_branch(branch):
   """Changes to the specified branch dir if it is not None"""
   if branch is not None:


-- 
  James Westby   --    GPG Key ID: B577FE13    --     http://jameswestby.net/
  seccure key - (3+)k7|M*edCX/.A:n*N!>|&7U.L#9E)Tu)T0>AM - secp256r1/nistp256



More information about the Pkg-bazaar-maint mailing list