From a5ee6fa1836ed3986be333d6c9b4eed8d639636b Mon Sep 17 00:00:00 2001 From: davidovski Date: Wed, 17 May 2023 17:02:25 +0000 Subject: Add schroot --- auto/port-alpine.sh | 2 +- repo/adoptopenjdk8/adoptopenjdk8.xibuild | 23 ++++++++++++ repo/gradle/gradle.xibuild | 32 +++++++++++++++++ repo/schroot/busybox-compat.patch | 50 ++++++++++++++++++++++++++ repo/schroot/getent.patch | 25 +++++++++++++ repo/schroot/getmntent.patch | 60 ++++++++++++++++++++++++++++++++ repo/schroot/musl.patch | 51 +++++++++++++++++++++++++++ repo/schroot/pam.d.schroot.patch | 20 +++++++++++ repo/schroot/remove-networks.patch | 41 ++++++++++++++++++++++ repo/schroot/schroot-cppunit.patch | 11 ++++++ repo/schroot/schroot.xibuild | 60 ++++++++++++++++++++++++++++++++ 11 files changed, 374 insertions(+), 1 deletion(-) create mode 100644 repo/adoptopenjdk8/adoptopenjdk8.xibuild create mode 100644 repo/gradle/gradle.xibuild create mode 100644 repo/schroot/busybox-compat.patch create mode 100644 repo/schroot/getent.patch create mode 100644 repo/schroot/getmntent.patch create mode 100644 repo/schroot/musl.patch create mode 100644 repo/schroot/pam.d.schroot.patch create mode 100644 repo/schroot/remove-networks.patch create mode 100644 repo/schroot/schroot-cppunit.patch create mode 100644 repo/schroot/schroot.xibuild diff --git a/auto/port-alpine.sh b/auto/port-alpine.sh index 42c1b42..1409d5f 100755 --- a/auto/port-alpine.sh +++ b/auto/port-alpine.sh @@ -4,7 +4,7 @@ # package=$1 -aports_dir="/home/david/docs/proj/alpine/aports" +aports_dir="../../alpine/aports" pkgbuild=$(find $aports_dir -name "$package" -type d | head -1) diff --git a/repo/adoptopenjdk8/adoptopenjdk8.xibuild b/repo/adoptopenjdk8/adoptopenjdk8.xibuild new file mode 100644 index 0000000..645ee87 --- /dev/null +++ b/repo/adoptopenjdk8/adoptopenjdk8.xibuild @@ -0,0 +1,23 @@ +#!/bin/sh + +NAME="adoptopenjdk8" +DESC="AdoptOpenJDK Java 8 binaries" + +MAKEDEPS="make " +DEPS="default-jvm less " + +PKG_VER=8 +RELEASE=u372b07 +SOURCE="https://github.com/adoptium/temurin8-binaries/releases/download/jdk8u372-b07/OpenJDK${PKG_VER%%.*}U-jdk_x64_alpine-linux_hotspot_${PKG_VER}${RELEASE}.tar.gz" + +package () { + out=$PKG_DEST/usr/lib/jvm/$NAME + mkdir -p $out + for f in NOTICE bin conf include jmods legal lib man release; do + mv $f $out/ + done +} + +postinstall () { + default-jvm || default-jvm $NAME +} diff --git a/repo/gradle/gradle.xibuild b/repo/gradle/gradle.xibuild new file mode 100644 index 0000000..82a055d --- /dev/null +++ b/repo/gradle/gradle.xibuild @@ -0,0 +1,32 @@ +#!/bin/sh + +NAME="gradle" +DESC="Build tool with a focus on build automation and support for multi-language development" + +MAKEDEPS="make adoptopenjdk11 " + +PKG_VER=8.0.2 +SOURCE="https://services.gradle.org/distributions/gradle-$PKG_VER-bin.zip" + +package () { + local gradlehome="/usr/share/java/gradle" + local destdir="$PKG_DEST/$gradlehome" + + install -dm755 "$destdir"/bin + rm bin/*.bat + install -m755 bin/* "$destdir"/bin + + install -dm755 "$PKG_DEST"/usr/bin + ln -sf $gradlehome/bin/gradle "$PKG_DEST"/usr/bin/gradle + + install -dm755 "$destdir"/lib + install -m644 lib/*.jar "$destdir"/lib + + install -dm755 "$destdir"/lib/plugins + install -m644 lib/plugins/*.jar "$destdir"/lib/plugins + + # NOTICE file should be redistributed for derivative works + local file; for file in LICENSE NOTICE; do + install -m644 -D $file "$PKG_DEST"/usr/share/licenses/gradle/$file + done +} diff --git a/repo/schroot/busybox-compat.patch b/repo/schroot/busybox-compat.patch new file mode 100644 index 0000000..98c0dc2 --- /dev/null +++ b/repo/schroot/busybox-compat.patch @@ -0,0 +1,50 @@ +diff --git a/etc/profile-templates/all/all/nssdatabases b/etc/profile-templates/all/all/nssdatabases +index 42fa310..815ddce 100644 +--- a/etc/profile-templates/all/all/nssdatabases ++++ b/etc/profile-templates/all/all/nssdatabases +@@ -4,4 +4,3 @@ + passwd + shadow + group +-gshadow +diff --git a/etc/profile-templates/buildd/all/nssdatabases b/etc/profile-templates/buildd/all/nssdatabases +index 42fa310..815ddce 100644 +--- a/etc/profile-templates/buildd/all/nssdatabases ++++ b/etc/profile-templates/buildd/all/nssdatabases +@@ -4,4 +4,3 @@ + passwd + shadow + group +-gshadow +diff --git a/etc/setup.d/20copyfiles b/etc/setup.d/20copyfiles +index 2c01af9..e427d35 100755 +--- a/etc/setup.d/20copyfiles ++++ b/etc/setup.d/20copyfiles +@@ -39,9 +39,9 @@ copy_file() + if [ -e "$2" ]; then + + # Device and inode +- da=$(/usr/bin/stat --format="%d %i" "$1") ++ da=$(/bin/stat -c "%d %i" "$1") + # This one can fail since it might not exist yet +- db=$(/usr/bin/stat --format="%d %i" "$2" 2>/dev/null || :) ++ db=$(/bin/stat -c "%d %i" "$2" 2>/dev/null || :) + + if [ "$da" = "$db" ]; then + COPY="false" +diff --git a/etc/setup.d/20nssdatabases b/etc/setup.d/20nssdatabases +index 6ea83c0..3f4019c 100755 +--- a/etc/setup.d/20nssdatabases ++++ b/etc/setup.d/20nssdatabases +@@ -42,9 +42,9 @@ if [ $STAGE = "setup-start" ] || [ $STAGE = "setup-recover" ]; then + fi + + # Device and inode +- dr=$(/usr/bin/stat --format="%d %i" "/etc/$db") ++ dr=$(/bin/stat -c "%d %i" "/etc/$db") + # This one can fail since it might not exist yet +- dc=$(/usr/bin/stat --format="%d %i" "${CHROOT_PATH}/etc/$db" 2>/dev/null || :) ++ dc=$(/bin/stat -c "%d %i" "${CHROOT_PATH}/etc/$db" 2>/dev/null || :) + + # If the database inside and outside the chroot is the + # same, it's very likely that dup_nss would blank the diff --git a/repo/schroot/getent.patch b/repo/schroot/getent.patch new file mode 100644 index 0000000..b89e63c --- /dev/null +++ b/repo/schroot/getent.patch @@ -0,0 +1,25 @@ +From 6ffdd152d3fb07921c02e739ce5b47d1e177e7e6 Mon Sep 17 00:00:00 2001 +From: Andrea Brancaleoni +Date: Mon, 24 Aug 2015 18:39:16 +0200 +Subject: [PATCH] getent + +--- + etc/setup.d/20nssdatabases | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git etc/setup.d/20nssdatabases etc/setup.d/20nssdatabases +index 6f14c81..697bb1e 100755 +--- a/etc/setup.d/20nssdatabases ++++ b/etc/setup.d/20nssdatabases +@@ -29,7 +29,7 @@ set -e + dup_nss() + { + info "Copying $1 database to $2" +- getent "$1" > "$2" ++ getent "$1" > "$2" 2>/dev/null || cat "/etc/$1" > "$2" + } + + if [ $STAGE = "setup-start" ] || [ $STAGE = "setup-recover" ]; then +-- +2.5.0 + diff --git a/repo/schroot/getmntent.patch b/repo/schroot/getmntent.patch new file mode 100644 index 0000000..8453bfb --- /dev/null +++ b/repo/schroot/getmntent.patch @@ -0,0 +1,60 @@ +From db62a534ebcf60391d9e0acffa641e60dfba18fb Mon Sep 17 00:00:00 2001 +From: Andrea Brancaleoni +Date: Wed, 19 Sep 2018 10:36:36 +0200 +Subject: [PATCH] getmntent fix + +--- + sbuild/sbuild-mntstream.cc | 15 ++------------- + sbuild/sbuild-mntstream.h | 3 +-- + 2 files changed, 3 insertions(+), 15 deletions(-) + +diff --git sbuild/sbuild-mntstream.cc sbuild/sbuild-mntstream.cc +index d376fe5..d7324e7 100644 +--- a/sbuild/sbuild-mntstream.cc ++++ b/sbuild/sbuild-mntstream.cc +@@ -37,9 +37,7 @@ namespace + emap init_errors[] = + { + // TRANSLATORS: %1% = mount file name +- emap(mntstream::MNT_OPEN, N_("Failed to open mount file ‘%1%’")), +- // TRANSLATORS: %1% = mount file name +- emap(mntstream::MNT_READ, N_("Failed to read mount file ‘%1%’")) ++ emap(mntstream::MNT_OPEN, N_("Failed to open mount file ‘%1%’")) + }; + + } +@@ -109,16 +107,7 @@ mntstream::read(int quantity) + errno = 0; + entry = getmntent(mntfile); + +- if (entry == 0) // EOF or error +- { +- //std::cerr << "Mount file read error: "; +- if (errno) // error +- { +- this->error_status = true; +- throw error(this->file, MNT_READ, strerror(errno)); +- } +- return; +- } ++ if (entry == 0) return; + + mntentry newentry(*entry); // make a mntentry + this->data.push_back(newentry); // push onto the end of the list +diff --git sbuild/sbuild-mntstream.h sbuild/sbuild-mntstream.h +index ea3d179..fffcdf4 100644 +--- a/sbuild/sbuild-mntstream.h ++++ b/sbuild/sbuild-mntstream.h +@@ -49,8 +49,7 @@ namespace sbuild + /// Error codes. + enum error_code + { +- MNT_OPEN, ///< Failed to open mount file. +- MNT_READ ///< Failed to read mount file. ++ MNT_OPEN ///< Failed to open mount file. + }; + + /// Exception type. +-- +2.19.0 + diff --git a/repo/schroot/musl.patch b/repo/schroot/musl.patch new file mode 100644 index 0000000..8e27ad7 --- /dev/null +++ b/repo/schroot/musl.patch @@ -0,0 +1,51 @@ +From 73936a423227aa78b7682bdd3edc20643763807b Mon Sep 17 00:00:00 2001 +From: Andrea Brancaleoni +Date: Wed, 19 Sep 2018 11:22:47 +0200 +Subject: [PATCH] musl + +--- + sbuild/sbuild-feature.cc | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git sbuild/sbuild-feature.cc sbuild/sbuild-feature.cc +index 5ac4725..9902db3 100644 +--- a/sbuild/sbuild-feature.cc ++++ b/sbuild/sbuild-feature.cc +@@ -20,6 +20,8 @@ + + #include + ++#include ++ + #include "sbuild-feature.h" + + using namespace sbuild; +-- +2.19.0 + +diff --git a/sbuild/Makefile.am b/sbuild/Makefile.am +index 03b5c7b..afa7638 100644 +--- a/sbuild/Makefile.am ++++ b/sbuild/Makefile.am +@@ -222,7 +222,7 @@ pkgconfigdata_DATA = sbuild.pc + # Uncomment to build a versioned library + libsbuild_version = -version-info $(SBUILD_CURRENT_INTERFACE):$(SBUILD_INTERFACE_AGE):$(SBUILD_BINARY_AGE) + libsbuild_la_LDFLAGS = $(libsbuild_version) \ +- -rpath $(libdir) -no-undefined ++ -rpath $(libdir) -no-undefined -lintl + + EXTRA_DIST = \ + CMakeLists.txt \ +diff --git a/test/Makefile.in b/test/Makefile.in +index ce78448..efbc287 100644 +--- a/test/Makefile.in ++++ b/test/Makefile.in +@@ -334,7 +334,7 @@ am__v_CC_1 = + CCLD = $(CC) + LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ +- $(AM_LDFLAGS) $(LDFLAGS) -o $@ ++ $(AM_LDFLAGS) $(LDFLAGS) -lcppunit -o $@ + AM_V_CCLD = $(am__v_CCLD_@AM_V@) + am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@) + am__v_CCLD_0 = @echo " CCLD " $@; diff --git a/repo/schroot/pam.d.schroot.patch b/repo/schroot/pam.d.schroot.patch new file mode 100644 index 0000000..ec63323 --- /dev/null +++ b/repo/schroot/pam.d.schroot.patch @@ -0,0 +1,20 @@ +--- a/etc/pam/schroot ++++ b/etc/pam/schroot +@@ -23,13 +23,9 @@ + # time restrainst on schroot usage. + # account requisite pam_time.so + +-# The standard Unix authentication modules, used with +-# NIS (man nsswitch) as well as normal /etc/passwd and +-# /etc/shadow entries. +-@include common-auth +-@include common-account +-@include common-session +- ++account required pam_unix.so ++session required pam_unix.so ++ + # Sets up user limits, please uncomment and read /etc/security/limits.conf + # to enable this functionality. + # session required pam_limits.so + diff --git a/repo/schroot/remove-networks.patch b/repo/schroot/remove-networks.patch new file mode 100644 index 0000000..7506669 --- /dev/null +++ b/repo/schroot/remove-networks.patch @@ -0,0 +1,41 @@ +From e59bc1b6c6535ec8ab8a57004351718ab2677196 Mon Sep 17 00:00:00 2001 +From: Andrea Brancaleoni +Date: Wed, 19 Sep 2018 12:36:41 +0200 +Subject: [PATCH] remove networks + +--- + etc/profile-templates/buildd/all/copyfiles | 1 - + etc/profile-templates/default/all/nssdatabases | 1 - + etc/profile-templates/desktop/all/nssdatabases | 1 - + 3 files changed, 3 deletions(-) + +diff --git etc/profile-templates/buildd/all/copyfiles etc/profile-templates/buildd/all/copyfiles +index fe18fb3..2469d3e 100644 +--- a/etc/profile-templates/buildd/all/copyfiles ++++ b/etc/profile-templates/buildd/all/copyfiles +@@ -3,4 +3,3 @@ + # + /etc/hosts + /etc/resolv.conf +-/etc/networks +diff --git etc/profile-templates/default/all/nssdatabases etc/profile-templates/default/all/nssdatabases +index a9f1319..22efe1b 100644 +--- a/etc/profile-templates/default/all/nssdatabases ++++ b/etc/profile-templates/default/all/nssdatabases +@@ -1,4 +1,3 @@ + services + protocols +-networks + hosts +diff --git etc/profile-templates/desktop/all/nssdatabases etc/profile-templates/desktop/all/nssdatabases +index a9f1319..22efe1b 100644 +--- a/etc/profile-templates/desktop/all/nssdatabases ++++ b/etc/profile-templates/desktop/all/nssdatabases +@@ -1,4 +1,3 @@ + services + protocols +-networks + hosts +-- +2.19.0 + diff --git a/repo/schroot/schroot-cppunit.patch b/repo/schroot/schroot-cppunit.patch new file mode 100644 index 0000000..3e11c73 --- /dev/null +++ b/repo/schroot/schroot-cppunit.patch @@ -0,0 +1,11 @@ +--- a/configure.ac 2017-05-20 09:50:30.146864516 +0000 ++++ b/configure.ac 2017-05-20 09:51:26.216792794 +0000 +@@ -336,7 +336,7 @@ + [HAVE_UUID=yes], + [HAVE_UUID=no]) + +-AM_PATH_CPPUNIT([1.10.0], [HAVE_CPPUNIT=yes]) ++PKG_CHECK_MODULES([CPPUNIT], [cppunit], [HAVE_CPPUNIT=yes], [HAVE_CPPUNIT=no]) + AM_CONDITIONAL([USE_UNIT_TESTS], [test -n "$HAVE_CPPUNIT"]) + + SCHROOT_CFLAGS="$UUID_CFLAGS" diff --git a/repo/schroot/schroot.xibuild b/repo/schroot/schroot.xibuild new file mode 100644 index 0000000..5b95788 --- /dev/null +++ b/repo/schroot/schroot.xibuild @@ -0,0 +1,60 @@ +#!/bin/sh + +NAME="schroot" +DESC="Allows users to execute shell commands under different root filesystems. (Successor to dchroot)." + +MAKEDEPS=" autoconf automake boost coreutils cppunit groff gettext libtool" + +PKG_VER=1.6.10 +SOURCE=" + https://deb.debian.org/debian/pool/main/s/schroot/schroot_$PKG_VER.orig.tar.xz +" + +ADDITIONAL=" + https://deb.debian.org/debian/pool/main/s/schroot/schroot_$PKG_VER-3+deb9u1.debian.tar.xz +busybox-compat.patch +getent.patch +getmntent.patch +musl.patch +pam.d.schroot.patch +remove-networks.patch +schroot-cppunit.patch +" + +prepare() { + apply_patches + + tar xf schroot_$PKG_VER-3+deb9u1.debian.tar.xz + + # shellcheck disable=SC2002 + cat "$BUILD_ROOT"/debian/patches/series | while read -r p; do + patch -p1 -i "$BUILD_ROOT"/debian/patches/"$p" + done + + # invalid sbuild_version + sed -i "s/@sbuild_version@/$PKG_VER/g" sbuild/sbuild.pc.in + + ./bootstrap +} + +build() { + ./configure \ + --prefix=/usr \ + --sysconfdir=/etc \ + --mandir=/usr/share/man \ + --localstatedir=/var \ + --enable-dchroot \ + --enable-lvm-snapshot \ + --enable-btrfs-snapshot \ + --with-bash-completion-dir=/usr/share/bash-completion/completions/ \ + BTRFS=/sbin/btrfs \ + BTRFSCTL=/sbin/btrfsctl \ + LVCREATE=/sbin/lvcreate \ + LVREMOVE=/sbin/lvremove + make +} + +package() { + make DESTDIR="$PKG_DEST" install +} + -- cgit v1.2.1