This is an automated email from the git hooks/post-receive script. guillem pushed a commit to branch main in repository dpkg.
View the commit online: https://git.dpkg.org/cgit/dpkg/dpkg.git/commit/?id=9766de9bd192a5175c07487a205b2443c8388649 commit 9766de9bd192a5175c07487a205b2443c8388649 Author: Guillem Jover <[email protected]> AuthorDate: Sun Oct 9 12:17:16 2022 +0200 libdpkg: Add a new pnaw_same package name printing mode We need this new mode to use in for database related package names so that they can make the database reproducible. --- lib/dpkg/dpkg-db.h | 2 ++ lib/dpkg/pkg-show.c | 4 ++++ lib/dpkg/t/t-pkg-show.c | 11 ++++++++++- 3 files changed, 16 insertions(+), 1 deletion(-) diff --git a/lib/dpkg/dpkg-db.h b/lib/dpkg/dpkg-db.h index a43d9d124..f94c7fcb8 100644 --- a/lib/dpkg/dpkg-db.h +++ b/lib/dpkg/dpkg-db.h @@ -412,6 +412,8 @@ enum pkg_name_arch_when { pnaw_never, /** Display arch only when it's non-ambiguous. */ pnaw_nonambig, + /** Display arch only when it's a Multi-Arch same package. */ + pnaw_same, /** Display arch only when it's a foreign one. */ pnaw_foreign, /** Always display arch. */ diff --git a/lib/dpkg/pkg-show.c b/lib/dpkg/pkg-show.c index 97d7ba96a..c32a128d7 100644 --- a/lib/dpkg/pkg-show.c +++ b/lib/dpkg/pkg-show.c @@ -41,6 +41,10 @@ pkgbin_name_needs_arch(const struct pkgbin *pkgbin, switch (pnaw) { case pnaw_never: break; + case pnaw_same: + if (pkgbin->multiarch == PKG_MULTIARCH_SAME) + return true; + return false; case pnaw_nonambig: if (pkgbin->multiarch == PKG_MULTIARCH_SAME) return true; diff --git a/lib/dpkg/t/t-pkg-show.c b/lib/dpkg/t/t-pkg-show.c index 0f6ece061..6bb361dec 100644 --- a/lib/dpkg/t/t-pkg-show.c +++ b/lib/dpkg/t/t-pkg-show.c @@ -51,11 +51,20 @@ test_pkg_show_name(void) pkgname = pkg_name(pkg, pnaw_always); test_pass(pkgname); test_str(pkgname, ==, "test:arch"); + + pkgname = pkg_name(pkg, pnaw_same); + test_pass(pkgname); + test_str(pkgname, ==, "test"); + + pkg->installed.multiarch = PKG_MULTIARCH_SAME; + pkgname = pkg_name(pkg, pnaw_same); + test_pass(pkgname); + test_str(pkgname, ==, "test:arch"); } TEST_ENTRY(test) { - test_plan(10); + test_plan(14); test_pkg_show_name(); } -- Dpkg.Org's dpkg

