From ae0aa3daff9bd2ba5daeaf7673b37504b31b69f3 Mon Sep 17 00:00:00 2001 From: Derrick Date: Fri, 23 Oct 2020 14:19:24 -0500 Subject: [PATCH] Upgraded python2 to 2.7.18 --- build-scripts/Python-2.7.16.build | 22 ------- build-scripts/python2.build | 58 +++++++++++++++++++ .../Python-2.7.16-void-fix-i686-rlock.patch | 55 ------------------ .../musl-find_library.patch} | 5 +- patches/python2-alpine/unchecked-ioctl.patch | 11 ++++ 5 files changed, 72 insertions(+), 79 deletions(-) delete mode 100644 build-scripts/Python-2.7.16.build create mode 100644 build-scripts/python2.build delete mode 100644 patches/Python-2.7.16-void-fix-i686-rlock.patch rename patches/{Python-2.7.16-void-musl-find_library.patch => python2-alpine/musl-find_library.patch} (87%) create mode 100644 patches/python2-alpine/unchecked-ioctl.patch diff --git a/build-scripts/Python-2.7.16.build b/build-scripts/Python-2.7.16.build deleted file mode 100644 index d4cdb02..0000000 --- a/build-scripts/Python-2.7.16.build +++ /dev/null @@ -1,22 +0,0 @@ -#! /bin/bash - -# Python 2.7.16 -# Source: https://www.python.org/ftp/python/2.7.16/Python-2.7.16.tar.xz - -patch -Np0 -i ../patches/Python-2.7.16-void-fix-i686-rlock.patch && -patch -Np0 -i ../patches/Python-2.7.16-void-musl-find_library.patch && - -rm -vr Modules/expat -rm -vr Modules/_ctypes/libffi* -rm -vr Modules/zlib -sed -i '/SQLITE_OMIT_LOAD_EXTENSION/d' setup.py -./configure --prefix=/usr \ - --enable-shared \ - --with-system-expat \ - --with-system-ffi \ - --with-ensurepip=yes \ - --enable-unicode=ucs4 \ - --enable-ipv6 --with-threads --with-computed-gotos --with-wctype-functions $BUILDTRUPLE && -read -p "Compile?" && make -j2 -read -p "Install?" && sudo -S porg -lD "make -j1 install" && \ -sudo -S chmod -v 755 /usr/lib/libpython2.7.so.1.0 diff --git a/build-scripts/python2.build b/build-scripts/python2.build new file mode 100644 index 0000000..2fc1af5 --- /dev/null +++ b/build-scripts/python2.build @@ -0,0 +1,58 @@ +#! /bin/bash + +# Python 2 +# Source: https://www.python.org/ftp/python/2.7.18/Python-2.7.18.tar.xz +# +# $BUILD = Directory to temporarily install +# $PKGS = Directory to store built packages +# +# DEPS +# Required: NONE +# Recommended: NONE +# Optional: Bluez, Valgrind, SQLite, Tk + +patch -Np1 -i ../patches/python2-alpine/musl-find_library.patch +patch -Np1 -i ../patches/python2-alpine/unchecked-ioctl.patch + +rm -r Modules/expat Modules/_ctypes/libffi* Modules/zlib && +export OPT="$CFLAGS -DTHREAD_STACK_SIZE=0x100000" && +./configure \ + --prefix=/usr \ + --enable-ipv6 \ + --enable-optimizations \ + --enable-shared \ + --enable-unicode=ucs4 \ + --with-system-expat \ + --with-system-ffi \ + --with-system-zlib \ + --with-threads $BUILDTRUPLE && +read -p "Compile?" && make -j2 && + +sudo -S make DESTDIR=$BUILD install && +unset OPT && + +cd $BUILD && sudo -S mkdir -v ${BUILD}/install && +cat > /tmp/slack-desc << "EOF" +# HOW TO EDIT THIS FILE: +# The "handy ruler" below makes it easier to edit a package description. Line +# up the first '|' above the ':' following the base package name, and the '|' +# on the right side marks the last column you can put a character in. You must +# make exactly 11 lines for the formatting to be correct. It's also +# customary to leave one space after the ':' except on otherwise blank lines. + + |-----handy-ruler------------------------------------------------------| +python2: python 2 (object-oriented interpreted programming language) +python2: +python2: Python is an interpreted, interactive, object-oriented programming +python2: language that combines remarkable power with very clear syntax. +python2: Python's basic power can be extended with your own modules written in +python2: C or C++. Python is also adaptable as an extension language for +python2: existing applications. +python2: +python2: +python2: +python2: +EOF +sudo -S mv -v /tmp/slack-desc install/ && +sudo -S makepkg -l y -c n $PKGS/python2-2.7.18-$(uname -m)-mlfs.txz && +sudo -S rm -rf ${BUILD}/* diff --git a/patches/Python-2.7.16-void-fix-i686-rlock.patch b/patches/Python-2.7.16-void-fix-i686-rlock.patch deleted file mode 100644 index 6867590..0000000 --- a/patches/Python-2.7.16-void-fix-i686-rlock.patch +++ /dev/null @@ -1,55 +0,0 @@ -It seems that avoiding to create local aliases for the self._rlock and -self._wlock methods prevents the strange errors on i686 related to -semaphore locking and unlocking. - -One example of failing builds is firefox-esr running gyp in an i686 environment. - ---- Lib/multiprocessing/queues.py 2017-09-16 19:38:35.000000000 +0200 -+++ Lib/multiprocessing/queues.py 2017-10-24 19:49:06.291351206 +0200 -@@ -369,13 +369,11 @@ - - def _make_methods(self): -- recv = self._reader.recv -- racquire, rrelease = self._rlock.acquire, self._rlock.release - def get(): -- racquire() -- try: -- return recv() -- finally: -- rrelease() -+ self._rlock.acquire() -+ try: -+ return self._reader.recv() -+ finally: -+ self._rlock.release() - self.get = get - - if self._wlock is None: -@@ -383,11 +382,9 @@ - self.put = self._writer.send - else: -- send = self._writer.send -- wacquire, wrelease = self._wlock.acquire, self._wlock.release - def put(obj): -- wacquire() -- try: -- return send(obj) -- finally: -- wrelease() -+ self._wlock.acquire() -+ try: -+ return self._writer.send(obj) -+ finally: -+ self._wlock.release() - self.put = put ---- Modules/_multiprocessing/semaphore.c 2017-09-16 19:38:35.000000000 +0200 -+++ Modules/_multiprocessing/semaphore.c 2017-10-28 10:49:56.944993401 +0200 -@@ -378,7 +378,7 @@ - } - } - #else -- int sval; -+ int sval = -1; - - /* This check is not an absolute guarantee that the semaphore - does not rise above maxvalue. */ diff --git a/patches/Python-2.7.16-void-musl-find_library.patch b/patches/python2-alpine/musl-find_library.patch similarity index 87% rename from patches/Python-2.7.16-void-musl-find_library.patch rename to patches/python2-alpine/musl-find_library.patch index ec9f3d9..7899abb 100644 --- a/patches/Python-2.7.16-void-musl-find_library.patch +++ b/patches/python2-alpine/musl-find_library.patch @@ -1,5 +1,6 @@ ---- Lib/ctypes/util.py.orig -+++ Lib/ctypes/util.py +diff -ru Python-2.7.12.orig/Lib/ctypes/util.py Python-2.7.12/Lib/ctypes/util.py +--- Python-2.7.12.orig/Lib/ctypes/util.py 2016-06-26 00:49:30.000000000 +0300 ++++ Python-2.7.12/Lib/ctypes/util.py 2016-11-03 16:05:46.954665040 +0200 @@ -204,6 +204,41 @@ def find_library(name, is64 = False): return _get_soname(_findLib_crle(name, is64) or _findLib_gcc(name)) diff --git a/patches/python2-alpine/unchecked-ioctl.patch b/patches/python2-alpine/unchecked-ioctl.patch new file mode 100644 index 0000000..4d5564c --- /dev/null +++ b/patches/python2-alpine/unchecked-ioctl.patch @@ -0,0 +1,11 @@ +--- ./Modules/fcntlmodule.c.orig ++++ ./Modules/fcntlmodule.c +@@ -118,7 +118,7 @@ + int mutate_arg = 1; + char buf[IOCTL_BUFSZ+1]; /* argument plus NUL byte */ + +- if (PyArg_ParseTuple(args, "O&Iw#|i:ioctl", ++ if (PyArg_ParseTuple(args, "O&Iw#|n:ioctl", + conv_descriptor, &fd, &code, + &str, &len, &mutate_arg)) { + char *arg;