summaryrefslogtreecommitdiff
path: root/meta/recipes-devtools/rpm
diff options
context:
space:
mode:
authorRobert Yang <liezhi.yang@windriver.com>2016-03-21 02:25:49 -0700
committerRichard Purdie <richard.purdie@linuxfoundation.org>2016-03-23 14:24:25 +0000
commit3cd4f96e94d8756d332b13215ce3ac2e1eaddee7 (patch)
treebe960133f9a99aed79739d60100426bf3c14e51f /meta/recipes-devtools/rpm
parent5d51bd1f02fb20e02d0de0ac9874d7f9a6f5ddc6 (diff)
downloadopenembedded-core-3cd4f96e94d8756d332b13215ce3ac2e1eaddee7.tar.gz
openembedded-core-3cd4f96e94d8756d332b13215ce3ac2e1eaddee7.tar.bz2
openembedded-core-3cd4f96e94d8756d332b13215ce3ac2e1eaddee7.zip
rpm: check _gpg_passphrase before ask for input
rpm always asked for pass phrasae when add signature, which made it can't work non-interactively, this patch fix the problem. It will work non-interactively if _gpg_passphrase is defined, and work as before if not. Signed-off-by: Robert Yang <liezhi.yang@windriver.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/recipes-devtools/rpm')
-rw-r--r--meta/recipes-devtools/rpm/rpm/rpmqv.c-check-_gpg_passphrase-before-ask-for-input.patch70
-rw-r--r--meta/recipes-devtools/rpm/rpm_5.4.16.bb1
2 files changed, 71 insertions, 0 deletions
diff --git a/meta/recipes-devtools/rpm/rpm/rpmqv.c-check-_gpg_passphrase-before-ask-for-input.patch b/meta/recipes-devtools/rpm/rpm/rpmqv.c-check-_gpg_passphrase-before-ask-for-input.patch
new file mode 100644
index 0000000000..c68681c1ed
--- /dev/null
+++ b/meta/recipes-devtools/rpm/rpm/rpmqv.c-check-_gpg_passphrase-before-ask-for-input.patch
@@ -0,0 +1,70 @@
+From bb48dbc88a58bc05a43d71a3375fb05358119ec5 Mon Sep 17 00:00:00 2001
+From: Robert Yang <liezhi.yang@windriver.com>
+Date: Sun, 20 Mar 2016 20:20:16 -0700
+Subject: [PATCH] rpmqv.c: check _gpg_passphrase before ask for input
+
+rpm always asked for pass phrasae when add signature, which made it
+can't work non-interactively, this patch fix the problem. It will work
+non-interactively if _gpg_passphrase is defined, and work as before if
+not.
+
+Upstream-Status: Pending
+
+Signed-off-by: Robert Yang <liezhi.yang@windriver.com>
+---
+ macros/macros.in | 7 +++++--
+ rpmqv.c | 17 ++++++++++-------
+ 2 files changed, 15 insertions(+), 9 deletions(-)
+
+diff --git a/macros/macros.in b/macros/macros.in
+index 2e5b07d..01b3aad 100644
+--- a/macros/macros.in
++++ b/macros/macros.in
+@@ -520,15 +520,18 @@ $_arbitrary_tags_tests Foo:Bar
+ # Macro(s) to hold the arguments passed to GPG/PGP for package
+ # signing and verification.
+ #
++
++%_gpg_passphrase_way %{?_gpg_passphrase:--passphrase "%{_gpg_passphrase}"}%{!?_gpg_passphrase:--passphrase-fd 3}
++
+ %__gpg_check_password_cmd %{__gpg} \
+- gpg --batch --no-verbose --passphrase-fd 3 -u "%{_gpg_name}" -so -
++ gpg --batch --no-verbose %{_gpg_passphrase_way} -u "%{_gpg_name}" -so -
+ #%__pgp_check_password_cmd %{__pgp} \
+ # pgp +batchmode=on +verbose=0 "%{_pgp_name}" -sf
+ #%__pgp5_check_password_cmd %{__pgp} \
+ # pgps +batchmode=on +verbose=0 +armor=off "%{_pgp_name}" -f
+
+ %__gpg_sign_cmd %{__gpg} \
+- gpg --batch --no-verbose --no-armor --passphrase-fd 3 --no-secmem-warning \
++ gpg --batch --no-verbose --no-armor %{_gpg_passphrase_way} --no-secmem-warning \
+ -u "%{_gpg_name}" -sbo %{__signature_filename} %{__plaintext_filename}
+ #%__pgp_sign_cmd %{__pgp} \
+ # pgp +batchmode=on +verbose=0 +armor=off \
+diff --git a/rpmqv.c b/rpmqv.c
+index b306486..7604396 100644
+--- a/rpmqv.c
++++ b/rpmqv.c
+@@ -831,13 +831,16 @@ int main(int argc, const char ** argv)
+ #endif
+ )
+ {
+- passPhrase = Getpass(_("Enter pass phrase: "));
+- if (rpmCheckPassPhrase(passPhrase)) {
+- fprintf(stderr, _("Pass phrase check failed\n"));
+- ec = EXIT_FAILURE;
+- goto exit;
++ passPhrase = rpmExpand("%{?_gpg_passphrase}", NULL);
++ if (passPhrase == NULL || passPhrase[0] == '\0') {
++ passPhrase = Getpass(_("Enter pass phrase: "));
++ if (rpmCheckPassPhrase(passPhrase)) {
++ fprintf(stderr, _("Pass phrase check failed\n"));
++ ec = EXIT_FAILURE;
++ goto exit;
++ }
++ fprintf(stderr, _("Pass phrase is good.\n"));
+ }
+- fprintf(stderr, _("Pass phrase is good.\n"));
+ /* XXX Getpass() should realloc instead. */
+ passPhrase = xstrdup(passPhrase);
+ }
diff --git a/meta/recipes-devtools/rpm/rpm_5.4.16.bb b/meta/recipes-devtools/rpm/rpm_5.4.16.bb
index eba043e3af..7621f8ffaa 100644
--- a/meta/recipes-devtools/rpm/rpm_5.4.16.bb
+++ b/meta/recipes-devtools/rpm/rpm_5.4.16.bb
@@ -114,6 +114,7 @@ SRC_URI += " \
file://rpm-python-AddErase.patch \
file://rpm-rpmpgp-popt.patch \
file://rpm-fix-lua-tests-compilation-failure.patch \
+ file://rpmqv.c-check-_gpg_passphrase-before-ask-for-input.patch \
"
# OE specific changes