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