aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gbp/deb/git.py24
-rw-r--r--gbp/scripts/import_dsc.py17
2 files changed, 27 insertions, 14 deletions
diff --git a/gbp/deb/git.py b/gbp/deb/git.py
index 1ab25b8..b4b8fba 100644
--- a/gbp/deb/git.py
+++ b/gbp/deb/git.py
@@ -21,6 +21,9 @@ from gbp.git import GitRepository, GitRepositoryError
from gbp.deb.pristinetar import DebianPristineTar
from gbp.format import format_str
+import gbp.log
+
+
class DebianGitRepository(GitRepository):
"""A git repository that holds the source of a Debian package"""
@@ -199,4 +202,25 @@ class DebianGitRepository(GitRepository):
"""
return True if self.has_branch(self.pristine_tar_branch) else False
+ def create_pristinetar_commits(self, upstream_tree, tarball, component_tarballs):
+ """
+ Create pristine-tar commits for a package with main tarball tarball
+ and (optionl) component tarballs based on upstream_tree
+
+ @param tarball: path to main tarball
+ @param component_tarballs: C{list} of C{tuple}s of component
+ name and path to additional tarball
+ @param upstream_tree: the treeish in the git repo to create the commits against
+ """
+ components = [c for (c, t) in component_tarballs]
+ main_tree = self.tree_drop_dirs(upstream_tree, components)
+
+ for component, name in component_tarballs:
+ subtree = self.tree_get_dir(upstream_tree, component)
+ if not subtree:
+ raise GitRepositoryError("No tree for '%s' found in '%s' to create pristine tar commit from" % (component, upstream_tree))
+ gbp.log.debug("Creating pristine tar commit '%s' from '%s'" % (component, subtree))
+ self.pristine_tar.commit(name, subtree)
+ self.pristine_tar.commit(tarball, main_tree)
+
# vim:et:ts=4:sw=4:et:sts=4:ai:set list listchars=tab\:»·,trail\:·:
diff --git a/gbp/scripts/import_dsc.py b/gbp/scripts/import_dsc.py
index 4cbf8d5..f343b7f 100644
--- a/gbp/scripts/import_dsc.py
+++ b/gbp/scripts/import_dsc.py
@@ -41,19 +41,6 @@ class SkipImport(Exception):
pass
-def generate_pristine_tarballs(repo, src, upstream_tree):
- subdirs = src.additional_tarballs.keys()
- main_tree = repo.tree_drop_dirs(upstream_tree, subdirs)
-
- for dir, tarball in src.additional_tarballs.items():
- subtree = repo.tree_get_dir(upstream_tree, dir)
- if not subtree:
- raise GbpError("No tree for '%s' found in '%s' to create pristine tar commit from" % (dir, upstream_tree))
- gbp.log.debug("Creating pristine tar commit '%s' from '%s'" % (dir, subtree))
- repo.pristine_tar.commit(tarball, subtree)
- repo.pristine_tar.commit(src.tgz, main_tree)
-
-
def download_source(pkg, dirs, unauth):
opts = [ '--download-only' ]
if unauth:
@@ -400,7 +387,9 @@ def main(argv):
if is_empty:
repo.create_branch(options.upstream_branch, commit)
if options.pristine_tar:
- generate_pristine_tarballs(repo, src, options.upstream_branch)
+ repo.create_pristinetar_commits(options.upstream_branch,
+ src.tgz,
+ src.additional_tarballs.items())
if (not repo.has_branch(options.debian_branch)
and (is_empty or options.create_missing_branches)):
repo.create_branch(options.debian_branch, commit)