Move get_compression() out of pkg.PkgPolicy class

Renames the function to parse_archive_filename() and changes it's
return values. Filename parsing is merely generic functionality, not
tied to any packaging policy.

The function 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>
Fix typos
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>
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>
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>
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>

Conflicts:
	gbp/pkg/__init__.py
Make pychecker happy

We don't use the class variable anywhere
Introduce rpm helpers

Implements a new gbp.rpm module that contains functionality for e.g.
parsing and editing spec files, reading src.rpm files rpm-specific
packaging policy etc.

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>
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>
Introduce git-import-srpm tool

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

Signed-off-by: Markus Lehtonen <markus.lehtonen@linux.intel.com>
Signed-off-by: Ed Bartosh <eduard.bartosh@intel.com>
Pass --no-pristine-tar to SRPM compnent tests

to avoid pristine-tar showing up in the matched branches
import-srpm: add 'vendor' config option

Intended to represent the distribution vendor (e.g. 'Debian').
Currently, this can be used in tag format strings.

NOTE: the vendor name is converted to lowercase when used in tag names.

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

Currently only including "gbp import-srpm"
tests: add tests for UpstreamSource.guess_version()

Signed-off-by: Markus Lehtonen <markus.lehtonen@linux.intel.com>
import-srpm: support --upstream-vcs-tag cmdline option

Similar to what the option does in git-import-orig-[rpm].

Signed-off-by: Markus Lehtonen <markus.lehtonen@linux.intel.com>
WIP: 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>
UpstreamSource.guess_version: recognise debian native tarballs

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