Hi,

I forgot to attach the patch. :)

-- 
"UNIX is basically a simple operating system, but you have to be a genius to
understand the simplicity."
-- Dennis Ritchie
Saludos /\/\ /\ >< `/
commit 79a0436d8c80d90f3844e4267b7f6187de3bd445
Author: Maximiliano Curia <m...@gnuservers.com.ar>
Date:   Sat May 24 19:47:12 2014 +0200

    Fix use of export_dir and build_dir before assignment.

diff --git a/gbp/scripts/buildpackage.py b/gbp/scripts/buildpackage.py
index af3cd15..7d284f1 100755
--- a/gbp/scripts/buildpackage.py
+++ b/gbp/scripts/buildpackage.py
@@ -490,6 +490,14 @@ class Hook(RunAtCommand):
         RunAtCommand.__init__(self, *args, **kwargs)
         self.run_error = '%s-hook %s' % (name, self.run_error)
 
+def _get_build_dir(source, options_export_dir, repo_dir):
+    if options_export_dir:
+        major = (source.changelog.debian_version if source.is_native()
+                 else source.changelog.upstream_version)
+        return os.path.join(options_export_dir,
+                            "%s-%s" % (source.sourcepkg, major))
+    else:
+        return repo_dir
 
 def main(argv):
     retval = 0
@@ -533,7 +541,8 @@ def main(argv):
 
         tree = write_tree(repo, options)
         source = source_vfs(repo, options, tree)
-        build_dir = export_dir if options.export_dir else repo_dir
+
+        build_dir = _get_build_dir(source, options.export_dir, repo_dir)
         if not options.tag_only:
             output_dir = prepare_output_dir(options.export_dir)
             tarball_dir = options.tarball_dir or output_dir
@@ -561,12 +570,9 @@ def main(argv):
                          extra_env={'GBP_GIT_DIR': repo.git_dir,
                                     'GBP_TMP_DIR': tmp_dir})(dir=tmp_dir)
 
-                major = (source.changelog.debian_version if source.is_native()
-                         else source.changelog.upstream_version)
-                export_dir = os.path.join(output_dir, "%s-%s" % (source.sourcepkg, major))
-                gbp.log.info("Moving '%s' to '%s'" % (tmp_dir, export_dir))
-                move_old_export(export_dir)
-                os.rename(tmp_dir, export_dir)
+                gbp.log.info("Moving '%s' to '%s'" % (tmp_dir, build_dir))
+                move_old_export(build_dir)
+                os.rename(tmp_dir, build_dir)
 
                 # Delayed tarball creation in case a postexport hook is used:
                 if not source.is_native() and options.postexport:
@@ -622,7 +628,7 @@ def main(argv):
 
     if not options.tag_only:
         if options.export_dir and options.purge and not retval:
-            RemoveTree(export_dir)()
+            RemoveTree(build_dir)()
 
         if source and not gbp.notifications.notify(source.changelog,
                                                    not retval,

Attachment: signature.asc
Description: Digital signature

Reply via email to