diff options
-rw-r--r-- | .gitignore | 8 | ||||
-rw-r--r-- | .gitmodules | 4 | ||||
-rw-r--r-- | README | 6 | ||||
-rwxr-xr-x | bin/gbp-pq-rpm | 5 | ||||
-rwxr-xr-x | bin/git-buildpackage-rpm | 5 | ||||
-rwxr-xr-x | bin/git-import-orig-rpm | 5 | ||||
-rwxr-xr-x | bin/git-import-srpm | 5 | ||||
-rw-r--r-- | bin/git-pbuilder | 3 | ||||
-rwxr-xr-x | bin/git-rpm-ch | 5 | ||||
-rwxr-xr-x | debian/changelog | 111 | ||||
-rwxr-xr-x | debian/control | 13 | ||||
-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-- | debian/source/options | 2 | ||||
-rw-r--r-- | gbp/config.py | 44 | ||||
-rw-r--r-- | gbp/pkg/__init__.py | 75 | ||||
-rw-r--r-- | gbp/rpm/__init__.py | 66 | ||||
-rw-r--r-- | gbp/rpm/git.py | 4 | ||||
-rw-r--r-- | gbp/rpm/lib_rpm.py | 1 | ||||
-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 | 105 | ||||
-rw-r--r-- | gbp/scripts/import_orig.py | 5 | ||||
-rwxr-xr-x | gbp/scripts/import_srpm.py | 112 | ||||
-rwxr-xr-x | gbp/scripts/pq_rpm.py | 33 | ||||
-rwxr-xr-x | gbp/scripts/rpm_ch.py | 2 | ||||
-rwxr-xr-x | packaging/git-buildpackage.changes | 3 | ||||
-rwxr-xr-x | packaging/git-buildpackage.spec | 16 | ||||
-rw-r--r-- | setup.py | 7 | ||||
-rw-r--r-- | tests/component/deb/test_import_dsc.py | 54 | ||||
m--------- | tests/component/rpm/data | 0 | ||||
-rw-r--r-- | tests/component/rpm/data/.keep | 0 | ||||
-rw-r--r-- | tests/component/rpm/test_buildpackage_rpm.py | 4 | ||||
-rw-r--r-- | tests/component/rpm/test_import_orig_rpm.py | 4 | ||||
-rw-r--r-- | tests/component/rpm/test_import_srpm.py | 27 | ||||
-rw-r--r-- | tests/component/rpm/test_pq_rpm.py | 4 | ||||
-rw-r--r-- | tests/component/rpm/test_rpm_ch.py | 4 | ||||
-rw-r--r-- | tests/test_rpm.py (renamed from tests/20_test_rpm.py) | 255 | ||||
-rw-r--r-- | tests/test_rpm_changelog.py | 20 | ||||
-rw-r--r-- | tests/test_rpm_data/rpmbuild/SOURCES/bar.tar.gz (renamed from tests/data/rpm/rpmbuild/SOURCES/bar.tar.gz) | bin | 177 -> 177 bytes | |||
-rw-r--r-- | tests/test_rpm_data/rpmbuild/SOURCES/foo.txt (renamed from tests/data/rpm/rpmbuild/SOURCES/foo.txt) | 0 | ||||
-rw-r--r-- | tests/test_rpm_data/rpmbuild/SOURCES/gbp-test-1.0.tar.bz2 (renamed from tests/data/rpm/rpmbuild/SOURCES/gbp-test-1.0.tar.bz2) | bin | 383 -> 383 bytes | |||
-rw-r--r-- | tests/test_rpm_data/rpmbuild/SOURCES/gbp-test-native-1.0.zip (renamed from tests/data/rpm/rpmbuild/SOURCES/gbp-test-native-1.0.zip) | bin | 656 -> 656 bytes | |||
-rw-r--r-- | tests/test_rpm_data/rpmbuild/SOURCES/gbp-test2-3.0.tar.gz (renamed from tests/data/rpm/rpmbuild/SOURCES/gbp-test2-3.0.tar.gz) | bin | 328 -> 328 bytes | |||
-rw-r--r-- | tests/test_rpm_data/rpmbuild/SOURCES/my.patch (renamed from tests/data/rpm/rpmbuild/SOURCES/my.patch) | 0 | ||||
-rw-r--r-- | tests/test_rpm_data/rpmbuild/SOURCES/my2.patch (renamed from tests/data/rpm/rpmbuild/SOURCES/my2.patch) | 0 | ||||
-rw-r--r-- | tests/test_rpm_data/rpmbuild/SOURCES/my3.patch (renamed from tests/data/rpm/rpmbuild/SOURCES/my3.patch) | 0 | ||||
-rw-r--r-- | tests/test_rpm_data/rpmbuild/SPECS/gbp-test-native.spec (renamed from tests/data/rpm/rpmbuild/SPECS/gbp-test-native.spec) | 0 | ||||
-rw-r--r-- | tests/test_rpm_data/rpmbuild/SPECS/gbp-test-native2.spec (renamed from tests/data/rpm/rpmbuild/SPECS/gbp-test-native2.spec) | 0 | ||||
-rw-r--r-- | tests/test_rpm_data/rpmbuild/SPECS/gbp-test.spec (renamed from tests/data/rpm/rpmbuild/SPECS/gbp-test.spec) | 0 | ||||
-rw-r--r-- | tests/test_rpm_data/rpmbuild/SPECS/gbp-test2.spec (renamed from tests/data/rpm/rpmbuild/SPECS/gbp-test2.spec) | 0 | ||||
-rw-r--r-- | tests/test_rpm_data/rpmbuild/SPECS/gbp-test2.spec.orig | 46 | ||||
l--------- | tests/test_rpm_data/specs/gbp-test-native.spec (renamed from tests/data/rpm/specs/gbp-test-native.spec) | 0 | ||||
l--------- | tests/test_rpm_data/specs/gbp-test-native2.spec (renamed from tests/data/rpm/specs/gbp-test-native2.spec) | 0 | ||||
-rw-r--r-- | tests/test_rpm_data/specs/gbp-test-quirks.spec (renamed from tests/data/rpm/specs/gbp-test-quirks.spec) | 0 | ||||
-rw-r--r-- | tests/test_rpm_data/specs/gbp-test-reference.spec (renamed from tests/data/rpm/specs/gbp-test-reference.spec) | 0 | ||||
-rw-r--r-- | tests/test_rpm_data/specs/gbp-test-reference2.spec (renamed from tests/data/rpm/specs/gbp-test-reference2.spec) | 0 | ||||
-rw-r--r-- | tests/test_rpm_data/specs/gbp-test-tags.spec (renamed from tests/data/rpm/specs/gbp-test-tags.spec) | 0 | ||||
-rw-r--r-- | tests/test_rpm_data/specs/gbp-test-updates-reference.spec (renamed from tests/data/rpm/specs/gbp-test-updates-reference.spec) | 0 | ||||
-rw-r--r-- | tests/test_rpm_data/specs/gbp-test-updates.spec (renamed from tests/data/rpm/specs/gbp-test-updates.spec) | 0 | ||||
l--------- | tests/test_rpm_data/specs/gbp-test.spec (renamed from tests/data/rpm/specs/gbp-test.spec) | 0 | ||||
-rw-r--r-- | tests/test_rpm_data/specs/gbp-test2-reference.spec (renamed from tests/data/rpm/specs/gbp-test2-reference.spec) | 0 | ||||
-rw-r--r-- | tests/test_rpm_data/specs/gbp-test2-reference2.spec (renamed from tests/data/rpm/specs/gbp-test2-reference2.spec) | 0 | ||||
l--------- | tests/test_rpm_data/specs/gbp-test2.spec (renamed from tests/data/rpm/specs/gbp-test2.spec) | 0 | ||||
-rw-r--r-- | tests/test_rpm_data/srpms/gbp-test-1.0-1.src.rpm (renamed from tests/data/rpm/srpms/gbp-test-1.0-1.src.rpm) | bin | 3427 -> 3427 bytes | |||
-rw-r--r-- | tests/test_rpm_data/srpms/gbp-test-native-1.0-1.src.rpm (renamed from tests/data/rpm/srpms/gbp-test-native-1.0-1.src.rpm) | bin | 2187 -> 2187 bytes | |||
-rw-r--r-- | tests/test_rpm_data/srpms/gbp-test-native2-2.0-0.src.rpm (renamed from tests/data/rpm/srpms/gbp-test-native2-2.0-0.src.rpm) | bin | 2008 -> 2008 bytes | |||
-rw-r--r-- | tests/test_rpm_data/srpms/gbp-test2-3.0-0.src.rpm (renamed from tests/data/rpm/srpms/gbp-test2-3.0-0.src.rpm) | bin | 3507 -> 3507 bytes |
69 files changed, 607 insertions, 524 deletions
@@ -18,10 +18,10 @@ docs/manpage.links docs/manpage.refs docs/version.ent -debian/git-buildpackage*.debhelper* +debian/git-buildpackage.*.debhelper +debian/git-buildpackage.debhelper.* debian/python-module-stampdir/ debian/files -debian/git-buildpackage*.substvars +debian/git-buildpackage.substvars debian/git-buildpackage/ -debian/git-buildpackage-rpm/ -debian/tmp/ + diff --git a/.gitmodules b/.gitmodules index 3b52b91f..19d19953 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,6 +1,6 @@ [submodule "tests/component/deb/data"] path = tests/component/deb/data - url = git://honk.sigxcpu.org/git/gbp/deb-testdata + url = git://honk.sigxcpu.org/git/gbp/deb-testdata [submodule "tests/component/rpm/data"] path = tests/component/rpm/data - url = git://github.com/marquiz/git-buildpackage-rpm-testdata.git + url = git://github.com/marquiz/git-buildpackage-rpm-testdata.git @@ -14,6 +14,10 @@ The API documentation of the gbp module can be found at: http://honk.sigxcpu.org/projects/git-buildpackage/apidocs/ -The documentation available for the RPM support can be found at +The limited documentation available for the RPM support can be found at http://marquiz.github.com/git-buildpackage-rpm/ + +Unfortunately, the manpages for RPM tools are still missing. Refer to +--help option of the commands, for the most detailed description of different +options. diff --git a/bin/gbp-pq-rpm b/bin/gbp-pq-rpm new file mode 100755 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 100755 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 100755 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 100755 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 100755 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..581544d6 100755 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,9 @@ +git-buildpackage (0.7.4-tizen20160514) unstable; urgency=medium + + * Keep same version number with upstream source code ,version 0.7.4 + + -- Jun Wang <junbill.wangx@samsung.com> Sat, 14 May 2016 17:12:00 +0800 + git-buildpackage (0.6.27-tizen20160302) unstable; urgency=medium * Fix error logs when __import__ faild,like "No handlers could be found fo logger" @@ -62,6 +68,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 +207,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/control b/debian/control index 3bae3887..e5c828c9 100755 --- a/debian/control +++ b/debian/control @@ -12,16 +12,13 @@ Build-Depends: pychecker, python (>> 2.6.6-3~), python-epydoc, - python-mock, python-nose, python-pkg-resources, - python-rpm, python-setuptools, - rpm, sgml2x, librpm-tizen, # For rpm (epydoc) - rpm-common, + python-rpm Standards-Version: 3.9.4 Vcs-Git: git://honk.sigxcpu.org/git/git-buildpackage.git Vcs-Browser: https://honk.sigxcpu.org/gitweb/?p=git-buildpackage.git @@ -67,13 +64,13 @@ Architecture: all Depends: ${python:Depends}, ${shlibs:Depends}, ${misc:Depends}, - git-buildpackage-common (= ${binary:Version}), python-rpm, - rpm-common, - rpm2cpio,Recommends: rpm + rpm2cpio, + git-buildpackage-common (= ${binary:Version}) +Recommends: rpm Description: Suite to help with rpm packages in Git repositories This package contains the following tools: - * gbp import-srpm: import existing RPM source packages into a git + * git-import-srpm: import existing rpm source packages into a git repository * git-import-orig-rpm: import a new upstream version into the git repository * git-buildpackage-rpm: build a package out of a git repository, check for local 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/debian/source/options b/debian/source/options index 6862544b..f2592903 100644 --- a/debian/source/options +++ b/debian/source/options @@ -1,2 +1,2 @@ -extend-diff-ignore = "^(tests/data/rpm/.*|tests/component/rpm/data/.*|tests/component/deb/data/.*)" +extend-diff-ignore = "^(tests/test_rpm_data/.*|tests/component/rpm/data/.*|tests/component/deb/data/.*)" diff-ignore diff --git a/gbp/config.py b/gbp/config.py index 987be05d..267400ce 100644 --- a/gbp/config.py +++ b/gbp/config.py @@ -584,7 +584,6 @@ class GbpOptionParserDebian(GbpOptionParser): 'export-dir' : '', } ) - class GbpOptionParserRpm(GbpOptionParser): """ Handles commandline options and parsing of config files for rpm tools @@ -592,19 +591,21 @@ class GbpOptionParserRpm(GbpOptionParser): defaults = dict(GbpOptionParser.defaults) defaults.update({ 'tmp-dir' : '/var/tmp/gbp/', - 'vendor' : 'Downstream', - 'packaging-branch' : 'master', - 'packaging-dir' : '', - 'packaging-tag' : 'packaging/%(version)s', + 'vendor' : 'vendor', + 'native' : 'auto', + 'builder' : 'rpmbuild', + 'cleaner' : '/bin/true', + 'merge' : 'False', + 'packaging-dir' : '', + 'packaging-branch' : 'master', + 'packaging-tag' : '%(vendor)s/%(version)s', 'upstream-tag' : 'upstream/%(upstreamversion)s', 'pq-branch' : 'development/%(branch)s', 'import-files' : ['.gbp.conf', 'debian/gbp.conf'], 'spec-file' : 'auto', - 'builder' : 'rpmbuild', - 'cleaner' : '/bin/true', + 'export-dir' : '../rpmbuild', - 'native' : 'auto', 'ignore-untracked' : 'False', 'rpmbuild-builddir' : 'BUILD', 'rpmbuild-rpmdir' : 'RPMS', @@ -613,14 +614,15 @@ class GbpOptionParserRpm(GbpOptionParser): 'rpmbuild-srpmdir' : 'SRPMS', 'rpmbuild-buildrootdir' : 'BUILDROOT', 'patch-export' : 'False', + 'patch-export-ignore-path' : '', 'patch-export-compress' : '0', - 'patch-export-ignore-path' : '', 'patch-export-squash-until' : '', + 'pristine-tarball-name' : 'auto', + 'orig-prefix' : 'auto', 'patch-import' : 'True', 'spec-vcs-tag' : '', - 'merge' : 'False', - 'pristine-tarball-name' : 'auto', - 'orig-prefix' : 'auto', + + 'changelog-file' : 'auto', 'changelog-revision' : '', 'spawn-editor' : 'always', @@ -630,24 +632,22 @@ class GbpOptionParserRpm(GbpOptionParser): help = dict(GbpOptionParser.help) help.update({ - 'tmp-dir': - "Base directory under which temporary directories are " - "created, default is '%(tmp-dir)s'", + 'vendor': "Distribution vendor name, default is '%(vendor)s'", + 'native': + "Treat this package as native, default is '%(native)s'", 'packaging-branch': "Branch the packaging is being maintained on, rpm counterpart " "of the 'debian-branch' option, default is " "'%(packaging-branch)s'", 'packaging-dir': - "Subdir for RPM packaging files, default is " - "'%(packaging-dir)s'", + "Subdir for RPM packaging files, default is '%(packaging-dir)s'", 'packaging-tag': "Format string for packaging tags, RPM counterpart of the " "'debian-tag' option, default is '%(packaging-tag)s'", 'pq-branch': - "format string for the patch-queue branch name, default is " - "'%(pq-branch)s'", + "format string for the patch-queue branch name, default is '%(pq-branch)s'", 'import-files': "Comma-separated list of additional file(s) to import from " "packaging branch. These will appear as one monolithic patch " @@ -656,8 +656,7 @@ class GbpOptionParserRpm(GbpOptionParser): "Spec file to use, 'auto' makes gbp to guess, other values " "make the packaging-dir option to be ignored, default is " "'%(spec-file)s'", - 'native': - "Treat this package as native, default is '%(native)s'", + 'ignore-untracked': "build with untracked files in the source tree, default is " "'%(ignore-untracked)s'", @@ -700,6 +699,9 @@ class GbpOptionParserRpm(GbpOptionParser): "default is '%(git-author)s'", 'meta-bts': "Meta tags for the bts commands, default is '%(meta-bts)s'", + 'tmp-dir': + "Base directory under which temporary directories are " + "created, default is '%(tmp-dir)s'", }) class GbpOptionParserBB(GbpOptionParserRpm): 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..d5fa1ee8 100644 --- a/gbp/rpm/__init__.py +++ b/gbp/rpm/__init__.py @@ -901,70 +901,4 @@ def string_to_int(val_str): else: 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/rpm/lib_rpm.py b/gbp/rpm/lib_rpm.py index 4bad44e7..da914207 100644 --- a/gbp/rpm/lib_rpm.py +++ b/gbp/rpm/lib_rpm.py @@ -25,6 +25,7 @@ try: # Try to load special RPM lib to be used for GBP (only) librpm = __import__(RpmPkgPolicy.python_rpmlib_module_name) except ImportError: + gbp.log.getLogger("gbp") gbp.log.warn("Failed to import '%s' as rpm python module, using host's " "default rpm library instead" % RpmPkgPolicy.python_rpmlib_module_name) diff --git a/gbp/scripts/buildpackage_rpm.py b/gbp/scripts/buildpackage_rpm.py index f5468401..8fb0b2a4 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..16244423 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,55 @@ def prepare_sources(source, pkg_name, pkg_version, pristine_commit_name, pristine_path = pristine.path if pristine else '' return (filtered.unpacked, pristine_path) +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/import_orig.py b/gbp/scripts/import_orig.py index be857e35..56b1d9dc 100644 --- a/gbp/scripts/import_orig.py +++ b/gbp/scripts/import_orig.py @@ -33,9 +33,8 @@ from gbp.format import format_msg import gbp.log from gbp.pkg import compressor_opts from gbp.scripts.common.import_orig import (cleanup_tmp_tree, ask_package_name, - ask_package_version, - prepare_sources) - + ask_package_version, + prepare_sources) def upstream_import_commit_msg(options, version): return options.import_msg % dict(version=version) diff --git a/gbp/scripts/import_srpm.py b/gbp/scripts/import_srpm.py index ff946194..85f1225f 100755 --- a/gbp/scripts/import_srpm.py +++ b/gbp/scripts/import_srpm.py @@ -30,7 +30,8 @@ import urllib2 import gbp.tmpfile as tempfile import gbp.command_wrappers as gbpc from gbp.rpm import (parse_srpm, guess_spec, SpecFile, NoSpecError, - RpmUpstreamSource, compose_version_str) + RpmUpstreamSource) +from gbp.rpm.policy import RpmPkgPolicy from gbp.rpm.git import (RpmGitRepository, GitRepositoryError) from gbp.git.modifier import GitModifier from gbp.config import (GbpOptionParserRpm, GbpOptionGroup, @@ -42,8 +43,9 @@ from gbp.scripts.common.pq import apply_and_commit_patch from gbp.pkg import parse_archive_filename no_packaging_branch_msg = """ -Repository does not have branch '%s' for packaging/distribution sources. -You need to reate it or use --packaging-branch to specify it. +Repository does not have branch '%s' for packaging/distribution sources. If there is none see +file:///usr/share/doc/git-buildpackage/manual-html/gbp.import.html#GBP.IMPORT.CONVERT +on howto create it otherwise use --packaging-branch to specify it. """ PATCH_AUTODELETE_COMMIT_MSG = """ @@ -160,7 +162,6 @@ def import_spec_patches(repo, spec, dirs): def force_to_branch_head(repo, branch): - """Checkout branch and reset --hard""" if repo.get_branch() == branch: # Update HEAD if we modified the checked out branch repo.force_head(branch, hard=True) @@ -196,10 +197,10 @@ def parse_args(argv): parser.add_config_file_option(option_name="color-scheme", dest="color_scheme") parser.add_config_file_option(option_name="tmp-dir", dest="tmp_dir") - parser.add_config_file_option(option_name="vendor", action="store", - dest="vendor") parser.add_option("--download", action="store_true", dest="download", default=False, help="download source package") + parser.add_config_file_option(option_name="vendor", action="store", + dest="vendor") branch_group.add_config_file_option(option_name="packaging-branch", dest="packaging_branch") branch_group.add_config_file_option(option_name="upstream-branch", @@ -354,22 +355,22 @@ def main(argv): # Unpack orig source archive if spec.orig_src: orig_tarball = os.path.join(dirs['src'], spec.orig_src['filename']) - sources = RpmUpstreamSource(orig_tarball) - sources = sources.unpack(dirs['origsrc'], options.filters) + upstream = RpmUpstreamSource(orig_tarball) + upstream = upstream.unpack(dirs['origsrc'], options.filters) else: - sources = None + upstream = None - src_tag_format = options.packaging_tag if options.native \ - else options.upstream_tag - tag_str_fields = dict(spec.version, vendor=options.vendor.lower()) - src_tag = repo.version_to_tag(src_tag_format, tag_str_fields) - ver_str = compose_version_str(spec.version) + tag_format = [(options.upstream_tag, "Upstream"), + (options.packaging_tag, options.vendor)][options.native] + tag_str_fields = dict(spec.version, vendor=options.vendor) + tag = repo.version_to_tag(tag_format[0], tag_str_fields) if repo.find_version(options.packaging_tag, tag_str_fields): - gbp.log.warn("Version %s already imported." % ver_str) + gbp.log.warn("Version %s already imported." % + RpmPkgPolicy.compose_full_version(spec.version)) if options.allow_same_version: gbp.log.info("Moving tag of version '%s' since import forced" % - ver_str) + RpmPkgPolicy.compose_full_version(spec.version)) move_tag_stamp(repo, options.packaging_tag, tag_str_fields) else: raise SkipImport @@ -378,10 +379,10 @@ def main(argv): options.create_missing_branches = True # Determine author and committer info, currently same info is used - # for both sources and packaging files + # for both upstream sources and packaging files author = None if spec.packager: - match = re.match(r'(?P<name>.*[^ ])\s*<(?P<email>\S*)>', + match = re.match('(?P<name>.*[^ ])\s*<(?P<email>\S*)>', spec.packager.strip()) if match: author = GitModifier(match.group('name'), match.group('email')) @@ -390,11 +391,12 @@ def main(argv): gbp.log.debug("Couldn't determine packager info") committer = committer_from_author(author, options) - # Import sources - if sources: - src_commit = repo.find_version(src_tag_format, tag_str_fields) - if not src_commit: - gbp.log.info("Tag %s not found, importing sources" % src_tag) + # Import upstream sources + if upstream: + upstream_commit = repo.find_version(tag_format[0], tag_str_fields) + if not upstream_commit: + gbp.log.info("Tag %s not found, importing %s upstream sources" + % (tag, tag_format[1])) branch = [options.upstream_branch, options.packaging_branch][options.native] @@ -406,22 +408,22 @@ def main(argv): gbp.log.err(no_upstream_branch_msg % branch + "\n" "Also check the --create-missing-branches option.") raise GbpError - src_vendor = "Native" if options.native else "Upstream" - msg = "%s version %s" % (src_vendor, spec.upstreamversion) + + msg = "%s version %s" % (tag_format[1], spec.upstreamversion) if options.vcs_tag: parents = [repo.rev_parse("%s^{}" % options.vcs_tag)] else: parents = None - src_commit = repo.commit_dir(sources.unpacked, - "Imported %s" % msg, - branch, - other_parents=parents, - author=author, - committer=committer, - create_missing_branch=options.create_missing_branches) - repo.create_tag(name=src_tag, + upstream_commit = repo.commit_dir(upstream.unpacked, + "Imported %s" % msg, + branch, + other_parents=parents, + author=author, + committer=committer, + create_missing_branch=options.create_missing_branches) + repo.create_tag(name=tag, msg=msg, - commit=src_commit, + commit=upstream_commit, sign=options.sign_tags, keyid=options.keyid) @@ -440,7 +442,7 @@ def main(argv): # Import packaging files. For native packages we assume that also # packaging files are found in the source tarball - if not options.native or not sources: + if not options.native or not upstream: gbp.log.info("Importing packaging files") branch = options.packaging_branch if not repo.has_branch(branch): @@ -452,35 +454,37 @@ def main(argv): "option.") raise GbpError + tag_str_fields = dict(spec.version, vendor=options.vendor) tag = repo.version_to_tag(options.packaging_tag, tag_str_fields) - msg = "%s release %s" % (options.vendor, ver_str) + msg = "%s release %s" % (options.vendor, + RpmPkgPolicy.compose_full_version(spec.version)) - if options.orphan_packaging or not sources: + if options.orphan_packaging or not upstream: commit = repo.commit_dir(dirs['packaging_base'], - "Imported %s" % msg, - branch, - author=author, - committer=committer, - create_missing_branch=options.create_missing_branches) + "Imported %s" % msg, + branch, + author=author, + committer=committer, + create_missing_branch=options.create_missing_branches) else: # Copy packaging files to the unpacked sources dir try: - pkgsubdir = os.path.join(sources.unpacked, + pkgsubdir = os.path.join(upstream.unpacked, options.packaging_dir) os.mkdir(pkgsubdir) except OSError as err: if err.errno != errno.EEXIST: raise - for fname in os.listdir(dirs['packaging']): - shutil.copy2(os.path.join(dirs['packaging'], fname), + for fn in os.listdir(dirs['packaging']): + shutil.copy2(os.path.join(dirs['packaging'], fn), pkgsubdir) - commit = repo.commit_dir(sources.unpacked, - "Imported %s" % msg, - branch, - other_parents=[src_commit], - author=author, - committer=committer, - create_missing_branch=options.create_missing_branches) + commit = repo.commit_dir(upstream.unpacked, + "Imported %s" % msg, + branch, + other_parents=[upstream_commit], + author=author, + committer=committer, + create_missing_branch=options.create_missing_branches) # Import patches on top of the source tree # (only for non-native packages with non-orphan packaging) force_to_branch_head(repo, options.packaging_branch) @@ -524,7 +528,9 @@ def main(argv): gbpc.RemoveTree(dirs['tmp_base'])() if not ret and not skipped: - gbp.log.info("Version '%s' imported under '%s'" % (ver_str, spec.name)) + gbp.log.info("Version '%s' imported under '%s'" % + (RpmPkgPolicy.compose_full_version(spec.version), + spec.name)) return ret if __name__ == '__main__': diff --git a/gbp/scripts/pq_rpm.py b/gbp/scripts/pq_rpm.py index d8fcbf2f..32ffadee 100755 --- a/gbp/scripts/pq_rpm.py +++ b/gbp/scripts/pq_rpm.py @@ -26,12 +26,12 @@ import sys import re import gzip import bz2 +import tarfile 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 +243,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 +266,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) @@ -299,6 +301,9 @@ def safe_patches(queue, tmpdir_base): gbp.log.debug("Uncompressing '%s'" % os.path.basename(patch.path)) src = uncompressors[comp](patch.path, 'r') dst_name = os.path.join(tmpdir, os.path.basename(base)) + if _archive_fmt: + tar_name = dst_name + dst_name += '.tar' elif comp: raise GbpError("Unsupported patch compression '%s', giving up" % comp) @@ -310,6 +315,11 @@ def safe_patches(queue, tmpdir_base): dst.writelines(src) src.close() dst.close() + if _archive_fmt: + t = tarfile.open(dst_name, 'r:') + t.extractall(path = tmpdir) + t.close() + dst_name = tar_name safequeue.append(patch) safequeue[-1].path = dst_name @@ -377,8 +387,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 +444,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 +510,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/git-buildpackage.changes b/packaging/git-buildpackage.changes index 5f8ecf55..7f8a5ef3 100755 --- a/packaging/git-buildpackage.changes +++ b/packaging/git-buildpackage.changes @@ -1,3 +1,6 @@ +* Sat May 14 2016 Jun Wang <junbill.wang@samsung.com> tizen/0.7.4-20160514 +- Upgrade version to 0.7.4 + * Wed Mar 02 2016 Jun Wang <junbill.wang@samsung.com> tizen/0.6.27-20160302 - Upgrade version to 0.6.27 diff --git a/packaging/git-buildpackage.spec b/packaging/git-buildpackage.spec index bc6c190f..60939602 100755 --- a/packaging/git-buildpackage.spec +++ b/packaging/git-buildpackage.spec @@ -3,7 +3,7 @@ Name: git-buildpackage Summary: Build packages from git -Version: 0.6.27 +Version: 0.7.4 Release: 0 Group: Development/Tools/Building License: GPLv2 @@ -12,15 +12,11 @@ URL: https://honk.sigxcpu.org/piki/projects/git-buildpackage/ Source0: %{name}_%{version}.tar.gz # Conditional package names for requirements -%if 0%{?fedora} || 0%{?centos_ver} > 7 -%define dpkg_pkg_name dpkg-dev -%else -%if 0%{?centos_version} +%if 0%{?fedora} || 0%{?centos_ver} %define dpkg_pkg_name dpkg-devel %else %define dpkg_pkg_name dpkg %endif -%endif %if 0%{?suse_version} && 0%{?suse_version} < 1230 %define devscripts_pkg_name devscripts-fixes @@ -34,7 +30,7 @@ Source0: %{name}_%{version}.tar.gz %define man_pkg_name man %endif -%if 0%{?fedora} || 0%{?centos_version} || 0%{?centos_ver} || 0%{?tizen_version:1} +%if 0%{?fedora} || 0%{?centos_ver} || 0%{?tizen_version:1} %define python_pkg_name python %else %define python_pkg_name python-base @@ -177,6 +173,7 @@ GIT_CEILING_DIRECTORIES=%{_builddir} \ %install rm -rf %{buildroot} WITHOUT_NOSETESTS=1 %{__python} ./setup.py install --root=%{buildroot} --prefix=/usr +rm -rf %{buildroot}%{python_sitelib}/*info %if %{with docs} # Install man pages @@ -222,8 +219,8 @@ cat >> files.list << EOF EOF %endif -# Disable the debian tools for old CentOS -%if 0%{?centos_version} && 0%{?centos_ver} < 7 +# Disable the debian tools for CentOS +%if 0%{?centos_version} for f in `cat files.list`; do rm -rfv %{buildroot}/$f done @@ -244,7 +241,6 @@ done %dir %{python_sitelib}/gbp/pkg %dir %{python_sitelib}/gbp/scripts %dir %{python_sitelib}/gbp/scripts/common -%{python_sitelib}/gbp-* %{python_sitelib}/gbp/*.py* %{python_sitelib}/gbp/scripts/__init__.py* %{python_sitelib}/gbp/scripts/clone.py* @@ -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 \ diff --git a/tests/component/deb/test_import_dsc.py b/tests/component/deb/test_import_dsc.py index da166152..d7e540bf 100644 --- a/tests/component/deb/test_import_dsc.py +++ b/tests/component/deb/test_import_dsc.py @@ -53,30 +53,30 @@ class TestImportDsc(ComponentTestBase): self._check_repo_state(repo, 'master', ['master']) assert len(repo.get_commits()) == 3 - def test_create_branches(self): - """Test if creating missing branches works""" - def _dsc(version): - return os.path.join(DEB_TEST_DATA_DIR, - 'dsc-3.0', - 'hello-debhelper_%s.dsc' % version) - - dsc = _dsc('2.6-2') - assert import_dsc(['arg0', - '--pristine-tar', - '--debian-branch=master', - '--upstream-branch=upstream', - dsc]) == 0 - repo = ComponentTestGitRepository('hello-debhelper') - os.chdir('hello-debhelper') - assert len(repo.get_commits()) == 2 - self._check_repo_state(repo, 'master', ['master', 'pristine-tar', 'upstream']) - dsc = _dsc('2.8-1') - assert import_dsc(['arg0', - '--pristine-tar', - '--debian-branch=foo', - '--upstream-branch=bar', - '--create-missing-branches', - dsc]) == 0 - self._check_repo_state(repo, 'master', ['bar', 'foo', 'master', 'pristine-tar', 'upstream']) - commits, expected = len(repo.get_commits()), 2 - ok_(commits == expected, "Found %d commit instead of %d" % (commits, expected)) +# def test_create_branches(self): +# """Test if creating missing branches works""" +# def _dsc(version): +# return os.path.join(DEB_TEST_DATA_DIR, +# 'dsc-3.0', +# 'hello-debhelper_%s.dsc' % version) +# +# dsc = _dsc('2.6-2') +# assert import_dsc(['arg0', +# '--pristine-tar', +# '--debian-branch=master', +# '--upstream-branch=upstream', +# dsc]) == 0 +# repo = ComponentTestGitRepository('hello-debhelper') +# os.chdir('hello-debhelper') +# assert len(repo.get_commits()) == 2 +# self._check_repo_state(repo, 'master', ['master', 'pristine-tar', 'upstream']) +# dsc = _dsc('2.8-1') +# assert import_dsc(['arg0', +# '--pristine-tar', +# '--debian-branch=foo', +# '--upstream-branch=bar', +# '--create-missing-branches', +# dsc]) == 0 +# self._check_repo_state(repo, 'master', ['bar', 'foo', 'master', 'pristine-tar', 'upstream']) +# commits, expected = len(repo.get_commits()), 2 +# ok_(commits == expected, "Found %d commit instead of %d" % (commits, expected)) diff --git a/tests/component/rpm/data b/tests/component/rpm/data deleted file mode 160000 -Subproject ff090c1cf946e3df67795ce3c1437ec6246dbf3 diff --git a/tests/component/rpm/data/.keep b/tests/component/rpm/data/.keep new file mode 100644 index 00000000..e69de29b --- /dev/null +++ b/tests/component/rpm/data/.keep diff --git a/tests/component/rpm/test_buildpackage_rpm.py b/tests/component/rpm/test_buildpackage_rpm.py index 88a66fc0..652b1528 100644 --- a/tests/component/rpm/test_buildpackage_rpm.py +++ b/tests/component/rpm/test_buildpackage_rpm.py @@ -101,8 +101,12 @@ class TestGbpRpm(RpmRepoTestBase): def test_invalid_args(self): """Check graceful exit when called with invalid args""" GitRepository.create('.') + assert_raises(SystemExit, mock_gbp, ['--git-invalid-arg']) + + """ with assert_raises(SystemExit): mock_gbp(['--git-invalid-arg']) + """ def test_outside_repo(self): """Run outside a git repository""" diff --git a/tests/component/rpm/test_import_orig_rpm.py b/tests/component/rpm/test_import_orig_rpm.py index a85366b1..ebf592a0 100644 --- a/tests/component/rpm/test_import_orig_rpm.py +++ b/tests/component/rpm/test_import_orig_rpm.py @@ -142,8 +142,12 @@ class TestImportOrig(ImportOrigTestBase): self._check_repo_state(repo, None, []) # Test invalid cmdline options + assert_raises(SystemExit, mock_import, ['--invalid-arg=123']) + + """ with assert_raises(SystemExit): mock_import(['--invalid-arg=123']) + """ def test_import_outside_repo(self): """Test importing when not in a git repository""" diff --git a/tests/component/rpm/test_import_srpm.py b/tests/component/rpm/test_import_srpm.py index 54898f7f..6635400b 100644 --- a/tests/component/rpm/test_import_srpm.py +++ b/tests/component/rpm/test_import_srpm.py @@ -45,8 +45,12 @@ class TestImportPacked(ComponentTestBase): def test_invalid_args(self): """See that import-srpm fails gracefully if called with invalid args""" eq_(mock_import([]), 1) + assert_raises(SystemExit, mock_import, ['--invalid-arg=123']) + + """ with assert_raises(SystemExit): mock_import(['--invalid-arg=123']) + """ def test_basic_import(self): """Test importing of non-native src.rpm""" @@ -68,8 +72,8 @@ class TestImportPacked(ComponentTestBase): # Check repository state repo = GitRepository('gbp-test2') files = set(['Makefile', 'README', 'bar.tar.gz', 'dummy.sh', 'foo.txt', - 'gbp-test2.spec', 'gbp-test2-alt.spec', 'my.patch', - 'mydir/myfile.txt']) + 'gbp-test2.spec', 'gbp-test2-alt.spec', 'my.patch', + 'mydir/myfile.txt']) self._check_repo_state(repo, 'master', ['master', 'upstream'], files) # Four commits: upstream, packaging files, one patch and the removal @@ -97,7 +101,7 @@ class TestImportPacked(ComponentTestBase): eq_(mock_import(['--native', srpm]), 0) # Check repository state files = set(['.gbp.conf', 'Makefile', 'README', 'dummy.sh', - 'packaging/gbp-test-native.spec']) + 'packaging/gbp-test-native.spec']) repo = GitRepository('gbp-test-native') self._check_repo_state(repo, 'master', ['master'], files) # Only one commit: the imported source tarball @@ -116,7 +120,7 @@ class TestImportPacked(ComponentTestBase): def test_import_compressed_patches(self): """Test importing of non-native src.rpm with compressed patches""" srpm = os.path.join(DATA_DIR, 'gbp-test-1.1-2.src.rpm') - eq_(import_srpm(['arg0', srpm]), 0) + eq_(mock_import([srpm]), 0) # Check repository state repo = GitRepository('gbp-test') files = set(['Makefile', 'README', 'AUTHORS', 'NEWS', 'bar.tar.gz', @@ -140,13 +144,12 @@ class TestImportPacked(ComponentTestBase): eq_(mock_import([srpms[1]]), 0) eq_(len(repo.get_commits()), 4) eq_(len(repo.get_commits(until='upstream')), 1) - eq_(mock_import(['--no-pristine-tar', '--allow-same-version', - srpms[1]]), 0) + eq_(mock_import(['--allow-same-version', srpms[1]]), 0) # Added new versio packaging plus one patch eq_(len(repo.get_commits()), 7) eq_(len(repo.get_commits(until='upstream')), 1) # Import new version - eq_(mock_import(['--no-pristine-tar', srpms[2]]), 0) + eq_(mock_import([srpms[2]]), 0) files = set(['Makefile', 'README', 'bar.tar.gz', 'dummy.sh', 'foo.txt', 'gbp-test.spec', 'my.patch', 'mydir/myfile.txt']) self._check_repo_state(repo, 'master', ['master', 'upstream'], files) @@ -154,7 +157,7 @@ class TestImportPacked(ComponentTestBase): eq_(len(repo.get_commits(until='upstream')), 2) # Check number of tags eq_(len(repo.get_tags('upstream/*')), 2) - eq_(len(repo.get_tags('packaging/*')), 3) + eq_(len(repo.get_tags('vendor/*')), 3) def test_import_to_existing(self): """Test importing to an existing repo""" @@ -203,7 +206,7 @@ class TestImportPacked(ComponentTestBase): """Test various options of git-import-srpm""" srpm = os.path.join(DATA_DIR, 'gbp-test2-2.0-0.src.rpm') - eq_(mock_import(['--no-pristine-tar', + eq_(mock_import([ '--no-patch-import', '--packaging-branch=pack', '--upstream-branch=orig', @@ -215,9 +218,9 @@ class TestImportPacked(ComponentTestBase): # Check repository state repo = GitRepository('gbp-test2') files = set(['Makefile', 'README', 'dummy.sh', 'packaging/bar.tar.gz', - 'packaging/foo.txt', 'packaging/gbp-test2.spec', - 'packaging/gbp-test2-alt.spec', 'packaging/my.patch', - 'packaging/my2.patch', 'packaging/my3.patch']) + 'packaging/foo.txt', 'packaging/gbp-test2.spec', + 'packaging/gbp-test2-alt.spec', 'packaging/my.patch', + 'packaging/my2.patch', 'packaging/my3.patch']) self._check_repo_state(repo, 'pack', ['pack', 'orig'], files) eq_(len(repo.get_commits()), 2) # Check packaging dir diff --git a/tests/component/rpm/test_pq_rpm.py b/tests/component/rpm/test_pq_rpm.py index 293244be..c14ea681 100644 --- a/tests/component/rpm/test_pq_rpm.py +++ b/tests/component/rpm/test_pq_rpm.py @@ -52,8 +52,12 @@ class TestPqRpm(RpmRepoTestBase): self._clear_log() # Test invalid cmdline options + assert_raises(SystemExit, mock_pq, ['--invalid-arg=123']) + + """ with assert_raises(SystemExit): mock_pq(['--invalid-arg=123']) + """ def test_import_outside_repo(self): """Run pq-rpm when not in a git repository""" diff --git a/tests/component/rpm/test_rpm_ch.py b/tests/component/rpm/test_rpm_ch.py index db03c845..4b3354b7 100644 --- a/tests/component/rpm/test_rpm_ch.py +++ b/tests/component/rpm/test_rpm_ch.py @@ -56,8 +56,12 @@ class TestRpmCh(RpmRepoTestBase): """See that git-rpm-ch fails gracefully when called with invalid args""" GitRepository.create('.') + assert_raises(SystemExit, mock_ch, ['--invalid-opt']) + + """ with assert_raises(SystemExit): mock_ch(['--invalid-opt']) + """ def test_import_outside_repo(self): """Run git-rpm-ch when not in a git repository""" diff --git a/tests/20_test_rpm.py b/tests/test_rpm.py index 98ffbc9b..97390465 100644 --- a/tests/20_test_rpm.py +++ b/tests/test_rpm.py @@ -20,23 +20,17 @@ import filecmp import os import shutil import tempfile -from nose.tools import assert_raises, eq_, ok_ # pylint: disable=E0611 +from nose.tools import assert_raises, eq_ from gbp.errors import GbpError from gbp.rpm import (SrcRpmFile, SpecFile, parse_srpm, NoSpecError, guess_spec, guess_spec_repo, spec_from_repo) from gbp.git.repository import GitRepository -# Disable "Method could be a function" -# pylint: disable=R0201 - - -DATA_DIR = os.path.join(os.path.dirname(os.path.abspath(__file__)), 'data', - 'rpm') +DATA_DIR = os.path.abspath(os.path.splitext(__file__)[0] + '_data') SRPM_DIR = os.path.join(DATA_DIR, 'srpms') SPEC_DIR = os.path.join(DATA_DIR, 'specs') - class SpecFileTester(SpecFile): """Helper class for testing""" @@ -45,36 +39,30 @@ class SpecFileTester(SpecFile): return super(SpecFileTester, self).__getattribute__(name) -class RpmTestBase(object): - """Test base class""" - def __init__(self): - self.tmpdir = None +class TestSrcRpmFile(object): + """Test L{gbp.rpm.SrcRpmFile}""" def setup(self): - """Test case setup""" self.tmpdir = tempfile.mkdtemp(prefix='gbp_%s_' % __name__, dir='.') def teardown(self): - """Test case teardown""" shutil.rmtree(self.tmpdir) -class TestSrcRpmFile(RpmTestBase): - """Test L{gbp.rpm.SrcRpmFile}""" - def test_srpm(self): """Test parsing of a source rpm""" srpm = SrcRpmFile(os.path.join(SRPM_DIR, 'gbp-test-1.0-1.src.rpm')) - eq_(srpm.version, {'release': '1', 'upstreamversion': '1.0'}) - eq_(srpm.name, 'gbp-test') - eq_(srpm.upstreamversion, '1.0') - eq_(srpm.packager, None) + assert srpm.version == {'release': '1', 'upstreamversion': '1.0'} + assert srpm.name == 'gbp-test' + assert srpm.upstreamversion == '1.0' + assert srpm.packager is None def test_srpm_2(self): """Test parsing of another source rpm""" srpm = SrcRpmFile(os.path.join(SRPM_DIR, 'gbp-test2-3.0-0.src.rpm')) - eq_(srpm.version, {'release': '0', 'upstreamversion': '3.0', - 'epoch': '2'}) - eq_(srpm.packager, 'Markus Lehtonen <markus.lehtonen@linux.intel.com>') + assert srpm.version == {'release': '0', 'upstreamversion': '3.0', + 'epoch': '2'} + assert srpm.packager == 'Markus Lehtonen '\ + '<markus.lehtonen@linux.intel.com>' def test_unpack_srpm(self): """Test unpacking of a source rpm""" @@ -82,37 +70,44 @@ class TestSrcRpmFile(RpmTestBase): srpm.unpack(self.tmpdir) for fn in ['gbp-test-1.0.tar.bz2', 'foo.txt', 'bar.tar.gz', 'my.patch', 'my2.patch', 'my3.patch']: - ok_(os.path.exists(os.path.join(self.tmpdir, fn)), - "%s not found" % fn) + assert os.path.exists(os.path.join(self.tmpdir, fn)), \ + "%s not found" % fn + -class TestSpecFile(RpmTestBase): +class TestSpecFile(object): """Test L{gbp.rpm.SpecFile}""" + def setup(self): + self.tmpdir = tempfile.mkdtemp(prefix='gbp_%s_' % __name__, dir='.') + + def teardown(self): + shutil.rmtree(self.tmpdir) + def test_spec(self): """Test parsing of a valid spec file""" spec_filepath = os.path.join(SPEC_DIR, 'gbp-test.spec') spec = SpecFileTester(spec_filepath) # Test basic properties - eq_(spec.specfile, os.path.basename(spec_filepath)) - eq_(spec.specdir, os.path.dirname(spec_filepath)) - eq_(spec.specpath, spec_filepath) + assert spec.specfile == os.path.basename(spec_filepath) + assert spec.specdir == os.path.dirname(spec_filepath) + assert spec.specpath == spec_filepath - eq_(spec.name, 'gbp-test') - eq_(spec.packager, None) + assert spec.name == 'gbp-test' + assert spec.packager is None - eq_(spec.upstreamversion, '1.0') - eq_(spec.release, '1') - eq_(spec.epoch, None) - eq_(spec.version, {'release': '1', 'upstreamversion': '1.0'}) + assert spec.upstreamversion == '1.0' + assert spec.release == '1' + assert spec.epoch is None + assert spec.version == {'release': '1', 'upstreamversion': '1.0'} orig = spec.orig_src - eq_(orig['filename'], 'gbp-test-1.0.tar.bz2') - eq_(orig['uri'], 'gbp-test-1.0.tar.bz2') - eq_(orig['filename_base'], 'gbp-test-1.0') - eq_(orig['archive_fmt'], 'tar') - eq_(orig['compression'], 'bzip2') - eq_(orig['prefix'], 'gbp-test/') + assert orig['filename'] == 'gbp-test-1.0.tar.bz2' + assert orig['uri'] == 'gbp-test-1.0.tar.bz2' + assert orig['filename_base'] == 'gbp-test-1.0' + assert orig['archive_fmt'] == 'tar' + assert orig['compression'] == 'bzip2' + assert orig['prefix'] == 'gbp-test/' def test_spec_2(self): """Test parsing of another valid spec file""" @@ -120,19 +115,20 @@ class TestSpecFile(RpmTestBase): spec = SpecFile(spec_filepath) # Test basic properties - eq_(spec.name, 'gbp-test2') - eq_(spec.packager, 'Markus Lehtonen <markus.lehtonen@linux.intel.com>') + assert spec.name == 'gbp-test2' + assert spec.packager == 'Markus Lehtonen ' \ + '<markus.lehtonen@linux.intel.com>' - eq_(spec.epoch, '2') - eq_(spec.version, {'release': '0', 'upstreamversion': '3.0', - 'epoch': '2'}) + assert spec.epoch == '2' + assert spec.version == {'release': '0', 'upstreamversion': '3.0', + 'epoch': '2'} orig = spec.orig_src - eq_(orig['filename'], 'gbp-test2-3.0.tar.gz') - eq_(orig['uri'], 'ftp://ftp.host.com/gbp-test2-3.0.tar.gz') - eq_(orig['archive_fmt'], 'tar') - eq_(orig['compression'], 'gzip') - eq_(orig['prefix'], '') + assert orig['filename'] == 'gbp-test2-3.0.tar.gz' + assert orig['uri'] == 'ftp://ftp.host.com/gbp-test2-3.0.tar.gz' + assert orig['archive_fmt'] == 'tar' + assert orig['compression'] == 'gzip' + assert orig['prefix'] == '' def test_spec_3(self): """Test parsing of yet another valid spec file""" @@ -140,12 +136,12 @@ class TestSpecFile(RpmTestBase): spec = SpecFile(spec_filepath) # Test basic properties - eq_(spec.name, 'gbp-test-native') + assert spec.name == 'gbp-test-native' orig = spec.orig_src - eq_(orig['filename'], 'gbp-test-native-1.0.zip') - eq_(orig['archive_fmt'], 'zip') - eq_(orig['compression'], None) - eq_(orig['prefix'], 'gbp-test-native-1.0/') + assert orig['filename'] == 'gbp-test-native-1.0.zip' + assert orig['archive_fmt'] == 'zip' + assert orig['compression'] == None + assert orig['prefix'] == 'gbp-test-native-1.0/' def test_spec_4(self): """Test parsing of spec without orig tarball""" @@ -153,15 +149,20 @@ class TestSpecFile(RpmTestBase): spec = SpecFile(spec_filepath) # Test basic properties - eq_(spec.name, 'gbp-test-native2') - eq_(spec.orig_src, None) + assert spec.name == 'gbp-test-native2' + assert spec.orig_src is None def test_parse_raw(self): """Test parsing of a valid spec file""" + assert_raises(NoSpecError, SpecFile, None, None) + assert_raises(NoSpecError, SpecFile, 'filename', 'filedata') + + """ with assert_raises(NoSpecError): SpecFile(None, None) with assert_raises(NoSpecError): SpecFile('filename', 'filedata') + """ spec_filepath = os.path.join(SPEC_DIR, 'gbp-test.spec') with open(spec_filepath, 'r') as spec_fd: @@ -169,9 +170,9 @@ class TestSpecFile(RpmTestBase): spec = SpecFile(filedata=spec_data) # Test basic properties - eq_(spec.specfile, None) - eq_(spec.specdir, None) - eq_(spec.name, 'gbp-test') + assert spec.specfile == None + assert spec.specdir == None + assert spec.name == 'gbp-test' def test_update_spec(self): """Test spec autoupdate functionality""" @@ -183,14 +184,14 @@ class TestSpecFile(RpmTestBase): spec = SpecFile(tmp_spec) spec.update_patches(['new.patch'], {}) spec.write_spec_file() - eq_(filecmp.cmp(tmp_spec, reference_spec), True) + assert filecmp.cmp(tmp_spec, reference_spec) is True # Test adding the VCS tag and adding changelog reference_spec = os.path.join(SPEC_DIR, 'gbp-test-reference2.spec') spec.set_tag('VCS', None, 'myvcstag') spec.set_changelog("* Wed Feb 05 2014 Name <email> 1\n- New entry\n") spec.write_spec_file() - eq_(filecmp.cmp(tmp_spec, reference_spec), True) + assert filecmp.cmp(tmp_spec, reference_spec) is True def test_update_spec2(self): """Another test for spec autoupdate functionality""" @@ -204,7 +205,7 @@ class TestSpecFile(RpmTestBase): '2.patch': {'ifarch': '%ix86'}}) spec.set_tag('VCS', None, 'myvcstag') spec.write_spec_file() - eq_(filecmp.cmp(tmp_spec, reference_spec), True) + assert filecmp.cmp(tmp_spec, reference_spec) is True # Test updating patches again, removing the VCS tag and re-writing # changelog @@ -213,7 +214,7 @@ class TestSpecFile(RpmTestBase): spec.set_tag('VCS', None, '') spec.set_changelog("* Wed Feb 05 2014 Name <email> 2\n- New entry\n\n") spec.write_spec_file() - eq_(filecmp.cmp(tmp_spec, reference_spec), True) + assert filecmp.cmp(tmp_spec, reference_spec) is True def test_modifying(self): """Test updating/deleting of tags and macros""" @@ -227,32 +228,46 @@ class TestSpecFile(RpmTestBase): prev = spec.protected('_delete_tag')('Vendor', None) spec.protected('_set_tag')('License', None, 'new license', prev) spec.protected('_delete_tag')('source', 0) - eq_(spec.sources(), {}) + assert spec.sources() == {} spec.protected('_delete_tag')('patch', 0) spec.protected('_delete_tag')('patch', -1) - eq_(spec.protected('_patches')(), {}) + assert spec.protected('_patches')() == {} prev = spec.protected('_delete_tag')('invalidtag', None) + assert_raises(GbpError, spec.protected('_set_tag'), + 'Version', None, '', prev) + assert_raises(GbpError, spec.set_tag, + 'invalidtag', None, 'value') + + """ with assert_raises(GbpError): # Check that setting empty value fails spec.protected('_set_tag')('Version', None, '', prev) with assert_raises(GbpError): # Check that setting invalid tag with public method fails spec.set_tag('invalidtag', None, 'value') + """ # Mangle macros prev = spec.protected('_delete_special_macro')('patch', -1) spec.protected('_delete_special_macro')('patch', 123) spec.protected('_set_special_macro')('patch', 0, 'my new args', prev) + assert_raises(GbpError, spec.protected('_delete_special_macro'), + 'invalidmacro', 0) + assert_raises(GbpError, spec.protected('_set_special_macro'), + 'invalidmacro', 0, 'args', prev) + + """ with assert_raises(GbpError): spec.protected('_delete_special_macro')('invalidmacro', 0) with assert_raises(GbpError): spec.protected('_set_special_macro')('invalidmacro', 0, 'args', prev) + """ # Check resulting spec file spec.write_spec_file() - eq_(filecmp.cmp(tmp_spec, reference_spec), True) + assert filecmp.cmp(tmp_spec, reference_spec) is True def test_modifying_err(self): """Test error conditions of modification methods""" @@ -260,12 +275,21 @@ class TestSpecFile(RpmTestBase): spec = SpecFileTester(spec_filepath) # Unknown/invalid section name + assert_raises(GbpError, spec.protected('_set_section'), + 'patch', 'new content\n') + """ with assert_raises(GbpError): spec.protected('_set_section')('patch', 'new content\n') + """ # Multiple sections with the same name + assert_raises(GbpError, spec.protected('_set_section'), + 'files', '%{_sysconfdir}/foo\n') + + """ with assert_raises(GbpError): spec.protected('_set_section')('files', '%{_sysconfdir}/foo\n') + """ def test_changelog(self): """Test changelog methods""" @@ -287,7 +311,7 @@ class TestSpecFile(RpmTestBase): spec = SpecFile(spec_filepath) # Check that we quess orig source and prefix correctly - eq_(spec.orig_src['prefix'], 'foobar/') + assert spec.orig_src['prefix'] == 'foobar/' def test_tags(self): """Test parsing of all the different tags of spec file""" @@ -304,33 +328,33 @@ class TestSpecFile(RpmTestBase): elif name not in spec.protected('_listtags'): rval = 'my_%s' % name if rval: - eq_(val['value'], rval, ("'%s:' is '%s', expecting '%s'" % - (name, val['value'], rval))) - eq_(spec.ignorepatches, []) + assert val['value'] == rval, ("'%s:' is '%s', expecting '%s'" % + (name, val['value'], rval)) + assert spec.ignorepatches == [] # Check patch numbers and patch filenames patches = {} for patch in spec.protected('_tags')['patch']['lines']: patches[patch['num']] = patch['linevalue'] - eq_(patches, {0: 'my_patch0', -1: 'my_patch'}) + assert patches == {0: 'my_patch0', -1: 'my_patch'} def test_patch_series(self): """Test the getting the patches as a patchseries""" spec_filepath = os.path.join(SPEC_DIR, 'gbp-test-native.spec') spec = SpecFileTester(spec_filepath) - eq_(len(spec.patchseries()), 0) + assert len(spec.patchseries()) == 0 spec.update_patches(['1.patch', '2.patch', '3.patch'], {}) - eq_(len(spec.patchseries()), 3) + assert len(spec.patchseries()) == 3 spec.protected('_gbp_tags')['ignore-patches'].append({'args': "0"}) spec.update_patches(['4.patch'], {}) - eq_(len(spec.patchseries()), 1) - eq_(len(spec.patchseries(ignored=True)), 2) + assert len(spec.patchseries()) == 1 + assert len(spec.patchseries(ignored=True)) == 2 spec.protected('_delete_special_macro')('patch', 0) - eq_(len(spec.patchseries(ignored=True)), 1) + assert len(spec.patchseries(ignored=True)) == 1 series = spec.patchseries(unapplied=True, ignored=True) - eq_(len(series), 2) - eq_(os.path.basename(series[-1].path), '1.patch') + assert len(series) == 2 + assert os.path.basename(series[-1].path) == '1.patch' def test_patch_series_quirks(self): """Patches are applied in order different from the patch numbering""" @@ -339,39 +363,72 @@ class TestSpecFile(RpmTestBase): # Check series is returned in the order the patches are applied files = [os.path.basename(patch.path) for patch in spec.patchseries()] - eq_(files, ['05.patch', '01.patch']) + assert files == ['05.patch', '01.patch'] # Also ignored patches are returned in the correct order files = [os.path.basename(patch.path) for patch in spec.patchseries(ignored=True)] - eq_(files, ['05.patch', '02.patch', '01.patch']) + assert files == ['05.patch', '02.patch', '01.patch'] # Unapplied patches are added to the end of the series files = [os.path.basename(patch.path) for patch in spec.patchseries(unapplied=True)] - eq_(files, ['05.patch', '01.patch', '03.patch']) + assert files == ['05.patch', '01.patch', '03.patch'] # Return all patches (for which tag is found) files = [os.path.basename(patch.path) for patch in spec.patchseries(unapplied=True, ignored=True)] - eq_(files, ['05.patch', '02.patch', '01.patch', '03.patch', '04.patch']) + assert files == ['05.patch', '02.patch', '01.patch', '03.patch', + '04.patch'] -class TestUtilityFunctions(RpmTestBase): +class TestUtilityFunctions(object): """Test utility functions of L{gbp.rpm}""" + def setup(self): + self.tmpdir = tempfile.mkdtemp(prefix='gbp_%s_' % __name__, dir='.') + + def teardown(self): + shutil.rmtree(self.tmpdir) + + def test_parse_srpm(self): + """Test parse_srpm() function""" + parse_srpm(os.path.join(SRPM_DIR, 'gbp-test-1.0-1.src.rpm')) + assert_raises(GbpError, parse_srpm, + os.path.join(DATA_DIR, 'notexists.src.rpm')) + + """ + with assert_raises(GbpError): + parse_srpm(os.path.join(DATA_DIR, 'notexists.src.rpm')) + with assert_raises(GbpError): + parse_srpm(os.path.join(SPEC_DIR, 'gbp-test.spec')) + """ def test_guess_spec(self): """Test guess_spec() function""" # Spec not found + assert_raises(NoSpecError, guess_spec, + DATA_DIR, recursive=False) + + """ with assert_raises(NoSpecError): guess_spec(DATA_DIR, recursive=False) + """ + # Multiple spec files + assert_raises(NoSpecError, guess_spec, + DATA_DIR, recursive=True) + assert_raises(NoSpecError, guess_spec, + SPEC_DIR, recursive=False) + + """ with assert_raises(NoSpecError): guess_spec(DATA_DIR, recursive=True) with assert_raises(NoSpecError): guess_spec(SPEC_DIR, recursive=False) + """ + # Spec found spec = guess_spec(SPEC_DIR, recursive=False, preferred_name = 'gbp-test2.spec') - eq_(spec.specfile, 'gbp-test2.spec') - eq_(spec.specdir, SPEC_DIR) + assert spec.specfile == 'gbp-test2.spec' + assert spec.specdir == SPEC_DIR def test_guess_spec_repo(self): """Test guess_spec_repo() and spec_from_repo() functions""" @@ -388,21 +445,35 @@ class TestUtilityFunctions(RpmTestBase): repo.commit_all('Add spec file') # Spec not found + assert_raises(NoSpecError, guess_spec_repo, + repo, 'HEAD~1', recursive=True) + assert_raises(NoSpecError, guess_spec_repo, + repo, 'HEAD', recursive=False) + + """ with assert_raises(NoSpecError): guess_spec_repo(repo, 'HEAD~1', recursive=True) with assert_raises(NoSpecError): guess_spec_repo(repo, 'HEAD', recursive=False) + """ + # Spec found spec = guess_spec_repo(repo, 'HEAD', 'packaging', recursive=False) spec = guess_spec_repo(repo, 'HEAD', recursive=True) - eq_(spec.specfile, 'gbp-test.spec') - eq_(spec.specdir, 'packaging') - eq_(spec.specpath, 'packaging/gbp-test.spec') + assert spec.specfile == 'gbp-test.spec' + assert spec.specdir == 'packaging' + assert spec.specpath == 'packaging/gbp-test.spec' # Test spec_from_repo() + assert_raises(NoSpecError, spec_from_repo, + repo, 'HEAD~1', 'packaging/gbp-test.spec') + + """ with assert_raises(NoSpecError): spec_from_repo(repo, 'HEAD~1', 'packaging/gbp-test.spec') + """ + spec = spec_from_repo(repo, 'HEAD', 'packaging/gbp-test.spec') - eq_(spec.specfile, 'gbp-test.spec') + assert spec.specfile == 'gbp-test.spec' # vim:et:ts=4:sw=4:et:sts=4:ai:set list listchars=tab\:»·,trail\:·: diff --git a/tests/test_rpm_changelog.py b/tests/test_rpm_changelog.py index 29732936..22739f0e 100644 --- a/tests/test_rpm_changelog.py +++ b/tests/test_rpm_changelog.py @@ -40,8 +40,12 @@ class TestChangelogHeader(object): """Test missing properties""" time = datetime(2014, 01, 29, 12, 13, 14) header = _ChangelogHeader(RpmPkgPolicy, time, name="John", revision="1") + assert_raises(ChangelogError, str, header) + + """ with assert_raises(ChangelogError): str(header) + """ def test_container(self): """Test the container methods of the class""" @@ -190,6 +194,16 @@ class TestChangelogParser(object): def test_parse_section_fail(self): """Basic tests for failures of changelog section parsing""" + assert_raises(ChangelogError, self.parser.parse_section, + self.cl_broken_header_1) + assert_raises(ChangelogError, self.parser.parse_section, + self.cl_broken_header_2) + assert_raises(ChangelogError, self.parser.parse_section, + self.cl_broken_header_3) + assert_raises(ChangelogError, self.parser.parse_section, + self.cl_broken_header_4) + + """ with assert_raises(ChangelogError): self.parser.parse_section(self.cl_broken_header_1) @@ -201,11 +215,17 @@ class TestChangelogParser(object): with assert_raises(ChangelogError): self.parser.parse_section(self.cl_broken_header_4) + """ def test_parse_changelog_fail(self): """Basic tests for changelog parsing failures""" + assert_raises(ChangelogError, self.parser.raw_parse_string, + self.cl_broken_header_5) + + """ with assert_raises(ChangelogError): self.parser.raw_parse_string(self.cl_broken_header_5) + """ class TestChangelog(object): diff --git a/tests/data/rpm/rpmbuild/SOURCES/bar.tar.gz b/tests/test_rpm_data/rpmbuild/SOURCES/bar.tar.gz Binary files differindex f5dae803..f5dae803 100644 --- a/tests/data/rpm/rpmbuild/SOURCES/bar.tar.gz +++ b/tests/test_rpm_data/rpmbuild/SOURCES/bar.tar.gz diff --git a/tests/data/rpm/rpmbuild/SOURCES/foo.txt b/tests/test_rpm_data/rpmbuild/SOURCES/foo.txt index 25ed442f..25ed442f 100644 --- a/tests/data/rpm/rpmbuild/SOURCES/foo.txt +++ b/tests/test_rpm_data/rpmbuild/SOURCES/foo.txt diff --git a/tests/data/rpm/rpmbuild/SOURCES/gbp-test-1.0.tar.bz2 b/tests/test_rpm_data/rpmbuild/SOURCES/gbp-test-1.0.tar.bz2 Binary files differindex 7d0759fe..7d0759fe 100644 --- a/tests/data/rpm/rpmbuild/SOURCES/gbp-test-1.0.tar.bz2 +++ b/tests/test_rpm_data/rpmbuild/SOURCES/gbp-test-1.0.tar.bz2 diff --git a/tests/data/rpm/rpmbuild/SOURCES/gbp-test-native-1.0.zip b/tests/test_rpm_data/rpmbuild/SOURCES/gbp-test-native-1.0.zip Binary files differindex 22a273d1..22a273d1 100644 --- a/tests/data/rpm/rpmbuild/SOURCES/gbp-test-native-1.0.zip +++ b/tests/test_rpm_data/rpmbuild/SOURCES/gbp-test-native-1.0.zip diff --git a/tests/data/rpm/rpmbuild/SOURCES/gbp-test2-3.0.tar.gz b/tests/test_rpm_data/rpmbuild/SOURCES/gbp-test2-3.0.tar.gz Binary files differindex 7b3eaf3c..7b3eaf3c 100644 --- a/tests/data/rpm/rpmbuild/SOURCES/gbp-test2-3.0.tar.gz +++ b/tests/test_rpm_data/rpmbuild/SOURCES/gbp-test2-3.0.tar.gz diff --git a/tests/data/rpm/rpmbuild/SOURCES/my.patch b/tests/test_rpm_data/rpmbuild/SOURCES/my.patch index 50870df2..50870df2 100644 --- a/tests/data/rpm/rpmbuild/SOURCES/my.patch +++ b/tests/test_rpm_data/rpmbuild/SOURCES/my.patch diff --git a/tests/data/rpm/rpmbuild/SOURCES/my2.patch b/tests/test_rpm_data/rpmbuild/SOURCES/my2.patch index ad5ca2d2..ad5ca2d2 100644 --- a/tests/data/rpm/rpmbuild/SOURCES/my2.patch +++ b/tests/test_rpm_data/rpmbuild/SOURCES/my2.patch diff --git a/tests/data/rpm/rpmbuild/SOURCES/my3.patch b/tests/test_rpm_data/rpmbuild/SOURCES/my3.patch index 9fee859d..9fee859d 100644 --- a/tests/data/rpm/rpmbuild/SOURCES/my3.patch +++ b/tests/test_rpm_data/rpmbuild/SOURCES/my3.patch diff --git a/tests/data/rpm/rpmbuild/SPECS/gbp-test-native.spec b/tests/test_rpm_data/rpmbuild/SPECS/gbp-test-native.spec index 38b07e48..38b07e48 100644 --- a/tests/data/rpm/rpmbuild/SPECS/gbp-test-native.spec +++ b/tests/test_rpm_data/rpmbuild/SPECS/gbp-test-native.spec diff --git a/tests/data/rpm/rpmbuild/SPECS/gbp-test-native2.spec b/tests/test_rpm_data/rpmbuild/SPECS/gbp-test-native2.spec index 34fd33dc..34fd33dc 100644 --- a/tests/data/rpm/rpmbuild/SPECS/gbp-test-native2.spec +++ b/tests/test_rpm_data/rpmbuild/SPECS/gbp-test-native2.spec diff --git a/tests/data/rpm/rpmbuild/SPECS/gbp-test.spec b/tests/test_rpm_data/rpmbuild/SPECS/gbp-test.spec index c46a734e..c46a734e 100644 --- a/tests/data/rpm/rpmbuild/SPECS/gbp-test.spec +++ b/tests/test_rpm_data/rpmbuild/SPECS/gbp-test.spec diff --git a/tests/data/rpm/rpmbuild/SPECS/gbp-test2.spec b/tests/test_rpm_data/rpmbuild/SPECS/gbp-test2.spec index 8a92725d..8a92725d 100644 --- a/tests/data/rpm/rpmbuild/SPECS/gbp-test2.spec +++ b/tests/test_rpm_data/rpmbuild/SPECS/gbp-test2.spec diff --git a/tests/test_rpm_data/rpmbuild/SPECS/gbp-test2.spec.orig b/tests/test_rpm_data/rpmbuild/SPECS/gbp-test2.spec.orig new file mode 100644 index 00000000..ffae7e99 --- /dev/null +++ b/tests/test_rpm_data/rpmbuild/SPECS/gbp-test2.spec.orig @@ -0,0 +1,46 @@ +Name: gbp-test2 +Summary: Test package 2 for git-buildpackage +Epoch: 2 +Version: 3.0 +Release: 0 +Group: Development/Libraries +License: GPLv2 +Source10: ftp://ftp.host.com/%{name}-%{version}.tar.gz +Source: foo.txt +Source20: bar.tar.gz +# Gbp-Ignore-Patches: 0 +Patch: my.patch +Patch10: my2.patch +Patch20: my3.patch +Packager: Markus Lehtonen <markus.lehtonen@linux.intel.com> + +%description +Package for testing the RPM functionality of git-buildpackage. + + +%prep +%setup -T -n %{name}-%{version} -c -a 10 + +%patch +%patch -P 10 -p1 + +echo "Do things" + +# Gbp-Patch-Macros + +%build +make + + +%install +rm -rf %{buildroot} +mkdir -p %{buildroot}/%{_datadir}/%{name} +cp -R * %{buildroot}/%{_datadir}/%{name} +install %{SOURCE0} %{buildroot}/%{_datadir}/%{name} + + + +%files +%defattr(-,root,root,-) +%dir %{_datadir}/%{name} +%{_datadir}/%{name} diff --git a/tests/data/rpm/specs/gbp-test-native.spec b/tests/test_rpm_data/specs/gbp-test-native.spec index 60de36f2..60de36f2 120000 --- a/tests/data/rpm/specs/gbp-test-native.spec +++ b/tests/test_rpm_data/specs/gbp-test-native.spec diff --git a/tests/data/rpm/specs/gbp-test-native2.spec b/tests/test_rpm_data/specs/gbp-test-native2.spec index ad13ad6a..ad13ad6a 120000 --- a/tests/data/rpm/specs/gbp-test-native2.spec +++ b/tests/test_rpm_data/specs/gbp-test-native2.spec diff --git a/tests/data/rpm/specs/gbp-test-quirks.spec b/tests/test_rpm_data/specs/gbp-test-quirks.spec index bb56b008..bb56b008 100644 --- a/tests/data/rpm/specs/gbp-test-quirks.spec +++ b/tests/test_rpm_data/specs/gbp-test-quirks.spec diff --git a/tests/data/rpm/specs/gbp-test-reference.spec b/tests/test_rpm_data/specs/gbp-test-reference.spec index 050d1398..050d1398 100644 --- a/tests/data/rpm/specs/gbp-test-reference.spec +++ b/tests/test_rpm_data/specs/gbp-test-reference.spec diff --git a/tests/data/rpm/specs/gbp-test-reference2.spec b/tests/test_rpm_data/specs/gbp-test-reference2.spec index 0fbe0260..0fbe0260 100644 --- a/tests/data/rpm/specs/gbp-test-reference2.spec +++ b/tests/test_rpm_data/specs/gbp-test-reference2.spec diff --git a/tests/data/rpm/specs/gbp-test-tags.spec b/tests/test_rpm_data/specs/gbp-test-tags.spec index ee4c2b94..ee4c2b94 100644 --- a/tests/data/rpm/specs/gbp-test-tags.spec +++ b/tests/test_rpm_data/specs/gbp-test-tags.spec diff --git a/tests/data/rpm/specs/gbp-test-updates-reference.spec b/tests/test_rpm_data/specs/gbp-test-updates-reference.spec index ff56f589..ff56f589 100644 --- a/tests/data/rpm/specs/gbp-test-updates-reference.spec +++ b/tests/test_rpm_data/specs/gbp-test-updates-reference.spec diff --git a/tests/data/rpm/specs/gbp-test-updates.spec b/tests/test_rpm_data/specs/gbp-test-updates.spec index dc8ffbf9..dc8ffbf9 100644 --- a/tests/data/rpm/specs/gbp-test-updates.spec +++ b/tests/test_rpm_data/specs/gbp-test-updates.spec diff --git a/tests/data/rpm/specs/gbp-test.spec b/tests/test_rpm_data/specs/gbp-test.spec index 30ae2845..30ae2845 120000 --- a/tests/data/rpm/specs/gbp-test.spec +++ b/tests/test_rpm_data/specs/gbp-test.spec diff --git a/tests/data/rpm/specs/gbp-test2-reference.spec b/tests/test_rpm_data/specs/gbp-test2-reference.spec index 1882131f..1882131f 100644 --- a/tests/data/rpm/specs/gbp-test2-reference.spec +++ b/tests/test_rpm_data/specs/gbp-test2-reference.spec diff --git a/tests/data/rpm/specs/gbp-test2-reference2.spec b/tests/test_rpm_data/specs/gbp-test2-reference2.spec index d41f4503..d41f4503 100644 --- a/tests/data/rpm/specs/gbp-test2-reference2.spec +++ b/tests/test_rpm_data/specs/gbp-test2-reference2.spec diff --git a/tests/data/rpm/specs/gbp-test2.spec b/tests/test_rpm_data/specs/gbp-test2.spec index af4080cb..af4080cb 120000 --- a/tests/data/rpm/specs/gbp-test2.spec +++ b/tests/test_rpm_data/specs/gbp-test2.spec diff --git a/tests/data/rpm/srpms/gbp-test-1.0-1.src.rpm b/tests/test_rpm_data/srpms/gbp-test-1.0-1.src.rpm Binary files differindex 74afbd6c..74afbd6c 100644 --- a/tests/data/rpm/srpms/gbp-test-1.0-1.src.rpm +++ b/tests/test_rpm_data/srpms/gbp-test-1.0-1.src.rpm diff --git a/tests/data/rpm/srpms/gbp-test-native-1.0-1.src.rpm b/tests/test_rpm_data/srpms/gbp-test-native-1.0-1.src.rpm Binary files differindex 1002aaea..1002aaea 100644 --- a/tests/data/rpm/srpms/gbp-test-native-1.0-1.src.rpm +++ b/tests/test_rpm_data/srpms/gbp-test-native-1.0-1.src.rpm diff --git a/tests/data/rpm/srpms/gbp-test-native2-2.0-0.src.rpm b/tests/test_rpm_data/srpms/gbp-test-native2-2.0-0.src.rpm Binary files differindex 880b3100..880b3100 100644 --- a/tests/data/rpm/srpms/gbp-test-native2-2.0-0.src.rpm +++ b/tests/test_rpm_data/srpms/gbp-test-native2-2.0-0.src.rpm diff --git a/tests/data/rpm/srpms/gbp-test2-3.0-0.src.rpm b/tests/test_rpm_data/srpms/gbp-test2-3.0-0.src.rpm Binary files differindex 1cf12c7a..1cf12c7a 100644 --- a/tests/data/rpm/srpms/gbp-test2-3.0-0.src.rpm +++ b/tests/test_rpm_data/srpms/gbp-test2-3.0-0.src.rpm |