From 698ec237180132948d22ee2fea740e2df8dcec5c Mon Sep 17 00:00:00 2001 From: jbj Date: Wed, 7 Oct 1998 15:33:51 +0000 Subject: [PATCH] attempt to deal rationally with os as "Linux" or "linux". CVS patchset: 2415 CVS date: 1998/10/07 15:33:51 --- CHANGES | 1 + lib/rpmrc.c | 42 ++++++++++++++++++++++++++++++++++-------- 2 files changed, 35 insertions(+), 8 deletions(-) diff --git a/CHANGES b/CHANGES index 966d025..41fd269 100644 --- a/CHANGES +++ b/CHANGES @@ -1,4 +1,5 @@ 2.5.5 -> 2.90 + - attempt to deal rationally with os as "Linux" or "linux". - add generalized expression handler (Tom Dyas) - use /usr/lib/rpm/mkinstalldirs if mkdir -p fails. - more portable dirent handling (Hermann Lauer). diff --git a/lib/rpmrc.c b/lib/rpmrc.c index ab33066..3388cf3 100644 --- a/lib/rpmrc.c +++ b/lib/rpmrc.c @@ -269,8 +269,16 @@ static struct machEquivInfo * machEquivSearch( struct machEquivTable * table, char * name) { int i; +/* + * 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"). + * XXX A copy of this string is embedded in headers and is + * XXX used by rpmInstallPackage->{os,arch}Okay->rpmMachineScore->. + * XXX to verify correct arch/os from headers. + */ for (i = 0; i < table->count; i++) - if (!strcmp(table->list[i].name, name)) + if (!strcasecmp(table->list[i].name, name)) return table->list + i; return NULL; @@ -439,7 +447,6 @@ int rpmReadConfigFiles(char * file, char * arch, char * os, int building, { char * canonarch, * canonos; - char * buildarch, * buildos; MacroEntry ** ME; rpmSetMachine(arch, os); @@ -459,15 +466,34 @@ int rpmReadConfigFiles(char * file, char * arch, char * os, int building, rpmRebuildPlatformVars(&buildplatform, &canonarch, &canonos); /* This is where we finally set the arch and os absolutely */ -/* rpmSetMachine(canonarch, canonos); */ - -/* XXX getMacroBody() may be nuked -- (see below) */ -buildarch = (char *) getMacroBody(&globalMacroContext, "buildarch"); -buildos = (char *) getMacroBody(&globalMacroContext, "buildos"); +/* rpmSetMachine(canonarch, canonos); */ -rpmSetMachine(buildarch,buildos); + { const char *buildarch; + const char *buildos; + + /* XXX getMacroBody() may be nuked -- (see below) */ + buildarch = (char *) getMacroBody(&globalMacroContext, "buildarch"); + buildos = (char *) getMacroBody(&globalMacroContext, "buildos"); + + /* + * XXX Capitalizing the 'L' is needed to insure that + * 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 and is + * XXX used by rpmInstallPackage->{os,arch}Okay->rpmMachineScore-> + * XXX to verify correct arch/os from headers. + */ + if (!strcmp(buildos, "linux")) { + char *mybuildos = strdup(buildos); + buildos[0] = 'L'; + rpmSetMachine(buildarch, mybuildos); + free(mybuildos); + } else { + rpmSetMachine(buildarch, buildos); + } + } return 0; } -- 2.7.4