aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNatanael Copa <ncopa@alpinelinux.org>2021-05-06 17:50:38 +0200
committerNatanael Copa <ncopa@alpinelinux.org>2021-05-06 17:50:38 +0200
commit3e6e8ebf9d30ce3152e4030d0cfc3fe4c34c31a1 (patch)
tree5240b019370ae25f1681e3a1e34008c291e80110
parentd240204c334b85f8287dc5ad70118901d2581cde (diff)
downloadaports-3e6e8ebf9d30ce3152e4030d0cfc3fe4c34c31a1.tar.gz
aports-3e6e8ebf9d30ce3152e4030d0cfc3fe4c34c31a1.tar.bz2
aports-3e6e8ebf9d30ce3152e4030d0cfc3fe4c34c31a1.tar.xz
main/abuild: backport support for pyX.Y proviers
-rw-r--r--main/abuild/0001-feat-abuild-add-support-for-pyX.Y-providers.patch104
-rw-r--r--main/abuild/APKBUILD4
2 files changed, 107 insertions, 1 deletions
diff --git a/main/abuild/0001-feat-abuild-add-support-for-pyX.Y-providers.patch b/main/abuild/0001-feat-abuild-add-support-for-pyX.Y-providers.patch
new file mode 100644
index 0000000000..b41cc5b314
--- /dev/null
+++ b/main/abuild/0001-feat-abuild-add-support-for-pyX.Y-providers.patch
@@ -0,0 +1,104 @@
+From ac3ee42458ebb6204c75135cbeb30201777e4116 Mon Sep 17 00:00:00 2001
+From: Leo <thinkabit.ukim@gmail.com>
+Date: Thu, 8 Aug 2019 19:01:39 -0300
+Subject: [PATCH 1/2] feat(abuild): add support for pyX.Y providers
+
+Now all python packages that install python modules under
+/usr/lib/pythonX.Y/site-packages will have a provider that indicates
+their MAJOR (X) and MINOR (Y) versions.
+
+pyX maps to the MAJOR version of the package, its objective is to allow
+users to quickly install a python module without having to search around
+for the correct package, doing `apk add py3.9:foo` will install whatever
+packages provides the foo module.
+
+The directories checked only go one level deep, so
+'/usr/lib/python3.9/site-packages/date' will generate
+py3:date=$pkgver-r$pkgrel.
+
+files ending with .py also count and are added with their .py prefix
+stripped away. so '/usr/lib/python3.9/site-packages/six.py' will
+generate py3:six=$pkgver-r$pkgrel.
+
+The reason for doing this is the same as creating pc:, so: and cmd:, it
+is more reliable and robust to depened on what we known of what the package
+provides than to try to guess via the pkgname.
+
+Co-authored-by: Chloe Kudryavtsev <toast@toast.cafe>
+---
+ abuild.in | 45 +++++++++++++++++++++++++++++++++++++++++++++
+ 1 file changed, 45 insertions(+)
+
+diff --git a/abuild.in b/abuild.in
+index 303834c..aad4223 100644
+--- a/abuild.in
++++ b/abuild.in
+@@ -1225,6 +1225,46 @@ prepare_command_provides() {
+ done
+ }
+
++prepare_py_provides() {
++ local dir="${subpkgdir:-$pkgdir}" py_providers=""
++ options_has "!tracedeps" && return 0
++ cd "$dir" || return 1
++
++ # Find all directories under site-packages, ignore __pycache__ and
++ # .egg-info packages, store the basename with the proper pyX.Y prefix
++ # one per-line
++ py_providers="$(find 'usr/lib/python'*/site-packages \
++ -print0 -mindepth 1 -maxdepth 1 \
++ -type f -iname '*.py' -o -type d \
++ 2>/dev/null | xargs -0 -I '{}' sh -c '
++ d="{}"
++
++ # Check if we were given a directory then check if there
++ # is a file called __init__.py inside, this is required
++ # to import modules, if there is no __init__.py then the
++ # installed directory is not actually a module, this is a
++ # special case for packages that use c-extensions and
++ # install their .c and .h files to $sitelib.
++ if [ -d "$d" ] && [ ! -f "$d"/__init__.py ]; then
++ exit 0
++ fi
++
++ # Find out which version of python we are building for
++ # this will find out by looking at the MAJOR and MINOR
++ # versions in /usr/lib/pythonMAJOR.MINOR
++ pyver="${d##*usr/lib/python}"
++ pyver="${pyver%%/*}"
++
++ # Strip the .py prefix if it exists
++ d="${d%%.py*}"
++
++ echo "py$pyver:${d##*/}"
++ ')"
++ local i; for i in $py_providers; do
++ echo "$i=$pkgver-r$pkgrel" >> "$controldir"/.provides-py
++ done
++}
++
+ # check if dir has arch specific binaries
+ dir_has_arch_binaries() {
+ local dir="$1"
+@@ -1294,6 +1334,7 @@ prepare_package() {
+ && prepare_symlinks \
+ && prepare_pkgconfig_provides \
+ && prepare_command_provides \
++ && prepare_py_provides \
+ || return 1
+ archcheck
+ }
+@@ -1447,6 +1488,10 @@ trace_apk_deps() {
+ sed 's/^/provides = cmd:/' "$dir"/.provides-command | sort -u \
+ >> "$dir"/.PKGINFO
+ fi
++ if [ -f "$dir"/.provides-py ]; then
++ sed 's/^/provides = /' "$dir"/.provides-py | sort -u \
++ >> "$dir"/.PKGINFO
++ fi
+ [ -z "$autodeps" ] && return 0
+ for i in $autodeps; do
+ echo "depend = $i"
+--
+2.31.1
+
diff --git a/main/abuild/APKBUILD b/main/abuild/APKBUILD
index 6c88acb220..3252e9ce19 100644
--- a/main/abuild/APKBUILD
+++ b/main/abuild/APKBUILD
@@ -2,7 +2,7 @@
pkgname=abuild
pkgver=3.8.0_rc2
_ver=${pkgver%_git*}
-pkgrel=0
+pkgrel=1
pkgdesc="Script to build Alpine Packages"
url="https://git.alpinelinux.org/cgit/abuild/"
arch="all"
@@ -27,6 +27,7 @@ subpackages="
options="suid"
pkggroups="abuild"
source="https://git.alpinelinux.org/abuild/snapshot/abuild-$pkgver.tar.xz
+ 0001-feat-abuild-add-support-for-pyX.Y-providers.patch
"
builddir="$srcdir"/abuild-$pkgver
@@ -85,4 +86,5 @@ _rootbld() {
sha512sums="
8e272666403ffb11a6d565e271754fa7b7ce90f5e746c8f5bd80694ece6786a12d27372d25880fe07e03bef18b3690e89e7a5a761766599a575c8db07e365b65 abuild-3.8.0_rc2.tar.xz
+3cb6d4f5ad4f68924115562a20c9ea5cc728f1378a5c884a923b4dcb8260d0b9126c47f69d6b3588abba7cfdb3c45b857d757d4f82437d94ab022be4ed1b0c06 0001-feat-abuild-add-support-for-pyX.Y-providers.patch
"