Mail archive
alpine-aports

[alpine-aports] [PATCH 1/3] main/debootstrap: cleanup by providing custom makedev script

From: Sören Tempel <soeren+git_at_soeren-tempel.net>
Date: Tue, 18 Aug 2015 20:46:25 +0200

Instead of replicating the Makefile devices.tar.gz rule in the package()
APKBUILD function.
---
 main/debootstrap/APKBUILD   | 48 +++++++++++++++++++--------------------------
 main/debootstrap/makedev.sh | 19 ++++++++++++++++++
 2 files changed, 39 insertions(+), 28 deletions(-)
 create mode 100755 main/debootstrap/makedev.sh
diff --git a/main/debootstrap/APKBUILD b/main/debootstrap/APKBUILD
index 247da7d..787d95b 100644
--- a/main/debootstrap/APKBUILD
+++ b/main/debootstrap/APKBUILD
_at_@ -1,3 +1,4 @@
+# Contributor: Sören Tempel <soeren+alpine_at_soeren-tempel.net>
 # Maintainer: Natanael Copa <ncopa_at_alpinelinux.org>
 pkgname=debootstrap
 pkgver=1.0.72
_at_@ -7,46 +8,37 @@ url="http://packages.qa.debian.org/d/debootstrap.html"
 arch="all"
 license="GPL2"
 depends="dpkg tar"
+makedepends=""
+install=""
+subpackages=""
 source="http://ftp.de.debian.org/debian/pool/main/d/debootstrap/debootstrap_$pkgver.tar.gz
-	pkgdetails.c"
+	pkgdetails.c
+	makedev.sh"
 
 _builddir="$srcdir"/debootstrap-$pkgver
 build() {
-	cd "$_builddir"
-	${CC:-gcc} $CFLAGS $LDFLAGS -o pkgdetails \
+	chmod +x "$srcdir/makedev.sh"
+	${CC:-gcc} $CFLAGS $LDFLAGS -o "$_builddir"/pkgdetails \
 		"$srcdir"/pkgdetails.c || return 1
 }
 
 package() {
 	cd "$_builddir"
-	# create devices.tar.gz
-	rm -rf dev
-	mkdir -p dev
-	chown 0:0 dev
-	chmod 755 dev
-	( cd dev
-		ln -s /proc/self/fd fd
-		ln -s fd/0 stdin
-		ln -s fd/1 stdout
-		ln -s fd/2 stderr
-		mknod full c 1 7
-		mknod null c 1 3
-		mknod ptmx c 5 2
-		mkdir pts shm
-		mknod random c 1 8
-		mknod tty c 5 0
-		mknod urandom c 1 9
-		mknod zero c 1 5
-	)
-	tar -czf devices.tar.gz dev
-	rm -rf dev
-	make DESTDIR="$pkgdir" install || return
+
+	# This can only be done in a fakeroot
+	make MAKEDEV="$srcdir/makedev.sh" \
+		devices.tar.gz || return 1
+
+	make DESTDIR="$pkgdir" install || return 1
 	install -Dm755 pkgdetails "$pkgdir"/usr/lib/debootstrap/pkgdetails
 }
 
 md5sums="0cacf6e3bd8b566e921d2a326d6fd2bd  debootstrap_1.0.72.tar.gz
-66b6fb6d862ba4886701c9b056088479  pkgdetails.c"
+66b6fb6d862ba4886701c9b056088479  pkgdetails.c
+ef5038e52173de7a18c37a0925ccf383  makedev.sh"
 sha256sums="90f4cf1390326f020b9192b6a45ba1d323fffab9c22c6f62451780e6f5482f8d  debootstrap_1.0.72.tar.gz
-1cf1644e8400693fd41d378f972c15fa7b32f3282117ea967c995705256a84d6  pkgdetails.c"
+1cf1644e8400693fd41d378f972c15fa7b32f3282117ea967c995705256a84d6  pkgdetails.c
+3f26318b59c7697205285d04eb68a4c65905faedd7bbcb4e53e803f9ea8e5c97  makedev.sh"
 sha512sums="b8f186b13f66789e96f775337d06821cfb464e35dd661a2bff1420bfb1254cf85ce9eb46be1a27dad7a462628e441cbfcdfffaf12ee5a394d15c248882295848  debootstrap_1.0.72.tar.gz
-432313c8aef4974f21cb81b48d9f1c319692325f24a456e460e6f92c6a15ade7f29dfee4bf2ab3664c90b09d1f16e46cb8dd898ebd317f2547e63a64a773d971  pkgdetails.c"
+432313c8aef4974f21cb81b48d9f1c319692325f24a456e460e6f92c6a15ade7f29dfee4bf2ab3664c90b09d1f16e46cb8dd898ebd317f2547e63a64a773d971  pkgdetails.c
+71f1dfe7d785cf5f4b2db7e4de01b5e542b33a1a49194a53665d4d68b5de47fc3c5b37ad2d1a7c37fb14d10c6758fa2fb043bd68a6fbb8b9dba90fb071a9db9c  makedev.sh"
diff --git a/main/debootstrap/makedev.sh b/main/debootstrap/makedev.sh
new file mode 100755
index 0000000..bee4ff8
--- /dev/null
+++ b/main/debootstrap/makedev.sh
_at_@ -0,0 +1,19 @@
+#!/bin/sh
+# Use this instead of packaging makedev.
+
+# Exit on failure.
+set -e
+
+# Create devices in $PWD.
+ln -s /proc/self/fd fd
+ln -s fd/0 stdin
+ln -s fd/1 stdout
+ln -s fd/2 stderr
+mknod full c 1 7
+mknod null c 1 3
+mknod ptmx c 5 2
+mkdir pts shm
+mknod random c 1 8
+mknod tty c 5 0
+mknod urandom c 1 9
+mknod zero c 1 5
-- 
2.5.0
---
Unsubscribe:  alpine-aports+unsubscribe_at_lists.alpinelinux.org
Help:         alpine-aports+help_at_lists.alpinelinux.org
---
Received on Tue Aug 18 2015 - 20:46:25 GMT