tests: Add a test case for epoch 0 in rpmdb pkglist

Basically we're choosing the libdnf behavior of omitting `Epoch: 0` which IMO is
the sane thing to do even though in *theory* they're different RPMs but
who would ever ship both without incrementing release/etc?

More information in: https://github.com/projectatomic/rpm-ostree/pull/187

Closes: #1198
Approved by: cgwalters
This commit is contained in:
Colin Walters 2018-01-11 14:02:44 -05:00 committed by Atomic Bot
parent 738fbc633b
commit bc5237ebf8
2 changed files with 11 additions and 2 deletions

View File

@ -385,6 +385,8 @@ get_obj_path() {
# $2+ - optional, treated as directive/value pairs
build_rpm() {
local name=$1; shift
# Unset, not zero https://github.com/projectatomic/rpm-ostree/issues/349
local epoch=""
local version=1.0
local release=1
local arch=x86_64
@ -415,7 +417,7 @@ EOF
echo "Conflicts: $arg" >> $spec;;
post_args)
post_args="$arg";;
version|release|arch|build|install|files|pretrans|pre|post|posttrans)
version|release|epoch|arch|build|install|files|pretrans|pre|post|posttrans)
declare $section="$arg";;
transfiletriggerin)
transfiletriggerin_patterns="$arg";
@ -434,6 +436,7 @@ EOF
cat >> $spec << EOF
Version: $version
Release: $release
${epoch:+Epoch: $epoch}
BuildArch: $arch
%description

View File

@ -59,7 +59,9 @@ assert_file_has_content err.txt "See https://github.com/projectatomic/rpm-ostree
echo "ok failed to install in /opt and /usr/local"
vm_build_rpm foo
# Explicit epoch of 0 as it's a corner case:
# https://github.com/projectatomic/rpm-ostree/issues/349
vm_build_rpm foo epoch 0
vm_rpmostree pkg-add foo-1.0
vm_cmd ostree refs |grep /foo/> refs.txt
pkgref=$(head -1 refs.txt)
@ -71,6 +73,10 @@ rm -f refs.txt refdata.txt
# This will cover things like us failing to break hardlinks for the rpmdb,
# as well as rofiles-fuse
vm_cmd ostree fsck
vm_cmd ostree show --print-metadata-key rpmostree.rpmdb.pkglist \
$(vm_get_deployment_info 0 checksum) > variant-pkglist.txt
# No 0: in EVR
assert_file_has_content_literal 'variant-pkglist.txt' "('foo', '1.0-1', 'x86_64')"
echo "ok pkg-add foo"
vm_reboot