[prev in list] [next in list] [prev in thread] [next in thread]
List: rpm-devel
Subject: Re: [CVS] RPM: rpm/ CHANGES rpm/lib/ rpmrc.c
From: Jeff Johnson <n3npq () mac ! com>
Date: 2009-02-15 12:51:33
Message-ID: 48CE2339-EC6A-4A27-9135-29AC67A06C75 () mac ! com
[Download RAW message or body]
Put the libcpuinfo development under a #ifdef please. I'd suggest
#define SUPPORT_LIBCPUINFO
AutoFu tests for HAVE_CPUINFO_H assume released code, which
just isn't close to being the case for your libcuinfo library yet.
See the end of "system.h" for several other wild implementations,
like AR payloads, that are no place close to being useful yet, or
perhaps ever.
I also question the usefulness of linking -lcpuinfo. You really
need to write up what is intended, not just whack in the code.
73 de Jeff
On Feb 14, 2009, at 7:31 PM, Per yvind Karlsen wrote:
> RPM Package Manager, CVS Repository
> http://rpm5.org/cvs/
>
> ____________________________________________________________________________
>
> Server: rpm5.org Name: Per yvind Karlsen
> Root: /v/rpm/cvs Email: pkarlsen@rpm5.org
> Module: rpm Date: 15-Feb-2009 01:31:37
> Branch: HEAD Handle: 2009021500313601
>
> Modified files:
> rpm CHANGES
> rpm/lib rpmrc.c
>
> Log:
> add initial support for detecting automatically detecting
> architecture through
> libcpuinfo. (more work needed!)
>
> Summary:
> Revision Changes Path
> 1.2774 +2 -0 rpm/CHANGES
> 2.250 +92 -0 rpm/lib/rpmrc.c
>
> ____________________________________________________________________________
>
> patch -p0 <<'@@ .'
> Index: rpm/CHANGES
>
> =
> =
> =
> =
> =
> =
> ======================================================================
> $ cvs diff -u -r1.2773 -r1.2774 CHANGES
> --- rpm/CHANGES 11 Feb 2009 16:59:28 -0000 1.2773
> +++ rpm/CHANGES 15 Feb 2009 00:31:36 -0000 1.2774
> @@ -1,5 +1,7 @@
>
> 5.2a2 -> 5.2a3:
> + - proyvind: add initial support for detecting automatically
> detecting
> + architecture through libcpuinfo.
> - jbj: stub-in /usr/lib/rpm/helpers/makeshlibs proof-of-concept.
> - proyvind: add %mips & %mipsx macros for mips archictecture.
> - jbj: add rpmdsNSType() to -lrpm loader map.
> @@ .
> patch -p0 <<'@@ .'
> Index: rpm/lib/rpmrc.c
>
> =
> =
> =
> =
> =
> =
> ======================================================================
> $ cvs diff -u -r2.249 -r2.250 rpmrc.c
> --- rpm/lib/rpmrc.c 9 Nov 2008 13:58:16 -0000 2.249
> +++ rpm/lib/rpmrc.c 15 Feb 2009 00:31:37 -0000 2.250
> @@ -8,6 +8,10 @@
> #define __power_pc() 0
> #endif
>
> +#if defined(HAVE_CPUINFO_H)
> +#include <cpuinfo.h>
> +#endif
> +
> #define _RPMIOB_INTERNAL /* XXX for rpmiobSlurp */
> #include <rpmio.h>
> #include <rpmcb.h>
> @@ -498,6 +502,92 @@
> }
> /*@=onlytrans@*/
>
> +#if defined(HAVE_CPUINFO_H)
> +static rpmRC rpmCpuinfo(void)
> +{
> + rpmRC rc = RPMRC_FAIL;
> + static struct utsname un;
> + const char *cpu;
> + miRE mi_re = NULL;
> + int mi_nre = 0;
> + int xx;
> + CVOG_t cvog = NULL;
> + uname(&un);
> + cpuinfo_t *cip = cpuinfo_new();
> +
> + xx = mireAppend(RPMMIRE_REGEX, 0, "noarch", NULL, &mi_re,
> &mi_nre);
> +
> +#if defined(__i386__) || defined(__x86_64__)
> + if(cpuinfo_has_feature(cip, CPUINFO_FEATURE_X86))
> + xx = mireAppend(RPMMIRE_REGEX, 0, "i386", NULL, &mi_re, &mi_nre);
> + if(cpuinfo_has_feature(cip, CPUINFO_FEATURE_X86_AC))
> + xx = mireAppend(RPMMIRE_REGEX, 0, "i486", NULL, &mi_re, &mi_nre);
> + if(cpuinfo_has_feature(cip, CPUINFO_FEATURE_X86_TSC))
> + xx = mireAppend(RPMMIRE_REGEX, 0, "i586", NULL, &mi_re, &mi_nre);
> + if(cpuinfo_get_vendor(cip) == CPUINFO_VENDOR_NSC)
> + xx = mireAppend(RPMMIRE_REGEX, 0, "geode", NULL, &mi_re, &mi_nre);
> + if(cpuinfo_has_feature(cip, CPUINFO_FEATURE_X86_CMOV))
> + xx = mireAppend(RPMMIRE_REGEX, 0, "i686", NULL, &mi_re, &mi_nre);
> + if(cpuinfo_has_feature(cip, CPUINFO_FEATURE_X86_MMX))
> + xx = mireAppend(RPMMIRE_REGEX, 0, "pentium2", NULL, &mi_re,
> &mi_nre);
> + if(cpuinfo_get_vendor(cip) == CPUINFO_VENDOR_AMD &&
> cpuinfo_get_vendor(cip) == CPUINFO_FEATURE_X86_3DNOW_PLUS)
> + xx = mireAppend(RPMMIRE_REGEX, 0, "athlon", NULL, &mi_re, &mi_nre);
> + if(cpuinfo_has_feature(cip, CPUINFO_FEATURE_X86_SSE))
> + xx = mireAppend(RPMMIRE_REGEX, 0, "pentium3", NULL, &mi_re,
> &mi_nre);
> + if(cpuinfo_has_feature(cip, CPUINFO_FEATURE_X86_SSE2))
> + xx = mireAppend(RPMMIRE_REGEX, 0, "pentium4", NULL, &mi_re,
> &mi_nre);
> + if(cpuinfo_has_feature(cip, CPUINFO_FEATURE_64BIT) &&
> strcmp(un.machine, "x86_64") == 0)
> + xx = mireAppend(RPMMIRE_REGEX, 0, "x86_64", NULL, &mi_re, &mi_nre);
> +#endif
> +
> +#if defined(__powerpc__)
> + if(cpuinfo_has_feature(cip, CPUINFO_FEATURE_PPC))
> + xx = mireAppend(RPMMIRE_REGEX, 0, "ppc", NULL, &mi_re, &mi_nre);
> + if(cpuinfo_has_feature(cip, CPUINFO_FEATURE_64BIT) &&
> strcmp(un.machine, "ppc64") == 0)
> + xx = mireAppend(RPMMIRE_REGEX, 0, "ppc64", NULL, &mi_re,
> &mi_nre);
> +#endif
> +
> +#if defined(__ia64__)
> + if(cpuinfo_has_feature(cip, CPUINFO_FEATURE_IA64))
> + xx = mireAppend(RPMMIRE_REGEX, 0, "ia64", NULL, &mi_re, &mi_nre);
> +#endif
> +
> +#if defined(__mips__)
> +#if defined(__MIPSEL__)
> +#define mips32 "mipsel"
> +#define mips64 "mips64el"
> +#elif define(__MIPSEB__)
> +#define mips32 "mips"
> +#define mips64 "mips64"
> +#endif
> + if(cpuinfo_has_feature(cip, CPUINFO_FEATURE_MIPS)) {
> + xx = mireAppend(RPMMIRE_REGEX, 0, mips32, NULL, &mi_re, &mi_nre);
> + if(cpuinfo_has_feature(cip, CPUINFO_FEATURE_64BIT) &&
> strcmp(un.machine, "mips64") == 0)
> + xx = mireAppend(RPMMIRE_REGEX, 0, mips64, NULL, &mi_re,
> &mi_nre);
> +#endif
> +
> + cpuinfo_destroy(cip);
> +
> + cpu = mi_re[mi_nre-1].pattern;
> + if(cpu != NULL)
> + {
> + if (!parseCVOG(cpu, &cvog) && cvog != NULL) {
> + addMacro(NULL, "_host_cpu", NULL, cvog->cpu, -1);
> + addMacro(NULL, "_host_vendor", NULL, cvog->vendor, -1);
> + addMacro(NULL, "_host_os", NULL, cvog->os, -1);
> + }
> + rc = RPMRC_OK;
> + if (rc == RPMRC_OK) {
> + platpat = mireFreeAll(platpat, nplatpat);
> + platpat = mi_re;
> + nplatpat = mi_nre;
> + }
> +
> + }
> + return rc;
> +}
> +#endif
> +
> /*@-onlytrans@*/ /* XXX miRE array, not refcounted. */
> int rpmPlatformScore(const char * platform, void * mi_re, int
> mi_nre)
> {
> @@ -602,6 +692,8 @@
> if (cp == NULL || cp[0] == '\0')
> cp = _platform;
> if (rpmPlatform(cp) == RPMRC_OK) {
> +#elif defined(HAVE_CPUINFO_H)
> + if (rpmPlatform(_platform) == RPMRC_OK || rpmCpuinfo() ==
> RPMRC_OK) {
> #else
> if (rpmPlatform(_platform) == RPMRC_OK) {
> #endif
> @@ .
> ______________________________________________________________________
> RPM Package Manager http://rpm5.org
> CVS Sources Repository rpm-cvs@rpm5.org
["smime.p7s" (smime.p7s)]
0 *H
010 + 0 *H
00 r k 0
*H
0|10 UDE10U
TC TrustCenter GmbH1%0#UTC TrustCenter Class 1 L1 CA1(0&UTC TrustCenter \
Class 1 L1 CA VI0 081202135405Z
091203135405Z0B10 UUS10UJeff Johnson10 *H
n3npq@mac.com0"0
*H
0
Ҭ14B~:*;˄rx%I"^~22Wń9i,#O))~SC ` \
˨ŕ1i!~I5S)R&Ϥ(tuIAЈTOb߁>fN*5Q <1Rn&,f`iR!S~WUzsB \
SNg>Ox>ɐ{FMк 00+00Q+0Eh \
ttp://www.trustcenter.de/certservices/cacerts/tc_class1_L1_CA_VI.crt02+0&http \
://ocsp.VI.tcclass1.trustcenter.de0U#0NjkJɻdK&0U0 0JU \
C0A0? * ,0200+$http://www.trustcenter.de/guidelines0U0UDL荺e9=7N&d?0TUM0K0I \
G EChttp://crl.VI.tcclass1.trustcenter.de/crl/v2/tc_class1_L1_CA_VI.crl03U%,0*+++
+70U0
n3npq@mac.com0
*H
c3#5@+Nwc<~3mJ \
2݉}dsOM3/cCåt(:ӌmxH#F?&N^?6c"*-7lu`+x|W \
ʕnbgҮV4H008 bnrd0 *H
010 UDE10UHamburg10UHamburg1:08U
1TC TrustCenter for Security in Data Networks GmbH1"0 UTC TrustCenter Class 1 \
CA1)0' *H certificate@trustcenter.de0
080718113854Z
101231225959Z0|10 UDE10U
TC TrustCenter GmbH1%0#UTC TrustCenter Class 1 L1 CA1(0&UTC TrustCenter \
Class 1 L1 CA VI00 *H
0 ?N~ݤ㰾(ݙuLαlK%8H
~uH@MNCm]9Xq
K1~_݄ Vfk(ѢzaW00'
@ 00+00L+0@http://www.trustcenter.de/certservices/ \
cacerts/tc_class_1_ca.crt0/+0#http://ocsp.tcclass1.trustcenter.de0U00JU \
C0A0? * ,0200+$http://www.trustcenter.de/guidelines0U0UNjkJɻdK&0U00 \
؆;http://crl.tcclass1.trustcenter.de/crl/v2/tc_class_1_ca.crlldap://www.trustc \
enter.de/CN=TC%20TrustCenter%20Class%201%20CA,O=TC%20TrustCenter%20AG,ou=rootcerts,dc=trustcenter,dc=de?certificateRevocationList?base?0
*H
n g,<H[<KB*8ُ˰y}e-pT-):mnzq/eJ̄tZմw"D˴W\&8kT.WƎ|W[30(0 \
0 *H
0y10U
Root CA10Uhttp://www.cacert.org1"0 UCA Cert Signing \
Authority1!0 *H support@cacert.org0
070806160927Z
090805160927Z0810UCAcert WoT User10 *H
n3npq@mac.com0"0
*H
0
MǼ~arqC?j(Ѝ.=
ܐ[m47囵{ Hǰmgk=FlFَ ^ \
c9hٕ/,fOcY;ik"XFS )֟W:Z#AqW:_rIqc&ZZAKBH
oY_x(V!zd AHDJAdG*QXVr:tpM 00U0 0V `HB
IGTo get your own certificate for FREE head over to \
http://www.CAcert.org0@U%907++ +7
+7
`HB02+&0$0"+0http://ocsp.cacert.org0U0
n3npq@mac.com0
*H
BmC2G$+`?kdC
o߫'iƬ'9\q459xOS@B= \
49ێ0أZ-n! Hrλy)gPmcFkrzGr1d3)g"LZ\bkR&h@[%|%@ht'?Нc]y4J
m
!ϵ[4QB}bK_gD, ?
wG:U\XC\! }i)7%7ufmW]-x|̭QćHxNF%3z3rR>~c͛y2GL<n#K/
(_Q7nfrCej T \
q$,76ICm@C@)H4{\ZX̢T@niQjcN'.i. +(a
=F(>O1B0>00|10 UDE10U
TC TrustCenter GmbH1%0#UTC TrustCenter Class 1 L1 CA1(0&UTC TrustCenter \
Class 1 L1 CA VI r k 0 + 0 *H 1 *H
0 *H
1
090215125134Z0# *H
1((:#S[˖50 +7100y10U
Root CA10Uhttp://www.cacert.org1"0 UCA Cert Signing \
Authority1!0 *H support@cacert.org0*H
1 0y10U
Root CA10Uhttp://www.cacert.org1"0 UCA Cert Signing \
Authority1!0 *H support@cacert.org0
*H
; R-j D ~LT[z?6gaz5I+Oս0Vy!F \
7a%:"yݗVm/(\'oz۩c/ \
/ZGS CmjNovi2ur {WHao4n \
Tm.nR-QoĤku m@dϘ?!ej^z.I6 3$C \
Wy
______________________________________________________________________
RPM Package Manager http://rpm5.org
Developer Communication List rpm-devel@rpm5.org
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic