diff options
-rw-r--r-- | meta/recipes-devtools/rpm/rpm/rpmqv.c-check-_gpg_passphrase-before-ask-for-input.patch | 70 | ||||
-rw-r--r-- | meta/recipes-devtools/rpm/rpm_5.4.16.bb | 1 |
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 @@ | |||
1 | From bb48dbc88a58bc05a43d71a3375fb05358119ec5 Mon Sep 17 00:00:00 2001 | ||
2 | From: Robert Yang <liezhi.yang@windriver.com> | ||
3 | Date: Sun, 20 Mar 2016 20:20:16 -0700 | ||
4 | Subject: [PATCH] rpmqv.c: check _gpg_passphrase before ask for input | ||
5 | |||
6 | rpm always asked for pass phrasae when add signature, which made it | ||
7 | can't work non-interactively, this patch fix the problem. It will work | ||
8 | non-interactively if _gpg_passphrase is defined, and work as before if | ||
9 | not. | ||
10 | |||
11 | Upstream-Status: Pending | ||
12 | |||
13 | Signed-off-by: Robert Yang <liezhi.yang@windriver.com> | ||
14 | --- | ||
15 | macros/macros.in | 7 +++++-- | ||
16 | rpmqv.c | 17 ++++++++++------- | ||
17 | 2 files changed, 15 insertions(+), 9 deletions(-) | ||
18 | |||
19 | diff --git a/macros/macros.in b/macros/macros.in | ||
20 | index 2e5b07d..01b3aad 100644 | ||
21 | --- a/macros/macros.in | ||
22 | +++ b/macros/macros.in | ||
23 | @@ -520,15 +520,18 @@ $_arbitrary_tags_tests Foo:Bar | ||
24 | # Macro(s) to hold the arguments passed to GPG/PGP for package | ||
25 | # signing and verification. | ||
26 | # | ||
27 | + | ||
28 | +%_gpg_passphrase_way %{?_gpg_passphrase:--passphrase "%{_gpg_passphrase}"}%{!?_gpg_passphrase:--passphrase-fd 3} | ||
29 | + | ||
30 | %__gpg_check_password_cmd %{__gpg} \ | ||
31 | - gpg --batch --no-verbose --passphrase-fd 3 -u "%{_gpg_name}" -so - | ||
32 | + gpg --batch --no-verbose %{_gpg_passphrase_way} -u "%{_gpg_name}" -so - | ||
33 | #%__pgp_check_password_cmd %{__pgp} \ | ||
34 | # pgp +batchmode=on +verbose=0 "%{_pgp_name}" -sf | ||
35 | #%__pgp5_check_password_cmd %{__pgp} \ | ||
36 | # pgps +batchmode=on +verbose=0 +armor=off "%{_pgp_name}" -f | ||
37 | |||
38 | %__gpg_sign_cmd %{__gpg} \ | ||
39 | - gpg --batch --no-verbose --no-armor --passphrase-fd 3 --no-secmem-warning \ | ||
40 | + gpg --batch --no-verbose --no-armor %{_gpg_passphrase_way} --no-secmem-warning \ | ||
41 | -u "%{_gpg_name}" -sbo %{__signature_filename} %{__plaintext_filename} | ||
42 | #%__pgp_sign_cmd %{__pgp} \ | ||
43 | # pgp +batchmode=on +verbose=0 +armor=off \ | ||
44 | diff --git a/rpmqv.c b/rpmqv.c | ||
45 | index b306486..7604396 100644 | ||
46 | --- a/rpmqv.c | ||
47 | +++ b/rpmqv.c | ||
48 | @@ -831,13 +831,16 @@ int main(int argc, const char ** argv) | ||
49 | #endif | ||
50 | ) | ||
51 | { | ||
52 | - passPhrase = Getpass(_("Enter pass phrase: ")); | ||
53 | - if (rpmCheckPassPhrase(passPhrase)) { | ||
54 | - fprintf(stderr, _("Pass phrase check failed\n")); | ||
55 | - ec = EXIT_FAILURE; | ||
56 | - goto exit; | ||
57 | + passPhrase = rpmExpand("%{?_gpg_passphrase}", NULL); | ||
58 | + if (passPhrase == NULL || passPhrase[0] == '\0') { | ||
59 | + passPhrase = Getpass(_("Enter pass phrase: ")); | ||
60 | + if (rpmCheckPassPhrase(passPhrase)) { | ||
61 | + fprintf(stderr, _("Pass phrase check failed\n")); | ||
62 | + ec = EXIT_FAILURE; | ||
63 | + goto exit; | ||
64 | + } | ||
65 | + fprintf(stderr, _("Pass phrase is good.\n")); | ||
66 | } | ||
67 | - fprintf(stderr, _("Pass phrase is good.\n")); | ||
68 | /* XXX Getpass() should realloc instead. */ | ||
69 | passPhrase = xstrdup(passPhrase); | ||
70 | } | ||
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 += " \ | |||
114 | file://rpm-python-AddErase.patch \ | 114 | file://rpm-python-AddErase.patch \ |
115 | file://rpm-rpmpgp-popt.patch \ | 115 | file://rpm-rpmpgp-popt.patch \ |
116 | file://rpm-fix-lua-tests-compilation-failure.patch \ | 116 | file://rpm-fix-lua-tests-compilation-failure.patch \ |
117 | file://rpmqv.c-check-_gpg_passphrase-before-ask-for-input.patch \ | ||
117 | " | 118 | " |
118 | 119 | ||
119 | # OE specific changes | 120 | # OE specific changes |