diff options
author | Isaac Yu <isaacyu1@isaacyu1.com> | 2023-02-02 19:05:33 +0000 |
---|---|---|
committer | Willy Sudiarto Raharjo <willysr@slackbuilds.org> | 2023-02-04 07:19:54 +0700 |
commit | 6520c03e4edf023cec505a521d4a18767fe55362 (patch) | |
tree | f0312eedecb5183fc979f2da6340d4af3b7f4c22 /python | |
parent | 8d2052232d7d6a24c59bd20ffb9d8b0d8f4851e0 (diff) |
python/python3-pywayland: Added (py bindings for libwayland library)
Signed-off-by: bedlam <dave@slackbuilds.org>
Signed-off-by: Willy Sudiarto Raharjo <willysr@slackbuilds.org>
Diffstat (limited to 'python')
-rw-r--r-- | python/python3-pywayland/CVE_2007_4559.patch | 38 | ||||
-rw-r--r-- | python/python3-pywayland/README | 7 | ||||
-rw-r--r-- | python/python3-pywayland/python3-pywayland.SlackBuild | 98 | ||||
-rw-r--r-- | python/python3-pywayland/python3-pywayland.info | 10 | ||||
-rw-r--r-- | python/python3-pywayland/slack-desc | 19 |
5 files changed, 172 insertions, 0 deletions
diff --git a/python/python3-pywayland/CVE_2007_4559.patch b/python/python3-pywayland/CVE_2007_4559.patch new file mode 100644 index 000000000000..437747cecbcb --- /dev/null +++ b/python/python3-pywayland/CVE_2007_4559.patch @@ -0,0 +1,38 @@ +This patch was taken from upstream pywayland 0.4.15: +https://github.com/flacjacket/pywayland/pull/42 +--- a/doc/protocol_build.py 2022-07-24 11:03:10.000000000 -0700 ++++ b/doc/protocol_build.py 2022-12-20 20:00:48.659884422 -0800 +@@ -14,6 +14,24 @@ + ) + ) + ++def _is_within_directory(directory, target): ++ """Helper to check for CVE-2007-4559""" ++ abs_directory = os.path.abspath(directory) ++ abs_target = os.path.abspath(target) ++ ++ prefix = os.path.commonprefix([abs_directory, abs_target]) ++ ++ return prefix == abs_directory ++ ++ ++def _safe_extractall(tar, path=".", members=None, *, numeric_owner=False): ++ """Helper to check for CVE-2007-4559""" ++ for member in tar.getmembers(): ++ member_path = os.path.join(path, member.name) ++ if not is_within_directory(path, member_path): ++ raise Exception("Attempted Path Traversal in Tar File") ++ ++ tar.extractall(path, members, numeric_owner=numeric_owner) + + def protocols_build(output_dir): + from pywayland.scanner import Protocol +@@ -26,7 +44,7 @@ + protocol_dest = "wayland-protocols-{}".format(protocols_version) + urllib.request.urlretrieve(protocols_source, protocol_dest + ".tar.xz") + with tarfile.open(protocol_dest + ".tar.xz") as f: +- f.extractall() ++ _safe_extractall(f) + + # walk the directory and generate all the protocols + protocol_files = [wayland_file] + sorted( diff --git a/python/python3-pywayland/README b/python/python3-pywayland/README new file mode 100644 index 000000000000..e5c71ccdff63 --- /dev/null +++ b/python/python3-pywayland/README @@ -0,0 +1,7 @@ +PyWayland provides a wrapper to the libwayland library using the CFFI +library to provide access to the Wayland library calls and written in +pure Python. + +python3-pywayland 0.4.14 is the last possible version for Slackware +15.0. Newer versions of python3-pywayland require a newer +python-setuptools. diff --git a/python/python3-pywayland/python3-pywayland.SlackBuild b/python/python3-pywayland/python3-pywayland.SlackBuild new file mode 100644 index 000000000000..5899aeecc5ba --- /dev/null +++ b/python/python3-pywayland/python3-pywayland.SlackBuild @@ -0,0 +1,98 @@ +#!/bin/bash + +# Slackware build script for python3-pywayland + +# Copyright 2023 Isaac Yu <isaacyu1@isaacyu1.com> +# All rights reserved. +# +# Redistribution and use of this script, with or without modification, is +# permitted provided that the following conditions are met: +# +# 1. Redistributions of this script must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# +# THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR IMPLIED +# WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO +# EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; +# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, +# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF +# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +cd $(dirname $0) ; CWD=$(pwd) + +PRGNAM=python3-pywayland +VERSION=${VERSION:-0.4.14} +BUILD=${BUILD:-1} +TAG=${TAG:-_SBo} +PKGTYPE=${PKGTYPE:-tgz} + +SRCNAM=pywayland + +if [ -z "$ARCH" ]; then + case "$( uname -m )" in + i?86) ARCH=i586 ;; + arm*) ARCH=arm ;; + *) ARCH=$( uname -m ) ;; + esac +fi + +if [ ! -z "${PRINT_PACKAGE_NAME}" ]; then + echo "$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE" + exit 0 +fi + +TMP=${TMP:-/tmp/SBo} +PKG=$TMP/package-$PRGNAM +OUTPUT=${OUTPUT:-/tmp} + +if [ "$ARCH" = "i586" ]; then + SLKCFLAGS="-O2 -march=i586 -mtune=i686" + LIBDIRSUFFIX="" +elif [ "$ARCH" = "i686" ]; then + SLKCFLAGS="-O2 -march=i686 -mtune=i686" + LIBDIRSUFFIX="" +elif [ "$ARCH" = "x86_64" ]; then + SLKCFLAGS="-O2 -fPIC" + LIBDIRSUFFIX="64" +else + SLKCFLAGS="-O2" + LIBDIRSUFFIX="" +fi + +set -e + +rm -rf $PKG +mkdir -p $TMP $PKG $OUTPUT +cd $TMP +rm -rf $SRCNAM-$VERSION +tar xvf $CWD/$PRGNAM-$VERSION.tar.gz +cd $SRCNAM-$VERSION +chown -R root:root . +find -L . \ + \( -perm 777 -o -perm 775 -o -perm 750 -o -perm 711 -o -perm 555 \ + -o -perm 511 \) -exec chmod 755 {} \; -o \ + \( -perm 666 -o -perm 664 -o -perm 640 -o -perm 600 -o -perm 444 \ + -o -perm 440 -o -perm 400 \) -exec chmod 644 {} \; + +# Backport patch from pywayland 0.4.15 for directory traversal vulnerability +# The patch is relevant for building docs +patch -p1 < $CWD/CVE_2007_4559.patch + +python3 setup.py install --root=$PKG + +find $PKG -print0 | xargs -0 file | grep -e "executable" -e "shared object" | grep ELF \ + | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null || true + +mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION +cp -a LICENSE README.rst $PKG/usr/doc/$PRGNAM-$VERSION +cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild + +mkdir -p $PKG/install +cat $CWD/slack-desc > $PKG/install/slack-desc + +cd $PKG +/sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE diff --git a/python/python3-pywayland/python3-pywayland.info b/python/python3-pywayland/python3-pywayland.info new file mode 100644 index 000000000000..e87279afc23c --- /dev/null +++ b/python/python3-pywayland/python3-pywayland.info @@ -0,0 +1,10 @@ +PRGNAM="python3-pywayland" +VERSION="0.4.14" +HOMEPAGE="https://github.com/flacjacket/pywayland" +DOWNLOAD="https://github.com/flacjacket/pywayland/archive/v0.4.14/python3-pywayland-0.4.14.tar.gz" +MD5SUM="bd14adba219986be14f58e4ca9eaa2b5" +DOWNLOAD_x86_64="" +MD5SUM_x86_64="" +REQUIRES="" +MAINTAINER="Isaac Yu" +EMAIL="isaacyu1@isaacyu1.com" diff --git a/python/python3-pywayland/slack-desc b/python/python3-pywayland/slack-desc new file mode 100644 index 000000000000..1423a834b62a --- /dev/null +++ b/python/python3-pywayland/slack-desc @@ -0,0 +1,19 @@ +# 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------------------------------------------------------| +python3-pywayland: python3-pywayland (Python bindings for the libwayland library) +python3-pywayland: +python3-pywayland: PyWayland provides a wrapper to the libwayland library using the CFFI +python3-pywayland: library to provide access to the Wayland library calls and written in +python3-pywayland: pure Python. +python3-pywayland: +python3-pywayland: +python3-pywayland: +python3-pywayland: +python3-pywayland: +python3-pywayland: |