diff options
author | Francois Pons <fpons@mandriva.com> | 2002-07-15 17:53:06 +0000 |
---|---|---|
committer | Francois Pons <fpons@mandriva.com> | 2002-07-15 17:53:06 +0000 |
commit | 91723db1551e0b6c0786eb27cda8e2d86aad4adb (patch) | |
tree | 1124d4a3e1ee8cb6a2341bbf4361971683845aad /perl-install/c/stuff.xs.pm | |
parent | 79e35cf523a1f6b29dc7096c2bbe04e6173b1a73 (diff) | |
download | drakx-backup-do-not-use-91723db1551e0b6c0786eb27cda8e2d86aad4adb.tar drakx-backup-do-not-use-91723db1551e0b6c0786eb27cda8e2d86aad4adb.tar.gz drakx-backup-do-not-use-91723db1551e0b6c0786eb27cda8e2d86aad4adb.tar.bz2 drakx-backup-do-not-use-91723db1551e0b6c0786eb27cda8e2d86aad4adb.tar.xz drakx-backup-do-not-use-91723db1551e0b6c0786eb27cda8e2d86aad4adb.zip |
cleaned no more used method.
Diffstat (limited to 'perl-install/c/stuff.xs.pm')
-rw-r--r-- | perl-install/c/stuff.xs.pm | 463 |
1 files changed, 1 insertions, 462 deletions
diff --git a/perl-install/c/stuff.xs.pm b/perl-install/c/stuff.xs.pm index e3ac37816..2253c419e 100644 --- a/perl-install/c/stuff.xs.pm +++ b/perl-install/c/stuff.xs.pm @@ -530,482 +530,23 @@ standard_charset() '; $ENV{C_RPM} and print ' -int -rpmReadConfigFiles() - CODE: - char *rpmrc = getenv("RPMRC_FILE"); - if (rpmrc != NULL && !*rpmrc) rpmrc = NULL; - RETVAL = rpmReadConfigFiles(rpmrc, NULL) == 0; - OUTPUT: - RETVAL - -int -rpmdbInit(root, perms) - char *root - int perms - CODE: - RETVAL = rpmdbInit(root, perms) == 0; - OUTPUT: - RETVAL - -void * -rpmdbOpen(root) - char *root - CODE: - static rpmdb db; - RETVAL = rpmdbOpen(root, &db, O_RDWR | O_CREAT, 0644) == 0 || - rpmdbOpen(root, &db, O_RDONLY, 0644) == 0 ? db : NULL; - OUTPUT: - RETVAL - -void * -rpmdbOpenForTraversal(root) - char *root - CODE: - static rpmdb db; - rpmErrorCallBackType old_cb; - old_cb = rpmErrorSetCallback(rpmError_callback_empty); - rpmSetVerbosity(RPMMESS_FATALERROR); - RETVAL = rpmdbOpen(root, &db, O_RDONLY, 0644) == 0 ? db : NULL; - rpmErrorSetCallback(old_cb); - rpmSetVerbosity(RPMMESS_NORMAL); - OUTPUT: - RETVAL - -void -rpmdbClose(db) - void *db - -int -rpmdbTraverse(db, ...) - void *db - PREINIT: - SV *callback = &PL_sv_undef; - int count; - Header h; - rpmdbMatchIterator mi; - CODE: - if (items > 1) { - callback = ST(1); - } - count = 0; - mi = rpmdbInitIterator(db, RPMDBI_PACKAGES, NULL, 0); - while (h = rpmdbNextIterator(mi)) { - if (callback != &PL_sv_undef && SvROK(callback)) { - dSP; - ENTER; - SAVETMPS; - PUSHMARK(sp); - XPUSHs(sv_2mortal(newSViv((IV)(void *)h))); - PUTBACK; - perl_call_sv(callback, G_DISCARD | G_SCALAR); - FREETMPS; - LEAVE; - } - ++count; - } - rpmdbFreeIterator(mi); - RETVAL = count; - OUTPUT: - RETVAL - -int -rpmdbNameTraverse(db, name, ...) - void *db - char *name - PREINIT: - SV *callback = &PL_sv_undef; - int count; - Header h; - rpmdbMatchIterator mi; - rpmErrorCallBackType oldcb; - CODE: - if (items > 2) { - callback = ST(2); - } - count = 0; - mi = rpmdbInitIterator(db, RPMTAG_NAME, name, 0); - oldcb = rpmErrorSetCallback(rpmError_callback_empty); - while (h = rpmdbNextIterator(mi)) { - if (callback != &PL_sv_undef && SvROK(callback)) { - dSP; - ENTER; - SAVETMPS; - PUSHMARK(sp); - XPUSHs(sv_2mortal(newSViv((IV)(void *)h))); - PUTBACK; - perl_call_sv(callback, G_DISCARD | G_SCALAR); - FREETMPS; - LEAVE; - } - ++count; - } - rpmErrorSetCallback(oldcb); - rpmdbFreeIterator(mi); - RETVAL = count; - OUTPUT: - RETVAL - - -void * -rpmtransCreateSet(db, rootdir) - void *db - char *rootdir - -void -rpmtransAvailablePackage(rpmdep, header, key) - void *rpmdep - void *header - char *key - CODE: - rpmtransAvailablePackage(rpmdep, header, strdup(key)); - -int -rpmtransAddPackage(rpmdep, header, key, update) - void *rpmdep - void *header - char *key - int update - CODE: - rpmTransactionSet r = rpmdep; - RETVAL = rpmtransAddPackage(r, header, NULL, strdup(key), update, NULL) == 0; - /* rpminstall.c of rpm-4 call headerFree directly after, we can make the same ?*/ - OUTPUT: - RETVAL - -int -rpmtransRemovePackages(db, rpmdep, p) - void *db - void *rpmdep - char *p - CODE: - rpmdb d = db; - rpmTransactionSet r = rpmdep; - Header h; - rpmdbMatchIterator mi; - int count = 0; - mi = rpmdbInitIterator(db, RPMDBI_LABEL, p, 0); - while (h = rpmdbNextIterator(mi)) { - unsigned int recOffset = rpmdbGetIteratorOffset(mi); - if (recOffset) { - rpmtransRemovePackage(rpmdep, recOffset); - ++count; - } - } - rpmdbFreeIterator(mi); - RETVAL=count; - OUTPUT: - RETVAL - -int -rpmdepOrder(order) - void *order - CODE: - RETVAL = rpmdepOrder(order) == 0; - OUTPUT: - RETVAL - -int -rpmdbRebuild(root) - char *root - CODE: - rpmErrorCallBackType old_cb; - old_cb = rpmErrorSetCallback(rpmError_callback_empty); - rpmSetVerbosity(RPMMESS_FATALERROR); - RETVAL = rpmdbRebuild(root) == 0; - rpmErrorSetCallback(old_cb); - rpmSetVerbosity(RPMMESS_NORMAL); - OUTPUT: - RETVAL - -void -rpmtransFree(trans) - void *trans - char * rpmErrorString() -int -rpmVersionCompare(headerFirst, headerSecond) - void *headerFirst - void *headerSecond - void rpmSetVeryVerbose() CODE: rpmSetVerbosity(RPMMESS_DEBUG); void -rpmtransSetScriptFd(trans, fd) - void *trans - int fd - CODE: - static FD_t scriptFd = NULL; - if (scriptFd != NULL) fdClose(scriptFd); - scriptFd = fdDup(fd); - rpmtransSetScriptFd(trans, scriptFd); - -void -rpmRunTransactions(trans, callbackOpen, callbackClose, callbackMessage, force) - void *trans - SV *callbackOpen - SV *callbackClose - SV *callbackMessage - int force - PPCODE: - rpmProblemSet probs; - void *rpmRunTransactions_callback(const void *h, const rpmCallbackType what, const unsigned long amount, const unsigned long total, const void * pkgKey, void * data) { - static int last_amount; - static FD_t fd = NULL; - char *msg = NULL; - char *param_s = NULL; - const unsigned long *param_ul1 = NULL; - const unsigned long *param_ul2 = NULL; - char *n = (char *) pkgKey; - static struct timeval tprev; - static struct timeval tcurr; - long delta; - - switch (what) { - case RPMCALLBACK_INST_OPEN_FILE: { - int i; - dSP; - PUSHMARK(sp); - XPUSHs(sv_2mortal(newSVpv(n, 0))); - PUTBACK; - i = perl_call_sv(callbackOpen, G_SCALAR); - SPAGAIN; - if (i != 1) croak("Big trouble\n"); - i = POPi; fd = fdDup(i); - fd = fdLink(fd, "persist DrakX"); - PUTBACK; - return fd; - } - - case RPMCALLBACK_INST_CLOSE_FILE: { - dSP; - PUSHMARK(sp); - XPUSHs(sv_2mortal(newSVpv(n, 0))); - PUTBACK; - perl_call_sv(callbackClose, G_DISCARD); - free(n); /* was strdup in rpmtransAddPackage */ - fd = fdFree(fd, "persist DrakX"); - if (fd) { - fdClose(fd); - fd = NULL; - } - break; - } - - case RPMCALLBACK_TRANS_START: { - switch (amount) { - case 1: msg = "Examining packages to install..."; break; - case 5: msg = "Examining files to install..."; break; - case 6: msg = "Finding overlapping files..."; break; - } - if (msg) param_ul1 = &total; - } break; - - case RPMCALLBACK_UNINST_START: { - msg = "Removing old files..."; - param_ul1 = &total; - } break; - - case RPMCALLBACK_TRANS_PROGRESS: { - msg = "Progressing transaction"; - param_ul1 = &amount; - } break; - - case RPMCALLBACK_UNINST_PROGRESS: { - msg = "Progressing removing old files"; - param_ul1 = &amount; - } break; - - case RPMCALLBACK_TRANS_STOP: { - msg = "Done transaction"; - } break; - - case RPMCALLBACK_UNINST_STOP: { - msg = "Done removing old files"; - } break; - - case RPMCALLBACK_INST_START: { - msg = "Starting installing package"; - gettimeofday(&tprev, NULL); - param_s = n; - - last_amount = 0; - } break; - - case RPMCALLBACK_INST_PROGRESS: - gettimeofday(&tcurr, NULL); - delta = 1000000 * (tcurr.tv_sec - tprev.tv_sec) + (tcurr.tv_usec - tprev.tv_usec); - if (delta > 200000 || amount >= total - 1) { /* (total && (amount - last_amount) * 22 / 4 / total)) { */ - msg = "Progressing installing package"; - param_s = n; - param_ul1 = &amount; - param_ul2 = &total; - - tprev = tcurr; - last_amount = amount; - } break; - default: break; - } - - if (msg) { - dSP ; - PUSHMARK(sp) ; - XPUSHs(sv_2mortal(newSVpv(msg, 0))); - if (param_s) { - XPUSHs(sv_2mortal(newSVpv(param_s, 0))); - } - if (param_ul1) { - XPUSHs(sv_2mortal(newSViv(*param_ul1))); - } - if (param_ul2) { - XPUSHs(sv_2mortal(newSViv(*param_ul2))); - } - PUTBACK ; - perl_call_sv(callbackMessage, G_DISCARD); - } - return NULL; - } - if (rpmRunTransactions(trans, rpmRunTransactions_callback, NULL, NULL, &probs, 0, force ? ~0 : ~RPMPROB_FILTER_DISKSPACE)) { - int i; - /* printf("rpmRunTransactions finished, errors occured %d\n", probs->numProblems); fflush(stdout); */ - EXTEND(SP, probs->numProblems); - for (i = 0; i < probs->numProblems; i++) { - PUSHs(sv_2mortal(newSVpv(rpmProblemString(&probs->probs[i]), 0))); - } - } - -void rpmErrorSetCallback(fd) int fd CODE: rpmError_callback_data = fd; rpmErrorSetCallback(rpmError_callback); -void * -rpmReadPackageHeader(fdno) - int fdno - CODE: - Header h; - int isSource, major; - FD_t fd = fdDup(fdno); - RETVAL = rpmReadPackageHeader(fd, &h, &isSource, &major, NULL) ? NULL : h; - fdClose(fd); - OUTPUT: - RETVAL - -void * -headerRead(fdno, magicp) - int fdno - int magicp - CODE: - FD_t fd = fdDup(fdno); - RETVAL = (void *) headerRead(fd, magicp); - fdClose(fd); - OUTPUT: - RETVAL - -void -headerFree(header) - void *header - -char * -headerGetEntry_string(h, query) - void *h - int query - CODE: - int type, count; - headerGetEntry((Header) h, query, &type, (void **) &RETVAL, &count); - OUTPUT: - RETVAL - int -headerGetEntry_int(h, query) - void *h - int query - CODE: - int type, count, *i; - headerGetEntry((Header) h, query, &type, (void **) &i, &count); - RETVAL = i ? *i : 0; /* assume non existant value as 0 (needed for EPOCH (SERIAL)) */ - OUTPUT: - RETVAL - -void -headerGetEntry_int_list(h, query) - void *h - int query - PPCODE: - int i, type, count = 0; - int_32 *intlist = (int_32 *) NULL; - if (headerGetEntry((Header) h, query, &type, (void**) &intlist, &count)) { - if (count > 0) { - EXTEND(SP, count); - for (i = 0; i < count; i++) { - PUSHs(sv_2mortal(newSViv(intlist[i]))); - } - } - } - -void -headerGetEntry_string_list(h, query) - void *h - int query - PPCODE: - int i, type, count = 0; - char **strlist = (char **) NULL; - if (headerGetEntry((Header) h, query, &type, (void**) &strlist, &count)) { - if (count > 0) { - EXTEND(SP, count); - for (i = 0; i < count; i++) { - PUSHs(sv_2mortal(newSVpv(strlist[i], 0))); - } - } - free(strlist); - } - -void -headerGetEntry_filenames(h) - void *h - PPCODE: - int i, type, count = 0; - char ** baseNames, ** dirNames; - int_32 * dirIndexes; - char **strlist = (char **) NULL; - - if (headerGetEntry((Header) h, RPMTAG_OLDFILENAMES, &type, (void**) &strlist, &count)) { - if (count > 0) { - EXTEND(SP, count); - for (i = 0; i < count; i++) { - PUSHs(sv_2mortal(newSVpv(strlist[i], 0))); - } - } - free(strlist); - } else { - - headerGetEntry(h, RPMTAG_BASENAMES, &type, (void **) &baseNames, &count); - headerGetEntry(h, RPMTAG_DIRINDEXES, &type, (void **) &dirIndexes, NULL); - headerGetEntry(h, RPMTAG_DIRNAMES, &type, (void **) &dirNames, NULL); - - if (baseNames && dirNames && dirIndexes) { - EXTEND(SP, count); - for(i = 0; i < count; i++) { - char *p = malloc(strlen(dirNames[dirIndexes[i]]) + strlen(baseNames[i]) + 1); - if (p == NULL) croak("malloc failed"); - strcpy(p, dirNames[dirIndexes[i]]); - strcat(p, baseNames[i]); - PUSHs(sv_2mortal(newSVpv(p, 0))); - free(p); - } - free(baseNames); - free(dirNames); - } - } - -int rpmvercmp(char *a, char *b); +rpmvercmp(char *a, char *b); '; @macros = ( @@ -1016,8 +557,6 @@ int rpmvercmp(char *a, char *b); LOG_WARNING LOG_INFO LOG_LOCAL1 ) ], ); -push @macros, [ qw(int RPMTAG_NAME RPMTAG_GROUP RPMTAG_SIZE RPMTAG_VERSION RPMTAG_SUMMARY RPMTAG_DESCRIPTION RPMTAG_RELEASE RPMTAG_EPOCH RPMTAG_ARCH RPMTAG_OBSOLETES RPMTAG_REQUIRENAME RPMTAG_FILEFLAGS RPMFILE_CONFIG) ] - if $ENV{C_RPM}; $\= "\n"; print; |