From 60dbbd83cc5b8864add2f0480e1ce727fccde7f1 Mon Sep 17 00:00:00 2001 From: Celeste <20312-Celeste@users.gitlab.alpinelinux.org> Date: Mon, 18 Dec 2023 06:41:57 +0000 Subject: [PATCH] testing/perl-sys-syscall: adopt aport also, enable on all archs with the help of patches from Debian --- ...store-missing-changes-from-0.20.0.22.patch | 125 ++++++++++++++++++ testing/perl-sys-syscall/APKBUILD | 45 ++++--- testing/perl-sys-syscall/aarch64.patch | 72 ++++++++++ testing/perl-sys-syscall/ppc64le.patch | 31 +++++ testing/perl-sys-syscall/ppc64le_epoll.patch | 11 -- testing/perl-sys-syscall/s390x.patch | 34 +++++ 6 files changed, 286 insertions(+), 32 deletions(-) create mode 100644 testing/perl-sys-syscall/0001-restore-missing-changes-from-0.20.0.22.patch create mode 100644 testing/perl-sys-syscall/aarch64.patch create mode 100644 testing/perl-sys-syscall/ppc64le.patch delete mode 100644 testing/perl-sys-syscall/ppc64le_epoll.patch create mode 100644 testing/perl-sys-syscall/s390x.patch diff --git a/testing/perl-sys-syscall/0001-restore-missing-changes-from-0.20.0.22.patch b/testing/perl-sys-syscall/0001-restore-missing-changes-from-0.20.0.22.patch new file mode 100644 index 00000000000..3c9e4569ba3 --- /dev/null +++ b/testing/perl-sys-syscall/0001-restore-missing-changes-from-0.20.0.22.patch @@ -0,0 +1,125 @@ +Patch-Source: https://sources.debian.org/data/main/libs/libsys-syscall-perl/0.25-7/debian/patches/0001-restore-missing-changes-from-0.20.0.22.patch + +>From 5fc4d9fd90f3e894bef0f1bdad0a17beaa81f39f Mon Sep 17 00:00:00 2001 +From: Eric Wong +Date: Wed, 3 Sep 2014 01:24:07 +0000 +Subject: [PATCH] restore missing changes from 0.20..0.22 + +Somehow the 0.25 release omitted all the following changes from +the 0.20..0.22 era. This restores the relevant changes based on +the diff between the following two tarballs: + +http://search.cpan.org/CPAN/authors/id/B/BR/BRADFITZ/Sys-Syscall-0.23.tar.gz +http://search.cpan.org/CPAN/authors/id/B/BR/BRADFITZ/Sys-Syscall-0.25.tar.gz + +0.22: + - don't modify non-localized $_. whoops. (we don't want to mess + with our caller's world) + +0.21: + - add missing EPOLLRDBAND, from Paul Visscher + +0.20: + - on x86_64 detect 32-bit vs 64-bit process and use right syscall + numbers. previously worked only with 64-bit userland. +--- + CHANGES | 15 +++++++++++++++ + lib/Sys/Syscall.pm | 19 +++++++++++++++---- + 2 files changed, 30 insertions(+), 4 deletions(-) + + +Bug: https://github.com/bradfitz/sys-syscall/issues/5 +Bug-Debian: https://bugs.debian.org/760336 + +diff --git a/CHANGES b/CHANGES +index cb97972..7cf0f2f 100644 +--- a/CHANGES ++++ b/CHANGES +@@ -1,5 +1,20 @@ + 0.25: + - adds ARM support + ++0.23: ++ - test bug fix https://rt.cpan.org/Public/Bug/Display.html?id=54322 ++ ++0.22: ++ - don't modify non-localized $_. whoops. (we don't want to mess ++ with our caller's world) ++ ++0.21: ++ - add missing EPOLLRDBAND, from Paul Visscher ++ ++0.20: ++ ++ - on x86_64 detect 32-bit vs 64-bit process and use right syscall ++ numbers. previously worked only with 64-bit userland. ++ + 0.1: + - first release. epoll and sendfile only. Linux only. +diff --git a/lib/Sys/Syscall.pm b/lib/Sys/Syscall.pm +index 8d7cca2..7821ff7 100644 +--- a/lib/Sys/Syscall.pm ++++ b/lib/Sys/Syscall.pm +@@ -3,14 +3,18 @@ + package Sys::Syscall; + use strict; + use POSIX qw(ENOSYS SEEK_CUR); ++use Config; + + require Exporter; + use vars qw(@ISA @EXPORT_OK %EXPORT_TAGS $VERSION); + + $VERSION = "0.25"; + @ISA = qw(Exporter); +-@EXPORT_OK = qw(sendfile epoll_ctl epoll_create epoll_wait EPOLLIN EPOLLOUT EPOLLERR EPOLLHUP EPOLL_CTL_ADD EPOLL_CTL_DEL EPOLL_CTL_MOD); +-%EXPORT_TAGS = (epoll => [qw(epoll_ctl epoll_create epoll_wait EPOLLIN EPOLLOUT EPOLLERR EPOLLHUP ++@EXPORT_OK = qw(sendfile epoll_ctl epoll_create epoll_wait ++ EPOLLIN EPOLLOUT EPOLLERR EPOLLHUP EPOLLRDBAND ++ EPOLL_CTL_ADD EPOLL_CTL_DEL EPOLL_CTL_MOD); ++%EXPORT_TAGS = (epoll => [qw(epoll_ctl epoll_create epoll_wait ++ EPOLLIN EPOLLOUT EPOLLERR EPOLLHUP EPOLLRDBAND + EPOLL_CTL_ADD EPOLL_CTL_DEL EPOLL_CTL_MOD)], + sendfile => [qw(sendfile)], + ); +@@ -19,6 +23,7 @@ use constant EPOLLIN => 1; + use constant EPOLLOUT => 4; + use constant EPOLLERR => 8; + use constant EPOLLHUP => 16; ++use constant EPOLLRDBAND => 128; + use constant EPOLL_CTL_ADD => 1; + use constant EPOLL_CTL_DEL => 2; + use constant EPOLL_CTL_MOD => 3; +@@ -53,6 +58,12 @@ if ($^O eq "linux") { + # boundaries. + my $u64_mod_8 = 0; + ++ # if we're running on an x86_64 kernel, but a 32-bit process, ++ # we need to use the i386 syscall numbers. ++ if ($machine eq "x86_64" && $Config{ptrsize} == 4) { ++ $machine = "i386"; ++ } ++ + if ($machine =~ m/^i[3456]86$/) { + $SYS_epoll_create = 254; + $SYS_epoll_ctl = 255; +@@ -222,7 +233,7 @@ sub epoll_wait_mod4 { + $epoll_wait_events = "\0" x 12 x $epoll_wait_size; + } + my $ct = syscall($SYS_epoll_wait, $_[0]+0, $epoll_wait_events, $_[1]+0, $_[2]+0); +- for ($_ = 0; $_ < $ct; $_++) { ++ for (0..$ct-1) { + @{$_[3]->[$_]}[1,0] = unpack("LL", substr($epoll_wait_events, 12*$_, 8)); + } + return $ct; +@@ -235,7 +246,7 @@ sub epoll_wait_mod8 { + $epoll_wait_events = "\0" x 16 x $epoll_wait_size; + } + my $ct = syscall($SYS_epoll_wait, $_[0]+0, $epoll_wait_events, $_[1]+0, $_[2]+0); +- for ($_ = 0; $_ < $ct; $_++) { ++ for (0..$ct-1) { + # 16 byte epoll_event structs, with format: + # 4 byte mask [idx 1] + # 4 byte padding (we put it into idx 2, useless) +-- +EW + diff --git a/testing/perl-sys-syscall/APKBUILD b/testing/perl-sys-syscall/APKBUILD index 495c84b9249..7e98b083680 100644 --- a/testing/perl-sys-syscall/APKBUILD +++ b/testing/perl-sys-syscall/APKBUILD @@ -1,42 +1,45 @@ -# Automatically generated by apkbuild-cpan, template 2 +# Automatically generated by apkbuild-cpan, template 3 # Contributor: Nick Andrew -# Maintainer: Nick Andrew +# Maintainer: Celeste pkgname=perl-sys-syscall +#_pkgreal is used by apkbuild-cpan to find modules at MetaCpan _pkgreal=Sys-Syscall pkgver=0.25 -pkgrel=8 +pkgrel=9 pkgdesc="Invoke system calls that are otherwise difficult to do from Perl" -url="https://metacpan.org/release/Sys-Syscall" -arch="all !aarch64 !s390x" +url="https://metacpan.org/release/Sys-Syscall/" +arch="noarch" license="GPL-1.0-or-later OR Artistic-1.0-Perl" depends="perl" subpackages="$pkgname-doc" -source="https://cpan.metacpan.org/authors/id/B/BR/BRADFITZ/$_pkgreal-$pkgver.tar.gz - ppc64le_epoll.patch +source="https://cpan.metacpan.org/authors/id/B/BR/BRADFITZ/Sys-Syscall-$pkgver.tar.gz + 0001-restore-missing-changes-from-0.20.0.22.patch + aarch64.patch + ppc64le.patch + s390x.patch " builddir="$srcdir/$_pkgreal-$pkgver" -prepare() { - default_prepare - - export CFLAGS=$(perl -MConfig -E 'say $Config{ccflags}') - PERL_MM_USE_DEFAULT=1 perl Makefile.PL INSTALLDIRS=vendor -} - build() { export CFLAGS=$(perl -MConfig -E 'say $Config{ccflags}') + PERL_MM_USE_DEFAULT=1 perl -I. Makefile.PL INSTALLDIRS=vendor make } -package() { - make DESTDIR="$pkgdir" install - find "$pkgdir" \( -name perllocal.pod -o -name .packlist \) -delete -} - check() { export CFLAGS=$(perl -MConfig -E 'say $Config{ccflags}') make test } -sha512sums="8b0641c992865cc7a29874a2166a4f0542039958839c6305cd4c33d17cfbdecd4f4ee74dc8110bfb000e42cabd803a84c6ba39037765d61ccb2bdf60522be87f Sys-Syscall-0.25.tar.gz -b8d9912ae7dba60dab3bbe742ab069b86ea3846454e97d3101e975cb5568a6ca161bd928f5d4b8bd305d99830da2668de496904851fa8569ca946235f54b891f ppc64le_epoll.patch" +package() { + make DESTDIR="$pkgdir" install + find "$pkgdir" \( -name perllocal.pod -o -name .packlist \) -delete +} + +sha512sums=" +8b0641c992865cc7a29874a2166a4f0542039958839c6305cd4c33d17cfbdecd4f4ee74dc8110bfb000e42cabd803a84c6ba39037765d61ccb2bdf60522be87f Sys-Syscall-0.25.tar.gz +aa40e1b6fe8b559dab6f99825e0a362668048e2c5ef0092a19b9e18a10fc061b1a234ab237040209685cc7f0e796721f4ec2e1c2b14b5d0d164c7353d7ac2822 0001-restore-missing-changes-from-0.20.0.22.patch +121e46b05020431c7fc76b629d8661991c0503f855d8888de7985d237b244e3766dc69e2bacfdd2af47595aee9737d58dcaa7c42ab0c8de0b4730edfaa4fc84d aarch64.patch +0a26b35e87063970d1081468b2008064cf3476764670fcd9c9123ba88a35eb22c3fa8c6c5bf44a4b8013147a7c3ddaec108aa71506b573bd8df80cc4731de2ed ppc64le.patch +2690e438f6a0e663cf640d76d61c24013cb26a6f04a5330b96fbcc311b05315306a9534bbe17f27d86f8df191f7084912f35ce1e7cfbe1c1e92d341c4960b6f2 s390x.patch +" diff --git a/testing/perl-sys-syscall/aarch64.patch b/testing/perl-sys-syscall/aarch64.patch new file mode 100644 index 00000000000..5cea6a2ff8d --- /dev/null +++ b/testing/perl-sys-syscall/aarch64.patch @@ -0,0 +1,72 @@ +Patch-Source: https://sources.debian.org/data/main/libs/libsys-syscall-perl/0.25-7/debian/patches/aarch64.patch + +From 6c7c516edfabd2edc835d0aaad39f946164bb25d Mon Sep 17 00:00:00 2001 +From: Yaakov Selkowitz +Date: Fri, 4 Dec 2015 02:31:28 -0600 +Subject: [PATCH 3/3] Add aarch64 support + +This is a bit complicated because AArch64, as a completely new architecture, +does not support the deprecated epoll_create and epoll_wait syscalls. +Instead, these wrap the epoll_create1 and epoll_pwait syscalls, which serve +the same purpose but with slightly different syntaxes. + +Origin: backport, https://github.com/bradfitz/sys-syscall/commit/6c7c516edfabd2edc835d0aaad39f946164bb25d +Bug-Debian: https://bugs.debian.org/824843 +--- + lib/Sys/Syscall.pm | 19 +++++++++++++++++-- + 1 file changed, 17 insertions(+), 2 deletions(-) + +diff --git a/lib/Sys/Syscall.pm b/lib/Sys/Syscall.pm +index 702e835..abd010a 100644 +--- a/lib/Sys/Syscall.pm ++++ b/lib/Sys/Syscall.pm +@@ -53,6 +53,8 @@ our ( + $SYS_readahead, + ); + ++our $no_deprecated = 0; ++ + if ($^O eq "linux") { + # whether the machine requires 64-bit numbers to be on 8-byte + # boundaries. +@@ -105,6 +107,14 @@ if ($^O eq "linux") { + $SYS_epoll_wait = 409; + $SYS_readahead = 379; + $u64_mod_8 = 1; ++ } elsif ($machine eq "aarch64") { ++ $SYS_epoll_create = 20; # (sys_epoll_create1) ++ $SYS_epoll_ctl = 21; ++ $SYS_epoll_wait = 22; # (sys_epoll_pwait) ++ $SYS_sendfile = 71; # (sys_sendfile64) ++ $SYS_readahead = 213; ++ $u64_mod_8 = 1; ++ $no_deprecated = 1; + } elsif ($machine =~ m/arm(v\d+)?.*l/) { + # ARM OABI + $SYS_epoll_create = 250; +@@ -207,7 +217,7 @@ sub epoll_defined { return $SYS_epoll_create ? 1 : 0; } + # size doesn't even matter (radix tree now, not hash) + sub epoll_create { + return -1 unless defined $SYS_epoll_create; +- my $epfd = eval { syscall($SYS_epoll_create, ($_[0]||100)+0) }; ++ my $epfd = eval { syscall($SYS_epoll_create, $no_deprecated ? 0 : ($_[0]||100)+0) }; + return -1 if $@; + return $epfd; + } +@@ -245,7 +255,12 @@ sub epoll_wait_mod8 { + $epoll_wait_size = $_[1]; + $epoll_wait_events = "\0" x 16 x $epoll_wait_size; + } +- my $ct = syscall($SYS_epoll_wait, $_[0]+0, $epoll_wait_events, $_[1]+0, $_[2]+0); ++ my $ct; ++ if ($no_deprecated) { ++ $ct = syscall($SYS_epoll_wait, $_[0]+0, $epoll_wait_events, $_[1]+0, $_[2]+0, undef); ++ } else { ++ $ct = syscall($SYS_epoll_wait, $_[0]+0, $epoll_wait_events, $_[1]+0, $_[2]+0); ++ } + for (0..$ct-1) { + # 16 byte epoll_event structs, with format: + # 4 byte mask [idx 1] +-- +2.8.1 + diff --git a/testing/perl-sys-syscall/ppc64le.patch b/testing/perl-sys-syscall/ppc64le.patch new file mode 100644 index 00000000000..980f4973049 --- /dev/null +++ b/testing/perl-sys-syscall/ppc64le.patch @@ -0,0 +1,31 @@ +Patch-Source: https://sources.debian.org/data/main/libs/libsys-syscall-perl/0.25-7/debian/patches/ppc64le.patch + +From b877ec33b331ba01e8fad8bed0d3cde55e1efa9e Mon Sep 17 00:00:00 2001 +From: Yaakov Selkowitz +Date: Fri, 4 Dec 2015 02:26:35 -0600 +Subject: [PATCH 1/3] Add ppc64le support + +Little endian uses the same syscalls as the big endian kernel. + +Origin: upstream, https://github.com/bradfitz/sys-syscall/commit/b877ec33b331ba01e8fad8bed0d3cde55e1efa9e +Bug-Debian: https://bugs.debian.org/824843 +--- + lib/Sys/Syscall.pm | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/lib/Sys/Syscall.pm b/lib/Sys/Syscall.pm +index 8d7cca2..ece65de 100644 +--- a/lib/Sys/Syscall.pm ++++ b/lib/Sys/Syscall.pm +@@ -78,7 +78,7 @@ if ($^O eq "linux") { + $SYS_epoll_wait = 232; + $SYS_sendfile = 40; + $SYS_readahead = 187; +- } elsif ($machine eq "ppc64") { ++ } elsif ($machine =~ m/^ppc64/) { + $SYS_epoll_create = 236; + $SYS_epoll_ctl = 237; + $SYS_epoll_wait = 238; +-- +2.8.1 + diff --git a/testing/perl-sys-syscall/ppc64le_epoll.patch b/testing/perl-sys-syscall/ppc64le_epoll.patch deleted file mode 100644 index 4f2174c8256..00000000000 --- a/testing/perl-sys-syscall/ppc64le_epoll.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- a/lib/Sys/Syscall.pm -+++ b/lib/Sys/Syscall.pm -@@ -65,7 +65,7 @@ - $SYS_epoll_wait = 232; - $SYS_sendfile = 40; - $SYS_readahead = 187; -- } elsif ($machine eq "ppc64") { -+ } elsif ($machine =~ m/^ppc64/) { - $SYS_epoll_create = 236; - $SYS_epoll_ctl = 237; - $SYS_epoll_wait = 238; diff --git a/testing/perl-sys-syscall/s390x.patch b/testing/perl-sys-syscall/s390x.patch new file mode 100644 index 00000000000..6f755cc355f --- /dev/null +++ b/testing/perl-sys-syscall/s390x.patch @@ -0,0 +1,34 @@ +Patch-Source: https://sources.debian.org/data/main/libs/libsys-syscall-perl/0.25-7/debian/patches/s390x.patch + +From 5628d9c0e299eea79e87aa8a5ed2d99a2895a4d0 Mon Sep 17 00:00:00 2001 +From: Yaakov Selkowitz +Date: Fri, 4 Dec 2015 02:28:00 -0600 +Subject: [PATCH 2/3] Add s390/x support + +Origin: upstream, https://github.com/bradfitz/sys-syscall/commit/5628d9c0e299eea79e87aa8a5ed2d99a2895a4d0 +Bug-Debian: https://bugs.debian.org/824843 +--- + lib/Sys/Syscall.pm | 7 +++++++ + 1 file changed, 7 insertions(+) + +diff --git a/lib/Sys/Syscall.pm b/lib/Sys/Syscall.pm +index ece65de..702e835 100644 +--- a/lib/Sys/Syscall.pm ++++ b/lib/Sys/Syscall.pm +@@ -92,6 +92,13 @@ if ($^O eq "linux") { + $SYS_sendfile = 186; # sys_sendfile64=226 + $SYS_readahead = 191; + $u64_mod_8 = 1; ++ } elsif ($machine =~ m/^s390/) { ++ $SYS_epoll_create = 249; ++ $SYS_epoll_ctl = 250; ++ $SYS_epoll_wait = 251; ++ $SYS_sendfile = 187; # sys_sendfile64=223 ++ $SYS_readahead = 222; ++ $u64_mod_8 = 1; + } elsif ($machine eq "ia64") { + $SYS_epoll_create = 1243; + $SYS_epoll_ctl = 1244; +-- +2.8.1 +