888 lines
21 KiB
Plaintext
888 lines
21 KiB
Plaintext
# rpmi.at: test various aspects of rpm install
|
|
#
|
|
# Copyright (C) 2007 Ralf Corsépius <corsepiu@fedoraproject.org>
|
|
#
|
|
# This program is free software; you can redistribute it and/or modify
|
|
# it under the terms of the GNU General Public License as published by
|
|
# the Free Software Foundation; either version 2 of the License, or
|
|
# (at your option) any later version.
|
|
#
|
|
# This program is distributed in the hope that it will be useful,
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
# GNU General Public License for more details.
|
|
#
|
|
# You should have received a copy of the GNU General Public License
|
|
# along with this program; if not, write to the Free Software
|
|
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
|
|
|
AT_BANNER([RPM install tests])
|
|
|
|
AT_SETUP([rpm -U <manifest>])
|
|
AT_KEYWORDS([install])
|
|
AT_CHECK([
|
|
RPMDB_INIT
|
|
|
|
echo /data/RPMS/hello-2.0-1.x86_64.rpm > ${RPMTEST}/tmp/test.mft
|
|
runroot rpm -U --ignorearch --ignoreos --nodeps \
|
|
/tmp/test.mft
|
|
],
|
|
[0],
|
|
[],
|
|
[])
|
|
AT_CLEANUP
|
|
|
|
AT_SETUP([rpm -U <manifest notfound 1>])
|
|
AT_KEYWORDS([install])
|
|
AT_CHECK([
|
|
RPMDB_INIT
|
|
|
|
echo /data/RPMS/hello-2.0-1.x86_64.rpm > ${RPMTEST}/tmp/test.mft
|
|
runroot rpm -U --ignorearch --ignoreos --nodeps \
|
|
/tmp/test-not-there.mft
|
|
],
|
|
[1],
|
|
[],
|
|
[error: open of /tmp/test-not-there.mft failed: No such file or directory
|
|
])
|
|
AT_CLEANUP
|
|
|
|
AT_SETUP([rpm -U <manifest notfound 2>])
|
|
AT_KEYWORDS([install])
|
|
AT_CHECK([
|
|
RPMDB_INIT
|
|
|
|
echo /data/RPMS/hello-not-there-2.0-1.x86_64.rpm > ${RPMTEST}/tmp/test.mft
|
|
runroot rpm -U --ignorearch --ignoreos --nodeps \
|
|
/tmp/test.mft
|
|
],
|
|
[1],
|
|
[],
|
|
[error: open of /data/RPMS/hello-not-there-2.0-1.x86_64.rpm failed: No such file or directory
|
|
])
|
|
AT_CLEANUP
|
|
|
|
AT_SETUP([rpm -U <notfound>])
|
|
AT_KEYWORDS([install])
|
|
AT_CHECK([
|
|
RPMDB_INIT
|
|
|
|
runroot rpm -U --ignorearch --ignoreos --nodeps \
|
|
/data/RPMS/hello-not-there-2.0-1.x86_64.rpm
|
|
],
|
|
[1],
|
|
[],
|
|
[error: open of /data/RPMS/hello-not-there-2.0-1.x86_64.rpm failed: No such file or directory
|
|
])
|
|
AT_CLEANUP
|
|
|
|
AT_SETUP([rpm -U <unsigned 1>])
|
|
AT_KEYWORDS([install])
|
|
AT_CHECK([
|
|
RPMDB_INIT
|
|
|
|
runroot rpm -U --ignorearch --ignoreos --nodeps \
|
|
/data/RPMS/hello-2.0-1.x86_64.rpm
|
|
],
|
|
[0],
|
|
[],
|
|
[])
|
|
AT_CLEANUP
|
|
|
|
AT_SETUP([rpm -U <unsigned 2>])
|
|
AT_KEYWORDS([install])
|
|
AT_CHECK([
|
|
RPMDB_INIT
|
|
|
|
runroot rpm -U --ignorearch --ignoreos --nodeps \
|
|
--define "_pkgverify_level signature" \
|
|
/data/RPMS/hello-2.0-1.x86_64.rpm
|
|
],
|
|
[1],
|
|
[],
|
|
[ package hello-2.0-1.x86_64 does not verify: no signature
|
|
])
|
|
AT_CLEANUP
|
|
|
|
AT_SETUP([rpm -U <corrupted unsigned 1>])
|
|
AT_KEYWORDS([install])
|
|
AT_CHECK([
|
|
RPMDB_INIT
|
|
|
|
pkg="hello-2.0-1.x86_64.rpm"
|
|
cp "${RPMTEST}"/data/RPMS/${pkg} "${RPMTEST}"/tmp/${pkg}
|
|
dd if=/dev/zero of="${RPMTEST}"/tmp/${pkg} \
|
|
conv=notrunc bs=1 seek=5555 count=6 2> /dev/null
|
|
|
|
echo "INSTALL 1"
|
|
runroot rpm -U --ignorearch --ignoreos --nodeps --nodigest \
|
|
--define "_pkgverify_level none" \
|
|
/tmp/${pkg} 2>&1 | sed -e 's/;.*$//g'
|
|
echo "INSTALL 2"
|
|
runroot rpm -U --ignorearch --ignoreos --nodeps \
|
|
--define "_pkgverify_level digest" \
|
|
/tmp/${pkg} 2>&1
|
|
echo "INSTALL 3"
|
|
runroot rpm -U --ignorearch --ignoreos --nodeps \
|
|
--define "_pkgverify_flags 0x30300" \
|
|
--define "__vsflags 0x30300" \
|
|
--define "_pkgverify_level digest" \
|
|
/tmp/${pkg} 2>&1
|
|
echo "INSTALL 4"
|
|
runroot rpm -U --ignorearch --ignoreos --nodeps --nodigest --noverify \
|
|
--define "_pkgverify_level digest" \
|
|
/tmp/${pkg} 2>&1 | sed -e 's/;.*$//g'
|
|
],
|
|
[0],
|
|
[INSTALL 1
|
|
error: unpacking of archive failed on file /usr/share/doc/hello-2.0/COPYING
|
|
error: hello-2.0-1.x86_64: install failed
|
|
INSTALL 2
|
|
error: /tmp/hello-2.0-1.x86_64.rpm: Header SHA256 digest: BAD (Expected ef920781af3bf072ae9888eec3de1c589143101dff9cc0b561468d395fb766d9 != 29fdfe92782fb0470a9a164a6c94af87d3b138c63b39d4c30e0223ca1202ba82)
|
|
error: /tmp/hello-2.0-1.x86_64.rpm: Header SHA1 digest: BAD (Expected 5cd9874c510b67b44483f9e382a1649ef7743bac != 4261b2c1eb861a4152c2239bce20bfbcaa8971ba)
|
|
error: /tmp/hello-2.0-1.x86_64.rpm cannot be installed
|
|
INSTALL 3
|
|
package hello-2.0-1.x86_64 does not verify: no digest
|
|
INSTALL 4
|
|
error: unpacking of archive failed on file /usr/share/doc/hello-2.0/COPYING
|
|
error: hello-2.0-1.x86_64: install failed
|
|
],
|
|
[])
|
|
AT_CLEANUP
|
|
|
|
AT_SETUP([rpm -U <corrupted unsigned 2>])
|
|
AT_KEYWORDS([install])
|
|
AT_CHECK([
|
|
RPMDB_INIT
|
|
|
|
pkg="hello-2.0-1.x86_64.rpm"
|
|
cp "${RPMTEST}"/data/RPMS/${pkg} "${RPMTEST}"/tmp/${pkg}
|
|
dd if=/dev/zero of="${RPMTEST}"/tmp/${pkg} \
|
|
conv=notrunc bs=1 seek=7777 count=6 2> /dev/null
|
|
|
|
echo "INSTALL 1"
|
|
runroot rpm -U --ignorearch --ignoreos --nodeps \
|
|
--define "_pkgverify_level none" \
|
|
/tmp/${pkg} 2>&1
|
|
echo "INSTALL 2"
|
|
runroot rpm -U --ignorearch --ignoreos --nodeps \
|
|
--define "_pkgverify_level digest" \
|
|
/tmp/${pkg} 2>&1
|
|
echo "INSTALL 3"
|
|
runroot rpm -U --ignorearch --ignoreos --nodeps \
|
|
--define "_pkgverify_flags 0x30300" \
|
|
--define "_pkgverify_level digest" \
|
|
/tmp/${pkg} 2>&1
|
|
echo "INSTALL 4"
|
|
runroot rpm -U --ignorearch --ignoreos --nodeps --nodigest --noverify \
|
|
--define "_pkgverify_level digest" \
|
|
/tmp/${pkg} 2>&1
|
|
],
|
|
[1],
|
|
[INSTALL 1
|
|
error: unpacking of archive failed: cpio: Bad magic
|
|
error: hello-2.0-1.x86_64: install failed
|
|
INSTALL 2
|
|
package hello-2.0-1.x86_64 does not verify: Payload SHA256 digest: BAD (Expected 84a7338287bf19715c4eed0243f5cdb447eeb0ade37b2af718d4060aefca2f7c != bea903609dceac36e1f26a983c493c98064d320fdfeb423034ed63d649b2c8dc)
|
|
INSTALL 3
|
|
package hello-2.0-1.x86_64 does not verify: no digest
|
|
INSTALL 4
|
|
error: unpacking of archive failed: cpio: Bad magic
|
|
error: hello-2.0-1.x86_64: install failed
|
|
],
|
|
[])
|
|
AT_CLEANUP
|
|
|
|
AT_SETUP([rpm -U <signed nokey 1>])
|
|
AT_KEYWORDS([install])
|
|
AT_CHECK([
|
|
RPMDB_INIT
|
|
|
|
runroot rpm -U --ignorearch --ignoreos --nodeps \
|
|
/data/RPMS/hello-2.0-1.x86_64-signed.rpm
|
|
],
|
|
[0],
|
|
[],
|
|
[warning: /data/RPMS/hello-2.0-1.x86_64-signed.rpm: Header V4 RSA/SHA256 Signature, key ID 1964c5fc: NOKEY
|
|
])
|
|
AT_CLEANUP
|
|
|
|
AT_SETUP([rpm -U <signed nokey 2>])
|
|
AT_KEYWORDS([install])
|
|
AT_CHECK([
|
|
RPMDB_INIT
|
|
|
|
runroot rpm -U --ignorearch --ignoreos --nodeps \
|
|
--define "_pkgverify_level signature" \
|
|
/data/RPMS/hello-2.0-1.x86_64-signed.rpm
|
|
],
|
|
[1],
|
|
[],
|
|
[warning: /data/RPMS/hello-2.0-1.x86_64-signed.rpm: Header V4 RSA/SHA256 Signature, key ID 1964c5fc: NOKEY
|
|
package hello-2.0-1.x86_64 does not verify: Header V4 RSA/SHA256 Signature, key ID 1964c5fc: NOKEY
|
|
])
|
|
AT_CLEANUP
|
|
|
|
AT_SETUP([rpm -U <signed 1>])
|
|
AT_KEYWORDS([install])
|
|
AT_CHECK([
|
|
RPMDB_INIT
|
|
|
|
runroot rpmkeys --import /data/keys/rpm.org-rsa-2048-test.pub
|
|
runroot rpm -U --ignorearch --ignoreos --nodeps \
|
|
/data/RPMS/hello-2.0-1.x86_64-signed.rpm
|
|
],
|
|
[0],
|
|
[],
|
|
[])
|
|
AT_CLEANUP
|
|
|
|
AT_SETUP([rpm -U <signed 2>])
|
|
AT_KEYWORDS([install])
|
|
AT_CHECK([
|
|
RPMDB_INIT
|
|
|
|
runroot rpmkeys --import /data/keys/rpm.org-rsa-2048-test.pub
|
|
runroot rpm -U --ignorearch --ignoreos --nodeps \
|
|
--define "_pkgverify_level signature" \
|
|
/data/RPMS/hello-2.0-1.x86_64-signed.rpm
|
|
],
|
|
[0],
|
|
[],
|
|
[])
|
|
AT_CLEANUP
|
|
|
|
AT_SETUP([rpm -U <corrupted signed 1>])
|
|
AT_KEYWORDS([install])
|
|
AT_CHECK([
|
|
RPMDB_INIT
|
|
|
|
pkg="hello-2.0-1.x86_64-signed.rpm"
|
|
cp "${RPMTEST}"/data/RPMS/${pkg} "${RPMTEST}"/tmp/${pkg}
|
|
dd if=/dev/zero of="${RPMTEST}"/tmp/${pkg} \
|
|
conv=notrunc bs=1 seek=264 count=2 2> /dev/null
|
|
|
|
runroot rpm -U --ignorearch --ignoreos --nodeps \
|
|
/tmp/${pkg}
|
|
],
|
|
[1],
|
|
[],
|
|
[error: /tmp/hello-2.0-1.x86_64-signed.rpm: Header RSA signature: BAD (package tag 268: invalid OpenPGP signature)
|
|
error: /tmp/hello-2.0-1.x86_64-signed.rpm cannot be installed
|
|
])
|
|
AT_CLEANUP
|
|
|
|
AT_SETUP([rpm -U <corrupted signed 2>])
|
|
AT_KEYWORDS([install])
|
|
AT_CHECK([
|
|
RPMDB_INIT
|
|
|
|
pkg="hello-2.0-1.x86_64-signed.rpm"
|
|
cp "${RPMTEST}"/data/RPMS/${pkg} "${RPMTEST}"/tmp/${pkg}
|
|
dd if=/dev/zero of="${RPMTEST}"/tmp/${pkg} \
|
|
conv=notrunc bs=1 seek=5555 count=6 2> /dev/null
|
|
|
|
runroot rpm -U --ignorearch --ignoreos --nodeps \
|
|
/tmp/${pkg}
|
|
],
|
|
[1],
|
|
[],
|
|
[error: /tmp/hello-2.0-1.x86_64-signed.rpm: Header V4 RSA/SHA256 Signature, key ID 1964c5fc: BAD
|
|
error: /tmp/hello-2.0-1.x86_64-signed.rpm: Header SHA256 digest: BAD (Expected ef920781af3bf072ae9888eec3de1c589143101dff9cc0b561468d395fb766d9 != 29fdfe92782fb0470a9a164a6c94af87d3b138c63b39d4c30e0223ca1202ba82)
|
|
error: /tmp/hello-2.0-1.x86_64-signed.rpm: Header SHA1 digest: BAD (Expected 5cd9874c510b67b44483f9e382a1649ef7743bac != 4261b2c1eb861a4152c2239bce20bfbcaa8971ba)
|
|
error: /tmp/hello-2.0-1.x86_64-signed.rpm cannot be installed
|
|
])
|
|
AT_CLEANUP
|
|
|
|
AT_SETUP([rpm -U <corrupted signed 3>])
|
|
AT_KEYWORDS([install])
|
|
AT_CHECK([
|
|
RPMDB_INIT
|
|
|
|
pkg="hello-2.0-1.x86_64-signed.rpm"
|
|
cp "${RPMTEST}"/data/RPMS/${pkg} "${RPMTEST}"/tmp/${pkg}
|
|
dd if=/dev/zero of="${RPMTEST}"/tmp/${pkg} \
|
|
conv=notrunc bs=1 seek=7711 count=6 2> /dev/null
|
|
|
|
echo "INSTALL 1"
|
|
runroot rpm -U --ignorearch --ignoreos --nodeps \
|
|
--define "_pkgverify_level none" \
|
|
/tmp/${pkg} 2>&1
|
|
|
|
echo "INSTALL 2"
|
|
runroot rpm -U --ignorearch --ignoreos --nodeps --nosignature \
|
|
--define "_pkgverify_level none" \
|
|
/tmp/${pkg} 2>&1
|
|
|
|
echo "INSTALL 3"
|
|
runroot rpm -U --ignorearch --ignoreos --nodeps \
|
|
--define "_pkgverify_level signature" \
|
|
/tmp/${pkg} 2>&1
|
|
|
|
echo "INSTALL 4"
|
|
runroot rpm -U --ignorearch --ignoreos --nodeps \
|
|
--define "_pkgverify_flags 0xc0c00" \
|
|
--define "__vsflags 0xc0c00" \
|
|
--define "_pkgverify_level signature" \
|
|
/tmp/${pkg} 2>&1
|
|
|
|
echo "INSTALL 5"
|
|
runroot rpm -U --ignorearch --ignoreos --nodeps --noverify \
|
|
--define "_pkgverify_level signature" \
|
|
/tmp/${pkg} 2>&1
|
|
],
|
|
[1],
|
|
[INSTALL 1
|
|
warning: /tmp/hello-2.0-1.x86_64-signed.rpm: Header V4 RSA/SHA256 Signature, key ID 1964c5fc: NOKEY
|
|
error: unpacking of archive failed: cpio: Bad magic
|
|
error: hello-2.0-1.x86_64: install failed
|
|
INSTALL 2
|
|
error: unpacking of archive failed: cpio: Bad magic
|
|
error: hello-2.0-1.x86_64: install failed
|
|
INSTALL 3
|
|
warning: /tmp/hello-2.0-1.x86_64-signed.rpm: Header V4 RSA/SHA256 Signature, key ID 1964c5fc: NOKEY
|
|
package hello-2.0-1.x86_64 does not verify: Header V4 RSA/SHA256 Signature, key ID 1964c5fc: NOKEY
|
|
INSTALL 4
|
|
package hello-2.0-1.x86_64 does not verify: no signature
|
|
INSTALL 5
|
|
warning: /tmp/hello-2.0-1.x86_64-signed.rpm: Header V4 RSA/SHA256 Signature, key ID 1964c5fc: NOKEY
|
|
error: unpacking of archive failed: cpio: Bad magic
|
|
error: hello-2.0-1.x86_64: install failed
|
|
],
|
|
[])
|
|
AT_CLEANUP
|
|
|
|
# ------------------------------
|
|
# Check if rpm -U *.src.rpm works
|
|
AT_SETUP([rpm -U *.src.rpm])
|
|
AT_KEYWORDS([install])
|
|
AT_CHECK([
|
|
RPMDB_INIT
|
|
rm -rf ${TOPDIR}
|
|
|
|
runroot rpm \
|
|
-U /data/SRPMS/hello-1.0-1.src.rpm
|
|
],
|
|
[0],
|
|
[ignore],
|
|
[ignore])
|
|
AT_CLEANUP
|
|
|
|
# ------------------------------
|
|
# Check if rpm -i *.src.rpm works
|
|
AT_SETUP([rpm -i *.src.rpm])
|
|
AT_KEYWORDS([install])
|
|
AT_CHECK([
|
|
RPMDB_INIT
|
|
rm -rf ${TOPDIR}
|
|
|
|
runroot rpm \
|
|
-i /data/SRPMS/hello-1.0-1.src.rpm
|
|
],
|
|
[0],
|
|
[ignore],
|
|
[ignore])
|
|
AT_CLEANUP
|
|
|
|
# ------------------------------
|
|
# Various error behavior tests
|
|
#
|
|
AT_SETUP([rpm -i <nonexistent file>])
|
|
AT_KEYWORDS([install])
|
|
AT_CHECK([
|
|
RPMDB_INIT
|
|
runroot rpm \
|
|
-i no_such_file
|
|
],
|
|
[1],
|
|
[],
|
|
[error: open of no_such_file failed: No such file or directory
|
|
])
|
|
AT_CLEANUP
|
|
|
|
AT_SETUP([rpm -i --nomanifest <garbage text file>])
|
|
AT_KEYWORDS([install])
|
|
AT_CHECK([
|
|
RPMDB_INIT
|
|
junk="${RPMTEST}/textfile"
|
|
cat << EOF > "${junk}"
|
|
no_such.file
|
|
not_an.rpm
|
|
EOF
|
|
|
|
runroot rpm \
|
|
-Uv --nomanifest /textfile
|
|
],
|
|
[1],
|
|
[],
|
|
[error: /textfile cannot be installed
|
|
])
|
|
AT_CLEANUP
|
|
|
|
AT_SETUP([rpm -i <garbage text file])
|
|
AT_KEYWORDS([install])
|
|
AT_CHECK([
|
|
RPMDB_INIT
|
|
junk="${RPMTEST}/not_an.rpm"
|
|
cat << EOF > "${junk}"
|
|
no_such.file
|
|
not_pkg.rpm
|
|
EOF
|
|
|
|
runroot rpm \
|
|
-Uv /not_an.rpm
|
|
],
|
|
[2],
|
|
[],
|
|
[error: open of no_such.file failed: No such file or directory
|
|
error: open of not_pkg.rpm failed: No such file or directory
|
|
])
|
|
AT_CLEANUP
|
|
|
|
# ------------------------------
|
|
AT_SETUP([rpm upgrade/downgrade])
|
|
RPMDB_INIT
|
|
|
|
for v in "1.0" "2.0"; do
|
|
runroot rpmbuild --quiet -bb \
|
|
--define "ver $v" \
|
|
/data/SPECS/versiontest.spec
|
|
done
|
|
|
|
# Test normal upgrade
|
|
AT_CHECK([
|
|
RPMDB_INIT
|
|
runroot rpm -U /build/RPMS/noarch/versiontest-1.0-1.noarch.rpm
|
|
runroot rpm -U /build/RPMS/noarch/versiontest-2.0-1.noarch.rpm
|
|
runroot rpm -q versiontest
|
|
],
|
|
[0],
|
|
[versiontest-2.0-1.noarch
|
|
],
|
|
[])
|
|
|
|
# Test upgrading to older package (should fail)
|
|
AT_CHECK([
|
|
RPMDB_INIT
|
|
|
|
runroot rpm -U /build/RPMS/noarch/versiontest-2.0-1.noarch.rpm
|
|
runroot rpm -U /build/RPMS/noarch/versiontest-1.0-1.noarch.rpm
|
|
],
|
|
[2],
|
|
[],
|
|
[ package versiontest-2.0-1.noarch (which is newer than versiontest-1.0-1.noarch) is already installed
|
|
])
|
|
|
|
# Test downgrading to older package with --oldpackage
|
|
AT_CHECK([
|
|
RPMDB_INIT
|
|
|
|
runroot rpm -U /build/RPMS/noarch/versiontest-2.0-1.noarch.rpm
|
|
runroot rpm -U --oldpackage /build/RPMS/noarch/versiontest-1.0-1.noarch.rpm
|
|
runroot rpm -q versiontest
|
|
],
|
|
[0],
|
|
[versiontest-1.0-1.noarch
|
|
],
|
|
[ignore])
|
|
|
|
# Test upgrade of different versions in same transaction
|
|
AT_CHECK([
|
|
RPMDB_INIT
|
|
|
|
runroot rpm -Uv \
|
|
/build/RPMS/noarch/versiontest-1.0-1.noarch.rpm \
|
|
/build/RPMS/noarch/versiontest-2.0-1.noarch.rpm
|
|
runroot rpm -q versiontest
|
|
],
|
|
[0],
|
|
[Verifying packages...
|
|
Preparing packages...
|
|
versiontest-2.0-1.noarch
|
|
versiontest-2.0-1.noarch
|
|
],
|
|
[warning: package versiontest-1.0-1.noarch was already added, replacing with versiontest-2.0-1.noarch
|
|
])
|
|
|
|
# Test upgrade of different versions in same transaction
|
|
AT_CHECK([
|
|
RPMDB_INIT
|
|
|
|
runroot rpm -Uv \
|
|
/build/RPMS/noarch/versiontest-2.0-1.noarch.rpm \
|
|
/build/RPMS/noarch/versiontest-1.0-1.noarch.rpm
|
|
runroot rpm -q versiontest
|
|
],
|
|
[0],
|
|
[Verifying packages...
|
|
Preparing packages...
|
|
versiontest-2.0-1.noarch
|
|
versiontest-2.0-1.noarch
|
|
],
|
|
[warning: package versiontest-2.0-1.noarch was already added, skipping versiontest-1.0-1.noarch
|
|
])
|
|
|
|
# Test install of two different versions in same transaction
|
|
AT_CHECK([
|
|
RPMDB_INIT
|
|
|
|
runroot rpm -i \
|
|
/build/RPMS/noarch/versiontest-1.0-1.noarch.rpm \
|
|
/build/RPMS/noarch/versiontest-2.0-1.noarch.rpm
|
|
runroot rpm -q versiontest
|
|
],
|
|
[0],
|
|
[versiontest-2.0-1.noarch
|
|
versiontest-1.0-1.noarch
|
|
],
|
|
[])
|
|
|
|
# Test install of two different versions in same transaction
|
|
# TODO: test only one was installed
|
|
AT_CHECK([
|
|
RPMDB_INIT
|
|
|
|
runroot rpm -i \
|
|
/build/RPMS/noarch/versiontest-1.0-1.noarch.rpm \
|
|
/build/RPMS/noarch/versiontest-1.0-1.noarch.rpm
|
|
runroot rpm -q versiontest
|
|
],
|
|
[0],
|
|
[versiontest-1.0-1.noarch
|
|
],
|
|
[])
|
|
# TODO: the same with epoch vs no epoch
|
|
AT_CLEANUP
|
|
|
|
AT_SETUP([rpm -U obsoleted packages])
|
|
AT_KEYWORDS([install obsolete])
|
|
RPMDB_INIT
|
|
runroot rpmbuild --quiet -bb \
|
|
--define "pkg one" \
|
|
--define "obs deptest-two <= 1.0" \
|
|
/data/SPECS/deptest.spec
|
|
runroot rpmbuild --quiet -bb \
|
|
--define "pkg two" \
|
|
/data/SPECS/deptest.spec
|
|
|
|
# Test upgrade of obsoleted package in same transaction
|
|
AT_CHECK([
|
|
RPMDB_INIT
|
|
|
|
runroot rpm -Uv \
|
|
/build/RPMS/noarch/deptest-two-1.0-1.noarch.rpm \
|
|
/build/RPMS/noarch/deptest-one-1.0-1.noarch.rpm
|
|
runroot rpm -q deptest-one
|
|
],
|
|
[0],
|
|
[Verifying packages...
|
|
Preparing packages...
|
|
deptest-one-1.0-1.noarch
|
|
deptest-one-1.0-1.noarch
|
|
],
|
|
[warning: package deptest-two-1.0-1.noarch was already added, replacing with deptest-one-1.0-1.noarch
|
|
])
|
|
|
|
# Test upgrade of obsoleted package in same transaction
|
|
AT_CHECK([
|
|
RPMDB_INIT
|
|
|
|
runroot rpm -Uv \
|
|
/build/RPMS/noarch/deptest-one-1.0-1.noarch.rpm \
|
|
/build/RPMS/noarch/deptest-two-1.0-1.noarch.rpm
|
|
runroot rpm -q deptest-one
|
|
],
|
|
[0],
|
|
[Verifying packages...
|
|
Preparing packages...
|
|
deptest-one-1.0-1.noarch
|
|
deptest-one-1.0-1.noarch
|
|
],
|
|
[warning: package deptest-one-1.0-1.noarch was already added, skipping deptest-two-1.0-1.noarch
|
|
])
|
|
AT_CLEANUP
|
|
|
|
AT_SETUP([rpm -U with invalid --relocate])
|
|
AT_KEYWORDS([install relocate])
|
|
AT_CHECK([
|
|
RPMDB_INIT
|
|
|
|
runroot rpmbuild --quiet -bb /data/SPECS/hello-script.spec
|
|
|
|
runroot rpm -U --test --ignoreos --relocate /usr=/opt \
|
|
/build/RPMS/noarch/hello-script-1.0-1.noarch.rpm
|
|
],
|
|
[1],
|
|
[],
|
|
[ path /usr in package hello-script-1.0-1.noarch is not relocatable
|
|
])
|
|
AT_CLEANUP
|
|
|
|
AT_SETUP([rpm -U --badreloc with invalid --relocate])
|
|
AT_KEYWORDS([install relocate])
|
|
AT_CHECK([
|
|
RPMDB_INIT
|
|
|
|
runroot rpmbuild --quiet -bb /data/SPECS/hello-script.spec
|
|
|
|
runroot rpm -U --test --ignoreos --badreloc --relocate /usr=/opt \
|
|
/build/RPMS/noarch/hello-script-1.0-1.noarch.rpm
|
|
],
|
|
[0],
|
|
[],
|
|
[])
|
|
AT_CLEANUP
|
|
|
|
AT_SETUP([rpm -i with/without --excludedocs])
|
|
AT_KEYWORDS([install excludedocs])
|
|
AT_CHECK([
|
|
RPMDB_INIT
|
|
|
|
runroot rpmbuild --quiet -bb /data/SPECS/testdoc.spec
|
|
|
|
runroot rpm -i --excludedocs \
|
|
/build/RPMS/noarch/testdoc-1.0-1.noarch.rpm
|
|
|
|
RPM_DOCDIR=$(runroot rpm --eval '%_defaultdocdir')
|
|
RPM_DATADIR=$(runroot rpm --eval '%_datadir')
|
|
|
|
test ! -e ${RPMTEST}${RPM_DOCDIR}/testdoc || exit 1
|
|
test -e ${RPMTEST}${RPM_DATADIR}/testdoc/nodoc || exit 1
|
|
|
|
runroot rpm -e testdoc
|
|
|
|
runroot rpm -i \
|
|
/build/RPMS/noarch/testdoc-1.0-1.noarch.rpm
|
|
test -e ${RPMTEST}${RPM_DOCDIR}/testdoc/documentation1 || exit 1
|
|
test -e ${RPMTEST}${RPM_DOCDIR}/testdoc/documentation2 || exit 1
|
|
test -e ${RPMTEST}${RPM_DOCDIR}/testdoc/examples/example1 || exit 1
|
|
test -e ${RPMTEST}${RPM_DOCDIR}/testdoc/examples/example2 || exit 1
|
|
test -e ${RPMTEST}${RPM_DATADIR}/testdoc/nodoc || exit 1
|
|
|
|
runroot rpm -e testdoc
|
|
],
|
|
[0],
|
|
[],
|
|
[])
|
|
AT_CLEANUP
|
|
|
|
AT_SETUP([rpm -i --excludeartifacts])
|
|
AT_KEYWORDS([install])
|
|
RPMDB_INIT
|
|
runroot rpmbuild --quiet -bb /data/SPECS/vattrtest.spec
|
|
|
|
AT_CHECK([
|
|
RPMDB_INIT
|
|
runroot rpm -i --excludeartifacts /build/RPMS/noarch/vattrtest-1.0-1.noarch.rpm
|
|
test -e ${RPMTEST}/opt/vattrtest/a && exit 1
|
|
runroot rpm -e vattrtest
|
|
runroot rpm -i /build/RPMS/noarch/vattrtest-1.0-1.noarch.rpm
|
|
test -e ${RPMTEST}/opt/vattrtest/a || exit 1
|
|
],
|
|
[0],
|
|
[],
|
|
[])
|
|
AT_CLEANUP
|
|
|
|
AT_SETUP([rpm -U <suicidal>])
|
|
AT_KEYWORDS([install])
|
|
RPMDB_INIT
|
|
|
|
for r in 1 2; do
|
|
runroot rpmbuild -bb --quiet \
|
|
--define "rel ${r}" \
|
|
/data/SPECS/suicidal.spec
|
|
done
|
|
|
|
AT_CHECK([
|
|
RPMDB_INIT
|
|
|
|
for r in 1 2; do
|
|
runroot rpm -U \
|
|
--define "_minimize_writes 0" \
|
|
/build/RPMS/noarch/suicidal-1-${r}.noarch.rpm
|
|
done
|
|
runroot rpm -V --nouser --nogroup suicidal
|
|
],
|
|
[0],
|
|
[],
|
|
[])
|
|
|
|
AT_CHECK([
|
|
RPMDB_INIT
|
|
|
|
for r in 1 2; do
|
|
runroot rpm -U \
|
|
--define "_minimize_writes 1" \
|
|
/build/RPMS/noarch/suicidal-1-${r}.noarch.rpm
|
|
done
|
|
runroot rpm -V --nouser --nogroup suicidal
|
|
],
|
|
[0],
|
|
[],
|
|
[])
|
|
AT_CLEANUP
|
|
|
|
# ------------------------------
|
|
# hardlink tests
|
|
AT_SETUP([rpm -i hardlinks])
|
|
AT_KEYWORDS([build install])
|
|
RPMDB_INIT
|
|
|
|
# Need a reproducable test package
|
|
runroot rpmbuild \
|
|
--define "%optflags -O2 -g" \
|
|
--define "%_target_platform noarch-linux" \
|
|
--define "%_binary_payload w.ufdio" \
|
|
--define "%_buildhost localhost" \
|
|
--define "%use_source_date_epoch_as_buildtime 1" \
|
|
--define "%source_date_epoch_from_changelog 1" \
|
|
--define "%clamp_mtime_to_source_date_epoch 1" \
|
|
--with owned_dir \
|
|
-bb --quiet /data/SPECS/hlinktest.spec
|
|
|
|
pkg="/build/RPMS/noarch/hlinktest-1.0-1.noarch.rpm"
|
|
|
|
cp "${RPMTEST}/${pkg}" "${RPMTEST}/tmp/1.rpm"
|
|
dd if=/dev/zero of="${RPMTEST}/tmp/1.rpm" \
|
|
conv=notrunc bs=1 seek=8180 count=6 2> /dev/null
|
|
|
|
cp "${RPMTEST}/${pkg}" "${RPMTEST}/tmp/2.rpm"
|
|
dd if=/dev/zero of="${RPMTEST}/tmp/2.rpm" \
|
|
conv=notrunc bs=1 seek=8150 count=6 2> /dev/null
|
|
|
|
cp "${RPMTEST}/${pkg}" "${RPMTEST}/tmp/3.rpm"
|
|
dd if=/dev/zero of="${RPMTEST}/tmp/3.rpm" \
|
|
conv=notrunc bs=1 seek=8050 count=6 2> /dev/null
|
|
|
|
AT_CHECK([
|
|
RPMDB_INIT
|
|
runroot rpm -i --noverify /tmp/1.rpm
|
|
# test that nothing of the contents remains after failure
|
|
test -d "${RPMTEST}/foo"
|
|
],
|
|
[1],
|
|
[],
|
|
[error: unpacking of archive failed: cpio: Archive file not in header
|
|
error: hlinktest-1.0-1.noarch: install failed
|
|
])
|
|
|
|
AT_CHECK([
|
|
RPMDB_INIT
|
|
runroot rpm -i --noverify /tmp/2.rpm
|
|
# test that nothing of the contents remains after failure
|
|
test -d "${RPMTEST}/foo"
|
|
],
|
|
[1],
|
|
[],
|
|
[error: unpacking of archive failed: cpio: Bad/unreadable header
|
|
error: hlinktest-1.0-1.noarch: install failed
|
|
])
|
|
|
|
AT_CHECK([
|
|
RPMDB_INIT
|
|
runroot rpm -i --noverify /tmp/3.rpm 2>&1| sed 's/;.*:/:/g'
|
|
# test that nothing of the contents remains after failure
|
|
test -d "${RPMTEST}/foo"
|
|
],
|
|
[1],
|
|
[error: unpacking of archive failed on file /foo/hello-world: Digest mismatch
|
|
error: hlinktest-1.0-1.noarch: install failed
|
|
],
|
|
[])
|
|
|
|
AT_CHECK([
|
|
RPMDB_INIT
|
|
runroot rpm -i /build/RPMS/noarch/hlinktest-1.0-1.noarch.rpm
|
|
runroot rpm -q --qf "[[%{filenlinks} %{filenames}\n]]%{longsize}\n" hlinktest
|
|
ls -i "${RPMTEST}"/foo/hello* | awk {'print $1'} | sort -u | wc -l
|
|
runroot rpm -e hlinktest
|
|
|
|
],
|
|
[0],
|
|
[1 /foo
|
|
2 /foo/aaaa
|
|
1 /foo/copyllo
|
|
4 /foo/hello
|
|
4 /foo/hello-bar
|
|
4 /foo/hello-foo
|
|
4 /foo/hello-world
|
|
2 /foo/zzzz
|
|
87
|
|
1
|
|
],
|
|
[])
|
|
|
|
AT_CHECK([
|
|
RPMDB_INIT
|
|
runroot rpm -i --excludepath=/foo/zzzz /build/RPMS/noarch/hlinktest-1.0-1.noarch.rpm
|
|
runroot rpm -Vv --nogroup --nouser hlinktest
|
|
runroot rpm -e hlinktest
|
|
],
|
|
[0],
|
|
[......... /foo
|
|
......... /foo/aaaa
|
|
......... /foo/copyllo
|
|
......... /foo/hello
|
|
......... /foo/hello-bar
|
|
......... /foo/hello-foo
|
|
......... /foo/hello-world
|
|
......... /foo/zzzz (not installed)
|
|
],
|
|
[])
|
|
|
|
AT_CHECK([
|
|
RPMDB_INIT
|
|
runroot rpm -i --excludepath=/foo/aaaa /build/RPMS/noarch/hlinktest-1.0-1.noarch.rpm
|
|
runroot rpm -Vv --nogroup --nouser hlinktest
|
|
runroot rpm -e hlinktest
|
|
],
|
|
[0],
|
|
[......... /foo
|
|
......... /foo/aaaa (not installed)
|
|
......... /foo/copyllo
|
|
......... /foo/hello
|
|
......... /foo/hello-bar
|
|
......... /foo/hello-foo
|
|
......... /foo/hello-world
|
|
......... /foo/zzzz
|
|
],
|
|
[])
|
|
|
|
AT_CHECK([
|
|
RPMDB_INIT
|
|
runroot rpm -i --excludepath=/foo/aaaa --excludepath=/foo/zzzz /build/RPMS/noarch/hlinktest-1.0-1.noarch.rpm
|
|
runroot rpm -Vv --nogroup --nouser hlinktest
|
|
runroot rpm -e hlinktest
|
|
],
|
|
[0],
|
|
[......... /foo
|
|
......... /foo/aaaa (not installed)
|
|
......... /foo/copyllo
|
|
......... /foo/hello
|
|
......... /foo/hello-bar
|
|
......... /foo/hello-foo
|
|
......... /foo/hello-world
|
|
......... /foo/zzzz (not installed)
|
|
],
|
|
[])
|
|
|
|
AT_CHECK([
|
|
RPMDB_INIT
|
|
runroot rpm -i --excludepath=/foo/hello-foo /build/RPMS/noarch/hlinktest-1.0-1.noarch.rpm
|
|
runroot rpm -Vv --nogroup --nouser hlinktest
|
|
runroot rpm -e hlinktest
|
|
],
|
|
[0],
|
|
[......... /foo
|
|
......... /foo/aaaa
|
|
......... /foo/copyllo
|
|
......... /foo/hello
|
|
......... /foo/hello-bar
|
|
......... /foo/hello-foo (not installed)
|
|
......... /foo/hello-world
|
|
......... /foo/zzzz
|
|
],
|
|
[])
|
|
AT_CLEANUP
|