diff options
-rw-r--r-- | bin/gbp-pq-rpm | 5 | ||||
-rw-r--r-- | bin/git-buildpackage-rpm | 5 | ||||
-rw-r--r-- | bin/git-import-orig-rpm | 5 | ||||
-rw-r--r-- | bin/git-import-srpm | 5 | ||||
-rw-r--r-- | bin/git-pbuilder | 3 | ||||
-rw-r--r-- | bin/git-rpm-ch | 5 | ||||
-rw-r--r-- | debian/changelog | 105 | ||||
-rw-r--r-- | debian/git-buildpackage-common.install | 29 | ||||
-rw-r--r-- | debian/git-buildpackage-rpm.install | 5 | ||||
-rw-r--r-- | debian/git-buildpackage.install | 17 | ||||
-rw-r--r-- | gbp/pkg/__init__.py | 75 | ||||
-rw-r--r-- | gbp/rpm/__init__.py | 65 | ||||
-rw-r--r-- | gbp/rpm/git.py | 4 | ||||
-rwxr-xr-x | gbp/scripts/buildpackage_rpm.py | 15 | ||||
-rw-r--r-- | gbp/scripts/common/buildpackage.py | 2 | ||||
-rw-r--r-- | gbp/scripts/common/import_orig.py | 115 | ||||
-rwxr-xr-x | gbp/scripts/pq_rpm.py | 24 | ||||
-rwxr-xr-x | gbp/scripts/rpm_ch.py | 2 | ||||
-rw-r--r-- | packaging/PKGBUILD | 4 | ||||
-rw-r--r-- | setup.py | 7 |
20 files changed, 206 insertions, 291 deletions
diff --git a/bin/gbp-pq-rpm b/bin/gbp-pq-rpm new file mode 100644 index 00000000..528020df --- /dev/null +++ b/bin/gbp-pq-rpm @@ -0,0 +1,5 @@ +#! /usr/bin/python -u +import sys +from gbp.scripts.pq_rpm import main + +sys.exit(main(sys.argv)) diff --git a/bin/git-buildpackage-rpm b/bin/git-buildpackage-rpm new file mode 100644 index 00000000..393f1ae1 --- /dev/null +++ b/bin/git-buildpackage-rpm @@ -0,0 +1,5 @@ +#! /usr/bin/python -u +import sys +from gbp.scripts.buildpackage_rpm import main + +sys.exit(main(sys.argv)) diff --git a/bin/git-import-orig-rpm b/bin/git-import-orig-rpm new file mode 100644 index 00000000..9e760c00 --- /dev/null +++ b/bin/git-import-orig-rpm @@ -0,0 +1,5 @@ +#! /usr/bin/python -u +import sys +from gbp.scripts.import_orig_rpm import main + +sys.exit(main(sys.argv)) diff --git a/bin/git-import-srpm b/bin/git-import-srpm new file mode 100644 index 00000000..721741b7 --- /dev/null +++ b/bin/git-import-srpm @@ -0,0 +1,5 @@ +#! /usr/bin/python -u +import sys +from gbp.scripts.import_srpm import main + +sys.exit(main(sys.argv)) diff --git a/bin/git-pbuilder b/bin/git-pbuilder index a9104d7a..a003b266 100644 --- a/bin/git-pbuilder +++ b/bin/git-pbuilder @@ -228,8 +228,7 @@ update|create|login) sudo "$BUILDER" --"$action" --distribution "$DIST" \ --othermirror "$OTHERMIRROR" "${OPTIONS[@]}" "$@" else - sudo "$BUILDER" --"$action" --distribution "$DIST" \ - "${OPTIONS[@]}" "$@" + sudo "$BUILDER" --"$action" --distribution "$DIST" "${OPTIONS[@]}" "$@" fi fi exit $? diff --git a/bin/git-rpm-ch b/bin/git-rpm-ch new file mode 100644 index 00000000..ef1340e7 --- /dev/null +++ b/bin/git-rpm-ch @@ -0,0 +1,5 @@ +#! /usr/bin/python -u +import sys +from gbp.scripts.rpm_ch import main + +sys.exit(main(sys.argv)) diff --git a/debian/changelog b/debian/changelog index bbd64edb..ee6ad668 100644 --- a/debian/changelog +++ b/debian/changelog @@ -62,6 +62,60 @@ git-buildpackage (0.6.22-tizen20150206) unstable; urgency=low -- Markus Lehtonen <markus.lehtonen@linux.intel.com> Fri, 06 Feb 2015 10:36:26 +0200 + * Upgrade version to 0.6.25 + + -- Rong Jinhui <jinhui.rong@samsung.com> Thu, 04 Aug 2015 08:53:30 +0800 + +git-buildpackage (0.6.15-tizen20140828) unstable; urgency=low + + [ Markus Lehtonen ] + * Rebase on top of upstream version 0.6.15 + * Changes in buildpackage-rpm + - new 'commitish' keyword for spec vcs tag + - notify: catch RuntimeError when importing pynotify + - fix exit code in case of GitRepositoryError + - always create tarball for native packages + - check submodules from the exported treeish + - fix crash when running prebuild hook + - always run cleaner hook + - add --git-no-build option + - don't crash on invalid vcs format strings + - add '--git-native' option + - remove some outdated/unnecessary exception handling + - get rid of prepare_export_dir() + - handle invalid keys in orig prefix + - internal refactoring and fixes + * Changes in rpm-ch + - implement --commit option + - implement --commit-msg option + - rpm-ch: implement --meta-bts option + - rpm.policy: don't allow leading whitespace in bts meta tags + * docs: manpages for the rpm tools + * Misc. fixes and features + - buildpackage: refactor tarball compression + - gbp-dch: fix handling of the '--meta' option + - import-orig-rpm: download tarball into parent directory + - GitRepository/has_submodules: add treeish argument + - tristate: implement __nonzero__() method + * Logging: + - don't automatically setup gbp-specific logger + - fix auto colorizing for custom streams + * Tests + - multiple fixes and additions in ComponentTestBase class + - testutils: add directories arg to ls_* functions + - add unit tests for buildpackage-rpm + * Packaging + - rpm-packaging: recommend/require unzip + - recommend/require zipmerge + - depend/recommend rpmbuild + + [ Junchun Guan ] + * Add PKGBUILD to support arch linux + + [ Li Jinjing ] + * rpm packaging: use macro for python binary + + -- Markus Lehtonen <markus.lehtonen@linux.intel.com> Thu, 28 Aug 2014 11:40:05 +0300 git-buildpackage (0.6.22) unstable; urgency=medium * [3d8939d] git.vfs: fix close method. Preventing a infinite recursion @@ -147,57 +201,6 @@ git-buildpackage (0.6.16) experimental; urgency=medium -- Guido Günther <agx@sigxcpu.org> Mon, 28 Jul 2014 15:57:49 +0200 -git-buildpackage (0.6.15-tizen20140828) unstable; urgency=low - - [ Markus Lehtonen ] - * Rebase on top of upstream version 0.6.15 - * Changes in buildpackage-rpm - - new 'commitish' keyword for spec vcs tag - - notify: catch RuntimeError when importing pynotify - - fix exit code in case of GitRepositoryError - - always create tarball for native packages - - check submodules from the exported treeish - - fix crash when running prebuild hook - - always run cleaner hook - - add --git-no-build option - - don't crash on invalid vcs format strings - - add '--git-native' option - - remove some outdated/unnecessary exception handling - - get rid of prepare_export_dir() - - handle invalid keys in orig prefix - - internal refactoring and fixes - * Changes in rpm-ch - - implement --commit option - - implement --commit-msg option - - rpm-ch: implement --meta-bts option - - rpm.policy: don't allow leading whitespace in bts meta tags - * docs: manpages for the rpm tools - * Misc. fixes and features - - buildpackage: refactor tarball compression - - gbp-dch: fix handling of the '--meta' option - - import-orig-rpm: download tarball into parent directory - - GitRepository/has_submodules: add treeish argument - - tristate: implement __nonzero__() method - * Logging: - - don't automatically setup gbp-specific logger - - fix auto colorizing for custom streams - * Tests - - multiple fixes and additions in ComponentTestBase class - - testutils: add directories arg to ls_* functions - - add unit tests for buildpackage-rpm - * Packaging - - rpm-packaging: recommend/require unzip - - recommend/require zipmerge - - depend/recommend rpmbuild - - [ Junchun Guan ] - * Add PKGBUILD to support arch linux - - [ Li Jinjing ] - * rpm packaging: use macro for python binary - - -- Markus Lehtonen <markus.lehtonen@linux.intel.com> Thu, 28 Aug 2014 11:40:05 +0300 - git-buildpackage (0.6.15) unstable; urgency=medium * [5cde49a] Revert "Determine build_dir upfront" diff --git a/debian/git-buildpackage-common.install b/debian/git-buildpackage-common.install index 722eab68..5283d546 100644 --- a/debian/git-buildpackage-common.install +++ b/debian/git-buildpackage-common.install @@ -1,24 +1,13 @@ usr/bin/gbp usr/bin/gbp-clone usr/bin/gbp-pull -usr/lib/python2.?/dist-packages/gbp-* -usr/lib/python2.?/dist-packages/gbp/command_wrappers.py -usr/lib/python2.?/dist-packages/gbp/config.py -usr/lib/python2.?/dist-packages/gbp/errors.py -usr/lib/python2.?/dist-packages/gbp/format.py -usr/lib/python2.?/dist-packages/gbp/git/ -usr/lib/python2.?/dist-packages/gbp/__init__.py -usr/lib/python2.?/dist-packages/gbp/log.py -usr/lib/python2.?/dist-packages/gbp/notifications.py -usr/lib/python2.?/dist-packages/gbp/patch_series.py -usr/lib/python2.?/dist-packages/gbp/pkg/ -usr/lib/python2.?/dist-packages/gbp/scripts/clone.py -usr/lib/python2.?/dist-packages/gbp/scripts/common/ -usr/lib/python2.?/dist-packages/gbp/scripts/config.py -usr/lib/python2.?/dist-packages/gbp/scripts/__init__.py -usr/lib/python2.?/dist-packages/gbp/scripts/pull.py -usr/lib/python2.?/dist-packages/gbp/scripts/supercommand.py -usr/lib/python2.?/dist-packages/gbp/tmpfile.py -usr/lib/python2.?/dist-packages/gbp/tristate.py -usr/lib/python2.?/dist-packages/gbp/version.py +usr/lib/python*/dist-packages/gbp/*.py* +usr/lib/python*/dist-packages/gbp/scripts/__init__.py* +usr/lib/python*/dist-packages/gbp/scripts/clone.py* +usr/lib/python*/dist-packages/gbp/scripts/config.py* +usr/lib/python*/dist-packages/gbp/scripts/pull.py* +usr/lib/python*/dist-packages/gbp/scripts/supercommand.py* +usr/lib/python*/dist-packages/gbp/scripts/common/*.py* +usr/lib/python*/dist-packages/gbp/git/*.py* +usr/lib/python*/dist-packages/gbp/pkg/*.py* etc/git-buildpackage/gbp.conf diff --git a/debian/git-buildpackage-rpm.install b/debian/git-buildpackage-rpm.install index f243ebb9..8c49491e 100644 --- a/debian/git-buildpackage-rpm.install +++ b/debian/git-buildpackage-rpm.install @@ -1,2 +1,3 @@ -usr/lib/python2.?/dist-packages/gbp/rpm/ -usr/lib/python2.?/dist-packages/gbp/scripts/*rpm*.py* +usr/bin/*rpm* +usr/lib/python*/dist-packages/gbp/rpm/*.py* +usr/lib/python*/dist-packages/gbp/scripts/*rpm*.py* diff --git a/debian/git-buildpackage.install b/debian/git-buildpackage.install index 291cb15a..7a276d7e 100644 --- a/debian/git-buildpackage.install +++ b/debian/git-buildpackage.install @@ -6,12 +6,11 @@ usr/bin/git-import-dscs usr/bin/git-import-orig usr/bin/git-pbuilder usr/bin/gbp-create-remote-repo -usr/lib/python2.?/dist-packages/gbp/dch.py -usr/lib/python2.?/dist-packages/gbp/deb/ -usr/lib/python2.?/dist-packages/gbp/scripts/buildpackage.py -usr/lib/python2.?/dist-packages/gbp/scripts/create_remote_repo.py -usr/lib/python2.?/dist-packages/gbp/scripts/dch.py -usr/lib/python2.?/dist-packages/gbp/scripts/import_dsc.py -usr/lib/python2.?/dist-packages/gbp/scripts/import_dscs.py -usr/lib/python2.?/dist-packages/gbp/scripts/import_orig.py -usr/lib/python2.?/dist-packages/gbp/scripts/pq.py +usr/lib/python*/dist-packages/gbp/deb/*.py* +usr/lib/python*/dist-packages/gbp/scripts/pq.py* +usr/lib/python*/dist-packages/gbp/scripts/buildpackage.py* +usr/lib/python*/dist-packages/gbp/scripts/dch.py* +usr/lib/python*/dist-packages/gbp/scripts/import_dsc.py* +usr/lib/python*/dist-packages/gbp/scripts/import_dscs.py* +usr/lib/python*/dist-packages/gbp/scripts/import_orig.py* +usr/lib/python*/dist-packages/gbp/scripts/create_remote_repo.py* diff --git a/gbp/pkg/__init__.py b/gbp/pkg/__init__.py index 4e99efe9..8162286b 100644 --- a/gbp/pkg/__init__.py +++ b/gbp/pkg/__init__.py @@ -142,67 +142,6 @@ class PkgPolicy(object): return True return False - @classmethod - def guess_upstream_src_version(cls, filename, extra_regex=r''): - """ - Guess the package name and version from the filename of an upstream - archive. - - @param filename: filename (archive or directory) from which to guess - @type filename: C{string} - @param extra_regex: additional regex to apply, needs a 'package' and a - 'version' group - @return: (package name, version) or ('', '') - @rtype: tuple - - >>> PkgPolicy.guess_upstream_src_version('foo-bar_0.2.orig.tar.gz') - ('foo-bar', '0.2') - >>> PkgPolicy.guess_upstream_src_version('foo-Bar_0.2.orig.tar.gz') - ('foo-Bar', '0.2.orig') - >>> PkgPolicy.guess_upstream_src_version('git-bar-0.2.tar.gz') - ('git-bar', '0.2') - >>> PkgPolicy.guess_upstream_src_version('git-bar-0.2-rc1.tar.gz') - ('git-bar', '0.2-rc1') - >>> PkgPolicy.guess_upstream_src_version('git-bar-0.2:~-rc1.tar.gz') - ('git-bar', '0.2:~-rc1') - >>> PkgPolicy.guess_upstream_src_version('git-Bar-0A2d:rc1.tar.bz2') - ('git-Bar', '0A2d:rc1') - >>> PkgPolicy.guess_upstream_src_version('git-1.tar.bz2') - ('git', '1') - >>> PkgPolicy.guess_upstream_src_version('kvm_87+dfsg.orig.tar.gz') - ('kvm', '87+dfsg') - >>> PkgPolicy.guess_upstream_src_version('foo-Bar-a.b.tar.gz') - ('', '') - >>> PkgPolicy.guess_upstream_src_version('foo-bar_0.2.orig.tar.xz') - ('foo-bar', '0.2') - >>> PkgPolicy.guess_upstream_src_version('foo-bar_0.2.tar.gz') - ('foo-bar', '0.2') - >>> PkgPolicy.guess_upstream_src_version('foo-bar_0.2.orig.tar.lzma') - ('foo-bar', '0.2') - >>> PkgPolicy.guess_upstream_src_version('foo-bar-0.2.zip') - ('foo-bar', '0.2') - >>> PkgPolicy.guess_upstream_src_version('foo-bar-0.2.tlz') - ('foo-bar', '0.2') - """ - version_chars = r'[a-zA-Z\d\.\~\-\:\+]' - basename = parse_archive_filename(os.path.basename(filename))[0] - - version_filters = map ( lambda x: x % version_chars, - ( # Debian upstream tarball: package_'<version>.orig.tar.gz' - r'^(?P<package>[a-z\d\.\+\-]+)_(?P<version>%s+)\.orig', - # Upstream 'package-<version>.tar.gz' - # or Debian native 'package_<version>.tar.gz' - # or directory 'package-<version>': - r'^(?P<package>[a-zA-Z\d\.\+\-]+)(-|_)(?P<version>[0-9]%s*)')) - if extra_regex: - version_filters = extra_regex + version_filters - - for filter in version_filters: - m = re.match(filter, basename) - if m: - return (m.group('package'), m.group('version')) - return ('', '') - @staticmethod def guess_upstream_src_version(filename, extra_regex=r''): """ @@ -441,11 +380,25 @@ class UpstreamSource(object): @property def archive_fmt(self): """Archive format of the sources, e.g. 'tar'""" + """ + >>> UpstreamSource('foo/bar.tar.gz').archive_fmt + 'tar' + >>> UpstreamSource('foo.bar.zip').archive_fmt + 'zip' + >>> UpstreamSource('foo.bar.baz').archive_fmt + """ return self._archive_fmt @property def compression(self): """Compression format of the sources, e.g. 'gzip'""" + """ + >>> UpstreamSource('foo/bar.tar.gz').compression + 'gzip' + >>> UpstreamSource('foo.bar.zip').compression + >>> UpstreamSource('foo.bz2').compression + 'bzip2' + """ return self._compression @property diff --git a/gbp/rpm/__init__.py b/gbp/rpm/__init__.py index 22983d2d..4c5c22bf 100644 --- a/gbp/rpm/__init__.py +++ b/gbp/rpm/__init__.py @@ -902,69 +902,4 @@ def string_to_int(val_str): return int(val_str) -def split_version_str(version): - """ - Parse full version string and split it into individual "version - components", i.e. upstreamversion, epoch and release - - @param version: full version of a package - @type version: C{str} - @return: individual version components - @rtype: C{dict} - - >>> split_version_str("1") - {'release': None, 'epoch': None, 'upstreamversion': '1'} - >>> split_version_str("1.2.3-5.3") - {'release': '5.3', 'epoch': None, 'upstreamversion': '1.2.3'} - >>> split_version_str("3:1.2.3") - {'release': None, 'epoch': '3', 'upstreamversion': '1.2.3'} - >>> split_version_str("3:1-0") - {'release': '0', 'epoch': '3', 'upstreamversion': '1'} - """ - ret = {'epoch': None, 'upstreamversion': None, 'release': None} - - e_vr = version.split(":", 1) - if len(e_vr) == 1: - v_r = e_vr[0].split("-", 1) - else: - ret['epoch'] = e_vr[0] - v_r = e_vr[1].split("-", 1) - ret['upstreamversion'] = v_r[0] - if len(v_r) > 1: - ret['release'] = v_r[1] - - return ret - -def compose_version_str(evr): - """ - Compose a full version string from individual "version components", - i.e. epoch, version and release - - @param evr: dict of version components - @type evr: C{dict} of C{str} - @return: full version - @rtype: C{str} - - >>> compose_version_str({'epoch': '', 'upstreamversion': '1.0'}) - '1.0' - >>> compose_version_str({'epoch': '2', 'upstreamversion': '1.0', 'release': None}) - '2:1.0' - >>> compose_version_str({'epoch': None, 'upstreamversion': '1', 'release': '0'}) - '1-0' - >>> compose_version_str({'epoch': '2', 'upstreamversion': '1.0', 'release': '2.3'}) - '2:1.0-2.3' - >>> compose_version_str({'epoch': '2', 'upstreamversion': '', 'release': '2.3'}) - """ - if 'upstreamversion' in evr and evr['upstreamversion']: - version = "" - if 'epoch' in evr and evr['epoch']: - version += "%s:" % evr['epoch'] - version += evr['upstreamversion'] - if 'release' in evr and evr['release']: - version += "-%s" % evr['release'] - if version: - return version - return None - - # vim:et:ts=4:sw=4:et:sts=4:ai:set list listchars=tab\:»·,trail\:·: diff --git a/gbp/rpm/git.py b/gbp/rpm/git.py index c7cc023b..92f8b2e0 100644 --- a/gbp/rpm/git.py +++ b/gbp/rpm/git.py @@ -19,7 +19,7 @@ import re from gbp.git import GitRepository, GitRepositoryError from gbp.pkg.pristinetar import PristineTar -from gbp.rpm import compose_version_str +from gbp.rpm.policy import RpmPkgPolicy class RpmGitRepository(GitRepository): """A git repository that holds the source of an RPM package""" @@ -66,7 +66,7 @@ class RpmGitRepository(GitRepository): 'myvendor/v1.0-2' """ version_tag = format % dict(str_fields, - version=compose_version_str(str_fields)) + version=RpmPkgPolicy.compose_full_version(str_fields)) return RpmGitRepository._sanitize_tag(version_tag) @staticmethod diff --git a/gbp/scripts/buildpackage_rpm.py b/gbp/scripts/buildpackage_rpm.py index 2b4f6386..56db5e13 100755 --- a/gbp/scripts/buildpackage_rpm.py +++ b/gbp/scripts/buildpackage_rpm.py @@ -137,10 +137,10 @@ def pristine_tar_build_orig(repo, orig_file, output_dir, options): raise return False -def get_upstream_tree(repo, version, options): +def get_upstream_tree(repo, spec, options): """Determine the upstream tree from the given options""" if options.upstream_tree.upper() == 'TAG': - tag_str_fields = {"upstreamversion": version, "vendor": "Upstream"} + tag_str_fields = dict(upstreamversion=spec.upstreamversion, vendor="Upstream") upstream_tree = repo.version_to_tag(options.upstream_tag, tag_str_fields) elif options.upstream_tree.upper() == 'BRANCH': if not repo.has_branch(options.upstream_branch): @@ -257,7 +257,7 @@ def git_archive_build_orig(repo, spec, output_dir, options): @rtype: C{str} """ try: - upstream_tree = get_upstream_tree(repo, spec.upstreamversion, options) + upstream_tree = get_upstream_tree(repo, spec, options) gbp.log.info("%s does not exist, creating from '%s'" % \ (spec.orig_src['filename'], upstream_tree)) if spec.orig_src['compression']: @@ -279,7 +279,7 @@ def export_patches(repo, spec, export_treeish, options): Generate patches and update spec file """ try: - upstream_tree = get_upstream_tree(repo, spec.upstreamversion, options) + upstream_tree = get_upstream_tree(repo, spec, options) update_patch_series(repo, spec, upstream_tree, export_treeish, options) except (GitRepositoryError, GbpError) as err: raise GbpAutoGenerateError(str(err)) @@ -353,9 +353,9 @@ def update_tag_str_fields(fields, tag_format_str, repo, commit_info): break -def packaging_tag_name(repo, version, commit_info, options): +def packaging_tag_name(repo, spec, commit_info, options): """Compose packaging tag as string""" - tag_str_fields = dict(version, vendor=options.vendor) + tag_str_fields = dict(spec.version, vendor=options.vendor) update_tag_str_fields(tag_str_fields, options.packaging_tag, repo, commit_info) return repo.version_to_tag(options.packaging_tag, tag_str_fields) @@ -667,7 +667,7 @@ def main(argv): if options.tag or options.tag_only: gbp.log.info("Tagging %s" % RpmPkgPolicy.compose_full_version(spec.version)) commit_info = repo.get_commit_info(tree) - tag = packaging_tag_name(repo, spec.version, commit_info, options) + tag = packaging_tag_name(repo, spec, commit_info, options) if options.retag and repo.has_tag(tag): repo.delete_tag(tag) create_packaging_tag(repo, tag, commit=tree, version=spec.version, @@ -708,6 +708,7 @@ def main(argv): if not options.tag_only: if spec and options.notify: summary = "Gbp-rpm %s" % ["failed", "successful"][not retval] + pkg_evr = {'upstreamversion': spec.version} message = ("Build of %s %s %s" % (spec.name, RpmPkgPolicy.compose_full_version(spec.version), ["failed", "succeeded"][not retval])) diff --git a/gbp/scripts/common/buildpackage.py b/gbp/scripts/common/buildpackage.py index 670f6823..d089df5a 100644 --- a/gbp/scripts/common/buildpackage.py +++ b/gbp/scripts/common/buildpackage.py @@ -73,7 +73,6 @@ def compress(cmd, options, output, input_data=None): except (OSError, IOError) as err: raise GbpError("Error creating %s: %s" % (output, err)) - def git_archive_submodules(repo, treeish, output, tmpdir_base, prefix, comp_type, comp_level, comp_opts, format='tar'): """ @@ -143,7 +142,6 @@ def untar_data(outdir, data): if popen.wait(): raise GbpError("Error extracting tar to %s" % outdir) - #{ Functions to handle export-dir def dump_tree(repo, export_dir, treeish, with_submodules, recursive=True): """Dump a git tree-ish to output_dir""" diff --git a/gbp/scripts/common/import_orig.py b/gbp/scripts/common/import_orig.py index adbfff5e..45e71c57 100644 --- a/gbp/scripts/common/import_orig.py +++ b/gbp/scripts/common/import_orig.py @@ -78,59 +78,6 @@ def ask_package_version(default, ver_validator_func, err_msg): # bit clearer. gbp.log.warn("\nNot a valid upstream version: '%s'.\n%s" % (version, err_msg)) - -def prepare_pristine_tar(source, pkg_name, pkg_version, pristine_commit_name, - filters=None, prefix=None, tmpdir=None): - """ - Prepare the upstream sources for pristine-tar import - - @param source: original upstream sources - @type source: C{UpstreamSource} - @param pkg_name: package name - @type pkg_name: C{str} - @param pkg_version: upstream version of the package - @type pkg_version: C{str} - @param pristine_commit_name: archive filename to commit to pristine-tar - @type pristine_commit_name: C{str} or C{None} - @param filters: filter to exclude files - @type filters: C{list} of C{str} or C{None} - @param prefix: prefix (i.e. leading directory of files) to use in - pristine-tar, set to C{None} to not mangle orig archive - @type prefix: C{str} or C{None} - @param tmpdir: temporary working dir (cleanup left to caller) - @type tmpdir: C{str} - @return: prepared source archive - @rtype: C{UpstreamSource} - """ - need_repack = False - if source.is_dir(): - if prefix is None: - prefix = '%s-%s' % (pkg_name, pkg_version) - gbp.log.info("Using guessed prefix '%s/' for pristine-tar" % prefix) - need_repack = True - else: - if prefix is not None and prefix == source.prefix: - prefix = None - comp = parse_archive_filename(pristine_commit_name)[2] - if filters or prefix is not None or source.compression != comp: - if not source.unpacked: - unpack_dir = tempfile.mkdtemp(prefix='pristine_unpack_', - dir=tmpdir) - source.unpack(unpack_dir) - need_repack = True - pristine_path = os.path.join(tmpdir, pristine_commit_name) - if need_repack: - gbp.log.debug("Packing '%s' from '%s' for pristine-tar" % - (pristine_path, source.unpacked)) - pristine = source.pack(pristine_path, filters, prefix) - else: - # Just create symlink for mangling the pristine tarball name - os.symlink(source.path, pristine_path) - pristine = source.__class__(pristine_path) - - return pristine - - def prepare_sources(source, pkg_name, pkg_version, pristine_commit_name, filters, filter_pristine, prefix, tmpdir): """ @@ -201,3 +148,65 @@ def prepare_sources(source, pkg_name, pkg_version, pristine_commit_name, pristine_path = pristine.path if pristine else '' return (filtered.unpacked, pristine_path) +def repack_source(source, new_name, unpack_dir, filters, new_prefix=None): + """Repack the source tree""" + repacked = source.pack(new_name, filters, new_prefix) + if source.is_tarball(): # the tarball was filtered on unpack + repacked.unpacked = source.unpacked + else: # otherwise unpack the generated tarball get a filtered tree + repacked.unpack(unpack_dir) + return repacked + + +def prepare_pristine_tar(source, pkg_name, pkg_version, pristine_commit_name, + filters=None, prefix=None, tmpdir=None): + """ + Prepare the upstream sources for pristine-tar import + + @param source: original upstream sources + @type source: C{UpstreamSource} + @param pkg_name: package name + @type pkg_name: C{str} + @param pkg_version: upstream version of the package + @type pkg_version: C{str} + @param pristine_commit_name: archive filename to commit to pristine-tar + @type pristine_commit_name: C{str} or C{None} + @param filters: filter to exclude files + @type filters: C{list} of C{str} or C{None} + @param prefix: prefix (i.e. leading directory of files) to use in + pristine-tar, set to C{None} to not mangle orig archive + @type prefix: C{str} or C{None} + @param tmpdir: temporary working dir (cleanup left to caller) + @type tmpdir: C{str} + @return: prepared source archive + @rtype: C{UpstreamSource} + """ + need_repack = False + if source.is_dir(): + if prefix is None: + prefix = '%s-%s' % (pkg_name, pkg_version) + gbp.log.info("Using guessed prefix '%s/' for pristine-tar" % prefix) + need_repack = True + else: + if prefix is not None and prefix == source.prefix: + prefix = None + comp = parse_archive_filename(pristine_commit_name)[2] + if filters or prefix is not None or source.compression != comp: + if not source.unpacked: + unpack_dir = tempfile.mkdtemp(prefix='pristine_unpack_', + dir=tmpdir) + source.unpack(unpack_dir) + need_repack = True + pristine_path = os.path.join(tmpdir, pristine_commit_name) + if need_repack: + gbp.log.debug("Packing '%s' from '%s' for pristine-tar" % + (pristine_path, source.unpacked)) + pristine = source.pack(pristine_path, filters, prefix) + else: + # Just create symlink for mangling the pristine tarball name + os.symlink(source.path, pristine_path) + pristine = source.__class__(pristine_path) + + return pristine + + diff --git a/gbp/scripts/pq_rpm.py b/gbp/scripts/pq_rpm.py index d8fcbf2f..e19218a9 100755 --- a/gbp/scripts/pq_rpm.py +++ b/gbp/scripts/pq_rpm.py @@ -27,11 +27,10 @@ import re import gzip import bz2 import subprocess - import gbp.tmpfile as tempfile from gbp.config import GbpOptionParserRpm from gbp.rpm.git import GitRepositoryError, RpmGitRepository -from gbp.git.modifier import GitModifier +from gbp.git.modifier import GitModifier, GitTz from gbp.command_wrappers import GitCommand, CommandExecFailed from gbp.errors import GbpError import gbp.log @@ -243,13 +242,14 @@ def parse_spec(options, repo, treeish=None): return spec -def find_upstream_commit(repo, upstreamversion, upstream_tag): +def find_upstream_commit(repo, spec, upstream_tag): """Find commit corresponding upstream version""" - tag_str_fields = {'upstreamversion': upstreamversion, + tag_str_fields = {'upstreamversion': spec.upstreamversion, 'vendor': 'Upstream'} upstream_commit = repo.find_version(upstream_tag, tag_str_fields) if not upstream_commit: - raise GbpError("Couldn't find upstream version %s" % upstreamversion) + raise GbpError("Couldn't find upstream version %s" % + spec.upstreamversion) return upstream_commit @@ -265,10 +265,11 @@ def export_patches(repo, options): else: spec = parse_spec(options, repo) pq_branch = pq_branch_name(current, options, spec.version) - upstream_commit = find_upstream_commit(repo, spec.upstreamversion, - options.upstream_tag) + upstream_commit = find_upstream_commit(repo, spec, options.upstream_tag) export_treeish = options.export_rev if options.export_rev else pq_branch + if not repo.has_treeish(export_treeish): + raise GbpError('Invalid treeish object %s' % export_treeish) update_patch_series(repo, spec, upstream_commit, export_treeish, options) @@ -377,8 +378,7 @@ def import_spec_patches(repo, options): spec = parse_spec(options, repo) spec_treeish = None base = current - upstream_commit = find_upstream_commit(repo, spec.upstreamversion, - options.upstream_tag) + upstream_commit = find_upstream_commit(repo, spec, options.upstream_tag) packager = get_packager(spec) pq_branch = pq_branch_name(base, options, spec.version) @@ -435,8 +435,7 @@ def rebase_pq(repo, options): else: base = current spec = parse_spec(options, repo) - upstream_commit = find_upstream_commit(repo, spec.upstreamversion, - options.upstream_tag) + upstream_commit = find_upstream_commit(repo, spec, options.upstream_tag) switch_to_pq_branch(repo, base, options) GitCommand("rebase")([upstream_commit]) @@ -502,8 +501,7 @@ def convert_package(repo, options): pq_branch = pq_branch_name(old_packaging, options, spec.version) raise GbpError(err_msg_base + "pq branch %s already exists" % pq_branch) # Check that the current branch is based on upstream - upstream_commit = find_upstream_commit(repo, spec.upstreamversion, - options.upstream_tag) + upstream_commit = find_upstream_commit(repo, spec, options.upstream_tag) if not is_ancestor(repo, upstream_commit, old_packaging): raise GbpError(err_msg_base + "%s is not based on upstream version %s" % (old_packaging, spec.upstreamversion)) diff --git a/gbp/scripts/rpm_ch.py b/gbp/scripts/rpm_ch.py index 5bbf6155..33058372 100755 --- a/gbp/scripts/rpm_ch.py +++ b/gbp/scripts/rpm_ch.py @@ -330,7 +330,7 @@ def update_changelog(changelog, entries, repo, spec, options): # Get fake information for the to-be-created git commit commit_info = {'author': GitModifier(date=now), 'committer': GitModifier(date=now)} - tag = packaging_tag_name(repo, spec.version, commit_info, options) + tag = packaging_tag_name(repo, spec, commit_info, options) else: commit_info = {'author': None, 'committer': None} tag = repo.describe('HEAD', longfmt=True, always=True) diff --git a/packaging/PKGBUILD b/packaging/PKGBUILD index dbe4b00b..60ffa9f6 100644 --- a/packaging/PKGBUILD +++ b/packaging/PKGBUILD @@ -1,6 +1,6 @@ pkgbase='git-buildpackage' pkgname=('git-buildpackage-rpm' 'git-buildpackage-common' 'git-buildpackage-doc') -pkgver=0.6.15 +pkgver=0.6.27 pkgrel=0 pkgdesc="Tools from Debian to integrate the package build system with Git" arch=(any) @@ -53,7 +53,7 @@ package_git-buildpackage-common() { package_git-buildpackage-rpm() { depends=("git-buildpackage-common=$pkgver-$pkgrel" "rpm") - provides=("tizen-gbp-rpm=20140605") + provides=("tizen-gbp-rpm=20160302") cd $srcdir/$pkgbase-$pkgver WITHOUT_NOSETESTS=1 \ python2 setup.py install \ @@ -70,7 +70,12 @@ setup(name = "gbp", 'bin/gbp-pull', 'bin/gbp-clone', 'bin/gbp-create-remote-repo', - 'bin/git-pbuilder'], + 'bin/git-pbuilder', + 'bin/git-import-srpm', + 'bin/gbp-pq-rpm', + 'bin/git-buildpackage-rpm', + 'bin/git-import-orig-rpm', + 'bin/git-rpm-ch'], packages = find_packages(exclude=['tests', 'tests.*']), data_files = [("/etc/git-buildpackage/", ["gbp.conf"]),], setup_requires=['nose>=0.11.1', 'coverage>=2.85'] if \ |