diff options
author | Michael Schroeder <mls@suse.de> | 2013-10-28 13:25:15 +0100 |
---|---|---|
committer | Michael Schroeder <mls@suse.de> | 2013-10-28 13:25:15 +0100 |
commit | afadcaf9b7946f6eececfd07ef1c0e89a7062a71 (patch) | |
tree | 254463991b470a6d7f131ffec50ba8df8ad46515 /tools | |
parent | eb84c69bbb7f1e38ef381c361d05e35c21e7fbfa (diff) | |
download | libsolv-afadcaf9b7946f6eececfd07ef1c0e89a7062a71.tar.gz libsolv-afadcaf9b7946f6eececfd07ef1c0e89a7062a71.tar.bz2 libsolv-afadcaf9b7946f6eececfd07ef1c0e89a7062a71.zip |
add repo_add_keyring() and repo_add_keydir() functions
Diffstat (limited to 'tools')
-rw-r--r-- | tools/rpms2solv.c | 29 |
1 files changed, 25 insertions, 4 deletions
diff --git a/tools/rpms2solv.c b/tools/rpms2solv.c index 93ee8c3..57c3697 100644 --- a/tools/rpms2solv.c +++ b/tools/rpms2solv.c @@ -22,6 +22,7 @@ #include "repo_rpmdb.h" #ifdef ENABLE_PUBKEY #include "repo_pubkey.h" +#include "solv_xfopen.h" #endif #include "repo_solv.h" #include "common_write.h" @@ -65,7 +66,7 @@ main(int argc, char **argv) int pubkeys = 0; #endif - while ((c = getopt(argc, argv, "0kb:m:")) >= 0) + while ((c = getopt(argc, argv, "0kKb:m:")) >= 0) { switch(c) { @@ -82,6 +83,9 @@ main(int argc, char **argv) case 'k': pubkeys = 1; break; + case 'K': + pubkeys = 2; + break; #endif default: exit(1); @@ -127,15 +131,32 @@ main(int argc, char **argv) for (i = 0; i < nrpms; i++) { #ifdef ENABLE_PUBKEY - if (pubkeys) - { + if (pubkeys == 2) + { + FILE *fp = solv_xfopen(rpms[i], "r"); + if (!fp) + { + perror(rpms[i]); + res = 1; + continue; + } + if (repo_add_keyring(repo, fp, REPO_REUSE_REPODATA|REPO_NO_INTERNALIZE)) + { + fprintf(stderr, "rpms2solv: %s\n", pool_errstr(pool)); + res = 1; + } + fclose(fp); + continue; + } + if (pubkeys) + { if (repo_add_pubkey(repo, rpms[i], REPO_REUSE_REPODATA|REPO_NO_INTERNALIZE) == 0) { fprintf(stderr, "rpms2solv: %s\n", pool_errstr(pool)); res = 1; } continue; - } + } #endif if (repo_add_rpm(repo, rpms[i], REPO_REUSE_REPODATA|REPO_NO_INTERNALIZE) == 0) { |