pkg.PkgPolicy: modify get_compression() to return base, archive format and compression

PkgPolicy.get_compression() now returns the base name of the file
(that is, filename without, archive and compression extensions), archive
format and compression method. Adds supported archive formats 'tar' and
'zip' and file extension aliases, e.g. 'tgz'.

Signed-off-by: Markus Lehtonen <markus.lehtonen@linux.intel.com>
import-orig: simplify repack_source() and tmpdir handling

Now a tmpdir is always created and sources are always unpacked into
there.

Signed-off-by: Markus Lehtonen <markus.lehtonen@linux.intel.com>
import-orig: move repacked_tarball_name() out from common

Moves repacked_tarball_name() from scripts/common back to the
Debian-specific script. The logic is too Debian-specific for RPM, after
all.

Signed-off-by: Markus Lehtonen <markus.lehtonen@linux.intel.com>
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>
gbp-pq: move write_patch() back to Debian script

Moves the write_patch() function from the common pq submodule back to
the Debian-specific pq script. It is a bit too Debian-specific: RPM does
not support topics and no need to mangle the patch contents.

Signed-off-by: Markus Lehtonen <markus.lehtonen@linux.intel.com>
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>
gbp-pq: refactor arguments of "apply patch" functions

The upcoming RPM side can't support topics.

Signed-off-by: Markus Lehtonen <markus.lehtonen@linux.intel.com>
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>
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>
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>
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>
Add 'packaging-dir' option to config.py

Needed by the upcoming rpm tools.

Signed-off-by: Markus Lehtonen <markus.lehtonen@linux.intel.com>
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>
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>
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>
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>
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>
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>
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>
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>