tools/git-buildpackage.git
10 years agorpm.SpecFile: change specfile attribute to represent filename
Markus Lehtonen [Fri, 4 Jan 2013 13:10:02 +0000 (15:10 +0200)]
rpm.SpecFile: change specfile attribute to represent filename

There is specdir to get the (absolute) directory path.

Signed-off-by: Markus Lehtonen <markus.lehtonen@linux.intel.com>
10 years agorpm: make SpecFile.update_patches() use new tag/macro methods
Markus Lehtonen [Fri, 4 Jan 2013 12:42:25 +0000 (14:42 +0200)]
rpm: make SpecFile.update_patches() use new tag/macro methods

Use new set/delete methods for updating the patches in the spec file.
The internal patches structure is not updated and now only used when
importing patches.

Signed-off-by: Markus Lehtonen <markus.lehtonen@linux.intel.com>
10 years agorpm helpers: yet another fix to patch numbering
Markus Lehtonen [Fri, 11 Jan 2013 14:36:28 +0000 (16:36 +0200)]
rpm helpers: yet another fix to patch numbering

'Patch:' does not indicate "patch number 0". Patch: and 'Patch0:' can
both be present in the same spec file.

Signed-off-by: Markus Lehtonen <markus.lehtonen@linux.intel.com>
10 years agorpm helpers: support all tags
Markus Lehtonen [Thu, 3 Jan 2013 15:08:36 +0000 (17:08 +0200)]
rpm helpers: support all tags

Support all 'non-list' tags that we know of.

Signed-off-by: Markus Lehtonen <markus.lehtonen@linux.intel.com>
10 years agorpm helpers: parse 'nosource' and 'nopatch' sources correctly
Markus Lehtonen [Thu, 3 Jan 2013 14:03:23 +0000 (16:03 +0200)]
rpm helpers: parse 'nosource' and 'nopatch' sources correctly

Signed-off-by: Markus Lehtonen <markus.lehtonen@linux.intel.com>
10 years agorpm helpers: implement _set/delete_special_macro() methods
Markus Lehtonen [Fri, 11 Jan 2013 14:28:05 +0000 (16:28 +0200)]
rpm helpers: implement _set/delete_special_macro() methods

Currently intended for updating '%patch' macros.

Signed-off-by: Markus Lehtonen <markus.lehtonen@linux.intel.com>
10 years agorpm refactor: rewrite set_tag functionality
Markus Lehtonen [Thu, 3 Jan 2013 10:43:08 +0000 (12:43 +0200)]
rpm refactor: rewrite set_tag functionality

In addition to refactoring, make sure that we keep the internal _tags
structure in sync.

Changes the default place for new tags: add new tags after the 'Name:'
tag instead of 'Release:'.

Signed-off-by: Markus Lehtonen <markus.lehtonen@linux.intel.com>
10 years agorpm/LinkedList.delete: return the previous node
Markus Lehtonen [Fri, 4 Jan 2013 12:37:13 +0000 (14:37 +0200)]
rpm/LinkedList.delete: return the previous node

The preceding node of the deleted node. However, return the next (i.e.
the new first node) of the list if deleting the first node, and, return
None if the list is empty after deletion.

Signed-off-by: Markus Lehtonen <markus.lehtonen@linux.intel.com>
10 years agorpm refactor: split spec parsing into multiple methods
Markus Lehtonen [Tue, 4 Dec 2012 10:00:52 +0000 (12:00 +0200)]
rpm refactor: split spec parsing into multiple methods

Also, record all tags, macros and other "section" directives from the
spec in separate internal structures. Here "section" stands for all
scripts, scriptlets and other directives, i.e. "%prep", "%post",
"%files" etc.

Signed-off-by: Markus Lehtonen <markus.lehtonen@linux.intel.com>
10 years agorpm refactor: move spec file filtering into a separate function
Markus Lehtonen [Mon, 3 Dec 2012 17:12:56 +0000 (19:12 +0200)]
rpm refactor: move spec file filtering into a separate function

Also, remove the skip_tags option from the init as it's currently not
used anywhere and it'd be better parse the spec file similarly in every
place. The option can be re-added in the future if really needed.

Signed-off-by: Markus Lehtonen <markus.lehtonen@linux.intel.com>
10 years agoimport-srpm: enhance spec guessing
Markus Lehtonen [Wed, 9 Jan 2013 12:06:39 +0000 (14:06 +0200)]
import-srpm: enhance spec guessing

Use package name (in case of src.rpm) or directory name (in case of dir)
as the preferred name of the spec file.

Signed-off-by: Markus Lehtonen <markus.lehtonen@linux.intel.com>
10 years agorpm.SpecFile: return correct patch file path in patchseries()
Markus Lehtonen [Wed, 9 Jan 2013 12:44:36 +0000 (14:44 +0200)]
rpm.SpecFile: return correct patch file path in patchseries()

Fixes importing patches when the 'Patch:' tag contains an URI.

Signed-off-by: Markus Lehtonen <markus.lehtonen@linux.intel.com>
10 years agobuildpackage-rpm: support setting/updating the 'VCS:' tag
Markus Lehtonen [Thu, 17 Jan 2013 08:41:18 +0000 (10:41 +0200)]
buildpackage-rpm: support setting/updating the 'VCS:' tag

Git-buildpackage-rpm now always updates the 'VCS:' tag in the exported
spec file. A new config option 'spec-vcs-tag' controls the format:
- if empty, no 'VCS' tag is inserted and possible old 'VCS' tag is
  removed
- otherwise, a 'VCS' tag is inserted or the old 'VCS' tag is updated
- '%(tag)s' expands to the long tag name (from git-describe)

Signed-off-by: Markus Lehtonen <markus.lehtonen@linux.intel.com>
10 years agorpm helpers: support updating tags in the spec file
Markus Lehtonen [Fri, 30 Nov 2012 17:11:35 +0000 (19:11 +0200)]
rpm helpers: support updating tags in the spec file

Currently only the 'VCS' tag is supported.

Signed-off-by: Markus Lehtonen <markus.lehtonen@linux.intel.com>
10 years agotests: add more comprehensive tests for import-srpm
Markus Lehtonen [Thu, 17 Jan 2013 08:23:57 +0000 (10:23 +0200)]
tests: add more comprehensive tests for import-srpm

Basic tests for virtually all features of import-srpm.

Adds a new python module to include all (upcoming) git-buildpackage rpm
commandline tool tests. Also, adds a separate git submodule for the rpm
test data.

Signed-off-by: Markus Lehtonen <markus.lehtonen@linux.intel.com>
10 years agorpm: simplify the SrcRpmFile class a bit
Markus Lehtonen [Wed, 21 Nov 2012 11:42:33 +0000 (13:42 +0200)]
rpm: simplify the SrcRpmFile class a bit

Get rid of the unnecessary private methods.

Signed-off-by: Markus Lehtonen <markus.lehtonen@linux.intel.com>
10 years agorpm: introduce new 'Gbp-Patch-Macros' special key in spec parsing
Markus Lehtonen [Wed, 21 Nov 2012 10:54:04 +0000 (12:54 +0200)]
rpm: introduce new 'Gbp-Patch-Macros' special key in spec parsing

This can be used to mark location where to add new patch macros when
updating the spec.

Signed-off-by: Markus Lehtonen <markus.lehtonen@linux.intel.com>
10 years agorpm: rename the 'GbpIgnorePatch' special key in spec parsing
Markus Lehtonen [Wed, 21 Nov 2012 10:51:53 +0000 (12:51 +0200)]
rpm: rename the 'GbpIgnorePatch' special key in spec parsing

to 'Gbp-Ignore-Patches' for better readability. All the special keys (or
"gbp-tags") now have to start with the "Gbp-" prefix.

Signed-off-by: Markus Lehtonen <markus.lehtonen@linux.intel.com>
10 years agorpm: use linked list to store spec content
Markus Lehtonen [Fri, 16 Nov 2012 09:12:40 +0000 (11:12 +0200)]
rpm: use linked list to store spec content

Tries to make spec parsing and updating more robust by using a linked
list to represent spec content, instead of using normal list and trying
to track line numbers. Deleting and adding lines should be safer, now.
Also, consolidates the regexp usage of spec parsing a bit.

Signed-off-by: Markus Lehtonen <markus.lehtonen@linux.intel.com>
10 years agorpm: implement a simple doubly linked list
Markus Lehtonen [Wed, 21 Nov 2012 07:45:46 +0000 (09:45 +0200)]
rpm: implement a simple doubly linked list

This class is intended to store the spec file content, needed for
modifying the spec file.

Signed-off-by: Markus Lehtonen <markus.lehtonen@linux.intel.com>
10 years agorpm: circumvent an rpm-python macro expansion problem
Markus Lehtonen [Mon, 19 Nov 2012 11:56:31 +0000 (13:56 +0200)]
rpm: circumvent an rpm-python macro expansion problem

Parse the spec file two times to circumvent a rpm-python problem which
causes macros not to be correctly expanded if used before their
definition.

Signed-off-by: Markus Lehtonen <markus.lehtonen@linux.intel.com>
10 years agorpm: configuration option for setting the output color scheme
Markus Lehtonen [Tue, 13 Nov 2012 09:50:34 +0000 (11:50 +0200)]
rpm: configuration option for setting the output color scheme

Adds the new 'color-scheme' option to the rpm tools.

Signed-off-by: Markus Lehtonen <markus.lehtonen@linux.intel.com>
10 years agodebian packaging: HACK: disable test in Debian builds
Markus Lehtonen [Mon, 10 Sep 2012 10:05:07 +0000 (13:05 +0300)]
debian packaging: HACK: disable test in Debian builds

Signed-off-by: Markus Lehtonen <markus.lehtonen@linux.intel.com>
10 years agoTODO: add rpm todo
Markus Lehtonen [Fri, 13 Jan 2012 13:01:28 +0000 (15:01 +0200)]
TODO: add rpm todo

Signed-off-by: Markus Lehtonen <markus.lehtonen@linux.intel.com>
10 years agobuildpackage-rpm: fail patch-export if local patches found
Markus Lehtonen [Thu, 8 Nov 2012 10:27:43 +0000 (12:27 +0200)]
buildpackage-rpm: fail patch-export if local patches found

Make patch export fail if local patch files (not marked for manual
maintenance) exist.

Signed-off-by: Markus Lehtonen <markus.lehtonen@linux.intel.com>
10 years agoimport-srpm: return 2 if patch import fails
Markus Lehtonen [Fri, 9 Nov 2012 06:40:36 +0000 (08:40 +0200)]
import-srpm: return 2 if patch import fails

A new return value for failed patch import. If the patch import fails
the repo is left in clean and buildable state so one might want to
distinguish that from other failures.

Signed-off-by: Markus Lehtonen <markus.lehtonen@linux.intel.com>
10 years agodocs: add initial RPM documentation
Markus Lehtonen [Wed, 22 Feb 2012 10:48:57 +0000 (12:48 +0200)]
docs: add initial RPM documentation

Signed-off-by: Markus Lehtonen <markus.lehtonen@linux.intel.com>
10 years agotests: add unittests for gbp.rpm
Markus Lehtonen [Tue, 30 Oct 2012 09:48:24 +0000 (11:48 +0200)]
tests: add unittests for gbp.rpm

Signed-off-by: Markus Lehtonen <markus.lehtonen@linux.intel.com>
10 years agorpm: circumvent a bug in python-rpm
Markus Lehtonen [Thu, 1 Nov 2012 14:36:16 +0000 (16:36 +0200)]
rpm: circumvent a bug in python-rpm

Which caused the packager tag to be incorrect in some cases. Rpm-python
doesn't seem to reset spec.sourceHeader[rpm.RPMTAG_PACKAGER] if no
packager tag is defined in the spec file. Thus, if we (in the same
context) first parse spec A (which has a packager tag) and then spec B
(which doesn't have a packager tag) python-rpm will give the packager of
A for B as well.

Signed-off-by: Markus Lehtonen <markus.lehtonen@linux.intel.com>
10 years agoimport-srpm: suppress some pylint warnings
Markus Lehtonen [Tue, 30 Oct 2012 15:20:55 +0000 (17:20 +0200)]
import-srpm: suppress some pylint warnings

Signed-off-by: Markus Lehtonen <markus.lehtonen@linux.intel.com>
10 years agobuildpackage-rpm: return 2 for patch-export or tarball generation errors
Markus Lehtonen [Fri, 21 Sep 2012 05:38:57 +0000 (08:38 +0300)]
buildpackage-rpm: return 2 for patch-export or tarball generation errors

Signed-off-by: Markus Lehtonen <markus.lehtonen@linux.intel.com>
10 years agorpm: implement file path filters in patch export
Markus Lehtonen [Fri, 14 Sep 2012 14:21:09 +0000 (17:21 +0300)]
rpm: implement file path filters in patch export

Implements a filter option allows one to filter out changes to certain
files/paths in the patch-generation. A commit is totally ignored if all
files would be filtered out. The path filter is given as a Python
regexp.

This option is useful for example in filtering out the changes to
packaging files when maintaining packaging and sources in the same
branch.

Signed-off-by: Markus Lehtonen <markus.lehtonen@linux.intel.com>
10 years agobuildpackage-rpm: support special tree-ish names in --git-upstream-tree
Markus Lehtonen [Fri, 24 Aug 2012 13:32:44 +0000 (16:32 +0300)]
buildpackage-rpm: support special tree-ish names in --git-upstream-tree

Support special 'WC*' and 'INDEX' values for the --git-upstream-tree
option.

Signed-off-by: Markus Lehtonen <markus.lehtonen@linux.intel.com>
10 years agoUniversal configurable base tmpdir for all gbp rpm tools
Markus Lehtonen [Thu, 12 Jul 2012 06:07:47 +0000 (09:07 +0300)]
Universal configurable base tmpdir for all gbp rpm tools

Signed-off-by: Markus Lehtonen <markus.lehtonen@linux.intel.com>
10 years agoimport-srpm: support for patch import
Markus Lehtonen [Wed, 27 Jun 2012 15:12:01 +0000 (18:12 +0300)]
import-srpm: support for patch import

Adds a new commandline option '--patch-import' for importing patches
into the source tree in packaging branch. When enabled, gbp applies and
commits all patches (not marked for manual maintenance) into the
packaging branch. If this succeeds, it also removes all imported patch
files from the packaging directory and the spec file.

Currently only supported for non-orphan-packaging.

This setting is true by default which should make more sense as the
developer wants to do code development in the packaging branch (if
he/she selects to use non-orphan packaging).

However, patch-import is force-disabled if in bare git repository. We
cannot support this, currently.

Signed-off-by: Markus Lehtonen <markus.lehtonen@linux.intel.com>
10 years agorpm: bigger refactor of import-srpm
Markus Lehtonen [Thu, 28 Jun 2012 08:01:25 +0000 (11:01 +0300)]
rpm: bigger refactor of import-srpm

Import source rpms in the same way as unpacked sources: that is, first
unpack the srpm and then use the same code for importing. Also, tries to
make tmpdir handling a bit better: all temporary directories are created
under one "base tmpdir".

Also, get rid of the orig tarball guessing and unpackging in SrcRpmFile
class in gbp.rpm.

Signed-off-by: Markus Lehtonen <markus.lehtonen@linux.intel.com>
10 years agorpm: support squashing commits in patch generation
Markus Lehtonen [Tue, 12 Jun 2012 07:42:41 +0000 (10:42 +0300)]
rpm: support squashing commits in patch generation

Implements an option for git-buildpackage-rpm and gbp-pq to squash
commits (from upstream) up to certain tree-ish into one monolithic diff.
Useful e.g. if you wan't to auto-generate a stable update patch.

The new format of the cmdline option filename is commit-ish followed by
(optionally) a colon and the desired diff filename base. Suffix '.diff'
is added by GBP.

Magic word 'HEAD' translates to the end-commit when given as the
squash-point.  This allows one to configure gbp to always squash all
commits into one monolithic diff.

Signed-off-by: Markus Lehtonen <markus.lehtonen@linux.intel.com>
10 years agorpm: add --orig-prefix option
Markus Lehtonen [Thu, 14 Jun 2012 16:34:09 +0000 (19:34 +0300)]
rpm: add --orig-prefix option

Adds a new option --orig-prefix that affects the prefix of the
generated/imported orig tarballs.

For git-buildpackage-rpm, it defines the prefix of tarballs generated by
the tool, 'auto' (default) makes gbp to guess the prefix, as before.
NOTE: this doesn't affect the tarballs checked out from pristine-tar
(i.e. if --pristine-tar is defined) or tarballs that are already present
(see --git-tarball-dir option).

For git-import-orig, this new option affects the prefix of tarballs
imported into pristine-tar branch. If set to 'auto' (default) gbp
doesn't mangle the prefix.

Other tools (e.g. git-import-srpm) are not affected.

Signed-off-by: Markus Lehtonen <markus.lehtonen@linux.intel.com>
10 years agorpm: enhance logic in guessing the prefix of source archives
Markus Lehtonen [Fri, 8 Jun 2012 07:20:12 +0000 (10:20 +0300)]
rpm: enhance logic in guessing the prefix of source archives

Now a prefix is guessed for all source archives (not for the one and
only "orig archive"). By default it is
'<archive_name>-<archive_version>/' if name and version can be
determined from the filename. If not, the archive basename (i.e.
filename less archive and compression extensions) is used.

In addition, more logic is applied to the "orig archive": gbp examines
the setup macro (if found) for the source and takes the prefix from
there. If some macros (in the '-n' option of the setup macro) cannot be
expanded archive basename us used as the prefix.

Signed-off-by: Markus Lehtonen <markus.lehtonen@linux.intel.com>
10 years agorpm: support generating compressed patches
Markus Lehtonen [Thu, 7 Jun 2012 14:20:21 +0000 (17:20 +0300)]
rpm: support generating compressed patches

This patch adds the support to generate compressed patches. User can
define the patch file size limit after which patches gzipped.

Re-writes the write_patch() function(s) and now uses the same-and-only
write_patch() for buildpackage-rpm and pq-rpm.

Signed-off-by: Markus Lehtonen <markus.lehtonen@linux.intel.com>
10 years agopq-rpm: support importing compressed patches
Markus Lehtonen [Thu, 7 Jun 2012 16:13:43 +0000 (19:13 +0300)]
pq-rpm: support importing compressed patches

Adds support for importing compressed patches.

NOTE: Only gzip is supported, for the time being, other compression
methods shouldn't be to hard to add, if needed.

Signed-off-by: Markus Lehtonen <markus.lehtonen@linux.intel.com>
10 years agorpm helpers: add support for gbp-specific rpmlib
Markus Lehtonen [Fri, 1 Jun 2012 08:19:36 +0000 (11:19 +0300)]
rpm helpers: add support for gbp-specific rpmlib

Adds support to use a special rpmlib, defined by rpm packaging policy.
This makes it possible to use the target distro's rpmlib. That is, parse
spec files for target distros (and architectures) incompatible with your
host system.

With the default RpmPkgPolicy, GBP tries to import "rpmlibgbp".

Signed-off-by: Markus Lehtonen <markus.lehtonen@linux.intel.com>
10 years agobuildpackage-rpm: add more tagging options
Markus Lehtonen [Wed, 4 Sep 2013 07:33:03 +0000 (10:33 +0300)]
buildpackage-rpm: add more tagging options

Add new possible keywords to be used in packaging-tag format string:
'nowtime', 'authortime', 'committime', 'nowtimenum', 'authortimenum' and
'committimenum'.

The '*timenum' keyword denote the corresponding '*time' keyword appended
with an additional incremental serial number. E.g. if 'nowtime' would
produce '20120531', 'nowtimenum' would (the first time) produce
'20120531.1'.

What is completely missing is a way to support these new tag keywords in
git-import-srpm tool. So, if you use these tags, git-import-srpm is not
able to reproduce the tags, (and, it is not necessarily able to
correctly tell if you've already imported a certain version of the
package).

Signed-off-by: Markus Lehtonen <markus.lehtonen@linux.intel.com>
10 years agoRpmGitRepository: make version-tag methods more flexible
Markus Lehtonen [Thu, 31 May 2012 06:48:50 +0000 (09:48 +0300)]
RpmGitRepository: make version-tag methods more flexible

Simplifies version_to_tag() and find_version() so that all string fields
(for the format string) are given in one dict. Now it's easier to
add support for new string fields (e.g. commitdate etc).

Signed-off-by: Markus Lehtonen <markus.lehtonen@linux.intel.com>
Signed-off-by: Ed Bartosh <eduard.bartosh@intel.com>
10 years agorpm helpers: make SpecFile and SrcRpmFile give (full) version as dict.
Markus Lehtonen [Wed, 30 May 2012 17:02:39 +0000 (20:02 +0300)]
rpm helpers: make SpecFile and SrcRpmFile give (full) version as dict.

The Dictionary contains different "version components", such as
upstreamversion, release and epoch. Makes e.g. tag creation consistent,
now.

Signed-off-by: Markus Lehtonen <markus.lehtonen@linux.intel.com>
10 years agorpm: add version parsing functions to pkg policy
Markus Lehtonen [Mon, 23 Apr 2012 09:51:08 +0000 (12:51 +0300)]
rpm: add version parsing functions to pkg policy

Adds functions for version string generation and parsing. These are
intended for parsing version strings taken e.g. from rpm filename or
changelogs.

Also, take these new version parsing functions into use in the rpm gbp
scripts.

Signed-off-by: Markus Lehtonen <markus.lehtonen@linux.intel.com>
Signed-off-by: Ed Bartosh <eduard.bartosh@intel.com>
10 years agobuildpackage-rpm: add option --git-ignore-untracked
Markus Lehtonen [Wed, 30 May 2012 06:23:46 +0000 (09:23 +0300)]
buildpackage-rpm: add option --git-ignore-untracked

Adds a new commandline option to ignore untracked files, when running
git-buildpackage-rpm. When this option is given, the
git-buildpackage-rpm command fails if there are changes to tracked
files, but, succeeds if there are untracked files present. Normally it
fails in either case.

Signed-off-by: Markus Lehtonen <markus.lehtonen@linux.intel.com>
10 years agodebian packaging: relax requirements on devscripts
Markus Lehtonen [Tue, 14 Jan 2014 07:39:12 +0000 (09:39 +0200)]
debian packaging: relax requirements on devscripts

No need to depend on the latest version.

Signed-off-by: Markus Lehtonen <markus.lehtonen@linux.intel.com>
10 years agodebian packaging: split Debian package into subpackages
Ed Bartosh [Thu, 24 May 2012 13:16:12 +0000 (16:16 +0300)]
debian packaging: split Debian package into subpackages

Split Debian package into three packages, following the introduction of
RPM tools. Now the Debian packaging resembles the default RPM packaging:
- git-buildpackage-common contains the common code for Deb and RPM tools
- git-buildpackage contains the Debian-specific modules/tools
- git-buildpackage-rpm contains the RPM-specific modules/tools

Signed-off-by: Zhang Qiang <qiang.z.zhang@intel.com>
Signed-off-by: Ed Bartosh <eduard.bartosh@intel.com>
Signed-off-by: Markus Lehtonen <markus.lehtonen@linux.intel.com>
10 years agodebian packaging: support for RPM tools
Markus Lehtonen [Thu, 25 Apr 2013 14:23:18 +0000 (17:23 +0300)]
debian packaging: support for RPM tools

Add requirements for git-buildpackage-rpm and other rpm tools.

Signed-off-by: Markus Lehtonen <markus.lehtonen@linux.intel.com>
10 years agoAdd rpm packaging files
Markus Lehtonen [Mon, 23 Apr 2012 12:29:53 +0000 (15:29 +0300)]
Add rpm packaging files

Signed-off-by: Ed Bartosh <eduard.bartosh@intel.com>
Signed-off-by: Olev Kartau <olev.kartau@intel.com>
Signed-off-by: Zhang Qiang <qiang.z.zhang@intel.com>
Signed-off-by: Markus Lehtonen <markus.lehtonen@linux.intel.com>
10 years agoREADME: mention RPM support
Markus Lehtonen [Thu, 12 Apr 2012 13:37:37 +0000 (16:37 +0300)]
README: mention RPM support

Signed-off-by: Markus Lehtonen <markus.lehtonen@linux.intel.com>
10 years agorpm: add 'vendor' config option
Markus Lehtonen [Thu, 12 Jan 2012 13:45:06 +0000 (15:45 +0200)]
rpm: add 'vendor' config option

Intended to represent the distribution vendor (e.g. 'Debian'). This can
be used in tag and branch name formatting.

Signed-off-by: Markus Lehtonen <markus.lehtonen@linux.intel.com>
10 years agorpm: add rpm-specific example config file
Markus Lehtonen [Thu, 12 Jan 2012 13:40:18 +0000 (15:40 +0200)]
rpm: add rpm-specific example config file

Signed-off-by: Markus Lehtonen <markus.lehtonen@linux.intel.com>
10 years agoIntroduce git-import-orig-rpm tool
Markus Lehtonen [Thu, 12 Jan 2012 13:39:55 +0000 (15:39 +0200)]
Introduce git-import-orig-rpm tool

Initial version of the git-import-orig-rpm: version of git-import-orig
intended for maintaining rpm packages.

Signed-off-by: Markus Lehtonen <markus.lehtonen@linux.intel.com>
10 years agoIntroduce git-buildpackage-rpm tool
Markus Lehtonen [Thu, 12 Jan 2012 13:39:12 +0000 (15:39 +0200)]
Introduce git-buildpackage-rpm tool

Initial version of git-buildpackage-rpm: git-buildpackage tool for rpms.

Also adds some new options to config.py that are exclusively used in
this tool.

Signed-off-by: Markus Lehtonen <markus.lehtonen@linux.intel.com>
Signed-off-by: Ed Bartosh <eduard.bartosh@intel.com>
Signed-off-by: Zhang Qiang <qiang.z.zhang@intel.com>
10 years agopq-rpm: support patch-export up to an arbitrary tree-ish
Markus Lehtonen [Wed, 8 May 2013 17:42:45 +0000 (20:42 +0300)]
pq-rpm: support patch-export up to an arbitrary tree-ish

If the end of the export range is not a commit "normal" patches are
generated up to HEAD and finally a raw diff between HEAD and the
end-tree-is generated.

Signed-off-by: Markus Lehtonen <markus.lehtonen@linux.intel.com>
10 years agopq-rpm: add new --pq-branch option
Markus Lehtonen [Fri, 11 May 2012 08:29:24 +0000 (11:29 +0300)]
pq-rpm: add new --pq-branch option

Adds a new command line option '--pq-branch' to set the name of
patch-queue branches. Changes the defaults pq-branch name for rpm tools
to 'development/%(branch)s' (instead of the old
'patch-queue/%(branch)s').

Signed-off-by: Markus Lehtonen <markus.lehtonen@linux.intel.com>
10 years agogbp-pq-rpm: add 'export-rev' option
Markus Lehtonen [Thu, 12 Jan 2012 13:44:43 +0000 (15:44 +0200)]
gbp-pq-rpm: add 'export-rev' option

This option allows generating patches from any git tree-ish (instead of
the default that is HEAD of patch-queue branch).

Signed-off-by: Markus Lehtonen <markus.lehtonen@linux.intel.com>
10 years agoIntroduce gbp-pq-rpm tool
Markus Lehtonen [Thu, 12 Jan 2012 13:38:29 +0000 (15:38 +0200)]
Introduce gbp-pq-rpm tool

Initial version of gbp-pq-rpm: a tool for managing patch queues for rpm
packages.

Signed-off-by: Markus Lehtonen <markus.lehtonen@linux.intel.com>
Signed-off-by: Olev Kartau <olev.kartau@intel.com>
10 years agoIntroduce git-import-srpm tool
Markus Lehtonen [Thu, 12 Jan 2012 13:37:49 +0000 (15:37 +0200)]
Introduce git-import-srpm tool

Initial version of the git-import-srpm: a tool for importing source
rpms.

Unit tests: created a separate method in TestHelp for RPM-specific
commands.

Signed-off-by: Markus Lehtonen <markus.lehtonen@linux.intel.com>
Signed-off-by: Ed Bartosh <eduard.bartosh@intel.com>
10 years agoAdd 'packaging-tag' option to config.py
Markus Lehtonen [Thu, 12 Jan 2012 13:36:10 +0000 (15:36 +0200)]
Add 'packaging-tag' option to config.py

This is the counterpart of 'debian-tag' (basically identical to that) to
not confuse rpm maintainers.

Signed-off-by: Markus Lehtonen <markus.lehtonen@linux.intel.com>
10 years agoRename internal var debian_tag -> packaging_tag
Markus Lehtonen [Thu, 12 Jan 2012 13:35:49 +0000 (15:35 +0200)]
Rename internal var debian_tag -> packaging_tag

This is done in sake of more general purpose naming, intended for
enabling rpm support: to allow logical naming for rpm and to
share as much code between debian and rpm tools as possible.

Signed-off-by: Markus Lehtonen <markus.lehtonen@linux.intel.com>
10 years agoAdd 'packaging-branch' cmdline option
Markus Lehtonen [Thu, 12 Jan 2012 13:35:37 +0000 (15:35 +0200)]
Add 'packaging-branch' cmdline option

This is the counterpart of 'debian-branch' (basically identical to that)
to not confuse rpm maintainers.

Also, adds this option to gbp-clone and gbp-pull commands (as an
alternative to the 'debian-branch option), which are usable for RPM in
their current form.

Signed-off-by: Markus Lehtonen <markus.lehtonen@linux.intel.com>
10 years agoRename internal var debian_branch -> packaging_branch
Markus Lehtonen [Thu, 12 Jan 2012 13:35:20 +0000 (15:35 +0200)]
Rename internal var debian_branch -> packaging_branch

This is done in sake of more general purpose naming, intended for
enabling rpm support.

Signed-off-by: Markus Lehtonen <markus.lehtonen@linux.intel.com>
10 years agoAdd 'packaging-dir' option to config.py
Markus Lehtonen [Thu, 12 Jan 2012 13:35:05 +0000 (15:35 +0200)]
Add 'packaging-dir' option to config.py

Needed by the upcoming rpm tools.

Signed-off-by: Markus Lehtonen <markus.lehtonen@linux.intel.com>
10 years agogbp-pull: two modes for --force
Markus Lehtonen [Thu, 12 Jan 2012 13:26:55 +0000 (15:26 +0200)]
gbp-pull: two modes for --force

The 'force' option now has two possible values:
'merge': upstream branch is merged, even if fast-forward is not
possible.

'clean': check out a clean copy from the upstream if fast-forward is not
possible (i.e. no merge). Local changes are lost in this case.

Signed-off-by: Markus Lehtonen <markus.lehtonen@linux.intel.com>
10 years agogbp-pull: similar update strategy for all branches
Markus Lehtonen [Thu, 12 Jan 2012 13:25:57 +0000 (15:25 +0200)]
gbp-pull: similar update strategy for all branches

Treat non-checked-out branches similarly to the current branch when
forcing update. That is, do git merge, instead of just setting the ref.

Also, renames fast_forward_branch() to update_branch() to better match
the functionality.

Signed-off-by: Markus Lehtonen <markus.lehtonen@linux.intel.com>
10 years agogbp-pull: implement --all cmdline option
Markus Lehtonen [Tue, 15 Jan 2013 14:28:24 +0000 (16:28 +0200)]
gbp-pull: implement --all cmdline option

This updates all remote-tracking branches (for the remote that is
fetched from) whose local branch name is identical to the remote branch
name.

Signed-off-by: Markus Lehtonen <markus.lehtonen@linux.intel.com>
10 years agoconfig: add rpm-specific option parser class
Markus Lehtonen [Mon, 13 Feb 2012 13:01:22 +0000 (15:01 +0200)]
config: add rpm-specific option parser class

Adds a new GbpOptionParserRpm class for handling rpm-specific options.

Signed-off-by: Markus Lehtonen <markus.lehtonen@linux.intel.com>
10 years agoIntroduce rpm helpers
Markus Lehtonen [Thu, 12 Jan 2012 13:29:03 +0000 (15:29 +0200)]
Introduce rpm helpers

Preparation for RPM support.

Signed-off-by: Markus Lehtonen <markus.lehtonen@linux.intel.com>
Signed-off-by: Ed Bartosh <eduard.bartosh@intel.com>
Signed-off-by: Zhang Qiang <qiang.z.zhang@intel.com>
Signed-off-by: Huang Hao <hao.h.huang@intel.com>
10 years agocommon/pq: support more flexible pq-branch naming
Markus Lehtonen [Fri, 6 Sep 2013 11:23:03 +0000 (14:23 +0300)]
common/pq: support more flexible pq-branch naming

Now any string fields (e.g. '%(version)s') can be used in the pq-branch
format strings - in addition to the '%(branch)s' supported before.

Signed-off-by: Markus Lehtonen <markus.lehtonen@linux.intel.com>
10 years agogbp-pq: readiness to configure the pq branch name
Markus Lehtonen [Fri, 11 May 2012 07:56:17 +0000 (10:56 +0300)]
gbp-pq: readiness to configure the pq branch name

All other gbp branches have configurable names. This commit adds the
readiness for user to configure/change the name of the patch-queue
branches, as well.

Patch-queue is defined in options as a format string, where '%(branch)s'
refers to the debian/packaging branch. If the pq-branch format string
does not contain '%(branch)s', there is only one patch-queue branch and
the debian/packaging branch is used as its base branch. That is, e.g. a
'gbp-pq switch' operation from the patch-queue branch always switches to
the debian/packaging branch.

Signed-off-by: Markus Lehtonen <markus.lehtonen@linux.intel.com>
Signed-off-by: Olev Kartau <olev.kartau@intel.com>
10 years agoUniversal configurable base tmpdir for all gbp tools
Markus Lehtonen [Thu, 12 Jul 2012 06:07:47 +0000 (09:07 +0300)]
Universal configurable base tmpdir for all gbp tools

Adds support for a configurable tmpdir under which all gbp tools now
create their temporary directories and files.

NOTE: an exception is git-import-dscs which doesn't use the common
configuration system.

Signed-off-by: Markus Lehtonen <markus.lehtonen@linux.intel.com>
10 years agoAdd gbp specific tempfile module
Markus Lehtonen [Wed, 11 Jul 2012 13:03:56 +0000 (16:03 +0300)]
Add gbp specific tempfile module

Minimal initial implementation that only adds tempdir parent directory
creation.

Signed-off-by: Markus Lehtonen <markus.lehtonen@linux.intel.com>
Signed-off-by: Olev Kartau <olev.kartau@intel.com>
10 years agobuildpackage: implement --[no-]build cmdline option
Markus Lehtonen [Fri, 26 Apr 2013 08:20:11 +0000 (11:20 +0300)]
buildpackage: implement --[no-]build cmdline option

For enabling/disabling the builder script. The option is a bit
asymmetric: --git-no-build automatically disables the 'postbuild' hook
whereas --git-build does not enable it (e.g. if --git-no-hooks is
given).

Signed-off-by: Markus Lehtonen <markus.lehtonen@linux.intel.com>
10 years agobuildpackage: fix exporting of working copy when run from a subdir
Markus Lehtonen [Thu, 25 Oct 2012 06:25:25 +0000 (09:25 +0300)]
buildpackage: fix exporting of working copy when run from a subdir

Exporting sources failed when git-buildpackage was run from a
subdirectory of the git working directory because the path of the custom
index file was not handled correctly.

Signed-off-by: Markus Lehtonen <markus.lehtonen@linux.intel.com>
10 years agobuildpackage: new "working copy" choices for --git-export
Markus Lehtonen [Mon, 9 Jul 2012 07:52:36 +0000 (10:52 +0300)]
buildpackage: new "working copy" choices for --git-export

Add support for building different kind of "working copies", when using
the --git-export option:
- 'WC.TRACKED': only use files that are already tracked
- 'WC.UNTRACKED': use untracked files, too
- 'WC.IGNORED': also add files that'd normally be ignored

Using '--git-export=WC' beaves like before.

Signed-off-by: Markus Lehtonen <markus.lehtonen@linux.intel.com>
10 years agobuildpackage: add 'untracked' option to write_wc()
Markus Lehtonen [Fri, 6 Jul 2012 13:45:54 +0000 (16:45 +0300)]
buildpackage: add 'untracked' option to write_wc()

Whether to ignore untracked files (untracked=False) or not
(untracked=True). Now, clones the temporary index file from the actual
index, in order to correctly update files.

Signed-off-by: Markus Lehtonen <markus.lehtonen@linux.intel.com>
Signed-off-by: Ed Bartosh <eduard.bartosh@intel.com>
10 years agoGitRepository/add_files: add new option 'untracked'
Markus Lehtonen [Fri, 6 Jul 2012 12:55:19 +0000 (15:55 +0300)]
GitRepository/add_files: add new option 'untracked'

With this option you can either only update already tracked files to
index the (untracked=False) or add new files, too.

Signed-off-by: Markus Lehtonen <markus.lehtonen@linux.intel.com>
10 years agoconfig: support for per-tree config files
Markus Lehtonen [Mon, 25 Mar 2013 08:56:47 +0000 (10:56 +0200)]
config: support for per-tree config files

Add support for reading the local config file(s) from a given git
tree-ish.

Signed-off-by: Markus Lehtonen <markus.lehtonen@linux.intel.com>
10 years agoconfig: read the right config if run from subdir
Markus Lehtonen [Fri, 6 Jul 2012 06:58:06 +0000 (09:58 +0300)]
config: read the right config if run from subdir

A step towards being able to run GBP tools from subdirectories.

Now expands '%(top_dir)s' and '%(git_dir)s' in config file path to root
of the working directory and git metadata directory, respectively.

Also, adds a new method _read_config_file() in preparation for
supporting per-tree config files.

Fixes tests.test_Config: currently the only correct way to define the
config file(s) to be parsed is by using the GBP_CONF_FILES environment
variable.

Signed-off-by: Markus Lehtonen <markus.lehtonen@linux.intel.com>
10 years agotests.testutils: add ls_zip() helper
Markus Lehtonen [Thu, 29 Aug 2013 07:37:56 +0000 (10:37 +0300)]
tests.testutils: add ls_zip() helper

For listing zip contents.

Signed-off-by: Markus Lehtonen <markus.lehtonen@linux.intel.com>
10 years agoimport-orig: rework sourcecode preparation and filtering
Markus Lehtonen [Wed, 14 Nov 2012 07:03:37 +0000 (09:03 +0200)]
import-orig: rework sourcecode preparation and filtering

Take in to use the newly added prepare_sources() function. Drop dead,
unneeded code.

Signed-off-by: Markus Lehtonen <markus.lehtonen@linux.intel.com>
10 years agoimport-orig: new function for filtering/re-packing sources
Markus Lehtonen [Mon, 26 Aug 2013 07:22:00 +0000 (10:22 +0300)]
import-orig: new function for filtering/re-packing sources

Introduces a new function prepare_sources() that prepares upstream
sources for importing into upstream branch and pristine-tar. That
includes unpacking, filtering and re-packing sources. What somewhat
complicates the logic is that it tries to avoid excess unpacking/packing
of the sources.

Also fixes the unpacking / filtering / repacking logic which was broken
with some parameter combinations.

Signed-off-by: Markus Lehtonen <markus.lehtonen@linux.intel.com>
10 years agoUpstreamSource.unpack: return UpstreamSource instance
Markus Lehtonen [Thu, 6 Jun 2013 12:19:37 +0000 (15:19 +0300)]
UpstreamSource.unpack: return UpstreamSource instance

Trying to keep UpstreamSource in consistent state so that unpacked and
packed sources are kept in sync.

Signed-off-by: Markus Lehtonen <markus.lehtonen@linux.intel.com>
10 years agoUpstreamSource.pack: reuse unpacked dir if no filter is used
Markus Lehtonen [Thu, 6 Jun 2013 12:21:48 +0000 (15:21 +0300)]
UpstreamSource.pack: reuse unpacked dir if no filter is used

Set the unpacked attribute to the source dir if the content is not
filtered.

Signed-off-by: Markus Lehtonen <markus.lehtonen@linux.intel.com>
10 years agoUpstreamSource: implement prefix guessing
Markus Lehtonen [Thu, 22 Aug 2013 13:24:13 +0000 (16:24 +0300)]
UpstreamSource: implement prefix guessing

Add a new attribure 'prefix', i.e. the "leading directory name" in an
archive. For example, this usually is '<name>-<version>' in release
tarballs.

Signed-off-by: Markus Lehtonen <markus.lehtonen@linux.intel.com>
Signed-off-by: Ɓukasz Stelmach <l.stelmach@samsung.com>
10 years agoUpstreamSource: check that the sources exist
Markus Lehtonen [Fri, 23 Aug 2013 11:04:12 +0000 (14:04 +0300)]
UpstreamSource: check that the sources exist

Signed-off-by: Markus Lehtonen <markus.lehtonen@linux.intel.com>
10 years agotests: test find_source() with unittest
Markus Lehtonen [Mon, 13 Jan 2014 16:39:05 +0000 (18:39 +0200)]
tests: test find_source() with unittest

Change doctests to unittests in order to have more flexibility in
testing.

Signed-off-by: Markus Lehtonen <markus.lehtonen@linux.intel.com>
10 years agoUpstreamSource: store the absolute path
Markus Lehtonen [Fri, 23 Aug 2013 11:01:39 +0000 (14:01 +0300)]
UpstreamSource: store the absolute path

This is more robust and reliable, e.g. in case cwd is changed.

Signed-off-by: Markus Lehtonen <markus.lehtonen@linux.intel.com>
10 years agoUpstreamSource: move version guessing logic to PkgPolicy
Markus Lehtonen [Fri, 23 Aug 2013 10:39:19 +0000 (13:39 +0300)]
UpstreamSource: move version guessing logic to PkgPolicy

PkgPolicy is more logical context, for example if guessing version from
a plain filename and not a real file.

Also, changes guess_version() to always return a tuple to simplify
checking its return value.

Signed-off-by: Markus Lehtonen <markus.lehtonen@linux.intel.com>
10 years agoUpstreamSource.guess_version: don't check for directories
Markus Lehtonen [Mon, 26 Aug 2013 13:47:57 +0000 (16:47 +0300)]
UpstreamSource.guess_version: don't check for directories

Directories are not recognized anyway, if guess_version() is called for
non-existent sources. And, parse_archive_filename() works fine for
directory names, too.

Signed-off-by: Markus Lehtonen <markus.lehtonen@linux.intel.com>
10 years agoUpstreamSource.guess_version: recognise debian native tarballs
Markus Lehtonen [Thu, 6 Jun 2013 11:53:45 +0000 (14:53 +0300)]
UpstreamSource.guess_version: recognise debian native tarballs

Signed-off-by: Markus Lehtonen <markus.lehtonen@linux.intel.com>
10 years agoUpstreamSource/guess_version: detect more compression formats
Markus Lehtonen [Thu, 27 Sep 2012 07:24:28 +0000 (10:24 +0300)]
UpstreamSource/guess_version: detect more compression formats

By utilizing the parse_archive_filename() function that detects e.g.
"alias suffixes" such as 'tgz'.

Signed-off-by: Markus Lehtonen <markus.lehtonen@linux.intel.com>
10 years agoUpstreamSource: introduce is_tarball() method
Markus Lehtonen [Mon, 9 Jul 2012 14:19:27 +0000 (17:19 +0300)]
UpstreamSource: introduce is_tarball() method

New method for checking if the sources are a tarball (possibly for
checking if the sources are committable by pristine-tar).

Signed-off-by: Markus Lehtonen <markus.lehtonen@linux.intel.com>
10 years agoUpstreamSource: add 'archive_fmt' and 'compression' properties
Markus Lehtonen [Mon, 9 Jul 2012 14:16:21 +0000 (17:16 +0300)]
UpstreamSource: add 'archive_fmt' and 'compression' properties

New properties for easily getting the archive format (tar, zip, ...) and
compression format (gzip, bzip2, ...) of the sources.

Signed-off-by: Markus Lehtonen <markus.lehtonen@linux.intel.com>
10 years agoIntroduce PkgPolicy.is_valid_orig_archive()
Markus Lehtonen [Mon, 9 Jul 2012 13:10:37 +0000 (16:10 +0300)]
Introduce PkgPolicy.is_valid_orig_archive()

A new method for checking if the given filename is usable as a orig
(upstream) source archive.

Also, takes this method into use in the UpstreamSource class.

Signed-off-by: Markus Lehtonen <markus.lehtonen@linux.intel.com>
10 years agoChange UpstreamSource to have PkgPolicy
Markus Lehtonen [Mon, 9 Jul 2012 12:17:24 +0000 (15:17 +0300)]
Change UpstreamSource to have PkgPolicy

The UpstreamSource class now gets a PkgPolicy in it's initialization.
Also, introduces new DebiaUpstreamSource class which is taken in use in
the scripts.

The PkgPolicy is not yet used for anything in UpstreamSource.

Signed-off-by: Markus Lehtonen <markus.lehtonen@linux.intel.com>
10 years agoUpstreamSource.pack: support prefix mangling
Markus Lehtonen [Thu, 14 Jun 2012 16:30:26 +0000 (19:30 +0300)]
UpstreamSource.pack: support prefix mangling

Add support for changing the prefix directory inside the tarball that is
generated. Also, fixes a bug that caused a "prefix-less" tarball to get
one, if unpacked and then repacked.

Also, adds this support to repack_source() in common/import_orig.

Signed-off-by: Markus Lehtonen <markus.lehtonen@linux.intel.com>