Merge branch 'altlinux-4.0'
This commit is contained in:
commit
70b853bb1f
@ -652,18 +652,37 @@ static int handlePreambleTag(Spec spec, Package pkg, int tag, const char *macro,
|
||||
addOrAppendListEntry(spec->buildRestrictions, tag, field);
|
||||
break;
|
||||
case RPMTAG_BUILDARCHS:
|
||||
if ((rc = poptParseArgvString(field,
|
||||
&(spec->BACount),
|
||||
&(spec->BANames)))) {
|
||||
{
|
||||
const char **BANames = NULL;
|
||||
int BACount = 0;
|
||||
if ((rc = poptParseArgvString(field, &BACount, &BANames))) {
|
||||
rpmError(RPMERR_BADSPEC,
|
||||
_("line %d: Bad BuildArchitecture format: %s\n"),
|
||||
spec->lineNum, spec->line);
|
||||
return RPMERR_BADSPEC;
|
||||
}
|
||||
if (!spec->BACount)
|
||||
spec->BANames = _free(spec->BANames);
|
||||
if (pkg == spec->packages) {
|
||||
/* toplevel */
|
||||
if (BACount > 0 && BANames != NULL) {
|
||||
spec->BACount = BACount;
|
||||
spec->BANames = BANames;
|
||||
BANames = NULL; /* don't free */
|
||||
}
|
||||
}
|
||||
else {
|
||||
/* subpackage */
|
||||
if (BACount != 1 || strcmp(BANames[0], "noarch")) {
|
||||
rpmError(RPMERR_BADSPEC,
|
||||
_("line %d: Only \"noarch\" sub-packages are supported: %s\n"),
|
||||
spec->lineNum, spec->line);
|
||||
BANames = _free(BANames);
|
||||
return RPMERR_BADSPEC;
|
||||
}
|
||||
headerAddEntry(pkg->header, RPMTAG_ARCH, RPM_STRING_TYPE, "noarch", 1);
|
||||
}
|
||||
BANames = _free(BANames);
|
||||
break;
|
||||
|
||||
}
|
||||
default:
|
||||
rpmError(RPMERR_INTERNAL, _("Internal error: Bogus tag %d\n"), tag);
|
||||
return RPMERR_INTERNAL;
|
||||
|
@ -230,6 +230,9 @@ static int copyNextLine(Spec spec, OFI_t *ofi, int strip)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static
|
||||
FILE *tmpfp = NULL; /* temporary file for `rpmbuild -bE' preprocessor */
|
||||
|
||||
int readLine(Spec spec, int strip)
|
||||
{
|
||||
#ifdef DYING
|
||||
@ -410,13 +413,10 @@ retry:
|
||||
}
|
||||
|
||||
if (spec->preprocess_mode) {
|
||||
char *chomped = xstrdup( spec->line );
|
||||
int len = strlen( chomped );
|
||||
|
||||
if ( '\n' == chomped[len-1] )
|
||||
chomped[len-1] = '\0';
|
||||
puts( chomped );
|
||||
chomped = _free( chomped );
|
||||
size_t len = strlen(spec->line);
|
||||
if (spec->line[len-1] == '\n')
|
||||
len--; /* chomp */
|
||||
fprintf(tmpfp, "%.*s\n", (int)len, spec->line);
|
||||
}
|
||||
|
||||
/*@-compmempass@*/ /* FIX: spec->readStack->next should be dependent */
|
||||
@ -638,6 +638,25 @@ int parseSpec(Spec *specp, const char *specFile, const char *rootURL,
|
||||
spec->fileStack = newOpenFileInfo();
|
||||
spec->fileStack->fileName = xstrdup(spec->specFile);
|
||||
spec->preprocess_mode = preprocess;
|
||||
|
||||
if (spec->preprocess_mode) {
|
||||
if (!recursing){
|
||||
assert(tmpfp == NULL);
|
||||
tmpfp = tmpfile();
|
||||
if (!tmpfp) {
|
||||
rpmError(RPMERR_CREATE,
|
||||
_("Cannot create temporary file: %s"),
|
||||
strerror(errno));
|
||||
return RPMERR_CREATE;
|
||||
}
|
||||
}
|
||||
else {
|
||||
assert(tmpfp);
|
||||
fseek(tmpfp, 0, SEEK_SET);
|
||||
ftruncate(fileno(tmpfp), 0);
|
||||
}
|
||||
}
|
||||
|
||||
if (buildRootURL) {
|
||||
const char * buildRoot;
|
||||
(void) urlPath(buildRootURL, &buildRoot);
|
||||
@ -848,8 +867,10 @@ fprintf(stderr, "*** PS buildRootURL(%s) %p macro set to %s\n", spec->buildRootU
|
||||
}
|
||||
|
||||
(void) headerAddEntry(pkg->header, RPMTAG_OS, RPM_STRING_TYPE, os, 1);
|
||||
(void) headerAddEntry(pkg->header, RPMTAG_ARCH,
|
||||
RPM_STRING_TYPE, arch, 1);
|
||||
if (!headerIsEntry(pkg->header, RPMTAG_ARCH))
|
||||
headerAddEntry(pkg->header, RPMTAG_ARCH, RPM_STRING_TYPE, arch, 1);
|
||||
else
|
||||
assert(pkg != spec->packages); /* noarch subpackage */
|
||||
if (!headerIsEntry(pkg->header, RPMTAG_RHNPLATFORM))
|
||||
(void) headerAddEntry(pkg->header, RPMTAG_RHNPLATFORM,
|
||||
RPM_STRING_TYPE, arch, 1);
|
||||
@ -876,5 +897,16 @@ fprintf(stderr, "*** PS buildRootURL(%s) %p macro set to %s\n", spec->buildRootU
|
||||
closeSpec(spec);
|
||||
*specp = spec;
|
||||
|
||||
if (spec->preprocess_mode) {
|
||||
char buf[BUFSIZ];
|
||||
size_t n;
|
||||
assert(tmpfp);
|
||||
fseek(tmpfp, 0, SEEK_SET);
|
||||
while ((n = fread(buf, 1, sizeof(buf), tmpfp)))
|
||||
fwrite(buf, 1, n, stdout);
|
||||
fclose(tmpfp);
|
||||
tmpfp = NULL;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
40
lib/rpmrc.c
40
lib/rpmrc.c
@ -990,7 +990,8 @@ static int is_athlon(void)
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int is_pentium3(void)
|
||||
/* Retrurns 3 for pentium3 and 4 for pentium4. Main difference is SSE2 support. */
|
||||
static int is_pentiumN(void)
|
||||
{
|
||||
unsigned int eax, ebx, ecx, edx, family, model;
|
||||
char vendor[16];
|
||||
@ -1009,7 +1010,8 @@ static int is_pentium3(void)
|
||||
{
|
||||
case 7: // Pentium III, Pentium III Xeon (model 7)
|
||||
case 8: // Pentium III, Pentium III Xeon, Celeron (model 8)
|
||||
case 9: // Pentium M
|
||||
return 3;
|
||||
case 9: // Pentium M, Celeron M
|
||||
/*
|
||||
Intel recently announced its new technology for mobile platforms,
|
||||
named Centrino, and presents it as a big advance in mobile PCs.
|
||||
@ -1022,27 +1024,15 @@ static int is_pentium3(void)
|
||||
constraints, and that is halfway between the Pentium III and the Pentium 4.
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
*/
|
||||
return 4;
|
||||
case 10: // Pentium III Xeon (model A)
|
||||
case 11: // Pentium III (model B)
|
||||
return 1;
|
||||
return 3;
|
||||
case 13: // Pentium M, Celeron M (90 nm)
|
||||
case 14: // Core Duo, Core Solo (65 nm)
|
||||
case 15: // Core2 Duo (65 nm)
|
||||
return 4;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int is_pentium4(void)
|
||||
{
|
||||
unsigned int eax, ebx, ecx, edx, family, model;
|
||||
char vendor[16];
|
||||
cpuid(0, &eax, &ebx, &ecx, &edx);
|
||||
memset(vendor, 0, sizeof(vendor));
|
||||
*((unsigned int *)&vendor[0]) = ebx;
|
||||
*((unsigned int *)&vendor[4]) = edx;
|
||||
*((unsigned int *)&vendor[8]) = ecx;
|
||||
if (strncmp(vendor, "GenuineIntel", 12) != 0)
|
||||
return 0;
|
||||
cpuid(1, &eax, &ebx, &ecx, &edx);
|
||||
family = (eax >> 8) & 0x0f;
|
||||
model = (eax >> 4) & 0x0f;
|
||||
if (family == 15)
|
||||
switch (model)
|
||||
{
|
||||
@ -1052,7 +1042,11 @@ static int is_pentium4(void)
|
||||
// Pentium 4 Xeon, Pentium 4 Xeon MP,
|
||||
// Celeron, Mobile Celron (0.13um)
|
||||
case 3: // Pentium 4, Celeron (0.09um)
|
||||
return 1;
|
||||
case 4: // Pentium 4, Pentium 4 Extream Edition,
|
||||
// Pentium D, Celeron D (0.09um)
|
||||
case 6: // Pentium 4, Pentium 4 Extream Edition,
|
||||
// Pentium D, Celeron D (0.065um)
|
||||
return 4;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
@ -1300,9 +1294,9 @@ static void defaultMachine(/*@out@*/ const char ** arch,
|
||||
|
||||
if ((class == '6' && is_athlon()) || class == '7')
|
||||
strcpy(un.machine, "athlon");
|
||||
else if (is_pentium4())
|
||||
else if (is_pentiumN() == 4)
|
||||
strcpy(un.machine, "pentium4");
|
||||
else if (is_pentium3())
|
||||
else if (is_pentiumN() == 3)
|
||||
strcpy(un.machine, "pentium3");
|
||||
else if (strchr("3456", un.machine[1]) && un.machine[1] != class)
|
||||
un.machine[1] = class;
|
||||
|
Loading…
Reference in New Issue
Block a user