PristineTar: move Debian-specific stuff to DebianPristineTar

Continuation to the PristineTar refactoring, makes the "common"
PristineTar independent of DebianPkgPolicy. This commit moves the
Debian-specific has_commit() and checkout() methods to DebianPristineTar
class and replaces them with more generic functions in the base class.
Also, drops the Debian-specific get_commit() method completely, as it
was not used outside the PristineTar class itself.

Signed-off-by: Markus Lehtonen <markus.lehtonen@linux.intel.com>
common/pq: use strip in apply_and_commit_patch()

Use the strip information of the patch when applying patches. Also,
changes GitRepository.apply_patch() to accept integer values as 'strip'
argument.

Signed-off-by: Markus Lehtonen <markus.lehtonen@linux.intel.com>
deb.git: Fixed typo in method name

Signed-off-by: Ed Bartosh <eduard.bartosh@intel.com>
GitRepository.find_tag: change deprecated _git_getoutput to _git_inout

Signed-off-by: Ed Bartosh <eduard.bartosh@intel.com>
Signed-off-by: Markus Lehtonen <markus.lehtonen@linux.intel.com>
GitRepository/get_commit_info: Add author timestamp to the info

Signed-off-by: Ed Bartosh <eduard.bartosh@intel.com>
Signed-off-by: Markus Lehtonen <markus.lehtonen@linux.intel.com>
GitRepository/get_commit_info: Add commit timestamp

Signed-off-by: Markus Lehtonen <markus.lehtonen@linux.intel.com>
GitRepository/rev_parse: introduced new parameter opt_args

Enables passing user-defined options to rev_parse().

Signed-off-by: Ed Bartosh <eduard.bartosh@intel.com>
GitRepository: fix merge() for older git versions

Adds a new method for getting the version of git suite (i.e. git utils)
installed on the OS running gbp.

Utilize the new function in GitRepository.merge() to not give
edit/no-edit option for older versions of git-merge, that don't support
it. Fixes a regression (with git-version < 1.7.8) caused by commit
f3aa87fa0361a.

Signed-off-by: Markus Lehtonen <markus.lehtonen@linux.intel.com>
GitRepository: option to ignore untracked in is_clean()

Add an option to ignore untracked files when checking if the repository
is clean.

Signed-off-by: Markus Lehtonen <markus.lehtonen@linux.intel.com>
gbp.git: Reimplement rfc822 date parsing without dateutil

In order to get rid of dependency to dateutil.

Signed-off-by: Ed Bartosh <eduard.bartosh@intel.com>
Signed-off-by: Markus Lehtonen <markus.lehtonen@linux.intel.com>
common/buildpackage: support for different archive formats

Adds support for defining the archive format of the output of
git_archive_single(), e.g. 'zip'. Defaults to 'tar', as before.

Signed-off-by: Ed Bartosh <eduard.bartosh@intel.com>
Signed-off-by: Markus Lehtonen <markus.lehtonen@linux.intel.com>
import-orig: refactor args of symlink_orig()

Add call arg to define the (formerly hard-coded) tarball basename in
symlink_orig(). In other words, this controls the name by which the
tarball is stored in pristine-tar branch.

This change makes symlink_orig() re-usable in the upcoming RPM-tools.

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>
docs: enable building html docs with docbook2html

This is useful if sgml2x package is not available.

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>