commit:     133742ca3a9497606262fab40ed6f4f965782a7c
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Tue Oct 28 18:49:42 2025 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Tue Oct 28 18:56:58 2025 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=133742ca

app-crypt/gnupg: provide /usr/bin/gpg and /usr/bin/gpgv in pkg_postinst

After app-crypt/gnupg[alternatives] is merged, gnupg no longer provides
/usr/bin/gpg, and there's no /usr/bin/gpg on the system until
app-alternatives/gpg can be merged. That's somewhat-fine unless
app-alternatives/gpg is a signed binpkg, in which case gpg is needed
to verify it.

Provide gpg and gpgv as orphaned symlinks in pkg_postinst to handle
this case.

Reported-by: Jay Faulkner <jayf <AT> gentoo.org>
Signed-off-by: Sam James <sam <AT> gentoo.org>

 app-crypt/gnupg/{gnupg-2.4.8.ebuild => gnupg-2.4.8-r1.ebuild} | 11 +++++++++++
 .../gnupg/{gnupg-2.5.13.ebuild => gnupg-2.5.13-r1.ebuild}     | 11 +++++++++++
 2 files changed, 22 insertions(+)

diff --git a/app-crypt/gnupg/gnupg-2.4.8.ebuild 
b/app-crypt/gnupg/gnupg-2.4.8-r1.ebuild
similarity index 95%
rename from app-crypt/gnupg/gnupg-2.4.8.ebuild
rename to app-crypt/gnupg/gnupg-2.4.8-r1.ebuild
index ea4af2024706..65df46615281 100644
--- a/app-crypt/gnupg/gnupg-2.4.8.ebuild
+++ b/app-crypt/gnupg/gnupg-2.4.8-r1.ebuild
@@ -204,3 +204,14 @@ my_src_install_all() {
        dodoc "${FILESDIR}"/README-systemd
        systemd_douserunit "${GNUPG_SYSTEMD_UNITS[@]/#/${T}/}"
 }
+
+pkg_postinst() {
+       # If /usr/bin/gpg and /usr/bin/gpgv do not exist, provide them.
+       if [[ ! -e ${EROOT}/usr/bin/gpg ]]; then
+               ln -sf -- gpg-reference "${EROOT}"/usr/bin/gpg || die
+       fi
+
+       if [[ ! -e ${EROOT}/usr/bin/gpgv ]]; then
+               ln -sf -- gpgv-reference "${EROOT}"/usr/bin/gpgv || die
+       fi
+}

diff --git a/app-crypt/gnupg/gnupg-2.5.13.ebuild 
b/app-crypt/gnupg/gnupg-2.5.13-r1.ebuild
similarity index 95%
rename from app-crypt/gnupg/gnupg-2.5.13.ebuild
rename to app-crypt/gnupg/gnupg-2.5.13-r1.ebuild
index 87cb1ff1d288..1e9503ba5a7e 100644
--- a/app-crypt/gnupg/gnupg-2.5.13.ebuild
+++ b/app-crypt/gnupg/gnupg-2.5.13-r1.ebuild
@@ -208,3 +208,14 @@ my_src_install_all() {
        dodoc "${FILESDIR}"/README-systemd
        systemd_douserunit "${GNUPG_SYSTEMD_UNITS[@]/#/${T}/}"
 }
+
+pkg_postinst() {
+       # If /usr/bin/gpg and /usr/bin/gpgv do not exist, provide them.
+       if [[ ! -e ${EROOT}/usr/bin/gpg ]]; then
+               ln -sf -- gpg-reference "${EROOT}"/usr/bin/gpg || die
+       fi
+
+       if [[ ! -e ${EROOT}/usr/bin/gpgv ]]; then
+               ln -sf -- gpgv-reference "${EROOT}"/usr/bin/gpgv || die
+       fi
+}

Reply via email to