]> git.pld-linux.org Git - packages/poldek.git/blob - poldek-rpmcmd.patch
- a bit cleaner version
[packages/poldek.git] / poldek-rpmcmd.patch
1 diff -ur poldek-0.18.8/main.c poldek-0.18.8-rpm/main.c
2 --- poldek-0.18.8/main.c        2004-12-30 13:37:30.000000000 +0100
3 +++ poldek-0.18.8-rpm/main.c    2005-05-21 00:19:48.878118872 +0200
4 @@ -247,6 +247,7 @@
5  #define OPT_ASK                   2006
6  #define OPT_NOASK                 2007
7  #define OPT_RPMOPT                2008
8 +#define OPT_RPMCMD                2009
9  #define OPT_MERGE                 2101
10  #define OPT_SW_V016               (1 << 0)
11  #define OPT_SW_NOASK              (1 << 1)
12 @@ -463,6 +464,7 @@
13  {"version", OPT_BANNER, 0, 0, N_("Display program version information and exit"), 500 },    
14  {"log", OPT_LOG, "FILE", 0, N_("Log program messages to FILE"), 500 },
15  {"v016", OPT_V016, 0, 0, N_("Read indexes created by versions < 0.17"), 500 },
16 +{"rpmcmd", OPT_RPMCMD, "FILE", 0, N_("Use FILE as rpm program"), 500 },
17  {0,  'v', 0, 0, N_("Be verbose."), 500 },
18  {0,  'q', 0, 0, N_("Do not produce any output."), 500 },
19  { 0, 0, 0, 0, 0, 0 },
20 @@ -917,6 +919,10 @@
21              argsp->switches |= OPT_SW_NOCONF;
22              break;
23  
24 +        case OPT_RPMCMD:
25 +            argsp->inst.rpmcommand = prepare_path(arg);
26 +            break;
27 +
28          case OPT_SPLITSIZE: {
29              char *p, rc;
30              check_mjrmode(argsp);
31 diff -ur poldek-0.18.8/pkgfetch.c poldek-0.18.8-rpm/pkgfetch.c
32 --- poldek-0.18.8/pkgfetch.c    2004-05-20 23:47:59.000000000 +0200
33 +++ poldek-0.18.8-rpm/pkgfetch.c        2005-05-21 00:19:48.879118720 +0200
34 @@ -43,7 +43,7 @@
35  
36  #ifdef HAVE_RPM_4_0    
37  
38 -int package_verify_sign(const char *path, unsigned flags) 
39 +int package_verify_sign(const char *path, unsigned flags, const char *rpmcommand) 
40  {
41      unsigned rpmflags = 0;
42  
43 @@ -67,7 +67,7 @@
44  
45  #else  /* HAVE_RPMCHECKSIG */
46  
47 -int package_verify_sign(const char *path, unsigned flags) 
48 +int package_verify_sign(const char *path, unsigned flags, const char *rpmcommand) 
49  {
50      char **argv;
51      char *cmd;
52 @@ -80,8 +80,8 @@
53      argv[n] = NULL;
54      n = 0;
55      
56 -    cmd = "/bin/rpm";
57 -    argv[n++] = "rpm";
58 +    cmd = rpmcommand;
59 +    argv[n++] = rpmcommand;
60      argv[n++] = "-K";
61  
62      nopts = n;
63 @@ -117,7 +117,7 @@
64  
65  #endif /* HAVE_RPMCHECKSIG */
66  
67 -int package_verify_pgpg_sign(const struct pkg *pkg, const char *localpath) 
68 +int package_verify_pgpg_sign(const struct pkg *pkg, const char *localpath, const char *rpmcommand) 
69  {
70      int rc = 1;
71  
72 @@ -133,7 +133,7 @@
73          if (pkg->pkgdir->flags & PKGDIR_VRFY_PGP)
74              verify_flags |= PKGVERIFY_PGP;
75          
76 -        if (!package_verify_sign(localpath, verify_flags)) {
77 +        if (!package_verify_sign(localpath, verify_flags, rpmcommand)) {
78              logn(LOGERR, "%s: signature verification failed", pkg_snprintf_s(pkg));
79              rc = 0;
80          }
81 @@ -145,7 +145,7 @@
82      return rc;
83  }
84  
85 -int packages_fetch(tn_array *pkgs, const char *destdir, int nosubdirs)
86 +int packages_fetch(tn_array *pkgs, const char *destdir, int nosubdirs, const char *rpmcommand)
87  {
88      int       i, nerr, urltype, ncdroms;
89      tn_array  *urls = NULL;
90 @@ -189,7 +189,7 @@
91                  
92              } else {
93                  rpmlib_verbose = -2; /* be quiet */
94 -                if (!package_verify_sign(path, PKGVERIFY_MD)) {
95 +                if (!package_verify_sign(path, PKGVERIFY_MD, rpmcommand)) {
96                      logn(LOGERR, _("%s: MD5 signature verification failed"),
97                           n_basenam(path));
98                      nerr++;
99 @@ -216,7 +216,7 @@
100              int pkg_ok, v = rpmlib_verbose;
101              
102              rpmlib_verbose = -2; /* be quiet */
103 -            pkg_ok = package_verify_sign(path, PKGVERIFY_MD);
104 +            pkg_ok = package_verify_sign(path, PKGVERIFY_MD, rpmcommand);
105              rpmlib_verbose = v;
106              
107              if (pkg_ok)         /* already downloaded,  */
108 @@ -283,7 +283,7 @@
109                  char localpath[PATH_MAX];
110                  snprintf(localpath, sizeof(localpath), "%s/%s", real_destdir,
111                           n_basenam(n_array_nth(urls, j)));
112 -                if (!package_verify_sign(localpath, PKGVERIFY_MD)) {
113 +                if (!package_verify_sign(localpath, PKGVERIFY_MD, rpmcommand)) {
114                      logn(LOGERR, _("%s: MD5 signature verification failed"),
115                           n_basenam(localpath));
116                      nerr++;
117 diff -ur poldek-0.18.8/pkgset-install.c poldek-0.18.8-rpm/pkgset-install.c
118 --- poldek-0.18.8/pkgset-install.c      2004-12-30 13:03:52.000000000 +0100
119 +++ poldek-0.18.8-rpm/pkgset-install.c  2005-05-21 00:19:48.883118112 +0200
120 @@ -2115,7 +2115,7 @@
121          if (destdir == NULL)
122              destdir = inst->cachedir;
123  
124 -        rc = packages_fetch(upg->install_pkgs, destdir, inst->fetchdir ? 1 : 0);
125 +        rc = packages_fetch(upg->install_pkgs, destdir, inst->fetchdir ? 1 : 0, inst->rpmcommand);
126  
127      } else if ((inst->flags & INSTS_NOHOLD) || (rc = check_holds(ps, upg))) {
128          int is_test = inst->flags & INSTS_RPMTEST;
129 diff -ur poldek-0.18.8/pkgset.c poldek-0.18.8-rpm/pkgset.c
130 --- poldek-0.18.8/pkgset.c      2004-12-30 13:05:24.000000000 +0100
131 +++ poldek-0.18.8-rpm/pkgset.c  2005-05-21 00:19:48.885117808 +0200
132 @@ -144,6 +144,7 @@
133      inst->dumpfile = NULL;
134      inst->rpmopts = NULL;
135      inst->rpmacros = NULL;
136 +    inst->rpmcommand = "/bin/rpm";
137      inst->askpkg_fn = ask_pkg;
138      inst->ask_fn = ask_yn;
139      inst->rpmacros = n_array_new(2, NULL, NULL);
140 diff -ur poldek-0.18.8/pkgset.h poldek-0.18.8-rpm/pkgset.h
141 --- poldek-0.18.8/pkgset.h      2004-07-02 19:42:40.000000000 +0200
142 +++ poldek-0.18.8-rpm/pkgset.h  2005-05-21 00:19:48.886117656 +0200
143 @@ -83,6 +83,7 @@
144      const char     *fetchdir;      /* dir to fetch files to  */
145      const char     *cachedir;      /* cache directory        */
146      const char     *dumpfile;      /* file to dump fqpns     */
147 +    const char     *rpmcommand;    /* deault /bin/rpm        */
148      tn_array       *rpmopts;       /* rpm cmdline opts (char *opts[]) */
149      tn_array       *rpmacros;      /* rpm macros to pass to cmdline (char *opts[]) */
150      tn_array       *hold_patterns;
151 @@ -190,7 +191,7 @@
152  
153  #define packages_unmark_all(pkgs) packages_mark(pkgs, 0, PKG_INDIRMARK | PKG_DIRMARK)
154  
155 -int packages_fetch(tn_array *pkgs, const char *destdir, int nosubdirs);
156 +int packages_fetch(tn_array *pkgs, const char *destdir, int nosubdirs, const char *rpmcommand);
157  int packages_rpminstall(tn_array *pkgs, struct pkgset *ps, struct inst_s *inst);
158  
159  int packages_uninstall(tn_array *pkgs, struct inst_s *inst, struct install_info *iinf);
160 @@ -206,10 +207,10 @@
161  #define PKGVERIFY_GPG  (1 << 1)
162  #define PKGVERIFY_PGP  (1 << 2)
163  
164 -int package_verify_sign(const char *path, unsigned flags);
165 +int package_verify_sign(const char *path, unsigned flags, const char *rpmcommand);
166  
167  /* looks if pkg->pkgdir has set VERSIGN flag */
168 -int package_verify_pgpg_sign(const struct pkg *pkg, const char *localpath);
169 +int package_verify_pgpg_sign(const struct pkg *pkg, const char *localpath, const char *rpmcommand);
170  
171  #include "pkgset-load.h"
172  
173 diff -ur poldek-0.18.8/rpminstall.c poldek-0.18.8-rpm/rpminstall.c
174 --- poldek-0.18.8/rpminstall.c  2004-12-01 17:22:38.000000000 +0100
175 +++ poldek-0.18.8-rpm/rpminstall.c      2005-05-21 00:19:48.887117504 +0200
176 @@ -236,21 +236,21 @@
177      n = 0;
178  
179      
180 -    if (!packages_fetch(pkgs, inst->cachedir, 0))
181 +    if (!packages_fetch(pkgs, inst->cachedir, 0, inst->rpmcommand))
182          return 0;
183      
184      if (inst->flags & INSTS_RPMTEST) {
185 -        cmd = "/bin/rpm";
186 -        argv[n++] = "rpm";
187 +        cmd = inst->rpmcommand;
188 +        argv[n++] = inst->rpmcommand;
189          
190      } else if (inst->flags & INSTS_USESUDO) {
191          cmd = "/usr/bin/sudo";
192          argv[n++] = "sudo";
193 -        argv[n++] = "/bin/rpm";
194 +        argv[n++] = inst->rpmcommand;
195          
196      } else {
197 -        cmd = "/bin/rpm";
198 -        argv[n++] = "rpm";
199 +        cmd = inst->rpmcommand;
200 +        argv[n++] = inst->rpmcommand;
201      }
202      
203      if (inst->flags & INSTS_INSTALL)
204 @@ -343,7 +343,7 @@
205                                 buf, name);
206              }
207  
208 -            if (!package_verify_pgpg_sign(pkg, path))
209 +            if (!package_verify_pgpg_sign(pkg, path, inst->rpmcommand))
210                  nsignerr++;
211              
212              s = alloca(len + 1);
213 diff -ur poldek-0.18.8/shell/get.c poldek-0.18.8-rpm/shell/get.c
214 --- poldek-0.18.8/shell/get.c   2002-03-25 21:30:08.000000000 +0100
215 +++ poldek-0.18.8-rpm/shell/get.c       2005-05-21 00:20:40.173320816 +0200
216 @@ -119,7 +119,7 @@
217          destdirp = destdir;
218      }
219      
220 -    if (!packages_fetch(pkgs, destdirp, 1))
221 +    if (!packages_fetch(pkgs, destdirp, 1, cmdarg->sh_s->inst->rpmcommand))
222          err++;
223      
224   l_end:
225 diff -ur poldek-0.18.8/uninstall.c poldek-0.18.8-rpm/uninstall.c
226 --- poldek-0.18.8/uninstall.c   2002-11-22 18:07:26.000000000 +0100
227 +++ poldek-0.18.8-rpm/uninstall.c       2005-05-21 00:19:48.889117200 +0200
228 @@ -340,17 +340,17 @@
229      n = 0;
230      
231      if (inst->flags & INSTS_RPMTEST) {
232 -        cmd = "/bin/rpm";
233 -        argv[n++] = "rpm";
234 +        cmd = inst->rpmcommand;
235 +        argv[n++] = inst->rpmcommand;
236          
237      } else if (inst->flags & INSTS_USESUDO) {
238          cmd = "/usr/bin/sudo";
239          argv[n++] = "sudo";
240 -        argv[n++] = "/bin/rpm";
241 +        argv[n++] = inst->rpmcommand;
242          
243      } else {
244 -        cmd = "/bin/rpm";
245 -        argv[n++] = "rpm";
246 +        cmd = inst->rpmcommand;
247 +        argv[n++] = inst->rpmcommand;
248      }
249      
250      argv[n++] = "--erase";
This page took 0.172032 seconds and 4 git commands to generate.