kernel: gitbuilder_pkg_name(), remote_pkg_path()

In preparation for local rpm support, encapsulate package naming.
Using sudo to rm copied/downloaded package is not necessary.

Signed-off-by: Ilya Dryomov <idryomov@redhat.com>
kernel: fix 'sha1: distro' vs per role configs

We may want to setup different kernels for different roles (as long as
all roles on the same node agree on their choice), so returning as soon
as 'distro' is seen is not right.  Also, no need to use find() as
'distro' is always an exact match.

Signed-off-by: Ilya Dryomov <idryomov@redhat.com>
kernel: download_kernel() shouldn't install kernels

Stop using rpm http url capabilities and download packages ourselves.
This keeps the structure the same for both rpms and debs and makes it
possible to fit in local rpm support.  Drop the "rpm already installed"
check for the same reasons.

Signed-off-by: Ilya Dryomov <idryomov@redhat.com>
kernel: get_image_version()

Use 'dpkg-deb -c' for debs instead of rolling our own.

Signed-off-by: Ilya Dryomov <idryomov@redhat.com>
kernel: local rpm support

install_kernel() now takes a path to a package in /tmp and can use
get_image_version() to obtain image version.

Signed-off-by: Ilya Dryomov <idryomov@redhat.com>
kernel: get_latest_image_version_{rpm, deb}()

A bit of refactoring to make things more clear and align distro case
with the rest of the code.  get_version_from_pkg() is renamed to
get_latest_image_version_deb() and get_latest_image_version_rpm() is
introduced to match it.

Signed-off-by: Ilya Dryomov <idryomov@redhat.com>
kernel: maybe_generate_initrd_rpm()

gitbuilder and local packages may not have initrd hooks in them,
depending on how old is the kernel - an appropriate %post section was
added to upstream spec only in 3.12.

Signed-off-by: Ilya Dryomov <idryomov@redhat.com>
kernel: add rpm: key

Add 'rpm:' key to not confuse people with stuff like

  kernel:
    deb: /path/to/foo.rpm

Signed-off-by: Ilya Dryomov <idryomov@redhat.com>