summaryrefslogtreecommitdiffstats
path: root/perl-install/c
diff options
context:
space:
mode:
Diffstat (limited to 'perl-install/c')
-rw-r--r--perl-install/c/.cvsignore8
-rw-r--r--perl-install/c/Makefile.PL18
-rw-r--r--perl-install/c/sbus.c35
-rw-r--r--perl-install/c/stuff.pm11
-rw-r--r--perl-install/c/stuff.xs.pm483
5 files changed, 498 insertions, 57 deletions
diff --git a/perl-install/c/.cvsignore b/perl-install/c/.cvsignore
index 0c6427c49..c2c3c1628 100644
--- a/perl-install/c/.cvsignore
+++ b/perl-install/c/.cvsignore
@@ -1,6 +1,8 @@
Makefile
-c.c
-c.bs
+Makefile_c
+stuff.c
+stuff.bs
pm_to_blib
+Makefile_c.old
blib
-c.xs
+stuff.xs
diff --git a/perl-install/c/Makefile.PL b/perl-install/c/Makefile.PL
index bb7eed0d1..0c41585a2 100644
--- a/perl-install/c/Makefile.PL
+++ b/perl-install/c/Makefile.PL
@@ -1,11 +1,17 @@
use ExtUtils::MakeMaker;
# See lib/ExtUtils/MakeMaker.pm for details of how to influence
# the contents of the Makefile that is written.
+
+my $libs = '-L/usr/X11R6/lib -lX11 -lgdk -lXxf86misc';
+$libs .= ' -lrpm -ldb1 -lz' if $ENV{C_RPM};
+
WriteMakefile(
- 'NAME' => 'c',
- 'VERSION_FROM' => 'c.pm', # finds $VERSION
- 'LIBS' => ['-ldb1 -lz'], # e.g., '-lm'
-# 'OBJECT' => 'c.o librpm.a',
- 'DEFINE' => '', # e.g., '-DHAVE_SOMETHING'
- 'INC' => '-Wall', # e.g., '-I/usr/include/other'
+ 'NAME' => 'stuff',
+ 'OPTIMIZE' => '-Os',
+ 'MAKEFILE' => 'Makefile_c',
+ 'OBJECT' => 'stuff.o smp.o md5.o md5_crypt.o sbus.o silo.o',
+ 'VERSION_FROM' => 'stuff.pm', # finds $VERSION
+ 'LIBS' => [$libs], # e.g., '-lm'
+ 'DEFINE' => '-DHIGHFIRST -D"MD5Name(x)=x"', # e.g., '-DHAVE_SOMETHING'
+ 'INC' => '-I/usr/include/rpm `gtk-config --cflags`', # e.g., '-I/usr/include/other'
);
diff --git a/perl-install/c/sbus.c b/perl-install/c/sbus.c
index 1fed1f886..85d44fa79 100644
--- a/perl-install/c/sbus.c
+++ b/perl-install/c/sbus.c
@@ -86,6 +86,25 @@ int prom_getchild(int node)
return *(int *)op->oprom_array;
}
+char *prom_getopt(char *var, int *lenp)
+{
+ DECL_OP(MAX_VAL);
+
+ strcpy (op->oprom_array, var);
+ if (ioctl (promfd, OPROMGETOPT, op) < 0)
+ return 0;
+ if (lenp) *lenp = op->oprom_size;
+ return op->oprom_array;
+}
+
+void prom_setopt(char *var, char *value) {
+ DECL_OP(MAX_VAL);
+
+ strcpy (op->oprom_array, var);
+ strcpy (op->oprom_array + strlen (var) + 1, value);
+ ioctl (promfd, OPROMSETOPT, op);
+}
+
char *prom_getproperty(char *prop, int *lenp)
{
DECL_OP(MAX_VAL);
@@ -113,11 +132,25 @@ int prom_getbool(char *prop)
}
}
+int prom_pci2node(int bus, int devfn) {
+ DECL_OP(2*sizeof(int));
+
+ ((int *)op->oprom_array)[0] = bus;
+ ((int *)op->oprom_array)[1] = devfn;
+ if (ioctl (promfd, OPROMPCI2NODE, op) < 0)
+ return 0;
+ prom_current_node = *(int *)op->oprom_array;
+ return *(int *)op->oprom_array;
+}
+
#else
int prom_open() { return 0; }
void prom_close() {}
int prom_getsibling(int node) { return 0; }
int prom_getchild(int node) { return 0; }
-char *prom_getproperty(char *prop, int *lenp) { return NULL; }
+char *prom_getopt(char *var, int *lenp) { return 0; /* NULL */ }
+void prom_setopt(char *var, char *value) {}
+char *prom_getproperty(char *prop, int *lenp) { return 0; /* NULL */ }
int prom_getbool(char *prop) { return 0; }
+int prom_pci2node(int bus, int devfn) { return 0; }
#endif /* __sparc__ */
diff --git a/perl-install/c/stuff.pm b/perl-install/c/stuff.pm
index ad5cf316d..0cb3e99f3 100644
--- a/perl-install/c/stuff.pm
+++ b/perl-install/c/stuff.pm
@@ -1,4 +1,4 @@
-package c::stuff;
+package c::stuff; # $Id$
use strict;
use vars qw($VERSION @ISA);
@@ -10,11 +10,9 @@ $VERSION = '0.01';
bootstrap c::stuff $VERSION;
-1;
-
sub headerGetEntry {
my ($h, $q) = @_;
-
+ $h or log::l("empty header in headerGetEntry"), return;
$q eq 'name' and return headerGetEntry_string($h, RPMTAG_NAME());
$q eq 'group' and return headerGetEntry_string($h, RPMTAG_GROUP());
$q eq 'version' and return headerGetEntry_string($h, RPMTAG_VERSION());
@@ -23,7 +21,10 @@ sub headerGetEntry {
$q eq 'description' and return headerGetEntry_string($h, RPMTAG_DESCRIPTION());
$q eq 'arch' and return headerGetEntry_string($h, RPMTAG_ARCH());
$q eq 'size' and return headerGetEntry_int($h, RPMTAG_SIZE());
- $q eq 'filenames' and return headerGetEntry_string_list($h, RPMTAG_FILENAMES());
$q eq 'obsoletes' and return headerGetEntry_string_list($h, RPMTAG_OBSOLETES());
+ $q eq 'requires' and return headerGetEntry_string_list($h, RPMTAG_REQUIRENAME());
+ $q eq 'fileflags' and return headerGetEntry_int_list($h, RPMTAG_FILEFLAGS());
+ $q eq 'filenames' and return headerGetEntry_filenames($h);
}
+1;
diff --git a/perl-install/c/stuff.xs.pm b/perl-install/c/stuff.xs.pm
index 2b301d1b0..ecffd9c10 100644
--- a/perl-install/c/stuff.xs.pm
+++ b/perl-install/c/stuff.xs.pm
@@ -5,28 +5,38 @@ print '
#include <ctype.h>
#include <unistd.h>
+#include <syslog.h>
#include <fcntl.h>
#include <resolv.h>
#include <sys/types.h>
#include <sys/wait.h>
#include <sys/ioctl.h>
+#include <sys/time.h>
+#include <sys/resource.h>
#include <sys/stat.h>
#include <sys/utsname.h>
+#include <sys/mount.h>
#include <linux/keyboard.h>
#include <linux/kd.h>
-#include <linux/fs.h>
#include <linux/hdreg.h>
#include <linux/vt.h>
+#include <linux/cdrom.h>
+#include <linux/loop.h>
#include <net/if.h>
#include <net/route.h>
#include <gdk/gdkx.h>
#include <X11/Xlib.h>
+#include <X11/extensions/xf86misc.h>
+#include <term.h>
#define SECTORSIZE 512
';
$ENV{C_RPM} and print '
+#undef Fflush
+#undef Mkdir
+#undef Stat
#include <rpm/rpmlib.h>
void rpmError_callback_empty(void) {}
@@ -40,15 +50,32 @@ void rpmError_callback(void) {
}
FD_t fd2FD_t(int fd) {
- static struct _FD f = { -1, NULL, NULL, NULL };
- f.fd_fd = fd;
- return fd == -1 ? NULL : &f;
+ static FD_t f = NULL;
+ if (fd == -1) return NULL;
+ if (f == NULL) f = fdNew("");
+ fdSetFdno(f, fd);
+ return f;
}
';
print '
+void initIMPS2() {
+ unsigned char imps2_s1[] = { 243, 200, 243, 100, 243, 80, };
+ unsigned char imps2_s2[] = { 246, 230, 244, 243, 100, 232, 3, };
+
+ int fd = open("/dev/cdrom", O_WRONLY);
+ if (fd < 0) return;
+
+ write (fd, imps2_s1, sizeof (imps2_s1));
+ usleep (30000);
+ write (fd, imps2_s2, sizeof (imps2_s2));
+ usleep (30000);
+ tcflush (fd, TCIFLUSH);
+ tcdrain(fd);
+}
+
long long llseek(int fd, long long offset, int whence);
MODULE = c::stuff PACKAGE = c::stuff
@@ -64,21 +91,34 @@ Xtest(display)
XSetCloseDownMode(d, RetainPermanent);
XCloseDisplay(d);
}
- {
- char *args[2];
- args[0] = d ? "false" : "true"; /* inverted on purpose! */
- args[1] = NULL;
- execvp(args[0], args);
- }
- printf("***************** SHOUDNT GET THERE ***************\n");
- exit(d != NULL);
+ _exit(d != NULL);
}
-
waitpid(pid, &RETVAL, 0);
OUTPUT:
RETVAL
void
+setMouseLive(display, type, emulate3buttons)
+ char *display
+ int type
+ int emulate3buttons
+ CODE:
+ {
+ XF86MiscMouseSettings mseinfo;
+ Display *d = XOpenDisplay(display);
+ if (d) {
+ if (XF86MiscGetMouseSettings(d, &mseinfo) == True) {
+ mseinfo.type = type;
+ mseinfo.flags |= MF_REOPEN;
+ mseinfo.emulate3buttons = emulate3buttons;
+ XF86MiscSetMouseSettings(d, &mseinfo);
+ XFlush(d);
+ if (type == MTYPE_IMPS2) initIMPS2();
+ }
+ }
+ }
+
+void
XSetInputFocus(window)
int window
CODE:
@@ -102,9 +142,74 @@ lseek_sector(fd, sector, offset)
OUTPUT:
RETVAL
+int
+isBurner(fd)
+ int fd
+ CODE:
+ RETVAL = ioctl(fd, CDROM_GET_CAPABILITY) & CDC_CD_RW;
+ OUTPUT:
+ RETVAL
+
+unsigned int
+total_sectors(fd)
+ int fd
+ CODE:
+ {
+ long s;
+ RETVAL = ioctl(fd, BLKGETSIZE, &s) == 0 ? s : 0;
+ }
+ OUTPUT:
+ RETVAL
+
+void
+unlimit_core()
+ CODE:
+ {
+ struct rlimit rlim = { RLIM_INFINITY, RLIM_INFINITY };
+ setrlimit(RLIMIT_CORE, &rlim);
+ }
+
+int
+getlimit_core()
+ CODE:
+ {
+ struct rlimit rlim;
+ getrlimit(RLIMIT_CORE, &rlim);
+ RETVAL = rlim.rlim_cur;
+ }
+ OUTPUT:
+ RETVAL
+
+void
+openlog(ident)
+ char *ident
+ CODE:
+ openlog(ident, 0, 0);
+
+void
+closelog()
+
+void
+syslog(mesg)
+ char *mesg
+ CODE:
+ syslog(LOG_WARNING, mesg);
+
void
setsid()
+void
+_exit(status)
+ int status
+
+int
+detectSMP()
+
+char*
+crypt_md5(pw, salt)
+ char *pw
+ char *salt
+
unsigned int
getpagesize()
@@ -185,7 +290,140 @@ kernel_version()
OUTPUT:
RETVAL
+char *
+kernel_arch()
+ CODE:
+ struct utsname u;
+ if (uname(&u) == 0) RETVAL = u.machine; else RETVAL = NULL;
+ OUTPUT:
+ RETVAL
+
+int
+set_loop(dev_fd, file)
+ int dev_fd
+ char *file
+ CODE:
+ RETVAL = 0;
+{
+ struct loop_info loopinfo;
+ int file_fd = open(file, O_RDWR);
+
+ if (file_fd < 0) return;
+
+ memset(&loopinfo, 0, sizeof(loopinfo));
+ strncpy(loopinfo.lo_name, file, LO_NAME_SIZE);
+ loopinfo.lo_name[LO_NAME_SIZE - 1] = 0;
+
+ if (ioctl(dev_fd, LOOP_SET_FD, file_fd) < 0) return;
+ if (ioctl(dev_fd, LOOP_SET_STATUS, &loopinfo) < 0) {
+ ioctl(dev_fd, LOOP_CLR_FD, 0);
+ return;
+ }
+ close(file_fd);
+ RETVAL = 1;
+}
+ OUTPUT:
+ RETVAL
+
+int
+del_loop(device)
+ char *device
+ CODE:
+ RETVAL = 0;
+{
+ int fd;
+ if ((fd = open(device, O_RDONLY)) < 0) return;
+ if (ioctl(fd, LOOP_CLR_FD, 0) < 0) return;
+ close(fd);
+ RETVAL = 1;
+}
+ OUTPUT:
+ RETVAL
+
+int
+prom_open()
+
+void
+prom_close()
+
+int
+prom_getsibling(node)
+ int node
+
+int
+prom_getchild(node)
+ int node
+
+void
+prom_getopt(key)
+ char *key
+ PPCODE:
+ int lenp = 0;
+ char *value = NULL;
+ value = prom_getopt(key, &lenp);
+ EXTEND(sp, 1);
+ if (value != NULL) {
+ PUSHs(sv_2mortal(newSVpv(value, 0)));
+ } else {
+ PUSHs(&PL_sv_undef);
+ }
+
+void
+prom_setopt(key, value)
+ char *key
+ char *value
+
+void
+prom_getproperty(key)
+ char *key
+ PPCODE:
+ int lenp = 0;
+ char *value = NULL;
+ value = prom_getproperty(key, &lenp);
+ EXTEND(sp, 1);
+ if (value != NULL) {
+ PUSHs(sv_2mortal(newSVpv(value, lenp)));
+ } else {
+ PUSHs(&PL_sv_undef);
+ }
+
+void
+prom_getstring(key)
+ char *key
+ PPCODE:
+ int lenp = 0;
+ char *value = NULL;
+ value = prom_getproperty(key, &lenp);
+ EXTEND(sp, 1);
+ if (value != NULL) {
+ PUSHs(sv_2mortal(newSVpv(value, 0)));
+ } else {
+ PUSHs(&PL_sv_undef);
+ }
+
+int
+prom_getbool(key)
+ char *key
+
+
+void
+initSilo()
+
+char *
+disk2PromPath(disk)
+ unsigned char *disk
+
+int
+hasAliases()
+
+char *
+promRootName()
+
+void
+setPromVars(linuxAlias, bootDevice)
+ char *linuxAlias
+ char *bootDevice
';
$ENV{C_RPM} and print '
@@ -220,7 +458,12 @@ rpmdbOpenForTraversal(root)
char *root
CODE:
static rpmdb db;
+ rpmErrorCallBackType old_cb;
+ old_cb = rpmErrorSetCallback(rpmError_callback_empty);
+ rpmSetVerbosity(RPMMESS_FATALERROR);
RETVAL = rpmdbOpenForTraversal(root, &db) == 0 ? db : NULL;
+ rpmErrorSetCallback(old_cb);
+ rpmSetVerbosity(RPMMESS_NORMAL);
OUTPUT:
RETVAL
@@ -241,7 +484,7 @@ rpmdbTraverse(db, ...)
}
count = 0;
num = rpmdbFirstRecNum(db);
- while (num) {
+ while (num>0) {
if (callback != &PL_sv_undef && SvROK(callback)) {
h = rpmdbGetRecord(db, num);
{
@@ -335,6 +578,31 @@ rpmtransAddPackage(rpmdep, header, key, update)
RETVAL
int
+rpmtransRemovePackages(db, rpmdep, p)
+ void *db
+ void *rpmdep
+ char *p
+ CODE:
+ rpmdb d = db;
+ rpmTransactionSet r = rpmdep;
+ dbiIndexSet matches;
+ int i;
+ int count = 0;
+ if (!rpmdbFindByLabel(d, p, &matches)) {
+ for (i = 0; i < dbiIndexSetCount(matches); ++i) {
+ unsigned int recOffset = dbiIndexRecordOffset(matches, i);
+ if (recOffset) {
+ rpmtransRemovePackage(rpmdep, recOffset);
+ ++count;
+ }
+ }
+ RETVAL=count;
+ } else
+ RETVAL=0;
+ OUTPUT:
+ RETVAL
+
+int
rpmdepOrder(order)
void *order
CODE:
@@ -383,7 +651,12 @@ 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
@@ -409,22 +682,37 @@ rpmtransSetScriptFd(trans, fd)
void *trans
int fd
CODE:
- rpmtransSetScriptFd(trans, fdDup(fd));
+ /* this code core dumps on install...
+ static FD_t scriptFd = NULL;
+ if (scriptFd == NULL) scriptFd = fdNew("");
+ fdSetFdno(scriptFd, fd);
+ rpmtransSetScriptFd(trans, scriptFd);
+ */
+ static FD_t scriptFd = NULL;
+ if (scriptFd != NULL) fdClose(scriptFd);
+ scriptFd = fdDup(fd);
+ rpmtransSetScriptFd(trans, scriptFd);
void
-rpmRunTransactions(trans, callbackOpen, callbackClose, callbackStart, callbackProgress, force)
+rpmRunTransactions(trans, callbackOpen, callbackClose, callbackMessage, force)
void *trans
SV *callbackOpen
SV *callbackClose
- SV *callbackStart
- SV *callbackProgress
+ SV *callbackMessage
int force
PPCODE:
rpmProblemSet probs;
void *rpmRunTransactions_callback(const Header h, const rpmCallbackType what, const unsigned long amount, const unsigned long total, const void * pkgKey, void * data) {
static FD_t fd;
static int last_amount;
+ 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: {
@@ -447,35 +735,86 @@ rpmRunTransactions(trans, callbackOpen, callbackClose, callbackStart, callbackPr
XPUSHs(sv_2mortal(newSVpv(n, 0)));
PUTBACK;
perl_call_sv(callbackClose, G_DISCARD);
- free(n); /* was strdup in rpmtransAddPackage */
+ free(n); /* was strdup in rpmtransAddPackage */
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: {
- dSP ;
- PUSHMARK(sp) ;
- XPUSHs(sv_2mortal(newSVpv(n, 0)));
- PUTBACK ;
- perl_call_sv(callbackStart, G_DISCARD);
- last_amount = 0;
- } break;
+ msg = "Starting installing package";
+ gettimeofday(&tprev, NULL);
+ param_s = n;
+
+ last_amount = 0;
+ } break;
case RPMCALLBACK_INST_PROGRESS:
- if ((amount - last_amount) * 4 / total) {
- dSP;
- PUSHMARK(sp);
- XPUSHs(sv_2mortal(newSViv(amount)));
- XPUSHs(sv_2mortal(newSViv(total)));
- PUTBACK ;
- perl_call_sv(callbackProgress, G_DISCARD);
+ 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)));
@@ -508,6 +847,10 @@ headerRead(fd, magicp)
OUTPUT:
RETVAL
+void
+headerFree(header)
+ void *header
+
char *
headerGetEntry_string(h, query)
void *h
@@ -530,29 +873,85 @@ headerGetEntry_int(h, query)
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) && count) {
- EXTEND(SP, count);
- for (i = 0; i < count; i++) {
- PUSHs(sv_2mortal(newSVpv(strlist[i], 0)));
+ 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);
}
}
- free(strlist);
';
@macros = (
[ qw(int S_IFCHR S_IFBLK KDSKBENT KT_SPEC NR_KEYS MAX_NR_KEYMAPS BLKRRPART TIOCSCTTY
- HDIO_GETGEO BLKGETSIZE
- MS_MGC_VAL MS_RDONLY O_NONBLOCK SECTORSIZE WNOHANG
- VT_ACTIVATE VT_WAITACTIVE VT_GETSTATE
+ HDIO_GETGEO BLKGETSIZE LOOP_GET_STATUS
+ MS_MGC_VAL MS_RDONLY O_NONBLOCK O_CREAT SECTORSIZE WNOHANG
+ VT_ACTIVATE VT_WAITACTIVE VT_GETSTATE CDROM_LOCKDOOR CDROMEJECT
) ],
);
-push @macros, [ qw(int RPMTAG_NAME RPMTAG_GROUP RPMTAG_SIZE RPMTAG_VERSION RPMTAG_SUMMARY RPMTAG_DESCRIPTION RPMTAG_RELEASE RPMTAG_ARCH RPMTAG_FILENAMES RPMTAG_OBSOLETES) ]
+push @macros, [ qw(int RPMTAG_NAME RPMTAG_GROUP RPMTAG_SIZE RPMTAG_VERSION RPMTAG_SUMMARY RPMTAG_DESCRIPTION RPMTAG_RELEASE RPMTAG_ARCH RPMTAG_OBSOLETES RPMTAG_REQUIRENAME RPMTAG_FILEFLAGS RPMFILE_CONFIG) ]
if $ENV{C_RPM};
$\= "\n";