common/buildpackage: fix handling of empty tarball prefix

Previously empty prefix in tarball generation introduced a leading slash
in all filenames in the archive.

Signed-off-by: Markus Lehtonen <markus.lehtonen@linux.intel.com>
GitRepository.diff: add 'ignore_submodules' option

Signed-off-by: Markus Lehtonen <markus.lehtonen@linux.intel.com>
pq: rewrite patch export functionality

Use our own function for constructing the patch files instead of using
the format-patch command of git. This way, we get the desired output
format directly, without the need for the error-prone "format-patch,
parse patch files, mangle and re-write patch files" cycle.

Signed-off-by: Markus Lehtonen <markus.lehtonen@linux.intel.com>
pq: don't overwrite patches in the same series

Fix patch naming in patch generation when '--no-patch-numbers' is used.
Previously, multiple commits with the same subject resulted in multiple
patches having the same filename. This lead into broken series with
missing patches as patch files were overwritten by the topmost commit.

Signed-off-by: Markus Lehtonen <markus.lehtonen@linux.intel.com>
pq: pass commit_info to format_patch()

Signed-off-by: Markus Lehtonen <markus.lehtonen@linux.intel.com>
pq.format_patch: support file path filtering

Implements a filter option that allows filtering 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.

Signed-off-by: Markus Lehtonen <markus.lehtonen@linux.intel.com>
pq: properly generate non-ascii patch files

Encode non-ascii email headers properly. Also, set MIME headers
correctly for the message body if the commit message body contains
non-ascii characters.

The reason for constructing the message in a little bit "clumsy" way is
the intention is to match the output of git-format-patch as closely as
possible.

Signed-off-by: Markus Lehtonen <markus.lehtonen@linux.intel.com>
pq: support patch-export commands

Support giving commands to pq as a meta tag in commit message. The
format is "Gbp: <command> [args]".

Currently, only one command is supported. namely 'ignore'. That is, one
can use 'Gbp: Ignore' in the commit message for ignoring the commit in
patch-generation.

Signed-off-by: Markus Lehtonen <markus.lehtonen@linux.intel.com>
pq: add format_diff() function

For generating a patch file from a diff between two arbitrary commits.

Signed-off-by: Markus Lehtonen <markus.lehtonen@linux.intel.com>
pq: listen to 'Gbp-Pq:' commands, too

Signed-off-by: Markus Lehtonen <markus.lehtonen@linux.intel.com>
pq: support 'Topic' patch-export command

Topic can be defined with either 'Gbp: Topic <topic>' or 'Gbp-Pq: Topic
<topic>' in the commit message.

This is to replace the "gbp-pq-topic: <topic>" command.

Signed-off-by: Markus Lehtonen <markus.lehtonen@linux.intel.com>
pq: deprecate the usage of 'gbp-pq-topic:'

Replaced by the "Gbp[-Pq]: Topic <topic>" command.

Signed-off-by: Markus Lehtonen <markus.lehtonen@linux.intel.com>
GitRepository: drop unused format_patch method

Signed-off-by: Markus Lehtonen <markus.lehtonen@linux.intel.com>
GbpOptionParser: allow using the default 'dest' attribute

Make it possible to add options without explicitly defining the 'dest'
attribute - in which case the default of OptionParser is used.

Signed-off-by: Markus Lehtonen <markus.lehtonen@linux.intel.com>
GitRepository.list_tree: add 'paths' option

Change-Id: I9331fec6fcd0e58dad7cb4a571a683e09ce08011
Signed-off-by: Markus Lehtonen <markus.lehtonen@linux.intel.com>
GitRepository.push: Add 'force' option

Signed-off-by: Lingchaox Xin <lingchaox.xin@intel.com>
Signed-off-by: Markus Lehtonen <markus.lehtonen@linux.intel.com>
GitRepository.push: Add 'tags' option

Signed-off-by: Lingchaox Xin <lingchaox.xin@intel.com>
Signed-off-by: Markus Lehtonen <markus.lehtonen@linux.intel.com>
GitRepository.pull: Add 'all_remotes' option

Also changes the method to utilize the GitArgs class.

Signed-off-by: Lingchaox Xin <lingchaox.xin@intel.com>
Signed-off-by: Markus Lehtonen <markus.lehtonen@linux.intel.com>
GitRepository/rev_parse: use _git_inout()

instead of the deprecated _git_getoutput() method.

Signed-off-by: Markus Lehtonen <markus.lehtonen@linux.intel.com>
GitRepository: raise GitRepositoryError instead of GbpError

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