[Git][reproducible-builds/reprotest][master] Update escape sequences for compatibility with python3.12.
Vagrant Cascadian (@vagrant)
gitlab at salsa.debian.org
Fri Apr 12 20:17:44 UTC 2024
Vagrant Cascadian pushed to branch master at Reproducible Builds / reprotest
Commits:
cf657354 by Vagrant Cascadian at 2024-04-12T13:11:25-07:00
Update escape sequences for compatibility with python3.12.
(Closes: #1068853)
These particular escapes were previously listed as DeprecationWarning,
but in Python 3.12 were changed to a SyntaxWarming:
https://discuss.python.org/t/collaboration-on-handling-python-3-12-incompatible-changes-distutils-and-asyncore-removal-invalid-escape-escape-etc/20721
Used the recommended pycodestyle command to find the specific issues:
pycodestyle --show-source --select W605 $(find -name "*.py")
Wow, this is getting ugly!
- - - - -
4 changed files:
- reprotest/__init__.py
- reprotest/build.py
- reprotest/environ.py
- reprotest/lib/adt_testbed.py
Changes:
=====================================
reprotest/__init__.py
=====================================
@@ -357,7 +357,7 @@ class TestArgs(collections.namedtuple('_Test',
print("Reproduction successful")
print("=======================")
print("No differences in %s" % self.artifact_pattern, flush=True)
- run_or_tee(['sh', '-ec', 'find %s -type f -exec sha256sum "{}" \;' % self.artifact_pattern],
+ run_or_tee(['sh', '-ec', 'find %s -type f -exec sha256sum "{}" \\;' % self.artifact_pattern],
'SHA256SUMS', self.result_dir,
cwd=os.path.join(dist_control, VSRC_DIR))
=====================================
reprotest/build.py
=====================================
@@ -312,7 +312,7 @@ def kernel(ctx, build, vary):
#
# 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('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 \
@@ -321,7 +321,7 @@ def kernel(ctx, build, vary):
parisc ppc32le ppc32 ppcle ppc s390 \
sparc32bash sparc32 sparc; \
do \
- DROP_ARCH="$DROP_ARCH -e ^$_ARCH_TO_DROP\$"; \
+ DROP_ARCH="$DROP_ARCH -e ^$_ARCH_TO_DROP\\$"; \
done; \
fi')
_ = _.append_setup_exec_raw('SETARCH_ARCH=$(echo "$SETARCH_ARCH" | grep $DROP_ARCH | shuf -n1)')
=====================================
reprotest/environ.py
=====================================
@@ -7,11 +7,11 @@ import os
xe_small = {
- "path": "(/\w{1,12}){1,4}",
- "port": "([1-9]\d{0,3}|[1-5]\d{4})",
- "domain": "\w{1,10}(\.\w{1,10}){0,3}",
- "password": "\w{1,40}",
- "username": "\w{2,20}",
+ "path": "(/\\w{1,12}){1,4}",
+ "port": "([1-9]\\d{0,3}|[1-5]\\d{4})",
+ "domain": "\\w{1,10}(\\.\\w{1,10}){0,3}",
+ "password": "\\w{1,40}",
+ "username": "\\w{2,20}",
}
xe_medium = dict(**{
@@ -110,7 +110,7 @@ def generate_dummy_environ(env=None, blacklist=BLACKLIST, whitelist=WHITELIST, n
and not matches(n, whitelist_names)))
extra_unknown = ["[A-Z]{2,5}(_[A-Z]{2,5}){1,3}",
"[A-Z]{2,5}(_[A-Z]{2,5}){1,3}",
- "REPROTEST_CAPTURE_ENVIRONMENT_UNKNOWN_\w+"]
+ "REPROTEST_CAPTURE_ENVIRONMENT_UNKNOWN_\\w+"]
# unset unrecognized stuff in the current env that doesn't match the
# whitelist or blacklist, which we set earlier
=====================================
reprotest/lib/adt_testbed.py
=====================================
@@ -302,7 +302,7 @@ class Testbed:
# create apt sources for --apt-pocket
for pocket in self.add_apt_pockets:
pocket = pocket.split('=', 1)[0] # strip off package list
- script = '''sed -rn 's/^(deb|deb-src) +(\[.*\] *)?([^ ]*(ubuntu.com|debian.org|ftpmaster|file:\/\/\/tmp\/testarchive)[^ ]*) +([^ -]+) +(.*)$/\\1 \\2\\3 \\5-%s \\6/p' /etc/apt/sources.list `ls /etc/apt/sources.list.d/*.list 2>/dev/null|| true` > /etc/apt/sources.list.d/%s.list; for retry in 1 2 3; do apt-get --no-list-cleanup -o Dir::Etc::sourcelist=/etc/apt/sources.list.d/%s.list -o Dir::Etc::sourceparts=/dev/null update 2>&1 && break || sleep 15; done''' % (pocket, pocket, pocket)
+ script = '''sed -rn 's/^(deb|deb-src) +(\\[.*\\] *)?([^ ]*(ubuntu.com|debian.org|ftpmaster|file:\\/\\/\\/tmp\\/testarchive)[^ ]*) +([^ -]+) +(.*)$/\\1 \\2\\3 \\5-%s \\6/p' /etc/apt/sources.list `ls /etc/apt/sources.list.d/*.list 2>/dev/null|| true` > /etc/apt/sources.list.d/%s.list; for retry in 1 2 3; do apt-get --no-list-cleanup -o Dir::Etc::sourcelist=/etc/apt/sources.list.d/%s.list -o Dir::Etc::sourceparts=/dev/null update 2>&1 && break || sleep 15; done''' % (pocket, pocket, pocket)
self.check_exec(['sh', '-ec', script])
# create apt pinning for --apt-pocket with package list
@@ -317,7 +317,7 @@ class Testbed:
# record the mtimes of dirs affecting the boot
boot_dirs = '/boot /etc/init /etc/init.d /etc/systemd/system /lib/systemd/system'
self.check_exec(['bash', '-ec',
- 'for d in %s; do [ ! -d $d ] || touch -r $d %s/${d//\//_}.stamp; done' % (
+ 'for d in %s; do [ ! -d $d ] || touch -r $d %s/${d//\\//_}.stamp; done' % (
boot_dirs, self.scratch)])
xenv = ['AUTOPKGTEST_IS_SETUP_COMMAND=1']
@@ -339,7 +339,7 @@ class Testbed:
if self.setup_commands and 'reboot' in self.caps:
boot_affected = self.execute(
['bash', '-ec', '[ ! -e /run/autopkgtest_no_reboot.stamp ] || exit 0;'
- 'for d in %s; do s=%s/${d//\//_}.stamp;'
+ 'for d in %s; do s=%s/${d//\\//_}.stamp;'
' [ ! -d $d ] || [ `stat -c %%Y $d` = `stat -c %%Y $s` ]; done' % (
boot_dirs, self.scratch)])[0]
if boot_affected:
@@ -732,7 +732,7 @@ echo PATH=$d/sbin:$d/bin:$d/usr/sbin:$d/usr/bin:$d/usr/games:$PATH
# shared libraries / Qt plugins
l=""
q=""
-for candidate in $(find $d -type d \( -name 'lib' -o -path '*/lib/*-linux-*' \)); do
+for candidate in $(find $d -type d \\( -name 'lib' -o -path '*/lib/*-linux-*' \\)); do
[ -z "$(ls $candidate/*.so $candidate/*.so.* 2>/dev/null)" ] || l="$candidate:$l"
[ -z "$(ls $candidate/lib*qt*.so* 2>/dev/null)" ] || q="$candidate:$q"
done
@@ -1208,7 +1208,7 @@ fi
# get release name
script = 'SRCS=$(ls /etc/apt/sources.list /etc/apt/sources.list.d/*.list 2>/dev/null|| true); '
- script += '''REL=$(sed -rn '/^(deb|deb-src) .*(ubuntu.com|debian.org|ftpmaster|file:\/\/\/tmp\/testarchive)/ { s/^[^ ]+ +(\[.*\] *)?[^ ]* +([^ -]+) +.*$/\\2/p}' $SRCS | head -n1); '''
+ script += '''REL=$(sed -rn '/^(deb|deb-src) .*(ubuntu.com|debian.org|ftpmaster|file:\\/\\/\\/tmp\\/testarchive)/ { s/^[^ ]+ +(\\[.*\\] *)?[^ ]* +([^ -]+) +.*$/\\2/p}' $SRCS | head -n1); '''
script += 'mkdir -p /etc/apt/preferences.d; '
script += 'PKGS="%s"; ' % ' '.join(binpkgs)
View it on GitLab: https://salsa.debian.org/reproducible-builds/reprotest/-/commit/cf6573549827960b551df97f10d5f9cb52cc2d67
--
View it on GitLab: https://salsa.debian.org/reproducible-builds/reprotest/-/commit/cf6573549827960b551df97f10d5f9cb52cc2d67
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/20240412/eee550c1/attachment.htm>
More information about the rb-commits
mailing list