aboutsummaryrefslogtreecommitdiffstats
path: root/main/xen
diff options
context:
space:
mode:
authorNatanael Copa <ncopa@alpinelinux.org>2014-10-09 16:10:28 +0000
committerNatanael Copa <ncopa@alpinelinux.org>2014-10-09 16:10:28 +0000
commit0c5e302b3f9267c3a929531f848bf98398f48485 (patch)
treea5f2c3abc574e9c79b91dfb49ecf7a0e3f707cc9 /main/xen
parentc2fa69955ac724d03c7c50f155e1a2dabc125c3c (diff)
downloadaports-0c5e302b3f9267c3a929531f848bf98398f48485.tar.bz2
aports-0c5e302b3f9267c3a929531f848bf98398f48485.tar.xz
main/xen: remove perl dependency
use a tiny C program to do the file/fd compare instead of perl
Diffstat (limited to 'main/xen')
-rw-r--r--main/xen/APKBUILD17
-rw-r--r--main/xen/xen-fd-is-file.c62
-rw-r--r--main/xen/xen-hotplug-lockfd.patch24
3 files changed, 101 insertions, 2 deletions
diff --git a/main/xen/APKBUILD b/main/xen/APKBUILD
index d4b6e5d852..484b645f65 100644
--- a/main/xen/APKBUILD
+++ b/main/xen/APKBUILD
@@ -3,12 +3,12 @@
# Maintainer: William Pitcock <nenolod@dereferenced.org>
pkgname=xen
pkgver=4.4.1
-pkgrel=2
+pkgrel=3
pkgdesc="Xen hypervisor"
url="http://www.xen.org/"
arch="x86_64"
license="GPL"
-depends="syslinux bash screen iproute2 logrotate perl"
+depends="syslinux bash screen iproute2 logrotate"
depends_dev="openssl-dev python-dev e2fsprogs-dev gettext zlib-dev ncurses-dev
libiconv-dev dev86 texinfo perl iasl pciutils-dev glib-dev yajl-dev
spice-dev gnutls-dev curl-dev libaio-dev lzo-dev xz-dev util-linux-dev
@@ -34,6 +34,9 @@ source="http://bits.xensource.com/oss-xen/release/$pkgver/$pkgname-$pkgver.tar.g
stdint_local.h
elf_local.h
+ xen-hotplug-lockfd.patch
+ xen-fd-is-file.c
+
xenstored.initd
xenstored.confd
xenconsoled.initd
@@ -136,6 +139,8 @@ build() {
build_tools || return 1
build_docs || return 1
build_stubdom || return 1
+
+ ${CC:-gcc} -o xen-fd-is-file "$srcdir"/xen-fd-is-file.c
}
package() {
@@ -160,6 +165,8 @@ package() {
done
install -Dm644 "$srcdir"/xen-consoles.logrotate \
"$pkgdir"/etc/xen/xen-consoles.logrotate
+
+ install -m755 xen-fd-is-file "$pkgdir"/usr/lib/xen/bin/xen-fd-is-file
}
libs() {
@@ -217,6 +224,8 @@ f7aa282a27f270a923f229f2040cd7b5 musl-support.patch
2b1afbf120b69c5d14c846178378116b musl-hvmloader-fix-stdint.patch
c9313a790faa727205627a1657b9bf06 stdint_local.h
c13f954d041a6fa78d0d241ad1780c0b elf_local.h
+750138c31ec96d1a11fe0c665ac07e9e xen-hotplug-lockfd.patch
+649f77b90978cd2b6d506ac44ec6c393 xen-fd-is-file.c
bd6d294c47d4285e770aefa6e63eeea2 xenstored.initd
d86504e12f05deca6b3eeeb90157160e xenstored.confd
ed262f15fb880badb53575539468646c xenconsoled.initd
@@ -238,6 +247,8 @@ dd1e784bc455eb62cb85b3fa24bfc34f575ceaab9597ef6a2f1ee7ff7b3cae0a hotplug-vif-vt
09b9feb9ea6f9c1bda5cc1672f42e8fc5186dc9dd5561f28c6f1904d80aca7fa musl-hvmloader-fix-stdint.patch
6b4ad2a9fdb3e23b06c8c1961a46b06c15a46471fe6fb13cdc269da37466f334 stdint_local.h
7f1ed2db24d8eba87a08eea0601a9ab339209906fdfa74c8c03564a1a6e6471e elf_local.h
+b183ed028a8c42a64e6fd3fb4b2b6dad832f52ed838fceb69bf681de4e7d794f xen-hotplug-lockfd.patch
+d0b3e5f282a07878341c38f40d01041ed37623757a99d6e0a420ca64d1f4ef2a xen-fd-is-file.c
2f3fa767e57c18433d196bb2aecfb575224183193f4acece85971683a9a5411b xenstored.initd
991bb7c9da02941556e29714bd96b26e39e57e0a5b514eadd78d9bfa3fa5a9dc xenstored.confd
93bea2eb90ea1b4628854c8141dd351bbd1fbc5959b12795447ea933ad025f01 xenconsoled.initd
@@ -259,6 +270,8 @@ c3a1b270347a99c8ce21118010ad8d817b4462a31cc5c75352faa7086969ef0646f3f4d0922d85c2
4acf7e360ae94f7c0f7541fcd106389402f215c28bd18ed1fd4be9d4b9d12550e17152f7e19b19793e16d4ee0e131ec3e3ce6011b42bc7683fcebdb4051c6109 musl-hvmloader-fix-stdint.patch
9dcb481c5b83c7df23e87be717d8a9234014f26a0f80893e125fe8110e2923562d95162d18ff64c08b5782cd7c085f90378a9e0802b3995c077c8ba32bbb669f stdint_local.h
853467a2d055c5bfbdc7bdca175a334241be44a7c5ac3c0a84a4bc5463b5c070b66d37e2a557429ef860727a6b7350683af758cc2494d85b6be4d883143a2c0d elf_local.h
+79cb1b6b81b17cb87a064dfe3548949dfb80f64f203cac11ef327102b7a25794549ce2d9c019ebf05f752214da8e05065e9219d069e679c0ae5bee3d090c685e xen-hotplug-lockfd.patch
+e76816c6ad0e91dc5f81947f266da3429b20e6d976c3e8c41202c6179532eec878a3f0913921ef3ac853c5dbad8082da3c9cd53b65081910516feb492577b7fc xen-fd-is-file.c
7a21f7cc05d5593a96ca5254ffed55919de97d7a1fe0d5b360876a5c0811416c9f985682c5b70325d99166ebabd149d0d061ea58da4283b2b0d2aab0d75e5368 xenstored.initd
093f7fbd43faf0a16a226486a0776bade5dc1681d281c5946a3191c32d74f9699c6bf5d0ab8de9d1195a2461165d1660788e92a3156c9b3c7054d7b2d52d7ff0 xenstored.confd
12f981b2459c65d66e67ec0b32d0d19b95a029bc54c2a79138cfe488d3524a22e51860f755abfe25ddcdaf1b27f2ded59b6e350b9d5f8791193d00e2d3673137 xenconsoled.initd
diff --git a/main/xen/xen-fd-is-file.c b/main/xen/xen-fd-is-file.c
new file mode 100644
index 0000000000..a1518e4df0
--- /dev/null
+++ b/main/xen/xen-fd-is-file.c
@@ -0,0 +1,62 @@
+#include <sys/stat.h>
+
+#include <stdio.h>
+#include <fcntl.h>
+#include <err.h>
+
+/*
+
+this is to be used as:
+
+ while true; do
+ eval "exec $_lockfd<>$_lockfile"
+ flock -x $_lockfd || return $?
+ if xen-fd-is-file $_lockfd $_lockfile; then break; fi
+ eval "exec $_lockfd<&-"
+ done
+
+instead of:
+
+ local rightfile
+ while true; do
+ eval "exec $_lockfd<>$_lockfile"
+ flock -x $_lockfd || return $?
+ # We can't just stat /dev/stdin or /proc/self/fd/$_lockfd or
+ # use bash's test -ef because those all go through what is
+ # actually a synthetic symlink in /proc and we aren't
+ # guaranteed that our stat(2) won't lose the race with an
+ # rm(1) between reading the synthetic link and traversing the
+ # file system to find the inum. Perl is very fast so use that.
+ rightfile=$( perl -e '
+ open STDIN, "<&'$_lockfd'" or die $!;
+ my $fd_inum = (stat STDIN)[1]; die $! unless defined $fd_inum;
+ my $file_inum = (stat $ARGV[0])[1];
+ print "y\n" if $fd_inum eq $file_inum;
+ ' "$_lockfile" )
+ if [ x$rightfile = xy ]; then break; fi
+ # Some versions of bash appear to be buggy if the same
+ # $_lockfile is opened repeatedly. Close the current fd here.
+ eval "exec $_lockfd<&-"
+ done
+*/
+
+int main(int argc, char *argv[])
+{
+ int lockfd;
+ const char *filename;
+ struct stat fdst, filest;
+
+ if (argc <= 2)
+ errx(1, "usage: %s FDNUM FILENAME\n", argv[0]);
+
+ lockfd = atoi(argv[1]);
+ filename = argv[2];
+
+ if (fstat(lockfd, &fdst) < 0)
+ err(2, "fstat(%i)", lockfd);
+
+ if (stat(filename, &filest) < 0)
+ err(3, "stat(%s)", filename);
+
+ return (fdst.st_ino != filest.st_ino);
+}
diff --git a/main/xen/xen-hotplug-lockfd.patch b/main/xen/xen-hotplug-lockfd.patch
new file mode 100644
index 0000000000..2f91889948
--- /dev/null
+++ b/main/xen/xen-hotplug-lockfd.patch
@@ -0,0 +1,24 @@
+We remove the perl snippet to verify the lockfile with lockfd to
+avoid perl dependency
+
+use a tiny C app to do the same job.
+
+--- ./tools/hotplug/Linux/locking.sh.orig
++++ ./tools/hotplug/Linux/locking.sh
+@@ -51,14 +51,8 @@
+ # actually a synthetic symlink in /proc and we aren't
+ # guaranteed that our stat(2) won't lose the race with an
+ # rm(1) between reading the synthetic link and traversing the
+- # file system to find the inum. Perl is very fast so use that.
+- rightfile=$( perl -e '
+- open STDIN, "<&'$_lockfd'" or die $!;
+- my $fd_inum = (stat STDIN)[1]; die $! unless defined $fd_inum;
+- my $file_inum = (stat $ARGV[0])[1];
+- print "y\n" if $fd_inum eq $file_inum;
+- ' "$_lockfile" )
+- if [ x$rightfile = xy ]; then break; fi
++ # file system to find the inum. We use tiny C file for that
++ if /usr/lib/xen/bin/xen-fd-is-file $_lockfd $_lockfile; then break; fi
+ # Some versions of bash appear to be buggy if the same
+ # $_lockfile is opened repeatedly. Close the current fd here.
+ eval "exec $_lockfd<&-"