diff options
Diffstat (limited to 'lib/rpminstall.c')
-rw-r--r-- | lib/rpminstall.c | 196 |
1 files changed, 0 insertions, 196 deletions
diff --git a/lib/rpminstall.c b/lib/rpminstall.c index 3d9906297..2606e89f1 100644 --- a/lib/rpminstall.c +++ b/lib/rpminstall.c @@ -307,19 +307,6 @@ int rpmInstall(rpmts ts, if (rpmExpandNumeric("%{?_repackage_all_erasures}")) ia->transFlags |= RPMTRANS_FLAG_REPACKAGE; - /* Initialize security context patterns (if not already done). */ - if (!(ia->transFlags & RPMTRANS_FLAG_NOCONTEXTS)) { - rpmsx sx = rpmtsREContext(ts); - if (sx == NULL) { - const char *fn = rpmGetPath("%{?_install_file_context_path}", NULL); - if (fn != NULL && *fn != '\0') { - sx = rpmsxNew(fn); - (void) rpmtsSetREContext(ts, sx); - } - fn = _free(fn); - } - sx = rpmsxFree(sx); - } (void) rpmtsSetFlags(ts, ia->transFlags); probFilter = ia->probFilter; @@ -905,189 +892,6 @@ int rpmInstallSource(rpmts ts, const char * arg, return rc; } -/*@unchecked@*/ -static int reverse = -1; - -/** - */ -static int IDTintcmp(const void * a, const void * b) - /*@*/ -{ - /*@-castexpose@*/ - return ( reverse * (((IDT)a)->val.u32 - ((IDT)b)->val.u32) ); - /*@=castexpose@*/ -} - -IDTX IDTXfree(IDTX idtx) -{ - if (idtx) { - int i; - if (idtx->idt) - for (i = 0; i < idtx->nidt; i++) { - IDT idt = idtx->idt + i; - idt->h = headerFree(idt->h); - idt->key = _free(idt->key); - } - idtx->idt = _free(idtx->idt); - idtx = _free(idtx); - } - return NULL; -} - -IDTX IDTXnew(void) -{ - IDTX idtx = xcalloc(1, sizeof(*idtx)); - idtx->delta = 10; - idtx->size = sizeof(*((IDT)0)); - return idtx; -} - -IDTX IDTXgrow(IDTX idtx, int need) -{ - if (need < 0) return NULL; - if (idtx == NULL) - idtx = IDTXnew(); - if (need == 0) return idtx; - - if ((idtx->nidt + need) > idtx->alloced) { - while (need > 0) { - idtx->alloced += idtx->delta; - need -= idtx->delta; - } - idtx->idt = xrealloc(idtx->idt, (idtx->alloced * idtx->size) ); - } - return idtx; -} - -IDTX IDTXsort(IDTX idtx) -{ - if (idtx != NULL && idtx->idt != NULL && idtx->nidt > 0) - qsort(idtx->idt, idtx->nidt, idtx->size, IDTintcmp); - return idtx; -} - -IDTX IDTXload(rpmts ts, rpmTag tag) -{ - IDTX idtx = NULL; - rpmdbMatchIterator mi; - HGE_t hge = (HGE_t) headerGetEntry; - Header h; - - /*@-branchstate@*/ - mi = rpmtsInitIterator(ts, tag, NULL, 0); -#ifdef NOTYET - (void) rpmdbSetIteratorRE(mi, RPMTAG_NAME, RPMMIRE_DEFAULT, '!gpg-pubkey'); -#endif - while ((h = rpmdbNextIterator(mi)) != NULL) { - rpmTagType type = RPM_NULL_TYPE; - int_32 count = 0; - int_32 * tidp; - - tidp = NULL; - if (!hge(h, tag, &type, (void **)&tidp, &count) || tidp == NULL) - continue; - - if (type == RPM_INT32_TYPE && (*tidp == 0 || *tidp == -1)) - continue; - - idtx = IDTXgrow(idtx, 1); - if (idtx == NULL) - continue; - if (idtx->idt == NULL) - continue; - - { IDT idt; - /*@-nullderef@*/ - idt = idtx->idt + idtx->nidt; - /*@=nullderef@*/ - idt->h = headerLink(h); - idt->key = NULL; - idt->instance = rpmdbGetIteratorOffset(mi); - idt->val.u32 = *tidp; - } - idtx->nidt++; - } - mi = rpmdbFreeIterator(mi); - /*@=branchstate@*/ - - return IDTXsort(idtx); -} - -IDTX IDTXglob(rpmts ts, const char * globstr, rpmTag tag) -{ - IDTX idtx = NULL; - HGE_t hge = (HGE_t) headerGetEntry; - Header h; - int_32 * tidp; - FD_t fd; - const char ** av = NULL; - int ac = 0; - rpmRC rpmrc; - int xx; - int i; - - av = NULL; ac = 0; - xx = rpmGlob(globstr, &ac, &av); - - if (xx == 0) - for (i = 0; i < ac; i++) { - rpmTagType type; - int_32 count; - int isSource; - - fd = Fopen(av[i], "r.ufdio"); - if (fd == NULL || Ferror(fd)) { - rpmError(RPMERR_OPEN, _("open of %s failed: %s\n"), av[i], - Fstrerror(fd)); - if (fd != NULL) (void) Fclose(fd); - continue; - } - - rpmrc = rpmReadPackageFile(ts, fd, av[i], &h); - (void) Fclose(fd); - switch (rpmrc) { - default: - goto bottom; - /*@notreached@*/ /*@switchbreak@*/ break; - case RPMRC_NOTTRUSTED: - case RPMRC_NOKEY: - case RPMRC_OK: - isSource = headerIsEntry(h, RPMTAG_SOURCEPACKAGE); - if (isSource) - goto bottom; - /*@switchbreak@*/ break; - } - - tidp = NULL; - /*@-branchstate@*/ - if (hge(h, tag, &type, (void **) &tidp, &count) && tidp != NULL) { - - idtx = IDTXgrow(idtx, 1); - if (idtx == NULL || idtx->idt == NULL) - goto bottom; - - { IDT idt; - idt = idtx->idt + idtx->nidt; - idt->h = headerLink(h); - idt->key = av[i]; - av[i] = NULL; - idt->instance = 0; - idt->val.u32 = *tidp; - } - idtx->nidt++; - } - /*@=branchstate@*/ -bottom: - h = headerFree(h); - } - - for (i = 0; i < ac; i++) - av[i] = _free(av[i]); - av = _free(av); ac = 0; - - return IDTXsort(idtx); -} - /** @todo Transaction handling, more, needs work. */ int rpmRollback(rpmts ts, struct rpmInstallArguments_s * ia, const char ** argv) { |