Send patches - preferably formatted by git format-patch - to patches at archlinux32 dot org.
summaryrefslogtreecommitdiff
path: root/build-support/pacman-static/replace-i686-by-pentium4-when-architecture-is-auto.patch
diff options
context:
space:
mode:
Diffstat (limited to 'build-support/pacman-static/replace-i686-by-pentium4-when-architecture-is-auto.patch')
-rw-r--r--build-support/pacman-static/replace-i686-by-pentium4-when-architecture-is-auto.patch104
1 files changed, 104 insertions, 0 deletions
diff --git a/build-support/pacman-static/replace-i686-by-pentium4-when-architecture-is-auto.patch b/build-support/pacman-static/replace-i686-by-pentium4-when-architecture-is-auto.patch
new file mode 100644
index 00000000..5ad0592e
--- /dev/null
+++ b/build-support/pacman-static/replace-i686-by-pentium4-when-architecture-is-auto.patch
@@ -0,0 +1,104 @@
+diff --git a/src/pacman/conf.c b/src/pacman/conf.c
+index 0f0c2cfb..23744328 100644
+--- a/src/pacman/conf.c
++++ b/src/pacman/conf.c
+@@ -18,6 +18,7 @@
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
++#include <cpuid.h>
+ #include <errno.h>
+ #include <limits.h>
+ #include <locale.h> /* setlocale */
+@@ -401,6 +402,12 @@ int config_add_architecture(char *arch)
+ char *newarch;
+ uname(&un);
+ newarch = strdup(un.machine);
++ if(strcmp(newarch, "i686") == 0) {
++ unsigned int eax, ebx, ecx, edx;
++ __get_cpuid(1, &eax, &ebx, &ecx, &edx);
++ if (edx & bit_SSE2)
++ newarch = strdup("pentium4");
++ }
+ free(arch);
+ arch = newarch;
+ }
+diff --git a/src/pacman/pacman.c b/src/pacman/pacman.c
+index 7e810127..b5bd2a37 100644
+--- a/src/pacman/pacman.c
++++ b/src/pacman/pacman.c
+@@ -26,6 +26,7 @@
+
+ #include <stdlib.h> /* atoi */
+ #include <stdio.h>
++#include <cpuid.h>
+ #include <ctype.h> /* isspace */
+ #include <limits.h>
+ #include <getopt.h>
+@@ -274,8 +275,19 @@ static void setuseragent(void)
+ int len;
+
+ uname(&un);
++ char machine[9];
++ strncpy(machine, un.machine, sizeof machine);
++ machine[sizeof machine-1] = '\0';
++ if(strcmp(machine, "i686") == 0) {
++ int eax, ebx, ecx, edx;
++ __get_cpuid(1, &eax, &ebx, &ecx, &edx);
++ if (edx & bit_SSE2) {
++ strncpy(machine, "pentium4", sizeof machine);
++ machine[sizeof machine-1] = '\0';
++ }
++ }
+ len = snprintf(agent, 100, "pacman/%s (%s %s) libalpm/%s",
+- PACKAGE_VERSION, un.sysname, un.machine, alpm_version());
++ PACKAGE_VERSION, un.sysname, machine, alpm_version());
+ if(len >= 100) {
+ pm_printf(ALPM_LOG_WARNING, _("HTTP_USER_AGENT truncated\n"));
+ }
+diff --git a/test/pacman/tests/upgrade082.py b/test/pacman/tests/upgrade082.py
+index 0bdbdf71..8c30ec32 100644
+--- a/test/pacman/tests/upgrade082.py
++++ b/test/pacman/tests/upgrade082.py
+@@ -3,6 +3,18 @@
+ import os
+ machine = os.uname()[4]
+
++if machine == 'i686':
++ import re
++ fo = open('/proc/cpuinfo')
++ for line in fo:
++ name_value = [s.strip() for s in line.split(':', 1)]
++ if len(name_value) != 2:
++ continue
++ name, value = name_value
++ if name == "flags":
++ if re.match(r'.*?\bsse2\b', value) is not None:
++ machine = 'pentium4'
++
+ p = pmpkg("dummy")
+ p.files = ["bin/dummy",
+ "usr/man/man1/dummy.1"]
+diff --git a/test/pacman/tests/upgrade083.py b/test/pacman/tests/upgrade083.py
+index 097ae02c..7195e35b 100644
+--- a/test/pacman/tests/upgrade083.py
++++ b/test/pacman/tests/upgrade083.py
+@@ -3,6 +3,18 @@
+ import os
+ machine = os.uname()[4]
+
++if machine == 'i686':
++ import re
++ fo = open('/proc/cpuinfo')
++ for line in fo:
++ name_value = [s.strip() for s in line.split(':', 1)]
++ if len(name_value) != 2:
++ continue
++ name, value = name_value
++ if name == "flags":
++ if re.match(r'.*?\bsse2\b', value) is not None:
++ machine = 'pentium4'
++
+ p = pmpkg("dummy")
+ p.files = ["bin/dummy",
+ "usr/man/man1/dummy.1"]