/* 1 bad magic */
/* 2 error */
int rpmInstallSourcePackage(char * rootdir, int fd, char ** specFile,
- rpmNotifyFunction notify, char * labelFormat) {
+ rpmNotifyFunction notify, char * labelFormat,
+ char ** cookie) {
int rc, isSource;
Header h;
int major, minor;
h = NULL;
}
+ if (cookie) {
+ *cookie = NULL;
+ if (h && headerGetEntry(h, RPMTAG_COOKIE, NULL, (void *) cookie,
+ NULL)) {
+ *cookie = strdup(*cookie);
+ }
+ }
+
rc = installSources(h, rootdir, fd, specFile, notify, labelFormat);
if (h) headerFree(h);
toRemove = realloc(toRemove, toRemoveAlloced * sizeof(int));
intptr = toRemove + j;
- for (j = 0; j < count; j++)
+ for (j = 0; j < matches.count; j++)
*intptr++ = matches.recs[j].recOffset;
dbiFreeIndexRecord(matches);
for (i = 0; i < fileCount; i++)
files[i].relativePath = files[i].relativePath;
-#if 0 /* Unfortunately this doesnt work as RPMs building code seems broken */
- for (i = 0; i < fileCount; i++)
- if (files[i].flags & RPMFILE_SPECFILE) break;
-#endif
- i = fileCount;
+ if (headerIsEntry(h, RPMTAG_COOKIE))
+ for (i = 0; i < fileCount; i++)
+ if (files[i].flags & RPMFILE_SPECFILE) break;
+
if (i == fileCount) {
/* find the spec file by name */
for (i = 0; i < fileCount; i++) {