aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorFabian Groffen <grobian@gentoo.org>2021-06-14 11:32:02 +0200
committerFabian Groffen <grobian@gentoo.org>2021-06-14 11:32:02 +0200
commitf1cf942274c47dce50bbaff45d41a8a83102e3fd (patch)
treea0e4866f868474903503077880fbfed09afa0211 /tests
parentlibq/tree: make tree_match_atom produce valid meta for binpkgs (diff)
downloadportage-utils-f1cf942274c47dce50bbaff45d41a8a83102e3fd.tar.gz
portage-utils-f1cf942274c47dce50bbaff45d41a8a83102e3fd.tar.bz2
portage-utils-f1cf942274c47dce50bbaff45d41a8a83102e3fd.zip
qmerge: once over to make better/more use of libq/tree
- unify best_version and grab_binpkg_info, into single function using tree_match_atom to benefit from cache and abstract any particulars - default to install action when no action given - unmerge previous package on merge upgrade again - possibly fix bug #792273 by exporting vars Bug: https://bugs.gentoo.org/792273 Signed-off-by: Fabian Groffen <grobian@gentoo.org>
Diffstat (limited to 'tests')
-rwxr-xr-xtests/qmerge/dotest52
-rw-r--r--tests/qmerge/packages/Packages13
-rw-r--r--tests/qmerge/packages/sys-devel/qmerge-test-2.0.tbz2bin0 -> 7334 bytes
3 files changed, 46 insertions, 19 deletions
diff --git a/tests/qmerge/dotest b/tests/qmerge/dotest
index 59f249d..0f870ef 100755
--- a/tests/qmerge/dotest
+++ b/tests/qmerge/dotest
@@ -22,16 +22,17 @@ set +e
# sanity check on environment
q -Cev
+qlist -kIv
# Do a merge into an empty tree.
-out=$(yes | qmerge -F qmerge-test)
+out=$(yes | qmerge -F qmerge-test-1.3)
tend $? "qmerge-test: [N] basic merge" || die "${out}"
[[ ${out} != *"FAIL"* ]]
tend $? "qmerge-test: [N] no FAIL messages" || die "${out}"
-order=$(echo "${out}" | awk '$1 == ">>>" && $2 ~ /^pkg_/ { printf "%s ", $NF }')
+order=$(echo "${out}" | awk '$1 == "@@@" && $2 ~ /^pkg_/ { printf "%s ", $NF }')
[[ ${order} == "pkg_pretend pkg_setup pkg_preinst pkg_postinst " ]]
tend $? "qmerge-test: [N] pkg_* order of execution" || die "$(printf '%s\n' "${order}" "${out}")"
@@ -45,14 +46,14 @@ tend $? "qmerge-test: [N] installed expected files" || die "$(treedir "${ROOT}")
# Now do a re-emerge.
-out=$(yes | qmerge -F qmerge-test)
+out=$(yes | qmerge -F "<qmerge-test-2")
tend $? "qmerge-test: [R] re-emerge" || die "${out}"
[[ -x ${ROOT}/usr/bin/qmerge-test ]]
tend $? "qmerge-test: [R] installed expected files" || die "$(treedir "${ROOT}")"
-order=$(echo "${out}" | awk '$1 == ">>>" && $2 ~ /^pkg_/ { printf "%s ", $NF }')
-[[ ${order} == "pkg_pretend pkg_setup pkg_preinst pkg_postinst " ]]
+order=$(echo "${out}" | awk '$1 == "@@@" && $2 ~ /^pkg_/ { printf "%s ", $NF }')
+[[ ${order} == "pkg_pretend pkg_setup pkg_preinst pkg_postinst pkg_prerm pkg_postrm " ]]
tend $? "qmerge-test: [R] pkg_* order of execution" || die "$(printf '%s\n' "${order}" "${out}")"
[[ -x ${ROOT}/usr/bin/qmerge-test && \
@@ -61,6 +62,19 @@ tend $? "qmerge-test: [R] pkg_* order of execution" || die "$(printf '%s\n' "${o
-f ${ROOT}/etc/._cfg0000_some.conf ]]
tend $? "qmerge-test: [R] re-installed expected files" || die "$(treedir "${ROOT}")"
+# upgrade to latest version
+
+out=$(yes | qmerge -F qmerge-test)
+tend $? "qmerge-test: [U] update" || die "${out}"
+
+[[ $(qlist -Iv qmerge-test) == "sys-devel/qmerge-test-2.0" ]]
+tend $? "qmerge-test: qlist does not report version 2.0 installed" || die "$(qlist -Iv qmerge-test;qlist -kIv) ${out}"
+
+[[ ! -x ${ROOT}/usr/bin/qmerge-test ]]
+tend $? "qmerge-test: binary from version 1 does not exist" || die "$(treedir "${ROOT}")"
+[[ -x ${ROOT}/usr/bin/qmerge-test2 ]]
+tend $? "qmerge-test: binary from version 2 exists" || die "$(treedir "${ROOT}")"
+
# Finally do an unmerge.
echo alkdsjfalksdf > "${ROOT}/etc/some.conf"
@@ -69,7 +83,7 @@ rm -f "${ROOT}/etc/._cfg0000_some.conf"
out=$(yes | qmerge -FU qmerge-test)
tend $? "qmerge-test: [C] uninstall" || die "${out}"
-order=$(echo "${out}" | awk '$1 == ">>>" { printf "%s ", $NF }')
+order=$(echo "${out}" | awk '$1 == "@@@" { printf "%s ", $NF }')
[[ ${order} == "pkg_prerm pkg_postrm " ]]
tend $? "qmerge-test: [C] pkg_* order of execution" || die "$(printf '%s\n' "${order}" "${out}")"
@@ -90,9 +104,9 @@ tend $? "qmerge-test: [M] install no /etc" || die "${out}"
tend $? "qmerge-test: [M] found no /etc" || die "$(treedir "${ROOT}")"
out=$(yes | qmerge -FU qmerge-test)
-tend $? "qmerge-test: [M] uninstall" || die "${out}"
+tend $? "qmerge-test: [U] uninstall" || die "${out}"
[[ ! -e ${ROOT}/etc ]]
-tend $? "qmerge-test: [M] /etc removed" || die "$(treedir "${ROOT}")"
+tend $? "qmerge-test: [U] /etc removed" || die "$(treedir "${ROOT}")"
export INSTALL_MASK="/etc -/etc/some.conf"
out=$(yes | qmerge -F qmerge-test)
@@ -101,9 +115,9 @@ tend $? "qmerge-test: [M] install only /etc/some.conf" || die "${out}"
tend $? "qmerge-test: [M] found /etc/another.conf" || die "$(treedir "${ROOT}")"
out=$(yes | qmerge -FU qmerge-test)
-tend $? "qmerge-test: [M] uninstall" || die "${out}"
+tend $? "qmerge-test: [U] uninstall" || die "${out}"
[[ ! -e ${ROOT}/etc ]]
-tend $? "qmerge-test: [M] /etc removed" || die "$(treedir "${ROOT}")"
+tend $? "qmerge-test: [U] /etc removed" || die "$(treedir "${ROOT}")"
export INSTALL_MASK="/usr -/usr/bin/dummy"
out=$(yes | qmerge -F qmerge-test)
@@ -114,22 +128,22 @@ tend $? "qmerge-test: [M] found /usr/bin/dummy" || die "$(treedir "${ROOT}")"
tend $? "qmerge-test: [M] /usr/bin/qmerge-test absent" || die "$(treedir "${ROOT}")"
out=$(yes | qmerge -FU qmerge-test)
-tend $? "qmerge-test: [M] uninstall" || die "${out}"
+tend $? "qmerge-test: [U] uninstall" || die "${out}"
[[ ! -e ${ROOT}/usr/bin/dummy ]]
-tend $? "qmerge-test: [M] /usr/bin/dummy removed" || die "$(treedir "${ROOT}")"
+tend $? "qmerge-test: [U] /usr/bin/dummy removed" || die "$(treedir "${ROOT}")"
export INSTALL_MASK="/usr -/usr/bin /usr/bin/dummy"
out=$(yes | qmerge -F qmerge-test)
tend $? "qmerge-test: [M] install except /usr/bin/dummy" || die "${out}"
[[ ! -e ${ROOT}/usr/bin/dummy ]]
tend $? "qmerge-test: [M] found no /usr/bin/dummy" || die "$(treedir "${ROOT}")"
-[[ -e ${ROOT}/usr/bin/qmerge-test ]]
-tend $? "qmerge-test: [M] found /usr/bin/qmerge-test" || die "$(treedir "${ROOT}")"
+[[ -e ${ROOT}/usr/bin/qmerge-test2 ]]
+tend $? "qmerge-test: [M] found /usr/bin/qmerge-test2" || die "$(treedir "${ROOT}")"
out=$(yes | qmerge -FU qmerge-test)
-tend $? "qmerge-test: [M] uninstall" || die "${out}"
-[[ ! -e ${ROOT}/usr/bin/qmerge-test ]]
-tend $? "qmerge-test: [M] /usr/bin/qmerge-test removed" || die "$(treedir "${ROOT}")"
+tend $? "qmerge-test: [U] uninstall" || die "${out}"
+[[ ! -e ${ROOT}/usr/bin/qmerge-test2 ]]
+tend $? "qmerge-test: [U] /usr/bin/qmerge-test2 removed" || die "$(treedir "${ROOT}")"
# try all compressions we know to see if we handle them properly
pkgver=qmerge-test-1.3
@@ -152,10 +166,10 @@ for compr in "" brotli gzip bzip2 xz lz4 zstd lzip lzop ; do
: $((rev++))
qtbz2 -j ${f} ${pkgver}.xpak pkgs/sys-devel/${pkgver}-r${rev}.tbz2
ls -l pkgs/sys-devel/${pkgver}-r${rev}.tbz2
- ROOT=/ qlist -kIv | tee /dev/stderr | wc -l
+ qlist -kIv | tee /dev/stderr | wc -l
# see if we can install this package
- out=$(yes | qmerge -Fv qmerge-test)
+ out=$(yes | qmerge -Fv =${pkgver}-r${rev})
tend $? "qmerge-test: [X] install ${pkgver}-r${rev}" || die "${out}"
qlist -Iv
out=$(yes | qmerge -FU qmerge-test)
diff --git a/tests/qmerge/packages/Packages b/tests/qmerge/packages/Packages
index e6fa3a2..cd34d8d 100644
--- a/tests/qmerge/packages/Packages
+++ b/tests/qmerge/packages/Packages
@@ -28,3 +28,16 @@ SHA1: 47f731ce30149f5ab15f0c47dc19b46e4b189d60
SIZE: 7289
REPO: local
+BUILD_TIME: 1367285976
+CPV: sys-devel/qmerge-test-2.0
+DEFINED_PHASES: install postinst postrm preinst prerm pretend setup
+DESC: my desc
+EAPI: 6
+KEYWORDS: ~amd64 ~x86
+LICENSE: GPL-2
+MD5: 100f6c414b1dc980fc73cf70178c2190
+MTIME: 1367290147
+SHA1: 5ba9c5db40a1b9be5e0e98b19b2cff5d2c197808
+SIZE: 7334
+REPO: local
+
diff --git a/tests/qmerge/packages/sys-devel/qmerge-test-2.0.tbz2 b/tests/qmerge/packages/sys-devel/qmerge-test-2.0.tbz2
new file mode 100644
index 0000000..1fac801
--- /dev/null
+++ b/tests/qmerge/packages/sys-devel/qmerge-test-2.0.tbz2
Binary files differ