[Git][reproducible-builds/reprotest][master] 2 commits: Implement realistic CPU architecture shuffling
Holger Levsen (@holger)
gitlab at salsa.debian.org
Wed Oct 13 07:07:59 UTC 2021
Holger Levsen pushed to branch master at Reproducible Builds / reprotest
Commits:
15e3c653 by Vasyl Gello at 2021-10-13T06:24:52+00:00
Implement realistic CPU architecture shuffling
64-bit applications can not run on 32-bit CPU, so filter
out 32-bit architectures from 'setarch --list' output
if reprotest is interpreted using 64-bit Python.
Signed-off-by: Vasyl Gello <vasek.gello at gmail.com>
- - - - -
8c8c32d3 by Holger Levsen at 2021-10-13T09:07:35+02:00
Merge branch 'mr-origin-16'
- - - - -
1 changed file:
- reprotest/build.py
Changes:
=====================================
reprotest/build.py
=====================================
@@ -9,6 +9,7 @@ import logging
import os
import shlex
import shutil
+import struct
import random
import time
import types
@@ -296,7 +297,27 @@ def kernel(ctx, build, vary):
if not vary:
_ = _.append_setup_exec_raw('SETARCH_ARCH=$(uname -m)')
else:
- _ = _.append_setup_exec_raw('SETARCH_ARCH=$(setarch --list | grep -vF "$(uname -m)" | shuf | head -n1)')
+ _ = _.append_setup_exec_raw('SETARCH_ARCH=$(setarch --list)')
+ # Perform realistic shuffling of architectures depending
+ # on the bitness of application.
+ # 64-bit binaries can NOT be executed on 32-bit CPU,
+ # so filter out setarch's PER_LINUX32 architectures:
+ #
+ # echo $(grep -ioe "{PER_LINUX.*,.*$" /tmp/setarch.c |
+ # grep -v machine | grep PER_LINUX32 | awk '{print $2}' | sort -Vu) | sed 's/,//g;s/"//g'
+ _ = _.append_setup_exec_raw('DROP_ARCH="-v -e ^$(uname -m)\$"')
+ _ = _.append_setup_exec_raw('WORDSIZE={}'.format(struct.calcsize("P")*8))
+ _ = _.append_setup_exec_raw('if [ $WORDSIZE -eq 64 ]; then \
+ for _ARCH_TO_DROP in armh armv7b armv7l \
+ armv8b armv8l arm athlon i386 i486 \
+ i586 i686 linux32 mips32 mips parisc32 \
+ parisc ppc32le ppc32 ppcle ppc s390 \
+ sparc32bash sparc32 sparc; \
+ do \
+ DROP_ARCH="$DROP_ARCH -e ^$_ARCH_TO_DROP\$"; \
+ done; \
+fi')
+ _ = _.append_setup_exec_raw('SETARCH_ARCH=$(echo "$SETARCH_ARCH" | grep $DROP_ARCH | shuf | head -n1)')
_ = _.append_setup_exec_raw('KERNEL_VERSION=$(uname -r)')
_ = _.append_setup_exec_raw('if [ ${KERNEL_VERSION#2.6} = $KERNEL_VERSION ]; then SETARCH_OPTS=--uname-2.6; fi')
if ctx.verbosity >= 1:
View it on GitLab: https://salsa.debian.org/reproducible-builds/reprotest/-/compare/880588d4cec24d8f2713bfa369743a991f13dd47...8c8c32d350c3371a5dcdaf701cdb990cd6141602
--
View it on GitLab: https://salsa.debian.org/reproducible-builds/reprotest/-/compare/880588d4cec24d8f2713bfa369743a991f13dd47...8c8c32d350c3371a5dcdaf701cdb990cd6141602
You're receiving this email because of your account on salsa.debian.org.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.reproducible-builds.org/pipermail/rb-commits/attachments/20211013/e76927ac/attachment.htm>
More information about the rb-commits
mailing list