summaryrefslogtreecommitdiff
path: root/gbp/scripts
diff options
context:
space:
mode:
authorMarkus Lehtonen <markus.lehtonen@linux.intel.com>2012-07-09 15:17:24 +0300
committerGuido Günther <agx@sigxcpu.org>2014-07-24 20:06:40 +0200
commitdbfc6276c4aa50b79f1cf27cfc24badc0b18da8f (patch)
tree60930339ad301b41ac793237ff347ea95b45b267 /gbp/scripts
parente374ee5a2381ba30056c1fa33bdb515d99ec704e (diff)
Change UpstreamSource to have PkgPolicy
The UpstreamSource class now gets a PkgPolicy in it's initialization. Also, introduces new DebiaUpstreamSource class which is taken in use in the scripts. The PkgPolicy is not yet used for anything in UpstreamSource. Signed-off-by: Markus Lehtonen <markus.lehtonen@linux.intel.com>
Diffstat (limited to 'gbp/scripts')
-rwxr-xr-xgbp/scripts/buildpackage.py6
-rw-r--r--gbp/scripts/common/import_orig.py41
-rw-r--r--gbp/scripts/import_dsc.py4
-rw-r--r--gbp/scripts/import_orig.py7
4 files changed, 28 insertions, 30 deletions
diff --git a/gbp/scripts/buildpackage.py b/gbp/scripts/buildpackage.py
index 8d79e8b..457673c 100755
--- a/gbp/scripts/buildpackage.py
+++ b/gbp/scripts/buildpackage.py
@@ -30,6 +30,7 @@ from gbp.config import (GbpOptionParserDebian, GbpOptionGroup)
from gbp.deb.git import (GitRepositoryError, DebianGitRepository)
from gbp.deb.source import DebianSource, DebianSourceError
from gbp.git.vfs import GitVfs
+from gbp.deb.upstreamsource import DebianUpstreamSource
from gbp.errors import GbpError
import gbp.log
import gbp.notifications
@@ -37,8 +38,7 @@ from gbp.scripts.common.buildpackage import (index_name, wc_name,
git_archive_submodules,
git_archive_single, dump_tree,
write_wc, drop_index)
-from gbp.pkg import (UpstreamSource, compressor_opts, compressor_aliases,
- parse_archive_filename)
+from gbp.pkg import compressor_opts, compressor_aliases, parse_archive_filename
def git_archive(repo, cp, output_dir, treeish, comp_type, comp_level, with_submodules):
"create a compressed orig tarball in output_dir using git_archive"
@@ -172,7 +172,7 @@ def extract_orig(orig_tarball, dest_dir):
gbp.log.info("Extracting %s to '%s'" % (os.path.basename(orig_tarball), dest_dir))
move_old_export(dest_dir)
- upstream = UpstreamSource(orig_tarball)
+ upstream = DebianUpstreamSource(orig_tarball)
upstream.unpack(dest_dir)
# Check if tarball extracts into a single folder or not:
diff --git a/gbp/scripts/common/import_orig.py b/gbp/scripts/common/import_orig.py
index c2c53a6..8e18e97 100644
--- a/gbp/scripts/common/import_orig.py
+++ b/gbp/scripts/common/import_orig.py
@@ -32,29 +32,26 @@ except ImportError:
pass
-class OrigUpstreamSource(UpstreamSource):
- """Upstream source that will be imported"""
-
- def needs_repack(self, options):
- """
- Determine if the upstream sources needs to be repacked
-
- We repack if
- 1. we want to filter out files and use pristine tar since we want
- to make a filtered tarball available to pristine-tar
- 2. when we don't have a suitable upstream tarball (e.g. zip archive or unpacked dir)
- and want to use filters
- 3. when we don't have a suitable upstream tarball (e.g. zip archive or unpacked dir)
- and want to use pristine-tar
- """
- if ((options.pristine_tar and options.filter_pristine_tar and len(options.filters) > 0)):
+def orig_needs_repack(upstream_source, options):
+ """
+ Determine if the upstream sources needs to be repacked
+
+ We repack if
+ 1. we want to filter out files and use pristine tar since we want
+ to make a filtered tarball available to pristine-tar
+ 2. when we don't have a suitable upstream tarball (e.g. zip archive or unpacked dir)
+ and want to use filters
+ 3. when we don't have a suitable upstream tarball (e.g. zip archive or unpacked dir)
+ and want to use pristine-tar
+ """
+ if ((options.pristine_tar and options.filter_pristine_tar and len(options.filters) > 0)):
+ return True
+ elif not upstream_source.is_orig():
+ if len(options.filters):
return True
- elif not self.is_orig():
- if len(options.filters):
- return True
- elif options.pristine_tar:
- return True
- return False
+ elif options.pristine_tar:
+ return True
+ return False
def cleanup_tmp_tree(tree):
diff --git a/gbp/scripts/import_dsc.py b/gbp/scripts/import_dsc.py
index 600b394..ce97fcb 100644
--- a/gbp/scripts/import_dsc.py
+++ b/gbp/scripts/import_dsc.py
@@ -26,8 +26,8 @@ import glob
import pipes
import time
import gbp.command_wrappers as gbpc
-from gbp.pkg import UpstreamSource
from gbp.deb.dscfile import DscFile
+from gbp.deb.upstreamsource import DebianUpstreamSource
from gbp.deb.git import (DebianGitRepository, GitRepositoryError)
from gbp.deb.changelog import ChangeLog
from gbp.git import rfc822_date_to_git
@@ -328,7 +328,7 @@ def main(argv):
set_bare_repo_options(options)
dirs['tmp'] = os.path.abspath(tempfile.mkdtemp(dir='..'))
- upstream = UpstreamSource(src.tgz)
+ upstream = DebianUpstreamSource(src.tgz)
upstream.unpack(dirs['tmp'], options.filters)
format = [(options.upstream_tag, "Upstream"), (options.debian_tag, "Debian")][src.native]
diff --git a/gbp/scripts/import_orig.py b/gbp/scripts/import_orig.py
index 542896e..f81d249 100644
--- a/gbp/scripts/import_orig.py
+++ b/gbp/scripts/import_orig.py
@@ -23,13 +23,14 @@ import sys
import tempfile
import gbp.command_wrappers as gbpc
from gbp.deb import (DebianPkgPolicy, parse_changelog_repo)
+from gbp.deb.upstreamsource import DebianUpstreamSource
from gbp.deb.uscan import (Uscan, UscanError)
from gbp.deb.changelog import ChangeLog, NoChangeLogError
from gbp.deb.git import (GitRepositoryError, DebianGitRepository)
from gbp.config import GbpOptionParserDebian, GbpOptionGroup, no_upstream_branch_msg
from gbp.errors import GbpError
import gbp.log
-from gbp.scripts.common.import_orig import (OrigUpstreamSource, cleanup_tmp_tree,
+from gbp.scripts.common.import_orig import (orig_needs_repack, cleanup_tmp_tree,
ask_package_name, ask_package_version,
repack_source, is_link_target)
@@ -167,7 +168,7 @@ def find_source(use_uscan, args):
elif len(args) == 0:
raise GbpError("No archive to import specified. Try --help.")
else:
- archive = OrigUpstreamSource(args[0])
+ archive = DebianUpstreamSource(args[0])
return archive
@@ -300,7 +301,7 @@ def main(argv):
source.unpack(tmpdir, options.filters)
gbp.log.debug("Unpacked '%s' to '%s'" % (source.path, source.unpacked))
- if source.needs_repack(options):
+ if orig_needs_repack(source, options):
gbp.log.debug("Filter pristine-tar: repacking '%s' from '%s'" % (source.path, source.unpacked))
(source, tmpdir) = repack_source(source, sourcepackage, version, tmpdir, options.filters)