Skip to content

Commit

Permalink
Add tests for HDRID, PKGID and SOURCEPKGID
Browse files Browse the repository at this point in the history
These need to exist and match across source <-> binary in v4 packages,
and must not exist at all in v6 because they are based on obsolete crypto
(SHA1 and MD5) in a way that we can't compatibly change.

Related: #3330
  • Loading branch information
pmatilai authored and dmnks committed Feb 11, 2025
1 parent 8dcb40d commit e1eb246
Showing 1 changed file with 43 additions and 0 deletions.
43 changes: 43 additions & 0 deletions tests/rpmpkgfmt.at
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,33 @@ rpm -qp --qf "%{rpmformat}\n" ${RPMTEST}/build/RPMS/4/noarch/attrtest-1.0-1.noar
],
[])

RPMTEST_CHECK([[
sid=$(rpm -qp --qf "%{pkgid}\n" ${RPMTEST}/build/SRPMS/attrtest-1.0-1.src.rpm)
pid=$(rpm -qp --qf "%{pkgid}\n" ${RPMTEST}/build/RPMS/4/noarch/attrtest-1.0-1.noarch.rpm)
spid=$(rpm -qp --qf "%{sourcepkgid}\n" ${RPMTEST}/build/RPMS/4/noarch/attrtest-1.0-1.*.rpm)
hid=$(rpm -qp --qf "%{hdrid}\n" ${RPMTEST}/build/RPMS/4/noarch/attrtest-1.0-1.noarch.rpm)
shid=$(rpm -qp --qf "%{hdrid}\n" ${RPMTEST}/build/SRPMS/attrtest-1.0-1.src.rpm)

# only validate the general characteristics here to avoid pinning
echo -n ${sid} | wc -c
echo -n ${pid} | wc -c
echo -n ${spid} | wc -c
echo -n ${hid} | wc -c
echo -n ${shid} | wc -c
[ "${sid}" = "${spid}" ] || exit 1
[ "${sid}" != "${pid}" ] || exit 1
[ "${pid}" != "${spid}" ] || exit 1
[ "${hid}" != "${shid}" ] || exit 1
]],
[0],
[32
32
32
40
40
],
[])

RPMTEST_CHECK([
cp /data/misc/rpmdump4-srpm.txt expout
${RPM_CONFIGDIR_PATH}/rpmdump ${RPMTEST}/build/SRPMS/attrtest-1.0-1.src.rpm
Expand Down Expand Up @@ -53,6 +80,22 @@ rpm -qp --qf "%{rpmformat}\n" ${RPMTEST}/build/RPMS/6/noarch/attrtest-1.0-1.noar
],
[])

RPMTEST_CHECK([
rpm -qp --qf "%{pkgid}\n" ${RPMTEST}/build/SRPMS/attrtest-1.0-1.src.rpm
rpm -qp --qf "%{pkgid}\n" ${RPMTEST}/build/RPMS/6/noarch/attrtest-1.0-1.noarch.rpm
rpm -qp --qf "%{sourcepkgid}\n" ${RPMTEST}/build/RPMS/6/noarch/attrtest-1.0-1.noarch.rpm
rpm -qp --qf "%{hdrid}\n" ${RPMTEST}/build/RPMS/6/noarch/attrtest-1.0-1.noarch.rpm
rpm -qp --qf "%{hdrid}\n" ${RPMTEST}/build/SRPMS/attrtest-1.0-1.src.rpm
],
[0],
[(none)
(none)
(none)
(none)
(none)
],
[])

RPMTEST_CHECK([
cp /data/misc/rpmdump6-srpm.txt expout
${RPM_CONFIGDIR_PATH}/rpmdump ${RPMTEST}/build/SRPMS/attrtest-1.0-1.src.rpm
Expand Down

0 comments on commit e1eb246

Please # to comment.