int writeRPM(Header header, char *fileName, int type,
CSA_t *csa, char *passPhrase, char **cookie)
{
- int fd, ifd, rc, count, arch, os, sigtype;
+ int fd, ifd, rc, count, sigtype;
+ int archnum, osnum;
char *sigtarget, *name, *version, *release;
char buf[BUFSIZ];
Header sig;
sprintf(buf, "%s-%s-%s", name, version, release);
if (csa->cpioFdIn < 0) {
- rpmGetArchInfo(NULL, &arch);
- rpmGetOsInfo(NULL, &os);
+ rpmGetArchInfo(NULL, &archnum);
+ rpmGetOsInfo(NULL, &osnum);
} else if (csa->lead != NULL) { /* XXX FIXME: exorcize lead/arch/os */
- arch = csa->lead->archnum;
- os = csa->lead->osnum;
+ archnum = csa->lead->archnum;
+ osnum = csa->lead->osnum;
} else {
- arch = -1;
- os = -1;
+ archnum = -1;
+ osnum = -1;
}
memset(&lead, 0, sizeof(lead));
lead.major = RPM_MAJOR_NUMBER;
lead.minor = 0;
lead.type = type;
- lead.archnum = arch;
- lead.osnum = os;
+ lead.archnum = archnum;
+ lead.osnum = osnum;
lead.signature_type = RPMSIG_HEADERSIG; /* New-style signature */
strncpy(lead.name, buf, sizeof(lead.name));
if (writeLead(fd, &lead)) {
char **names;
int count;
+ /*
+ * XXX The strcasecmp below is necessary so the old (rpm < 2.90) style
+ * XXX os-from-uname (e.g. "Linux") is compatible with the new
+ * XXX os-from-platform (e.g "linux" from "sparc-*-linux").
+ */
if (headerGetEntry(header, tag, NULL, (void **)&names, &count)) {
while (count--) {
- if (!strcmp(names[count], name)) {
+ if (!strcasecmp(names[count], name)) {
FREE(names);
return 1;
}
{
char buf[BUFSIZ], *tok;
+ /*
+ * XXX The strcasecmp below is necessary so the old (rpm < 2.90) style
+ * XXX os-from-uname (e.g. "Linux") is compatible with the new
+ * XXX os-from-platform (e.g "linux" from "sparc-*-linux").
+ */
strcpy(buf, line);
strtok(buf, " \n\t");
while ((tok = strtok(NULL, " \n\t"))) {
- if (! strcmp(tok, token)) {
+ if (! strcasecmp(tok, token)) {
return 1;
}
}
rpmGetArchInfo(&arch, NULL);
rpmGetOsInfo(&os, NULL);
+
s = spec->line;
SKIPSPACE(s);
match = -1;
{
int parsePart = PART_PREAMBLE;
int initialPackage = 1;
- char *name, *arch, *os;
+ char *name;
char *saveArch;
Package pkg;
int x, index;
spec->timeCheck = 0;
}
- /* Add some standard macros */
- rpmGetArchInfo(&arch, NULL);
- rpmGetOsInfo(&os, NULL);
-#ifdef DEAD
- setStandardMacros(spec, arch, os);
-#endif
-
/* All the parse*() functions expect to have a line pre-read */
/* in the spec's line buffer. Except for parsePreamble(), */
/* which handles the initial entry into a spec file. */
}
/* Check for description in each package and add arch and os */
- pkg = spec->packages;
- while (pkg) {
+ { char *arch, *os, *myos = NULL;
+
+ rpmGetArchInfo(&arch, NULL);
+ rpmGetOsInfo(&os, NULL);
+ /*
+ * XXX Capitalizing the 'L' is needed to insure that old
+ * XXX os-from-uname (e.g. "Linux") is compatible with the new
+ * XXX os-from-platform (e.g "linux" from "sparc-*-linux").
+ * XXX A copy of this string is embedded in headers.
+ */
+ if (!strcmp(os, "linux")) {
+ os = myos = strdup(os);
+ *os = 'L';
+ }
+
+ for (pkg = spec->packages; pkg != NULL; pkg = pkg->next) {
headerGetEntry(pkg->header, RPMTAG_NAME, NULL, (void **) &name, NULL);
if (!headerIsEntry(pkg->header, RPMTAG_DESCRIPTION)) {
rpmError(RPMERR_BADSPEC, _("Package has no %%description: %s"), name);
headerAddEntry(pkg->header, RPMTAG_OS, RPM_STRING_TYPE, os, 1);
headerAddEntry(pkg->header, RPMTAG_ARCH, RPM_STRING_TYPE, arch, 1);
-
- pkg = pkg->next;
+ }
+ FREE(myos);
}
closeSpec(spec);