rpm  5.4.14
rpmts.c
Go to the documentation of this file.
1 
5 #include "system.h"
6 
7 #include <rpmio.h>
8 #include <rpmiotypes.h> /* XXX fnpyKey */
9 #include <rpmlog.h>
10 #include <iosm.h> /* XXX iosmFileAction */
11 #include <rpmurl.h>
12 #include <rpmpgp.h>
13 #include <rpmmacro.h> /* XXX rpmtsOpenDB() needs rpmGetPath */
14 #include <rpmkeyring.h>
15 #include <rpmhkp.h>
16 #include <rpmsx.h>
17 
18 #include <rpmtypes.h>
19 #define _RPMTAG_INTERNAL /* XXX tagStore_s */
20 #include <rpmtag.h>
21 #include <pkgio.h>
22 
23 #define _RPMDB_INTERNAL /* XXX almost opaque sigh */
24 #include "rpmdb.h" /* XXX stealing db->db_mode. */
25 
26 #include "rpmal.h"
27 #include "rpmds.h"
28 #include "rpmfi.h"
29 #include "rpmlock.h"
30 #include "rpmns.h"
31 
32 #define _RPMTE_INTERNAL /* XXX te->h */
33 #include "rpmte.h"
34 
35 #define _RPMTS_INTERNAL
36 #define _RPMBAG_INTERNAL
37 #include "rpmts.h"
38 
39 #include <rpmcli.h>
40 
41 #include "fs.h"
42 
43 /* XXX FIXME: merge with existing (broken?) tests in system.h */
44 /* portability fiddles */
45 #if STATFS_IN_SYS_STATVFS
46 /*@-incondefs@*/
47 #if defined(__LCLINT__)
48 /*@-declundef -exportheader -protoparammatch @*/ /* LCL: missing annotation */
49 extern int statvfs (const char * file, /*@out@*/ struct statvfs * buf)
50  /*@globals fileSystem @*/
51  /*@modifies *buf, fileSystem @*/;
52 /*@=declundef =exportheader =protoparammatch @*/
53 /*@=incondefs@*/
54 #else
55 # include <sys/statvfs.h>
56 #endif
57 #else
58 # if STATFS_IN_SYS_VFS
59 # include <sys/vfs.h>
60 # else
61 # if STATFS_IN_SYS_MOUNT
62 # include <sys/mount.h>
63 # else
64 # if STATFS_IN_SYS_STATFS
65 # include <sys/statfs.h>
66 # endif
67 # endif
68 # endif
69 #endif
70 
71 #include "debug.h"
72 
73 /*@access FD_t @*/ /* XXX void * arg */
74 /*@access rpmdb @*/ /* XXX db->db_chrootDone, NULL */
75 
76 /*@access rpmDiskSpaceInfo @*/
77 /*@access rpmKeyring @*/
78 /*@access rpmps @*/
79 /*@access rpmte @*/
80 /*@access rpmtsi @*/
81 /*@access fnpyKey @*/
82 /*@access pgpDig @*/
83 /*@access pgpDigParams @*/
84 
85 #ifdef __cplusplus
86 GENfree(rpmDiskSpaceInfo)
87 GENfree(uint32_t *)
88 GENfree(fnpyKey *)
89 GENfree(rpmte *)
90 #endif /* __cplusplus */
91 
92 /*@unchecked@*/
93 int _rpmts_debug = 0;
94 
95 /*@unchecked@*/
96 int _rpmts_stats = 0;
97 
98 /*@unchecked@*/
99 int _rpmts_macros = 0;
100 
102 {
103  int rc = 0;
104 
105  if (ts->rdb != NULL) {
106  (void) rpmswAdd(rpmtsOp(ts, RPMTS_OP_DBGET), &ts->rdb->db_getops);
107  (void) rpmswAdd(rpmtsOp(ts, RPMTS_OP_DBPUT), &ts->rdb->db_putops);
108  (void) rpmswAdd(rpmtsOp(ts, RPMTS_OP_DBDEL), &ts->rdb->db_delops);
109  rc = rpmdbClose(ts->rdb);
110  ts->rdb = NULL;
111  }
112  return rc;
113 }
114 
115 int rpmtsOpenDB(rpmts ts, int dbmode)
116 {
117  int rc = 0;
118 
119  if (ts->rdb != NULL && ts->dbmode == dbmode)
120  return 0;
121 
122  (void) rpmtsCloseDB(ts);
123 
124  /* XXX there's a db lock race here that is the callers responsibility. */
125 
126  ts->dbmode = dbmode;
127  rc = rpmdbOpen(ts->rootDir, &ts->rdb, ts->dbmode, (mode_t)0644);
128  if (rc) {
129  const char * dn = rpmGetPath(ts->rootDir, "%{_dbpath}", NULL);
130  rpmlog(RPMLOG_ERR, _("cannot open Packages database in %s\n"), dn);
131  dn = _free(dn);
132  }
133  return rc;
134 }
135 
137 {
138  void * lock = rpmtsAcquireLock(ts);
139  rpmdb db = NULL;
140  const char * fn;
141  struct stat sb;
142  int rc;
143  int xx;
144 
145  /* XXX Seqno update needs O_RDWR. */
146  rc = rpmtsOpenDB(ts, O_RDWR);
147  if (rc) goto exit;
148  db = rpmtsGetRdb(ts);
149 
150  if (!(db->db_api == 3 || db->db_api == 4))
151  goto exit;
152 
153  rc = rpmtxnCheckpoint(db);
154  if (rc) goto exit;
155 
156  { size_t dbix;
157  for (dbix = 0; dbix < db->db_ndbi; dbix++) {
158  tagStore_t dbiTags = &db->db_tags[dbix];
159 
160  /* Remove configured secondary indices. */
161  switch (dbiTags->tag) {
162  case RPMDBI_PACKAGES:
163  case RPMDBI_AVAILABLE:
164  case RPMDBI_ADDED:
165  case RPMDBI_REMOVED:
166  case RPMDBI_DEPCACHE:
167  case RPMDBI_SEQNO:
168  case RPMDBI_BTREE:
169  case RPMDBI_HASH:
170  case RPMDBI_QUEUE:
171  case RPMDBI_RECNO:
172  continue;
173  /*@notreached@*/ /*@switchbreak@*/ break;
174  default:
175  fn = rpmGetPath(db->db_root, db->db_home, "/",
176  (dbiTags->str != NULL ? dbiTags->str : tagName(dbiTags->tag)),
177  NULL);
178  if (!Stat(fn, &sb))
179  xx = Unlink(fn);
180  fn = _free(fn);
181  /*@switchbreak@*/ break;
182  }
183 
184  /* Open (and re-create) each index. */
185  (void) dbiOpen(db, dbiTags->tag, db->db_flags);
186  }
187  }
188 
189  /* Unreference header used by associated secondary index callbacks. */
190  (void) headerFree(db->db_h);
191  db->db_h = NULL;
192 
193  /* Reset the Seqno counter to the maximum primary key */
194  rpmlog(RPMLOG_DEBUG, D_("rpmdb: max. primary key %u\n"),
195  (unsigned)db->db_maxkey);
196  fn = rpmGetPath(db->db_root, db->db_home, "/Seqno", NULL);
197  if (!Stat(fn, &sb))
198  xx = Unlink(fn);
199  (void) dbiOpen(db, RPMDBI_SEQNO, db->db_flags);
200  fn = _free(fn);
201 
202  rc = rpmtxnCheckpoint(db);
203 
204  xx = rpmtsCloseDB(ts);
205 
206 exit:
207  lock = rpmtsFreeLock(lock);
208  return rc;
209 }
210 
211 /*@-compdef@*/ /* keyp might not be defined. */
213  const void * keyp, size_t keylen)
214 {
215  rpmmi mi = (ts->rdb == NULL && rpmtsOpenDB(ts, ts->dbmode))
216  ? NULL
217  : rpmmiInit(ts->rdb, rpmtag, keyp, keylen);
218  return mi;
219 }
220 /*@=compdef@*/
221 
223 {
224  rpmbag bag = ts->bag;
225  int rc = 0;
226 
227  if (bag != NULL) {
228  rpmsdb * sdbp = bag->sdbp;
229  int i = bag->nsdbp;
230  if (sdbp)
231  while (--i >= 0) {
232  rpmdb sdb;
233  if (sdbp[i] == NULL)
234  continue;
235  sdb = (rpmdb) sdbp[i]->_db;
236  if (sdb) {
237  int xx;
238  (void) rpmswAdd(rpmtsOp(ts, RPMTS_OP_DBGET), &sdb->db_getops);
239  (void) rpmswAdd(rpmtsOp(ts, RPMTS_OP_DBPUT), &sdb->db_putops);
240  (void) rpmswAdd(rpmtsOp(ts, RPMTS_OP_DBDEL), &sdb->db_delops);
241  xx = rpmdbClose(sdb);
242  if (xx && rc == 0)
243  rc = xx;
244  }
245  (void) rpmbagDel(bag, i);
246  }
247  ts->bag = rpmbagFree(ts->bag);
248  }
249  return rc;
250 }
251 
252 int rpmtsOpenSDB(rpmts ts, int dbmode)
253 {
254  static int has_sdbpath = -1;
255  rpmbag bag = ts->bag;
256  rpmsdb * sdbp = NULL;
257  rpmdb sdb = NULL;
258  int sdbmode = O_RDONLY;
259  const char * s = NULL;
260 #ifdef DYING /* XXX solevedb's never need chroot prefix. */
261  const char * rootDir = ts->rootDir;
262 #else
263  const char * rootDir = "/";
264 #endif
265  ARGV_t av = NULL;
266  int ac = 0;
267  int rc = 0;
268  int xx;
269  int i;
270 
271  if (bag == NULL) {
272  bag = ts->bag = rpmbagNew(NULL, 0);
273  if (bag == NULL)
274  goto exit;
275  }
276  sdbp = bag->sdbp;
277  sdb = (rpmdb) (sdbp[0] ? sdbp[0]->_db : NULL);
278  sdbmode = (sdbp[0] ? sdbp[0]->dbmode : O_RDONLY);
279 
280  if (sdb != NULL && sdbmode == dbmode) {
281  rc = 0;
282  goto exit;
283  }
284 
285  if (has_sdbpath < 0)
286  has_sdbpath = rpmExpandNumeric("%{?_solve_dbpath:1}");
287 
288  /* If not configured, don't try to open. */
289  if (has_sdbpath <= 0) {
290  rc = 1;
291  goto exit;
292  }
293 
294  s = rpmExpand("%{?_solve_dbpath}", NULL);
295  xx = argvSplit(&av, s, ":");
296  ac = argvCount(av);
297 
298  for (i = 0; i < ac; i++) {
299  const char * fn;
300  urltype ut;
301 
302  if (av[i] == NULL || *av[i] == '\0')
303  continue;
304 
305  fn = NULL;
306  ut = urlPath(av[i], &fn);
307 
308  /* XXX Lstat(fn, &sb) to ensure a directory? */
309  addMacro(NULL, "_dbpath", NULL, fn, RMIL_DEFAULT);
310  xx = rpmdbOpen(rootDir, &sdb, dbmode, (mode_t)0644);
311  delMacro(NULL, "_dbpath");
312 
313  if (xx) {
314  const char * dn = rpmGetPath(rootDir, "/", fn, NULL);
315  rpmlog(RPMLOG_WARNING, _("cannot open Solve database in %s\n"), dn);
316  dn = _free(dn);
317  if (rc == 0)
318  rc = xx;
319 
320  /* XXX only try to open the solvedb once. */
321  has_sdbpath = 0;
322  continue;
323  }
324 
325  xx = rpmbagAdd(bag, sdb, dbmode);
326  }
327 
328  av = argvFree(av);
329  s = _free(s);
330 
331 exit:
332 if (_rpmts_debug)
333 fprintf(stderr, "<-- %s(%p, 0%o) rc %d\n", __FUNCTION__, ts, dbmode, rc);
334  return rc;
335 }
336 
343 static int sugcmp(const void * a, const void * b)
344  /*@*/
345 {
346  const char * astr = *(const char **)a;
347  const char * bstr = *(const char **)b;
348  return strcmp(astr, bstr);
349 }
350 
351 int rpmtsSolve(rpmts ts, rpmds ds, /*@unused@*/ const void * data)
352 {
353  HE_t he = (HE_t) memset(alloca(sizeof(*he)), 0, sizeof(*he));
354  rpmbag bag = ts->bag;
355  rpmsdb * sdbp = NULL;
356  const char * errstr = NULL;
357  const char * str = NULL;
358  rpmmi mi;
359  Header bh = NULL;
360  Header h = NULL;
361  size_t bhnamelen = 0;
362  time_t bhtime = 0;
363  rpmTag rpmtag;
364  const char * keyp;
365  size_t keylen = 0;
366  int rc = 1; /* assume not found */
367  int xx;
368  int i;
369 
370 if (_rpmts_debug)
371 fprintf(stderr, "--> %s(%p,%p,%p)\n", __FUNCTION__, ts, ds, data);
372 
373  /* Make suggestions only for installing Requires: */
374  if (ts->goal != TSM_INSTALL)
375  goto exit;
376 
377  switch (rpmdsTagN(ds)) {
378  case RPMTAG_CONFLICTNAME:
379  default:
380  goto exit;
381  /*@notreached@*/ break;
382  case RPMTAG_DIRNAMES: /* XXX perhaps too many wrong answers? */
383  case RPMTAG_REQUIRENAME:
384  case RPMTAG_FILELINKTOS:
385  break;
386  }
387 
388  keyp = rpmdsN(ds);
389  if (keyp == NULL)
390  goto exit;
391 
392  if (bag == NULL) {
393  xx = rpmtsOpenSDB(ts, O_RDONLY);
394  if (xx)
395  goto exit;
396  bag = ts->bag;
397  if (bag == NULL)
398  goto exit;
399  }
400 
401  sdbp = bag->sdbp;
402 
403  if (sdbp)
404  for (i = 0; i < (int)bag->nsdbp; i++) {
405  rpmdb sdb = NULL;
406 
407  if (sdbp[i] == NULL)
408  continue;
409  sdb = (rpmdb) sdbp[i]->_db;
410  if (sdb == NULL)
411  continue;
412 
413  /* Look for a matching Provides: in suggested universe. */
414  rpmtag = (*keyp == '/' ? RPMTAG_FILEPATHS : RPMTAG_PROVIDENAME);
415  mi = rpmmiInit(sdb, rpmtag, keyp, keylen);
416  while ((h = rpmmiNext(mi)) != NULL) {
417  size_t hnamelen;
418  time_t htime;
419 
420  if (rpmtag == RPMTAG_PROVIDENAME && !rpmdsAnyMatchesDep(h, ds, 1))
421  continue;
422 
423  he->tag = RPMTAG_NAME;
424  xx = headerGet(h, he, 0);
425  hnamelen = ((xx && he->p.str) ? strlen(he->p.str) : 0);
426  he->p.ptr = _free(he->p.ptr);
427 
428  /* XXX Prefer the shortest pkg N for basenames/provides resp. */
429  if (bhnamelen > 0 && hnamelen > bhnamelen)
430  continue;
431 
432  /* XXX Prefer the newest build if given alternatives. */
433  he->tag = RPMTAG_BUILDTIME;
434  xx = headerGet(h, he, 0);
435  htime = (xx && he->p.ui32p ? he->p.ui32p[0] : 0);
436  he->p.ptr = _free(he->p.ptr);
437 
438  if (htime <= bhtime)
439  continue;
440 
441  /* Save new "best" candidate. */
442  (void)headerFree(bh);
443  bh = NULL;
444  bh = headerLink(h);
445  bhtime = htime;
446  bhnamelen = hnamelen;
447  }
448  mi = rpmmiFree(mi);
449  }
450 
451  /* Is there a suggested resolution? */
452  if (bh == NULL)
453  goto exit;
454 
455  /* Get the path to the package file. */
457  he->p.ptr = NULL;
458  xx = headerGet(bh, he, 0);
459  if (he->p.str) {
460  str = he->p.str;
461  he->p.str = NULL;
462  } else {
463  /* Format the suggested resolution path. */
464  const char * qfmt = rpmExpand("%{?_solve_name_fmt}", NULL);
465  if (qfmt == NULL || *qfmt == '\0')
466  goto exit;
467  str = headerSprintf(bh, qfmt, NULL, rpmHeaderFormats, &errstr);
468  qfmt = _free(qfmt);
469  }
470 
471  (void) headerFree(bh);
472  bh = NULL;
473  if (errstr) {
474  rpmlog(RPMLOG_ERR, _("incorrect solve path format: %s\n"), errstr);
475  goto exit;
476  }
477 
478  if (ts->depFlags & RPMDEPS_FLAG_ADDINDEPS) {
479  FD_t fd;
480  rpmRC rpmrc;
481 
482  fd = Fopen(str, "r.fdio");
483  if (fd == NULL || Ferror(fd)) {
484  rpmlog(RPMLOG_ERR, _("open of %s failed: %s\n"), str,
485  Fstrerror(fd));
486  if (fd != NULL) {
487  xx = Fclose(fd);
488  fd = NULL;
489  }
490  str = _free(str);
491  goto exit;
492  }
493  rpmrc = rpmReadPackageFile(ts, fd, str, &h);
494  xx = Fclose(fd);
495  switch (rpmrc) {
496  default:
497  str = _free(str);
498  break;
499  case RPMRC_NOTTRUSTED:
500  case RPMRC_NOKEY:
501  case RPMRC_OK:
502  if (h != NULL &&
503  !rpmtsAddInstallElement(ts, h, (fnpyKey)str, 1, NULL))
504  {
505  rpmlog(RPMLOG_DEBUG, D_("Adding: %s\n"), str);
506  rc = -1; /* XXX restart unsatisfiedDepends() */
507  break;
508  }
509  break;
510  }
511  (void)headerFree(h);
512  h = NULL;
513  goto exit;
514  }
515 
516  rpmlog(RPMLOG_DEBUG, D_("Suggesting: %s\n"), str);
517  /* If suggestion is already present, don't bother. */
518  if (ts->suggests != NULL && ts->nsuggests > 0) {
519  if (bsearch(&str, ts->suggests, ts->nsuggests,
520  sizeof(*ts->suggests), sugcmp))
521  {
522  str = _free(str);
523  goto exit;
524  }
525  }
526 
527  /* Add a new (unique) suggestion. */
528  ts->suggests = (const void **) xrealloc(ts->suggests,
529  sizeof(*ts->suggests) * (ts->nsuggests + 2));
530  ts->suggests[ts->nsuggests] = str;
531  ts->nsuggests++;
532  ts->suggests[ts->nsuggests] = NULL;
533 
534  if (ts->nsuggests > 1)
535  qsort(ts->suggests, ts->nsuggests, sizeof(*ts->suggests), sugcmp);
536 
537 exit:
538 if (_rpmts_debug)
539 fprintf(stderr, "<-- %s(%p,%p,%p) rc %d N %s EVR %s F 0x%x\n", __FUNCTION__, ts, ds, data, rc, rpmdsN(ds), rpmdsEVR(ds), rpmdsFlags(ds));
540  return rc;
541 }
542 
543 int rpmtsAvailable(rpmts ts, const rpmds ds)
544 {
545  fnpyKey * sugkey;
546  int rc = 1; /* assume not found */
547 
548  if (ts->availablePackages == NULL)
549  return rc;
550  sugkey = rpmalAllSatisfiesDepend(ts->availablePackages, ds, NULL);
551  if (sugkey == NULL)
552  return rc;
553 
554  /* XXX no alternatives yet */
555  if (sugkey[0] != NULL) {
556  ts->suggests = (const void **) xrealloc(ts->suggests,
557  sizeof(*ts->suggests) * (ts->nsuggests + 2));
558  ts->suggests[ts->nsuggests] = sugkey[0];
559  sugkey[0] = NULL;
560  ts->nsuggests++;
561  ts->suggests[ts->nsuggests] = NULL;
562  }
563  sugkey = _free(sugkey);
564  return rc;
565 }
566 
568  int (*solve) (rpmts ts, rpmds key, const void * data),
569  const void * solveData)
570 {
571  int rc = 0;
572 
573  if (ts) {
574 /*@-assignexpose -temptrans @*/
575  ts->solve = solve;
576  ts->solveData = solveData;
577 /*@=assignexpose =temptrans @*/
578  }
579  return rc;
580 }
581 
583 {
584  static const char msg[] = "rpmtsProblems";
585  rpmps ps = NULL;
586  if (ts) {
587  if (ts->probs == NULL)
588  ts->probs = rpmpsCreate();
589 /*@-castexpose@*/
590  ps = rpmpsLink(ts->probs, msg);
591 /*@=castexpose@*/
592  }
593  return ps;
594 }
595 
597 {
598  rpmtsi pi; rpmte p;
599 
600  if (ts == NULL)
601  return;
602 
603  /* Clean up after dependency checks. */
604  pi = rpmtsiInit(ts);
605  while ((p = rpmtsiNext(pi, (rpmElementType)0)) != NULL)
606  rpmteCleanDS(p);
607  pi = rpmtsiFree(pi);
608 
609  ts->addedPackages = rpmalFree(ts->addedPackages);
610  ts->numAddedPackages = 0;
611 
612  ts->erasedPackages = rpmalFree(ts->erasedPackages);
613  ts->numErasedPackages = 0;
614 
615  ts->suggests = _free(ts->suggests);
616  ts->nsuggests = 0;
617 
618  ts->probs = rpmpsFree(ts->probs);
619 
620  rpmtsCleanDig(ts);
621 }
622 
624 {
625  rpmtsi pi; rpmte p;
626  int oc;
627 
628  if (ts == NULL)
629  return;
630 
631 /*@-nullstate@*/ /* FIX: partial annotations */
632  rpmtsClean(ts);
633 /*@=nullstate@*/
634 
635  for (pi = rpmtsiInit(ts), oc = 0; (p = rpmtsiNext(pi, (rpmElementType)0)) != NULL; oc++) {
636 /*@-type -unqualifiedtrans @*/
637  ts->order[oc] = rpmteFree(ts->order[oc]);
638 /*@=type =unqualifiedtrans @*/
639  }
640  pi = rpmtsiFree(pi);
641  ts->numAddedFiles = 0;
642  ts->numErasedFiles = 0;
643 
644  ts->orderCount = 0;
645  ts->ntrees = 0;
646  ts->maxDepth = 0;
647 
648  ts->numRemovedPackages = 0;
649 /*@-nullstate@*/ /* FIX: partial annotations */
650  return;
651 /*@=nullstate@*/
652 }
653 
654 static void rpmtsPrintStat(const char * name, /*@null@*/ struct rpmop_s * op)
655  /*@globals fileSystem @*/
656  /*@modifies fileSystem @*/
657 {
658  static unsigned int scale = (1000 * 1000);
659  if (op != NULL && op->count > 0)
660  fprintf(stderr, " %s %8d %6lu.%06lu MB %6lu.%06lu secs\n",
661  name, op->count,
662  (unsigned long)op->bytes/scale, (unsigned long)op->bytes%scale,
663  op->usecs/scale, op->usecs%scale);
664 }
665 
666 /*@unchecked@*/ /*@relnull@*/
667 extern rpmop _hdr_loadops;
668 /*@unchecked@*/ /*@relnull@*/
669 extern rpmop _hdr_getops;
670 
671 static void rpmtsPrintStats(rpmts ts)
672  /*@globals fileSystem, internalState @*/
673  /*@modifies fileSystem, internalState @*/
674 {
676 
677  if (_hdr_loadops)
679  if (_hdr_getops)
681 
682  rpmtsPrintStat("total: ", rpmtsOp(ts, RPMTS_OP_TOTAL));
683  rpmtsPrintStat("check: ", rpmtsOp(ts, RPMTS_OP_CHECK));
684  rpmtsPrintStat("order: ", rpmtsOp(ts, RPMTS_OP_ORDER));
685  rpmtsPrintStat("fingerprint: ", rpmtsOp(ts, RPMTS_OP_FINGERPRINT));
686  rpmtsPrintStat("repackage: ", rpmtsOp(ts, RPMTS_OP_REPACKAGE));
687  rpmtsPrintStat("install: ", rpmtsOp(ts, RPMTS_OP_INSTALL));
688  rpmtsPrintStat("erase: ", rpmtsOp(ts, RPMTS_OP_ERASE));
689  rpmtsPrintStat("scriptlets: ", rpmtsOp(ts, RPMTS_OP_SCRIPTLETS));
690  rpmtsPrintStat("compress: ", rpmtsOp(ts, RPMTS_OP_COMPRESS));
691  rpmtsPrintStat("uncompress: ", rpmtsOp(ts, RPMTS_OP_UNCOMPRESS));
692  rpmtsPrintStat("digest: ", rpmtsOp(ts, RPMTS_OP_DIGEST));
693  rpmtsPrintStat("signature: ", rpmtsOp(ts, RPMTS_OP_SIGNATURE));
694  rpmtsPrintStat("dbadd: ", rpmtsOp(ts, RPMTS_OP_DBADD));
695  rpmtsPrintStat("dbremove: ", rpmtsOp(ts, RPMTS_OP_DBREMOVE));
696  rpmtsPrintStat("dbget: ", rpmtsOp(ts, RPMTS_OP_DBGET));
697  rpmtsPrintStat("dbput: ", rpmtsOp(ts, RPMTS_OP_DBPUT));
698  rpmtsPrintStat("dbdel: ", rpmtsOp(ts, RPMTS_OP_DBDEL));
699  rpmtsPrintStat("readhdr: ", rpmtsOp(ts, RPMTS_OP_READHDR));
700  rpmtsPrintStat("hdrload: ", rpmtsOp(ts, RPMTS_OP_HDRLOAD));
701  rpmtsPrintStat("hdrget: ", rpmtsOp(ts, RPMTS_OP_HDRGET));
702 /*@-globstate@*/
703  return;
704 /*@=globstate@*/
705 }
706 
707 static void rpmtsFini(void * _ts)
708  /*@modifies _ts @*/
709 {
710  rpmts ts = (rpmts) _ts;
711 
712 /*@-nullstate@*/ /* FIX: partial annotations */
713  /* XXX there's a recursion here ... release and reacquire the lock */
714 #ifndef BUGGY
715  yarnRelease(ts->_item.use); /* XXX hack-o-round */
716 #endif
717  rpmtsEmpty(ts);
718 #ifndef BUGGY
719  yarnPossess(ts->_item.use); /* XXX hack-o-round */
720 #endif
721 /*@=nullstate@*/
722 
723  ts->PRCO = rpmdsFreePRCO(ts->PRCO);
724 
725  (void) rpmtsCloseDB(ts);
726 assert(ts->txn == NULL); /* XXX FIXME */
727  ts->txn = NULL;
728 
729  (void) rpmtsCloseSDB(ts);
730 
731  (void) rpmbfFree(ts->rbf);
732  ts->rbf = NULL;
733  ts->removedPackages = _free(ts->removedPackages);
734 
735  ts->availablePackages = rpmalFree(ts->availablePackages);
736  ts->numAvailablePackages = 0;
737 
738  ts->dsi = _free(ts->dsi);
739 
740  if (ts->scriptFd != NULL) {
741 /*@-refcounttrans@*/ /* FIX: XfdFree annotation */
742  ts->scriptFd = fdFree(ts->scriptFd, __FUNCTION__);
743 /*@=refcounttrans@*/
744  ts->scriptFd = NULL;
745  }
746  ts->rootDir = _free(ts->rootDir);
747  ts->currDir = _free(ts->currDir);
748 
749 /*@-type +voidabstract @*/ /* FIX: double indirection */
750  ts->order = _free(ts->order);
751 /*@=type =voidabstract @*/
752  ts->orderAlloced = 0;
753 
754  ts->keyring = rpmKeyringFree(ts->keyring);
755  (void) rpmhkpFree(ts->hkp);
756  ts->hkp = NULL;
757 
758  if (_rpmts_stats)
759  rpmtsPrintStats(ts);
760 
761  if (_rpmts_macros) {
762  const char ** av = NULL;
763 /*@-globs@*/ /* Avoid rpmGlobalMcroContext et al. */
764  (void)rpmGetMacroEntries(NULL, NULL, 1, &av);
765 /*@=globs@*/
766  argvPrint("macros used", av, NULL);
767  av = argvFree(av);
768  }
769 }
770 
771 /*@unchecked@*/ /*@only@*/ /*@null@*/
773 
774 static rpmts rpmtsGetPool(/*@null@*/ rpmioPool pool)
775  /*@globals _rpmtsPool, fileSystem, internalState @*/
776  /*@modifies pool, _rpmtsPool, fileSystem, internalState @*/
777 {
778  rpmts ts;
779 
780  if (_rpmtsPool == NULL) {
781  _rpmtsPool = rpmioNewPool("ts", sizeof(*ts), -1, _rpmts_debug,
782  NULL, NULL, rpmtsFini);
783  pool = _rpmtsPool;
784  }
785  ts = (rpmts) rpmioGetPool(pool, sizeof(*ts));
786  memset(((char *)ts)+sizeof(ts->_item), 0, sizeof(*ts)-sizeof(ts->_item));
787  return ts;
788 }
789 
790 void * rpmtsGetKeyring(rpmts ts, /*@unused@*/ int autoload)
791 {
792  rpmKeyring keyring = NULL;
793  if (ts) {
794 #ifdef NOTYET
795  if (ts->keyring == NULL && autoload)
796  loadKeyring(ts);
797  keyring = rpmKeyringLink(ts->keyring);
798 #else
799  keyring = ts->keyring;
800 #endif
801  }
802 /*@-refcounttrans@*/
803  return (void *)keyring;
804 /*@=refcounttrans@*/
805 }
806 
807 int rpmtsSetKeyring(rpmts ts, void * _keyring)
808 {
809  rpmKeyring keyring = (rpmKeyring) _keyring;
810 
811  if (ts == NULL)
812  return -1;
813 
814 #ifdef NOTYET
815  /*
816  * Should we permit switching keyring on the fly? For now, require
817  * rpmdb isn't open yet (fairly arbitrary limitation)...
818  */
819  if (rpmtsGetRdb(ts) != NULL)
820  return -1;
821 #endif
822 
823 /*@-modnomods@*/
824  ts->keyring = rpmKeyringFree(ts->keyring);
825 /*@=modnomods@*/
826 
827 #ifdef NOTYET
828  ts->keyring = rpmKeyringLink(keyring);
829 #else
830 /*@-assignexpose -newreftrans @*/
831 /*@i@*/ ts->keyring = keyring;
832 /*@=assignexpose =newreftrans @*/
833 #endif
834 
835  return 0;
836 }
837 
838 rpmVSFlags rpmtsVSFlags(/*@unused@*/ rpmts ts)
839 {
840  return pgpDigVSFlags;
841 }
842 
844  /*@globals pgpDigVSFlags @*/
845  /*@modifies pgpDigVSFlags @*/
846 {
847  rpmVSFlags ovsflags;
848  ovsflags = pgpDigVSFlags;
850  return ovsflags;
851 }
852 
853 /*
854  * This allows us to mark transactions as being of a certain type.
855  * The three types are:
856  *
857  * RPM_TRANS_NORMAL
858  * RPM_TRANS_ROLLBACK
859  * RPM_TRANS_AUTOROLLBACK
860  *
861  * ROLLBACK and AUTOROLLBACK transactions should always be ran as
862  * a best effort. In particular this is important to the autorollback
863  * feature to avoid rolling back a rollback (otherwise known as
864  * dueling rollbacks (-;). AUTOROLLBACK's additionally need instance
865  * counts passed to scriptlets to be altered.
866  */
867 /* Let them know what type of transaction we are */
869 {
870  return (rpmTSType) ((ts != NULL) ? ts->type : 0);
871 }
872 
874 {
875  if (ts != NULL)
876  ts->type = type;
877 }
878 
880 {
881  return ((ts != NULL) ? ts->arbgoal : 0);
882 }
883 
885 {
886  if (ts != NULL)
887  ts->arbgoal = goal;
888 }
889 
890 int rpmtsUnorderedSuccessors(rpmts ts, int first)
891 {
892  int unorderedSuccessors = 0;
893  if (ts != NULL) {
894  unorderedSuccessors = ts->unorderedSuccessors;
895  if (first >= 0)
896  ts->unorderedSuccessors = first;
897  }
898  return unorderedSuccessors;
899 }
900 
901 const char * rpmtsRootDir(rpmts ts)
902 {
903  const char * rootDir = NULL;
904 
905  if (ts != NULL && ts->rootDir != NULL) {
906  urltype ut = urlPath(ts->rootDir, &rootDir);
907  switch (ut) {
908  case URL_IS_UNKNOWN:
909  case URL_IS_PATH:
910  break;
911  case URL_IS_DASH:
912  case URL_IS_HKP:
913  case URL_IS_FTP:
914  case URL_IS_HTTP:
915  case URL_IS_HTTPS:
916  case URL_IS_MONGO: /* XXX FIXME */
917  default:
918  rootDir = "/";
919  break;
920  }
921  }
922  return rootDir;
923 }
924 
925 void rpmtsSetRootDir(rpmts ts, const char * rootDir)
926 {
927  if (ts != NULL) {
928  size_t rootLen;
929 
930  ts->rootDir = _free(ts->rootDir);
931 
932  if (rootDir == NULL) {
933 #ifdef DYING
934  ts->rootDir = xstrdup("");
935 #endif
936  return;
937  }
938  rootLen = strlen(rootDir);
939 
940  /* Make sure that rootDir has trailing / */
941  if (!(rootLen && rootDir[rootLen - 1] == '/')) {
942  char * t = (char *) alloca(rootLen + 2);
943  *t = '\0';
944  (void) stpcpy( stpcpy(t, rootDir), "/");
945  rootDir = t;
946  }
947  ts->rootDir = xstrdup(rootDir);
948  }
949 }
950 
951 const char * rpmtsCurrDir(rpmts ts)
952 {
953  const char * currDir = NULL;
954  if (ts != NULL) {
955  currDir = ts->currDir;
956  }
957  return currDir;
958 }
959 
960 void rpmtsSetCurrDir(rpmts ts, const char * currDir)
961 {
962  if (ts != NULL) {
963  ts->currDir = _free(ts->currDir);
964  if (currDir)
965  ts->currDir = xstrdup(currDir);
966  }
967 }
968 
970 {
971  FD_t scriptFd = NULL;
972  if (ts != NULL) {
973  scriptFd = ts->scriptFd;
974  }
975 /*@-compdef -refcounttrans -usereleased@*/
976  return scriptFd;
977 /*@=compdef =refcounttrans =usereleased@*/
978 }
979 
980 void rpmtsSetScriptFd(rpmts ts, FD_t scriptFd)
981 {
982 
983  if (ts != NULL) {
984  if (ts->scriptFd != NULL) {
985 /*@-assignexpose@*/
986  ts->scriptFd = fdFree(ts->scriptFd, "rpmtsSetScriptFd");
987 /*@=assignexpose@*/
988  ts->scriptFd = NULL;
989  }
990 /*@-assignexpose -castexpose @*/
991  if (scriptFd != NULL)
992  ts->scriptFd = fdLink((void *)scriptFd, "rpmtsSetScriptFd");
993 /*@=assignexpose =castexpose @*/
994  }
995 }
996 
998 {
999  int selinuxEnabled = 0;
1000  if (ts)
1001  selinuxEnabled = (ts->selinuxEnabled > 0);
1002  return selinuxEnabled;
1003 }
1004 
1006 {
1007  return (ts != NULL ? ts->chrootDone : 0);
1008 }
1009 
1010 int rpmtsSetChrootDone(rpmts ts, int chrootDone)
1011 {
1012  int ochrootDone = 0;
1013  if (ts != NULL) {
1014  ochrootDone = ts->chrootDone;
1015  if (ts->rdb != NULL)
1016  ts->rdb->db_chrootDone = chrootDone;
1017  ts->chrootDone = chrootDone;
1018  }
1019  return ochrootDone;
1020 }
1021 
1023 {
1024  rpmuint32_t tid = 0; /* XXX -1 is time(2) error return. */
1025  if (ts != NULL) {
1026  tid = ts->tid[0];
1027  }
1028  return tid;
1029 }
1030 
1032 {
1033  rpmuint32_t otid = 0; /* XXX -1 is time(2) error return. */
1034  if (ts != NULL) {
1035  otid = ts->tid[0];
1036  ts->tid[0] = tid;
1037  ts->tid[1] = 0;
1038  }
1039  return otid;
1040 }
1041 
1043 {
1044  rpmPRCO PRCO = NULL;
1045 
1046  if (ts != NULL) {
1047  static int oneshot = 0;
1048  if (!oneshot) {
1049  const char * fn = rpmGetPath("%{?_rpmds_sysinfo_path}", NULL);
1050  int xx;
1051 
1052  ts->PRCO = rpmdsNewPRCO(NULL);
1053  if (fn && *fn != '\0' && !rpmioAccess(fn, NULL, R_OK))
1054  xx = rpmdsSysinfo(ts->PRCO, NULL);
1055  fn = _free(fn);
1056  oneshot++;
1057  }
1058  PRCO = ts->PRCO;
1059  }
1060 /*@-compdef -retexpose -usereleased @*/
1061  return PRCO;
1062 /*@=compdef =retexpose =usereleased @*/
1063 }
1064 
1065 int rpmtsInitDSI(const rpmts ts)
1066 {
1067  rpmDiskSpaceInfo dsi;
1068  struct stat sb;
1069  int rc;
1070  size_t i;
1071 
1073  return 0;
1074  if (ts->filesystems != NULL)
1075  return 0;
1076 
1077  rpmlog(RPMLOG_DEBUG, D_("mounted filesystems:\n"));
1079  D_(" i dev bsize bavail iavail mount point\n"));
1080 
1081  rc = rpmGetFilesystemList(&ts->filesystems, &ts->filesystemCount);
1082  if (rc || ts->filesystems == NULL || ts->filesystemCount == 0)
1083  return rc;
1084 
1085  /* Get available space on mounted file systems. */
1086 
1087  ts->dsi = _free(ts->dsi);
1088  ts->dsi = (rpmDiskSpaceInfo) xcalloc((ts->filesystemCount + 1), sizeof(*ts->dsi));
1089 
1090  dsi = ts->dsi;
1091 
1092  if (dsi != NULL)
1093  for (i = 0; (i < ts->filesystemCount) && dsi; i++, dsi++) {
1094 #if STATFS_IN_SYS_STATVFS
1095  struct statvfs sfb;
1096  memset(&sfb, 0, sizeof(sfb));
1097  rc = statvfs(ts->filesystems[i], &sfb);
1098 #else
1099  struct statfs sfb;
1100  memset(&sfb, 0, sizeof(sfb));
1101 # if STAT_STATFS4
1102 /* This platform has the 4-argument version of the statfs call. The last two
1103  * should be the size of struct statfs and 0, respectively. The 0 is the
1104  * filesystem type, and is always 0 when statfs is called on a mounted
1105  * filesystem, as we're doing.
1106  */
1107  rc = statfs(ts->filesystems[i], &sfb, sizeof(sfb), 0);
1108 # else
1109  rc = statfs(ts->filesystems[i], &sfb);
1110 # endif
1111 #endif
1112  if (rc)
1113  break;
1114 
1115  rc = stat(ts->filesystems[i], &sb);
1116  if (rc)
1117  break;
1118  dsi->dev = sb.st_dev;
1119 /* XXX figger out how to get this info for non-statvfs systems. */
1120 #if STATFS_IN_SYS_STATVFS
1121  dsi->f_frsize = sfb.f_frsize;
1122 #if defined(RPM_OS_AIX)
1123  dsi->f_fsid = 0; /* sfb.f_fsid is a structure on AIX */
1124 #else
1125  dsi->f_fsid = sfb.f_fsid;
1126 #endif
1127  dsi->f_flag = sfb.f_flag;
1128  dsi->f_favail = (long long) sfb.f_favail;
1129  dsi->f_namemax = sfb.f_namemax;
1130 #elif defined(__APPLE__) && defined(__MACH__) && !defined(_SYS_STATVFS_H_)
1131  dsi->f_fsid = 0; /* "Not meaningful in this implementation." */
1132  dsi->f_namemax = pathconf(ts->filesystems[i], _PC_NAME_MAX);
1133 #elif defined(__OpenBSD__)
1134  dsi->f_fsid = 0; /* sfb.f_fsid is a structure on OpenBSD */
1135  dsi->f_namemax = pathconf(ts->filesystems[i], _PC_NAME_MAX);
1136 #else
1137  dsi->f_fsid = sfb.f_fsid;
1138  dsi->f_namemax = sfb.f_namelen;
1139 #endif
1140 
1141  dsi->f_bsize = sfb.f_bsize;
1142  dsi->f_blocks = (unsigned long long)sfb.f_blocks;
1143  dsi->f_bfree = (unsigned long long)sfb.f_bfree;
1144  dsi->f_files = (unsigned long long)sfb.f_files;
1145  dsi->f_ffree = (unsigned long long)sfb.f_ffree;
1146 
1147  dsi->bneeded = 0;
1148  dsi->ineeded = 0;
1149 #ifdef STATFS_HAS_F_BAVAIL
1150  dsi->f_bavail = (long long)(sfb.f_bavail ? sfb.f_bavail : 1);
1151  if (sfb.f_ffree > 0 && sfb.f_files > 0 && sfb.f_favail > 0)
1152  dsi->f_favail = (long long)sfb.f_favail;
1153  else /* XXX who knows what evil lurks here? */
1154  dsi->f_favail = !(sfb.f_ffree == 0 && sfb.f_files == 0)
1155  ? (signed long long) sfb.f_ffree : -1;
1156 #else
1157 /* FIXME: the statfs struct doesn't have a member to tell how many blocks are
1158  * available for non-superusers. f_blocks - f_bfree is probably too big, but
1159  * it's about all we can do.
1160  */
1161  dsi->f_bavail = sfb.f_blocks - sfb.f_bfree;
1162  /* XXX Avoid FAT and other file systems that have not inodes. */
1163  dsi->f_favail = !(sfb.f_ffree == 0 && sfb.f_files == 0)
1164  ? sfb.f_ffree : -1;
1165 #endif
1166 
1167 #if !defined(ST_RDONLY)
1168 #define ST_RDONLY 1
1169 #endif
1170  rpmlog(RPMLOG_DEBUG, "%5u 0x%08x %8u %12ld %12ld %s %s\n",
1171  (unsigned)i, (unsigned) dsi->dev, (unsigned) dsi->f_bsize,
1172  (signed long) dsi->f_bavail, (signed long) dsi->f_favail,
1173  ((dsi->f_flag & ST_RDONLY) ? "ro" : "rw"),
1174  ts->filesystems[i]);
1175  }
1176  return rc;
1177 }
1178 
1179 void rpmtsUpdateDSI(const rpmts ts, dev_t dev,
1180  rpmuint32_t fileSize, rpmuint32_t prevSize, rpmuint32_t fixupSize,
1181  int _action)
1182 {
1183  iosmFileAction action = (iosmFileAction) _action;
1184  rpmDiskSpaceInfo dsi;
1185  rpmuint64_t bneeded;
1186 
1187  dsi = ts->dsi;
1188  if (dsi) {
1189  while (dsi->f_bsize && dsi->dev != dev)
1190  dsi++;
1191  if (dsi->f_bsize == 0)
1192  dsi = NULL;
1193  }
1194  if (dsi == NULL)
1195  return;
1196 
1197  bneeded = BLOCK_ROUND(fileSize, dsi->f_bsize);
1198 
1199  switch (action) {
1200  case FA_BACKUP:
1201  case FA_SAVE:
1202  case FA_ALTNAME:
1203  dsi->ineeded++;
1204  dsi->bneeded += bneeded;
1205  /*@switchbreak@*/ break;
1206 
1207  /*
1208  * FIXME: If two packages share a file (same md5sum), and
1209  * that file is being replaced on disk, will dsi->bneeded get
1210  * adjusted twice? Quite probably!
1211  */
1212  case FA_CREATE:
1213  dsi->bneeded += bneeded;
1214  dsi->bneeded -= BLOCK_ROUND(prevSize, dsi->f_bsize);
1215  /*@switchbreak@*/ break;
1216 
1217  case FA_ERASE:
1218  dsi->ineeded--;
1219  dsi->bneeded -= bneeded;
1220  /*@switchbreak@*/ break;
1221 
1222  default:
1223  /*@switchbreak@*/ break;
1224  }
1225 
1226  if (fixupSize)
1227  dsi->bneeded -= BLOCK_ROUND(fixupSize, dsi->f_bsize);
1228 }
1229 
1230 void rpmtsCheckDSIProblems(const rpmts ts, const rpmte te)
1231 {
1232  rpmDiskSpaceInfo dsi;
1233  rpmps ps;
1234  int fc;
1235  size_t i;
1236 
1237  if (ts->filesystems == NULL || ts->filesystemCount == 0)
1238  return;
1239 
1240  dsi = ts->dsi;
1241  if (dsi == NULL)
1242  return;
1243  fc = rpmfiFC( rpmteFI(te, RPMTAG_BASENAMES) );
1244  if (fc <= 0)
1245  return;
1246 
1247  ps = rpmtsProblems(ts);
1248  for (i = 0; i < ts->filesystemCount; i++, dsi++) {
1249 
1250  if (dsi->f_bavail > 0 && adj_fs_blocks(dsi->bneeded) > dsi->f_bavail) {
1251  if (dsi->bneeded != dsi->obneeded) {
1253  rpmteNEVR(te), rpmteKey(te),
1254  ts->filesystems[i], NULL, NULL,
1255  (adj_fs_blocks(dsi->bneeded) - dsi->f_bavail) * dsi->f_bsize);
1256  dsi->obneeded = dsi->bneeded;
1257  }
1258  }
1259 
1260  if (dsi->f_favail > 0 && adj_fs_blocks(dsi->ineeded) > dsi->f_favail) {
1261  if (dsi->ineeded != dsi->oineeded) {
1263  rpmteNEVR(te), rpmteKey(te),
1264  ts->filesystems[i], NULL, NULL,
1265  (adj_fs_blocks(dsi->ineeded) - dsi->f_favail));
1266  dsi->oineeded = dsi->ineeded;
1267  }
1268  }
1269 
1270  if ((dsi->bneeded || dsi->ineeded) && (dsi->f_flag & ST_RDONLY)) {
1272  rpmteNEVR(te), rpmteKey(te),
1273  ts->filesystems[i], NULL, NULL, 0);
1274  }
1275  }
1276  ps = rpmpsFree(ps);
1277 }
1278 
1280  rpmCallbackType what, rpmuint64_t amount, rpmuint64_t total)
1281 {
1282  void * ptr = NULL;
1283  if (ts && ts->notify) {
1284  Header h;
1285  fnpyKey cbkey;
1286  /*@-type@*/ /* FIX: cast? */
1287  /*@-noeffectuncon @*/ /* FIX: check rc */
1288  if (te) {
1289 /*@-castexpose -mods@*/ /* XXX noisy in transaction.c */
1290  h = headerLink(te->h);
1291 /*@=castexpose =mods@*/
1292  cbkey = rpmteKey(te);
1293  } else {
1294  h = NULL;
1295  cbkey = NULL;
1296  }
1297  ptr = ts->notify(h, what, amount, total, cbkey, ts->notifyData);
1298  (void)headerFree(h);
1299  h = NULL;
1300  /*@=noeffectuncon @*/
1301  /*@=type@*/
1302  }
1303  return ptr;
1304 }
1305 
1307 {
1308  int nelements = 0;
1309  if (ts != NULL && ts->order != NULL) {
1310  nelements = ts->orderCount;
1311  }
1312  return nelements;
1313 }
1314 
1316 {
1317  rpmte te = NULL;
1318  if (ts != NULL && ts->order != NULL) {
1319  if (ix >= 0 && ix < ts->orderCount)
1320  te = ts->order[ix];
1321  }
1322  /*@-compdef@*/
1323  return te;
1324  /*@=compdef@*/
1325 }
1326 
1328 {
1329  return (rpmprobFilterFlags) (ts != NULL ? ts->ignoreSet : 0);
1330 }
1331 
1333 {
1335  if (ts != NULL) {
1336  transFlags = ts->transFlags;
1337  if (rpmtsSELinuxEnabled(ts) > 0)
1338  transFlags = (rpmtransFlags)(transFlags & ~RPMTRANS_FLAG_NOCONTEXTS);
1339  else
1340  transFlags = (rpmtransFlags)(transFlags | RPMTRANS_FLAG_NOCONTEXTS);
1341  }
1342  return transFlags;
1343 }
1344 
1346 {
1347  rpmtransFlags otransFlags = (rpmtransFlags) 0;
1348  if (ts != NULL) {
1349  otransFlags = ts->transFlags;
1350  if (rpmtsSELinuxEnabled(ts) > 0)
1351  transFlags = (rpmtransFlags)
1352  (transFlags & ~RPMTRANS_FLAG_NOCONTEXTS);
1353  else
1354  transFlags = (rpmtransFlags)
1355  (transFlags | RPMTRANS_FLAG_NOCONTEXTS);
1356  ts->transFlags = transFlags;
1357  }
1358  return otransFlags;
1359 }
1360 
1362 {
1363  return (rpmdepFlags) (ts != NULL ? ts->depFlags : 0);
1364 }
1365 
1367 {
1368  rpmdepFlags odepFlags = (rpmdepFlags) 0;
1369  if (ts != NULL) {
1370  odepFlags = ts->depFlags;
1371  ts->depFlags = depFlags;
1372  }
1373  return odepFlags;
1374 }
1375 
1377 {
1378 /*@-compdef -retexpose -usereleased@*/
1379  return ts->spec;
1380 /*@=compdef =retexpose =usereleased@*/
1381 }
1382 
1384 {
1385  Spec ospec = ts->spec;
1386 /*@-assignexpose -temptrans@*/
1387  ts->spec = spec;
1388 /*@=assignexpose =temptrans@*/
1389  return ospec;
1390 }
1391 
1393 {
1394 /*@-compdef -retexpose -usereleased@*/
1395  return ts->relocateElement;
1396 /*@=compdef =retexpose =usereleased@*/
1397 }
1398 
1400 {
1401  rpmte orelocateElement = ts->relocateElement;
1402 /*@-assignexpose -temptrans@*/
1403  ts->relocateElement = relocateElement;
1404 /*@=assignexpose =temptrans@*/
1405  return orelocateElement;
1406 }
1407 
1409 {
1410  return (ts != NULL ? ts->goal : TSM_UNKNOWN);
1411 }
1412 
1414 {
1415  tsmStage ogoal = TSM_UNKNOWN;
1416  if (ts != NULL) {
1417  ogoal = ts->goal;
1418  ts->goal = goal;
1419  }
1420  return ogoal;
1421 }
1422 
1424 {
1425  return (ts != NULL ? ts->dbmode : 0);
1426 }
1427 
1428 int rpmtsSetDBMode(rpmts ts, int dbmode)
1429 {
1430  int odbmode = 0;
1431  if (ts != NULL) {
1432  odbmode = ts->dbmode;
1433  ts->dbmode = dbmode;
1434  }
1435  return odbmode;
1436 }
1437 
1439 {
1440  return (ts != NULL ? ts->color : 0);
1441 }
1442 
1444 {
1445  rpmuint32_t ocolor = 0;
1446  if (ts != NULL) {
1447  ocolor = ts->color;
1448  ts->color = color;
1449  }
1450  return ocolor;
1451 }
1452 
1454 {
1455  return (ts != NULL ? ts->prefcolor : 0);
1456 }
1457 
1459  rpmCallbackFunction notify, rpmCallbackData notifyData)
1460 {
1461  if (ts != NULL) {
1462  ts->notify = notify;
1463  ts->notifyData = notifyData;
1464  }
1465  return 0;
1466 }
1467 
1469 {
1470  rpmts ts = rpmtsGetPool(_rpmtsPool);
1471  int xx;
1472 
1473  memset(&ts->ops, 0, sizeof(ts->ops));
1474  (void) rpmswEnter(rpmtsOp(ts, RPMTS_OP_TOTAL), -1);
1475  ts->type = RPMTRANS_TYPE_NORMAL;
1476  ts->goal = TSM_UNKNOWN;
1477  ts->filesystemCount = 0;
1478  ts->filesystems = NULL;
1479  ts->dsi = NULL;
1480 
1481  ts->solve = rpmtsSolve;
1482  ts->solveData = NULL;
1483  ts->nsuggests = 0;
1484  ts->suggests = NULL;
1485 
1486  ts->PRCO = NULL;
1487 
1488  ts->bag = NULL;
1489 
1490  ts->rdb = NULL;
1491  ts->dbmode = O_RDONLY;
1492  ts->txn = NULL;
1493 
1494  ts->scriptFd = NULL;
1495  { struct timeval tv;
1496  xx = gettimeofday(&tv, NULL);
1497  ts->tid[0] = (rpmuint32_t) tv.tv_sec;
1498  ts->tid[1] = (rpmuint32_t) tv.tv_usec;
1499  }
1500  ts->delta = 5;
1501 
1502  ts->color = rpmExpandNumeric("%{?_transaction_color}");
1503  ts->prefcolor = rpmExpandNumeric("%{?_prefer_color}");
1504  if (!ts->prefcolor) ts->prefcolor = 0x2;
1505 
1506  ts->rbf = NULL;
1507  ts->numRemovedPackages = 0;
1508  ts->allocedRemovedPackages = ts->delta;
1509  ts->removedPackages = (uint32_t *) xcalloc(ts->allocedRemovedPackages,
1510  sizeof(*ts->removedPackages));
1511 
1512  ts->rootDir = NULL;
1513  ts->currDir = NULL;
1514  ts->chrootDone = 0;
1515 
1516  ts->selinuxEnabled = rpmsxEnabled(NULL);
1517 
1518  ts->numAddedPackages = 0;
1519  ts->addedPackages = NULL;
1520 
1521  ts->numErasedPackages = 0;
1522  ts->erasedPackages = NULL;
1523 
1524  ts->numAvailablePackages = 0;
1525  ts->availablePackages = NULL;
1526 
1527  ts->orderAlloced = 0;
1528  ts->orderCount = 0;
1529  ts->order = NULL;
1530  ts->ntrees = 0;
1531  ts->maxDepth = 0;
1532 
1533  ts->probs = NULL;
1534 
1535  ts->keyring = NULL;
1536  ts->hkp = NULL;
1537  ts->dig = NULL;
1538 
1539  /* Set autorollback goal to the end of time. */
1540  ts->arbgoal = 0xffffffff;
1541 
1542  return rpmtsLink(ts, "tsCreate");
1543 }
int rpmtsSetNotifyCallback(rpmts ts, rpmCallbackFunction notify, rpmCallbackData notifyData)
Set transaction notify callback function and argument.
Definition: rpmts.c:1458
int rpmtsSolve(rpmts ts, rpmds ds, const void *data)
Attempt to solve a needed dependency using the solve database.
Definition: rpmts.c:351
qsort(mc->macroTable, mc->firstFree, sizeof(mc->macroTable[0]), compareMacroName)
int rpmtsChrootDone(rpmts ts)
Get chrootDone flag, i.e.
Definition: rpmts.c:1005
int rpmtsSetKeyring(rpmts ts, void *_keyring)
Set transaction keyring.
Definition: rpmts.c:807
const char * str
Definition: rpmtag.h:73
int xx
Definition: spec.c:744
rpmTag tag
Definition: rpmtag.h:501
int oc
Definition: macro.c:748
rpmop rpmtsOp(rpmts ts, rpmtsOpX opx)
Retrieve operation timestamp from a transaction set.
Definition: pkgio.c:133
rpmte rpmtsSetRelocateElement(rpmts ts, rpmte relocateElement)
Set current relocate transaction element.
Definition: rpmts.c:1399
rpmprobFilterFlags rpmtsFilterFlags(rpmts ts)
Get problem ignore bit mask, i.e.
Definition: rpmts.c:1327
#define headerFree(_h)
Definition: rpmtag.h:870
struct rpmdb_s * rpmdb
Database of headers and tag value indices.
Definition: rpmtypes.h:43
rpmlog(RPMLOG_ERR,"%s\n", buf)
int rpmtsInitDSI(const rpmts ts)
Initialize disk space info for each and every mounted file systems.
Definition: rpmts.c:1065
struct rpmte_s * rpmte
An element of a transaction set, i.e.
Definition: rpmtypes.h:38
Spec rpmtsSetSpec(rpmts ts, Spec spec)
Set a spec control structure in transaction set.
Definition: rpmts.c:1383
rpmtime_t rpmswAdd(rpmop to, rpmop from)
Sum statistic counters.
Definition: rpmsw.c:280
enum urltype_e urltype
Supported URL types.
rpmtime_t usecs
Definition: rpmsw.h:43
OpenPGP constants and structures from RFC-2440.
static PyObject *int type
Definition: rpmmi-py.c:151
void *(* rpmCallbackFunction)(const void *h, const rpmCallbackType what, const rpmuint64_t amount, const rpmuint64_t total, fnpyKey key, rpmCallbackData data)
Definition: rpmiotypes.h:419
void rpmpsAppend(rpmps ps, rpmProblemType type, const char *pkgNEVR, fnpyKey key, const char *dn, const char *bn, const char *altNEVR, rpmuint64_t ulong1)
Append a problem to current set of problems.
Definition: rpmps.c:123
enum iosmFileAction_e iosmFileAction
File disposition(s) during package install/erase processing.
static void rpmtsPrintStats(rpmts ts)
Definition: rpmts.c:671
Structures used for an &quot;rpmte&quot; transaction element.
struct rpmPRCO_s * rpmPRCO
Container for commonly extracted dependency set(s).
Definition: rpmtypes.h:33
char * xstrdup(const char *str)
Definition: rpmmalloc.c:321
int rpmtsDBMode(rpmts ts)
Retrieve dbmode of transaction set.
Definition: rpmts.c:1423
rpmuint32_t * ui32p
Definition: rpmtag.h:70
FD_t Fopen(const char *path, const char *_fmode)
fopen(3) clone.
Definition: rpmio.c:2831
char * rpmGetPath(const char *path,...)
Return (malloc&#39;ed) expanded, canonicalized, file path.
Definition: macro.c:3371
#define RPMDBI_QUEUE
Definition: rpmtag.h:489
Structure(s) used for file info tag sets.
rpmfi rpmteFI(rpmte te, rpmTag tag)
Retrieve file info tag set from transaction element.
Definition: rpmte.c:587
enum rpmprobFilterFlags_e rpmprobFilterFlags
rpmtransFlags rpmtsSetFlags(rpmts ts, rpmtransFlags transFlags)
Set transaction flags, i.e.
Definition: rpmts.c:1345
struct rpmts_s * rpmts
The RPM Transaction Set.
Definition: rpmtypes.h:14
int rc
Definition: poptALL.c:670
evrFlags rpmdsFlags(const rpmds ds)
Return current dependency flags.
Definition: rpmds.c:691
rpmdb rpmtsGetRdb(rpmts ts)
Get transaction set database handle.
Definition: pkgio.c:151
void rpmtsUpdateDSI(const rpmts ts, dev_t dev, rpmuint32_t fileSize, rpmuint32_t prevSize, rpmuint32_t fixupSize, int _action)
Update disk space info for a file.
Definition: rpmts.c:1179
The Header data structure.
#define RPMDBI_REMOVED
Definition: rpmtag.h:481
int rpmdbClose(rpmdb db)
Close all database indices and free rpmdb.
Definition: rpmdb.c:866
int rpmtsSetSolveCallback(rpmts ts, int(*solve)(rpmts ts, rpmds key, const void *data), const void *solveData)
Definition: rpmts.c:567
rpmuint32_t rpmtsSetTid(rpmts ts, rpmuint32_t tid)
Set transaction id, i.e.
Definition: rpmts.c:1031
headerSprintfExtension rpmHeaderFormats
Table of query format extensions.
Definition: formats.c:305
#define R_OK
Definition: system.h:234
int Stat(const char *path, struct stat *st)
stat(2) clone.
Definition: rpmrpc.c:1361
#define RPMDBI_RECNO
Definition: rpmtag.h:490
FD_t fdLink(void *cookie, const char *msg)
int rpmtsUnorderedSuccessors(rpmts ts, int first)
Set index of 1st element of successors.
Definition: rpmts.c:890
Definition: rpmdb.c:436
int rpmdsSysinfo(rpmPRCO PRCO, const char *fn)
Load sysinfo dependencies into a dependency set.
Definition: rpmds.c:1746
enum rpmCallbackType_e rpmCallbackType
Bit(s) to identify progress callbacks.
enum tsStage_e tsmStage
Access mounted file system information.
enum rpmTag_e rpmTag
Definition: rpmtag.h:468
rpmte rpmtsiNext(rpmtsi tsi, rpmElementType type)
Return next transaction element of type.
Definition: rpmte.c:831
int rpmtsRebuildDB(rpmts ts)
Rebuild the database used by the transaction.
Definition: rpmts.c:136
rpmTSType rpmtsType(rpmts ts)
Return the type of a transaction.
Definition: rpmts.c:868
void addMacro(MacroContext mc, const char *n, const char *o, const char *b, int level)
Add macro to context.
Definition: macro.c:2722
void rpmtsEmpty(rpmts ts)
Re-create an empty transaction set.
Definition: rpmts.c:623
void rpmtsSetARBGoal(rpmts ts, rpmuint32_t goal)
Set autorollback goal.
Definition: rpmts.c:884
rpmPRCO rpmdsNewPRCO(Header h)
Create dependency set(s) container.
Definition: rpmds.c:2866
struct rpmps_s * rpmps
Transaction problems found while processing a transaction set/.
Definition: rpmps.h:25
int rpmsxEnabled(rpmsx sx)
Return SELinux enabled state.
Definition: rpmsx.c:134
Header headerLink(Header h)
Reference a header instance.
int ac
Definition: rpmgrep.c:1431
tsmStage rpmtsSetGoal(rpmts ts, tsmStage goal)
Set goal of transaction set.
Definition: rpmts.c:1413
Header h
Definition: spec.c:739
rpmuint32_t rpmtsGetTid(rpmts ts)
Get transaction id, i.e.
Definition: rpmts.c:1022
repo _ts
Definition: rpmrepo.c:164
int rpmfiFC(rpmfi fi)
Return file count from file info set.
Definition: rpmfi.c:87
void rpmtsSetCurrDir(rpmts ts, const char *currDir)
Set transaction currDir, i.e.
Definition: rpmts.c:960
exit Fhe p ptr
Definition: db3.c:2119
rpmPRCO rpmdsFreePRCO(rpmPRCO PRCO)
Free dependency set(s) container.
Definition: rpmds.c:2841
rpmdepFlags rpmtsSetDFlags(rpmts ts, rpmdepFlags depFlags)
Set dependency flags, i.e.
Definition: rpmts.c:1366
delMacro(mc, n)
char * alloca()
rpmop _hdr_getops
Definition: header.c:94
enum rpmRC_e rpmRC
RPM return codes.
Definition: signature.c:616
int _rpmts_debug
Definition: rpmts.c:93
Yet Another syslog(3) API clone.
goto exit
Definition: db3.c:1903
void rpmtsCheckDSIProblems(const rpmts ts, const rpmte te)
Check a transaction element for disk space problems.
Definition: rpmts.c:1230
memset(_r, 0, sizeof(*_r))
enum rpmElementType_e rpmElementType
Transaction element type.
rpmts rpmtsLink(rpmts ts, const char *msg)
Reference a transaction set instance.
unsigned int rpmuint32_t
Definition: rpmiotypes.h:28
pgpVSFlags pgpDigVSFlags
Disabler bits(s) for signature/digest checking.
Definition: rpmpgp.c:1104
rpmts rpmtsCreate(void)
Create an empty transaction set.
Definition: rpmts.c:1468
void rpmtsSetRootDir(rpmts ts, const char *rootDir)
Set transaction rootDir, i.e.
Definition: rpmts.c:925
const char * Fstrerror(FD_t fd)
strerror(3) clone.
Definition: rpmio.c:2399
void * xcalloc(size_t nmemb, size_t size)
Definition: rpmmalloc.c:300
assert(key->size==sizeof(hdrNum))
void * ptr
Definition: rpmtag.h:67
#define RPMDBI_SEQNO
Definition: rpmtag.h:486
int rpmdbOpen(const char *prefix, rpmdb *dbp, int mode, mode_t perms)
Open rpm database.
Definition: rpmdb.c:1175
int count
Definition: rpmsw.h:41
int ix
Definition: rpmps-py.c:174
char * p
Definition: macro.c:413
char * headerSprintf(Header h, const char *fmt, headerTagTableEntry tags, headerSprintfExtension exts, errmsg_t *errmsg)
Return formatted output string from header tags.
Definition: hdrfmt.c:6748
rpmps rpmpsCreate(void)
Create a problem set.
Definition: rpmps.c:61
void * rpmtsGetKeyring(rpmts ts, int autoload)
Get transaction keyring.
Definition: rpmts.c:790
rpmmi rpmmiFree(rpmmi mi)
Destroy rpm database iterator.
rpmioItem rpmioGetPool(rpmioPool pool, size_t size)
Get unused item from pool, or alloc a new item.
Definition: rpmmalloc.c:220
fprintf(stderr,"--> %s(%p,%p,%p) sig %p sigp %p\n", __FUNCTION__, dig, t, rsactx, sig, sigp)
int rpmGetMacroEntries(MacroContext mc, void *_mire, int used, const char ***avp)
Return macro entries as string array.
Definition: macro.c:319
FD_t fdFree(FD_t fd, const char *msg)
rpmte rpmtsRelocateElement(rpmts ts)
Get current relocate transaction element.
Definition: rpmts.c:1392
int argvCount(const ARGV_t argv)
Return no.
Definition: argv.c:71
int rpmdsAnyMatchesDep(const Header h, const rpmds req, int nopromote)
Compare package provides dependencies from header with a single dependency.
Definition: rpmds.c:4209
rpmTag rpmdsTagN(const rpmds ds)
Return current dependency type.
Definition: rpmds.c:702
rpmTagData p
Definition: rpmtag.h:504
unsigned long long rpmuint64_t
Definition: rpmiotypes.h:29
ARGV_t argvFree(ARGV_t argv)
Destroy an argv array.
Definition: argv.c:44
const char * tagName(rpmTag tag)
Return tag name from value.
Definition: tagname.c:436
void rpmswExit(op, 0)
int rpmtsCloseDB(rpmts ts)
Close the database used by the transaction.
Definition: rpmts.c:101
static const char * file
Definition: parseFiles.c:20
int rpmioAccess(const char *FN, const char *path, int mode)
Check FN access, expanding relative paths and twiddles.
Definition: rpmio.c:3070
rpmRC rpmReadPackageFile(rpmts ts, FD_t fd, const char *fn, Header *hdrp)
Return package header from file handle, verifying digests/signatures.
Definition: package.c:83
Header rpmmiNext(rpmmi mi)
Return next package header from iteration.
Definition: rpmdb.c:2248
struct _HE_s * HE_t
Destroy an extension cache.
Definition: rpmtag.h:59
rpmuint32_t rpmtsColor(rpmts ts)
Retrieve color bits of transaction set.
Definition: rpmts.c:1438
Structure(s) used for dependency tag sets.
key
Definition: macro.c:383
int headerGet(Header h, HE_t he, unsigned int flags)
Retrieve extension or tag value from a header.
Definition: header.c:2230
void * rpmtsNotify(rpmts ts, rpmte te, rpmCallbackType what, rpmuint64_t amount, rpmuint64_t total)
Perform transaction progress notify callback.
Definition: rpmts.c:1279
int rpmtsAddInstallElement(rpmts ts, Header h, fnpyKey key, int upgrade, rpmRelocation relocs)
Add package to be installed to transaction set.
Definition: depends.c:547
The FD_t File Handle data structure.
const char * rpmtsRootDir(rpmts ts)
Get transaction rootDir, i.e.
Definition: rpmts.c:901
struct tagStore_s * tagStore_t
Definition: rpmtag.h:519
Definition: iosm.h:32
The structure used to store values parsed from a spec file.
Definition: rpmspec.h:113
static void rpmtsPrintStat(const char *name, struct rpmop_s *op)
Definition: rpmts.c:654
char * rpmExpand(const char *arg,...)
Return (malloc&#39;ed) concatenated macro expansion(s).
Definition: macro.c:3178
static rpmts rpmtsGetPool(rpmioPool pool)
Definition: rpmts.c:774
int rpmtsOpenDB(rpmts ts, int dbmode)
Open the database used by the transaction.
Definition: rpmts.c:115
int rpmtsCloseSDB(rpmts ts)
Close the database used by the transaction to solve dependencies.
Definition: rpmts.c:222
rpmtsi rpmtsiFree(rpmtsi tsi)
Destroy transaction element iterator.
rpmte rpmtsElement(rpmts ts, int ix)
Return (ordered) transaction set element.
Definition: rpmts.c:1315
rpmRC rpmrc
Definition: rpmts-py.c:924
int rpmtsSetDBMode(rpmts ts, int dbmode)
Set dbmode of transaction set.
Definition: rpmts.c:1428
* op
Definition: rpmps-py.c:266
pgpVSFlags rpmVSFlags
Bit(s) to control digest and signature verification.
Definition: rpmts.h:35
node fd
Definition: rpmfd-py.c:124
static int sugcmp(const void *a, const void *b)
Compare suggested package resolutions (qsort/bsearch).
Definition: rpmts.c:343
tsmStage rpmtsGoal(rpmts ts)
Retrieve goal of transaction set.
Definition: rpmts.c:1408
int Fclose(FD_t fd)
fclose(3) clone.
Definition: rpmio.c:2532
Cumulative statistics for an operation.
Definition: rpmsw.h:39
#define RPMDBI_DEPCACHE
Definition: rpmtag.h:478
struct rpmds_s * rpmds
Dependency tag sets from a header, so that a header can be discarded early.
Definition: rpmtypes.h:28
void argvPrint(const char *msg, ARGV_t argv, FILE *fp)
Print argv array elements.
Definition: argv.c:19
rpmps rpmpsFree(rpmps ps)
Destroy a problem set.
void * rpmCallbackData
Definition: rpmiotypes.h:149
int _rpmts_stats
Definition: rpmts.c:96
Spec rpmtsSpec(rpmts ts)
Get spec control structure from transaction set.
Definition: rpmts.c:1376
rpmVSFlags rpmtsSetVSFlags(rpmts ts, rpmVSFlags vsflags)
Set verify signatures flag(s).
Definition: rpmts.c:843
int Ferror(FD_t fd)
ferror(3) clone.
Definition: rpmio.c:2942
void rpmteCleanDS(rpmte te)
Destroy dependency set info of transaction element.
Definition: rpmte.c:38
Definition: rpmtag.h:500
void rpmtsClean(rpmts ts)
Free memory needed only for dependency checks and ordering.
Definition: rpmts.c:596
struct rpmtsi_s * rpmtsi
Transaction element iterator.
Definition: rpmte.h:31
return strcmp(ame->name, bme->name)
#define RPMDBI_BTREE
Definition: rpmtag.h:487
rpmuint32_t rpmtsSetColor(rpmts ts, rpmuint32_t color)
Set color bits of transaction set.
Definition: rpmts.c:1443
rpmop _hdr_loadops
Definition: header.c:90
const char * s
Definition: poptALL.c:734
char * t
Definition: rpmds.c:2716
int rpmtsSELinuxEnabled(rpmts ts)
Get selinuxEnabled flag, i.e.
Definition: rpmts.c:997
urltype urlPath(const char *url, const char **pathp)
Return path component of URL.
Definition: url.c:430
static PyObject *rpmtransFlags transFlags
Definition: rpmts-py.c:785
Definition: iosm.h:29
dbiIndex dbiOpen(rpmdb db, rpmTag tag, unsigned int flags)
Definition: rpmdb.c:223
enum rpmtransFlags_e rpmtransFlags
Bit(s) to control rpmtsRun() operation.
Methods to handle package elements.
rpmioPool rpmioNewPool(const char *name, size_t size, int limit, int flags, char *(*dbg)(void *item), void(*init)(void *item), void(*fini)(void *item))
Create a memory pool.
Definition: rpmmalloc.c:109
int rpmtsAvailable(rpmts ts, const rpmds ds)
Attempt to solve a needed dependency using memory resident tables.
Definition: rpmts.c:543
int rpmtsNElements(rpmts ts)
Return number of (ordered) transaction set elements.
Definition: rpmts.c:1306
mi
Definition: rpmdb-py.c:159
char * stpcpy(char *dest, const char *src)
te
Definition: macro.c:552
int rpmGetFilesystemList(const char ***listptr, rpmuint32_t *num)
Return (cached) file system mount points.
Definition: fs.c:294
rpmtransFlags rpmtsFlags(rpmts ts)
Get transaction flags, i.e.
Definition: rpmts.c:1332
ps
Definition: rpmts-py.c:548
enum rpmTSType_e rpmTSType
Transaction Types.
rpmuint32_t rpmtsARBGoal(rpmts ts)
Return the autorollback goal.
Definition: rpmts.c:879
const void * fnpyKey
Definition: rpmiotypes.h:121
Structures and prototypes used for an &quot;rpmts&quot; transaction set.
Definition: iosm.h:36
const char * rpmdsEVR(const rpmds ds)
Return current dependency epoch-version-release.
Definition: rpmds.c:680
const char * msg
Definition: rpmts-py.c:976
rpmVSFlags rpmtsVSFlags(rpmts ts)
Get verify signatures flag(s).
Definition: rpmts.c:838
int argvSplit(ARGV_t *argvp, const char *str, const char *seps)
Split a string into an argv array.
Definition: argv.c:233
return NULL
Definition: poptALL.c:613
#define RPMDBI_AVAILABLE
Definition: rpmtag.h:482
rpmPRCO rpmtsPRCO(rpmts ts)
Get transaction set dependencies.
Definition: rpmts.c:1042
const char * rpmtsCurrDir(rpmts ts)
Get transaction currDir, i.e.
Definition: rpmts.c:951
fnpyKey * rpmalAllSatisfiesDepend(const rpmal al, const rpmds ds, alKey *keyp)
Check added package file lists for package(s) that have a provide.
Definition: rpmal.c:419
rpmal rpmalFree(rpmal al)
Destroy available list.
#define RMIL_DEFAULT
Markers for sources of macros added throughout rpm.
Definition: rpmmacro.h:55
unsigned long long bytes
Definition: rpmsw.h:42
static void
Print copy of spec file, filling in Group/Description/Summary from specspo.
Definition: spec.c:737
rpmioPool _rpmtsPool
Definition: poptALL.c:565
int rpmtsSetChrootDone(rpmts ts, int chrootDone)
Set chrootDone flag, i.e.
Definition: rpmts.c:1010
int _rpmts_macros
Definition: rpmts.c:99
static const char * name
Structures used for managing added/available package lists.
char * buf
Parse (and execute) macro undefinition.
Definition: macro.c:703
File state machine to handle archive I/O and system call&#39;s.
#define _(Text)
Definition: system.h:29
const char * rpmteNEVR(rpmte te)
Retrieve name-version-release string from transaction element.
Definition: rpmte.c:536
char * b
Definition: macro.c:746
int
Save source and expand field into target.
Definition: rpmds.c:2709
void rpmtsSetType(rpmts ts, rpmTSType type)
Set transaction type.
Definition: rpmts.c:873
const char * rpmdsN(const rpmds ds)
Return current dependency name.
Definition: rpmds.c:668
rpmuint32_t rpmtsPrefColor(rpmts ts)
Retrieve preferred file color.
Definition: rpmts.c:1453
rpmps rpmpsLink(rpmps ps, const char *msg)
Reference a problem set instance.
fnpyKey rpmteKey(rpmte te)
Retrieve key from transaction element.
Definition: rpmte.c:568
ARGstr_t * ARGV_t
Definition: argv.h:12
Access RPM indices using Berkeley DB interface(s).
void rpmswEnter(op, 0)
#define D_(Text)
Definition: system.h:526
rpmte rpmteFree(rpmte te)
Destroy a transaction element.
PRCO
Definition: rpmds-py.c:441
rpmVSFlags vsflags
Definition: rpmrepo.c:161
rpmdepFlags rpmtsDFlags(rpmts ts)
Get dependency flags, i.e.
Definition: rpmts.c:1361
rpmmi rpmtsInitIterator(const rpmts ts, rpmTag rpmtag, const void *keyp, size_t keylen)
Return transaction database iterator.
Definition: rpmts.c:212
static void * _free(const void *p)
Wrapper to free(3), hides const compilation noise, permit NULL, return NULL.
Definition: rpmiotypes.h:647
int i
Definition: spec.c:743
enum rpmdepFlags_e rpmdepFlags
Bit(s) to control rpmtsCheck() and rpmtsOrder() operation.
int rpmExpandNumeric(const char *arg)
Return macro expansion as a numeric value.
Definition: macro.c:3252
#define RPMDBI_HASH
Definition: rpmtag.h:488
static void rpmtsFini(void *_ts)
Definition: rpmts.c:707
const char ** av
Definition: rpmts-py.c:788
void rpmtsSetScriptFd(rpmts ts, FD_t scriptFd)
Definition: rpmts.c:980
#define RPMDBI_PACKAGES
Pseudo-tags used by the rpmdb and rpmgi iterator API&#39;s.
Definition: rpmtag.h:477
#define xrealloc
Definition: system.h:35
FD_t rpmtsScriptFd(rpmts ts)
Definition: rpmts.c:969
size_t fn
Definition: macro.c:1698
#define RPMDBI_ADDED
Definition: rpmtag.h:480
rpmtsi rpmtsiInit(rpmts ts)
Create transaction element iterator.
rpmmi rpmmiInit(rpmdb db, rpmTag tag, const void *keyp, size_t keylen)
Return database iterator.
Definition: rpmdb.c:2491
#define ST_RDONLY
static PyObject *rpmds ds
Definition: rpmte-py.c:283
rpmps rpmtsProblems(rpmts ts)
Return current transaction set problems.
Definition: rpmts.c:582
int rpmtsOpenSDB(rpmts ts, int dbmode)
Open the database used by the transaction to solve dependencies.
Definition: rpmts.c:252
Spec spec
Definition: spec-py.c:121
Definition: iosm.h:33
int Unlink(const char *path)
unlink(2) clone.
Definition: rpmrpc.c:397
void rpmtsCleanDig(rpmts ts)
Free signature verification data.
Definition: pkgio.c:457