aboutsummaryrefslogtreecommitdiffhomepage
path: root/git-buildpackage
diff options
context:
space:
mode:
authorGuido Guenther <agx@sigxcpu.org>2007-11-05 19:57:16 +0100
committerGuido Guenther <agx@sigxcpu.org>2007-11-05 19:57:16 +0100
commit1e68e5020101b4e923b039e28548760f1e433ccd (patch)
treedbb233cb2be299ad6f2943b444909d444083c2a1 /git-buildpackage
parentd17637ea18415c56b0d91cfdacd1f0f451154beb (diff)
add tarball-dir option losely based on patch from Sjoerd Simons (Closes: #448357)
Diffstat (limited to 'git-buildpackage')
-rwxr-xr-xgit-buildpackage44
1 files changed, 29 insertions, 15 deletions
diff --git a/git-buildpackage b/git-buildpackage
index 10291291..036d9f8d 100755
--- a/git-buildpackage
+++ b/git-buildpackage
@@ -24,7 +24,7 @@ import errno
import pipes
import time
from gbp.git_utils import (GitRepositoryError, GitRepository, build_tag)
-from gbp.deb_utils import (parse_changelog, is_native, orig_file, has_orig)
+from gbp.deb_utils import (parse_changelog, is_native, orig_file, has_orig, copy_orig)
from gbp.command_wrappers import (GitTag, Command, CommandExecFailed, RemoveTree)
from gbp.config import GbpOptionParser
from gbp.errors import GbpError
@@ -133,6 +133,8 @@ def main(argv):
help="format string for upstream tags, default is '%(upstream-tag)s'")
parser.add_config_file_option(option_name="export-dir", dest="export_dir",
help="before building export into EXPORT_DIR")
+ parser.add_config_file_option(option_name="tarball-dir", dest="tarball_dir",
+ help="location to look for external tarballs")
parser.add_option("--git-export", dest="treeish", default=default_tree,
help="export treeish object TREEISH, default is '%s'" % default_tree)
(options, args) = parser.parse_args(args)
@@ -167,6 +169,11 @@ def main(argv):
raise GbpError,"'%s' does not exist, not a debian package" % changelog
output_dir = prepare_output_dir(options.export_dir)
+ if options.tarball_dir:
+ tarball_dir = options.tarball_dir
+ else:
+ tarball_dir = output_dir
+
if not repo.has_treeish(options.treeish):
raise GbpError # git-ls-tree printed an error message already
# Export to another build dir if requested:
@@ -184,21 +191,28 @@ def main(argv):
move_old_export(export_dir)
os.rename(tmp_dir, export_dir)
- # Build the orig.tar.gz if necessary:
- if not is_native(cp) and not has_orig(cp, output_dir) and not options.no_create_orig:
- # --upstream-branch was given on the command line, so use this:
- if options.upstream_branch != GbpOptionParser.defaults['upstream-branch']:
- upstream_tree = options.upstream_branch
- else:
- upstream_tree = build_tag(options.upstream_tag, cp['Upstream-Version'])
- # fall back to the upstream-branch tip if the tag doesn't exist
+ # Get the orig.tar.gz if necessary:
+ if not is_native(cp):
+ if has_orig(cp, output_dir):
+ pass
+ elif options.tarball_dir: # separate tarball dir specified
+ print "Getting orig tarbball from %s" % tarball_dir
+ if not copy_orig(cp, tarball_dir, output_dir):
+ raise GbpError, "Cannot copy orig tarball from %s" % tarball_dir
+ elif not options.no_create_orig:
+ # --upstream-branch was given on the command line, so use this:
+ if options.upstream_branch != GbpOptionParser.defaults['upstream-branch']:
+ upstream_tree = options.upstream_branch
+ else:
+ upstream_tree = build_tag(options.upstream_tag, cp['Upstream-Version'])
+ # fall back to the upstream-branch tip if the tag doesn't exist
+ if not repo.has_treeish(upstream_tree):
+ upstream_tree = GbpOptionParser.defaults['upstream-branch']
+ print "%s does not exist, creating from '%s'" % (orig_file(cp), upstream_tree)
if not repo.has_treeish(upstream_tree):
- upstream_tree = GbpOptionParser.defaults['upstream-branch']
- print "%s does not exist, creating from '%s'" % (orig_file(cp), upstream_tree)
- if not repo.has_treeish(upstream_tree):
- raise GbpError # git-ls-tree printed an error message already
- if not create_orig(cp, output_dir, upstream_tree):
- raise GbpError, "Cannot create upstream tarball at '%s'" % output_dir
+ raise GbpError # git-ls-tree printed an error message already
+ if not create_orig(cp, output_dir, upstream_tree):
+ raise GbpError, "Cannot create upstream tarball at '%s'" % output_dir
if options.export_dir:
os.chdir(export_dir)