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>
GitRepository: fix process cwd in _git_inout()

Signed-off-by: Markus Lehtonen <markus.lehtonen@linux.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: make get_commit_info() more robust

Now uses git-show instead of git-log. This is needed for further
enhancements (namely to get name-status for merge commits). Also, use
null-character as the field separator which makes parsing more reliable.

The method now returns 'body' of the commit message as is, without
stripping or splitting to lines.

In addition, get_commit_info() now uses GitArgs and _git_inout() instead
of the deprecated _git_getoutput().

Signed-off-by: Markus Lehtonen <markus.lehtonen@linux.intel.com>
GitRepository/get_commit_info: Add timestamps

Add author and commit timestamps to the info returned by
get_commit_info() method.

Signed-off-by: Ed Bartosh <eduard.bartosh@intel.com>
Signed-off-by: Markus Lehtonen <markus.lehtonen@linux.intel.com>
GitRepository/get_commit_info: add file status

Add file status and name to the info returned by the get_commit_info()
method.

Signed-off-by: Zhang Qiang <qiang.z.zhang@intel.com>
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>
GitRepository: raise gitRepositoryError instead of passing CommandExecFailed silently

Signed-off-by: Ed Bartosh <eduard.bartosh@intel.com>
GitRepository: Implement status method

Simple wrapper to the git-status command.

Signed-off-by: Ed Bartosh <eduard.bartosh@intel.com>
Signed-off-by: Markus Lehtonen <markus.lehtonen@linux.intel.com>
GitRepository: allow repo inititialization from subdir

This allows initialization of a GitRepository object, even if the
current working directory (or path given to GitRepository) is not the
top level directory of the git repository.

Don't guess the git meta data dir, but, take it as reported by git
itself.

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>
GitRepository: rewrite git_archive()

Add support for filtering. That is, allow the caller to pipe the output
of git-archive through a filter command, usually a compression program.

Don't use of the deprecated _git_getoutput() method. And don't try
to use _git_inout() either, as we're not interested in the output
(stdout) of git-archive, but, merely want redirect it to a file or pipe
to a filter command.

Also, gets rid of the hackish use of 'cwd' option.

The 'output' is now considered to be relative to the caller's cwd, not
the git repo dir. This should be more intuitive.

Signed-off-by: Markus Lehtonen <markus.lehtonen@linux.intel.com>
buildpackage/git_archive_single() use GitRepository.archive()

Use GitRepository.archive() method like git_archive_submodules() does.
This makes it possible to call git_archive_single() independent of the
callers current working directory.

Get rid of the pipe in git_archive_single() and utilize the filter
command in archive() method of GitRepository, instead.

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>
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>