From 439ee1e44f661de6df79ea82553e7eea92566be7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C4=90o=C3=A0n=20Tr=E1=BA=A7n=20C=C3=B4ng=20Danh?= Date: Wed, 9 Nov 2022 19:36:30 +0700 Subject: [PATCH 1/4] do-extract: extract rpm with bsdtar, too --- common/hooks/do-extract/00-distfiles.sh | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/common/hooks/do-extract/00-distfiles.sh b/common/hooks/do-extract/00-distfiles.sh index c173fe2af1ea..9147811f95ef 100644 --- a/common/hooks/do-extract/00-distfiles.sh +++ b/common/hooks/do-extract/00-distfiles.sh @@ -110,14 +110,12 @@ hook() { fi ;; rpm) - if command -v rpmextract &>/dev/null; then - cd "$extractdir" - rpmextract $srcdir/$curfile - if [ $? -ne 0 ]; then - msg_error "$pkgver: extracting $curfile into $XBPS_BUILDDIR.\n" - fi - else - msg_error "$pkgver: cannot find rpmextract for extraction.\n" + if ! command -v bsdtar &>/dev/null; then + msg_error "$pkgver: cannot find bsdtar for extraction.\n" + fi + bsdtar -x --no-same-permissions --no-same-owner -f $srcdir/$curfile -C "$extractdir" + if [ $? -ne 0 ]; then + msg_error "$pkgver: extracting $curfile into $XBPS_BUILDDIR.\n" fi ;; txt) From 2819763bb26707e11e09c7954ce9b1fb8b459f92 Mon Sep 17 00:00:00 2001 From: classabbyamp Date: Tue, 8 Nov 2022 22:36:31 -0500 Subject: [PATCH 2/4] common/hooks/do-extract/00-distfiles.sh: support deb files --- common/hooks/do-extract/00-distfiles.sh | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/common/hooks/do-extract/00-distfiles.sh b/common/hooks/do-extract/00-distfiles.sh index 9147811f95ef..1749bfb08ecc 100644 --- a/common/hooks/do-extract/00-distfiles.sh +++ b/common/hooks/do-extract/00-distfiles.sh @@ -3,7 +3,7 @@ hook() { local srcdir="$XBPS_SRCDISTDIR/$pkgname-$version" - local f j curfile found extractdir innerdir num_dirs + local f j curfile found extractdir innerdir innerfile num_dirs local TAR_CMD if [ -z "$distfiles" -a -z "$checksum" ]; then @@ -62,6 +62,7 @@ hook() { *.tar) cursufx="tar";; *.zip) cursufx="zip";; *.rpm) cursufx="rpm";; + *.deb) cursufx="deb";; *.patch) cursufx="txt";; *.diff) cursufx="txt";; *.txt) cursufx="txt";; @@ -84,7 +85,7 @@ hook() { cd "$extractdir" case ${cursufx} in gz) - gunzip -f $curfile + gunzip -f $curfile ;; bz2) bunzip2 -f $curfile @@ -118,6 +119,23 @@ hook() { msg_error "$pkgver: extracting $curfile into $XBPS_BUILDDIR.\n" fi ;; + deb) + cd "$extractdir" + innerfile="$(ar t $srcdir/$curfile | grep '^data\.tar')" + if [ $? -ne 0 ]; then + msg_error "$pkgver: unable to find data archive inside $curfile.\n" + fi + ar x "$srcdir/$curfile" "$innerfile" + if [ $? -ne 0 ]; then + msg_error "$pkgver: extracting $curfile into $XBPS_BUILDDIR.\n" + fi + mkdir -p "${curfile%.deb}" + $TAR_CMD -x --no-same-permissions --no-same-owner -f "${innerfile}" -C "${curfile%.deb}" + if [ $? -ne 0 ]; then + msg_error "$pkgver: extracting $innerfile from $curfile into $XBPS_BUILDDIR.\n" + fi + rm "${innerfile}" + ;; txt) cp -f $srcdir/$curfile "$extractdir" ;; From ee38344dde34215725af8ca9c94cefd08ac318ae Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C4=90o=C3=A0n=20Tr=E1=BA=A7n=20C=C3=B4ng=20Danh?= Date: Wed, 9 Nov 2022 18:11:09 +0700 Subject: [PATCH 3/4] fixup! common/hooks/do-extract/00-distfiles.sh: support deb files --- common/hooks/do-extract/00-distfiles.sh | 34 +++++++++++++++---------- 1 file changed, 20 insertions(+), 14 deletions(-) diff --git a/common/hooks/do-extract/00-distfiles.sh b/common/hooks/do-extract/00-distfiles.sh index 1749bfb08ecc..583a2869b8e5 100644 --- a/common/hooks/do-extract/00-distfiles.sh +++ b/common/hooks/do-extract/00-distfiles.sh @@ -120,21 +120,27 @@ hook() { fi ;; deb) - cd "$extractdir" - innerfile="$(ar t $srcdir/$curfile | grep '^data\.tar')" - if [ $? -ne 0 ]; then - msg_error "$pkgver: unable to find data archive inside $curfile.\n" - fi - ar x "$srcdir/$curfile" "$innerfile" - if [ $? -ne 0 ]; then - msg_error "$pkgver: extracting $curfile into $XBPS_BUILDDIR.\n" - fi - mkdir -p "${curfile%.deb}" - $TAR_CMD -x --no-same-permissions --no-same-owner -f "${innerfile}" -C "${curfile%.deb}" - if [ $? -ne 0 ]; then - msg_error "$pkgver: extracting $innerfile from $curfile into $XBPS_BUILDDIR.\n" + if command -v bsdtar &>/dev/null; then + bsdtar -x -O -f "$srcdir/$curfile" "data.tar.*" | + bsdtar -C "$extractdir" -x --no-same-permissions --no-same-owner + if [ $? -ne 0 ]; then + msg_error "$pkgver: extracting $curfile into $XBPS_BUILDDIR.\n" + fi + else + ( + cd "$extractdir" + if innerfile="$(ar t $srcdir/$curfile | grep '^data\.tar')"; then + msg_error "$pkgver: unable to find data archive inside $curfile.\n" + fi + if ! ar x "$srcdir/$curfile" "$innerfile"; then + msg_error "$pkgver: extracting $curfile into $XBPS_BUILDDIR.\n" + fi + if ! $TAR_CMD -x --no-same-permissions --no-same-owner -f "${innerfile}"; then + msg_error "$pkgver: extracting $innerfile from $curfile into $XBPS_BUILDDIR.\n" + fi + rm "${innerfile}" + ) fi - rm "${innerfile}" ;; txt) cp -f $srcdir/$curfile "$extractdir" From 96fa2d771d30ce0612c4c89981dc81c1812a9e41 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C4=90o=C3=A0n=20Tr=E1=BA=A7n=20C=C3=B4ng=20Danh?= Date: Wed, 9 Nov 2022 19:37:24 +0700 Subject: [PATCH 4/4] fixup! common/hooks/do-extract/00-distfiles.sh: support deb files --- common/hooks/do-extract/00-distfiles.sh | 14 +------------- 1 file changed, 1 insertion(+), 13 deletions(-) diff --git a/common/hooks/do-extract/00-distfiles.sh b/common/hooks/do-extract/00-distfiles.sh index 583a2869b8e5..14503de3ed76 100644 --- a/common/hooks/do-extract/00-distfiles.sh +++ b/common/hooks/do-extract/00-distfiles.sh @@ -127,19 +127,7 @@ hook() { msg_error "$pkgver: extracting $curfile into $XBPS_BUILDDIR.\n" fi else - ( - cd "$extractdir" - if innerfile="$(ar t $srcdir/$curfile | grep '^data\.tar')"; then - msg_error "$pkgver: unable to find data archive inside $curfile.\n" - fi - if ! ar x "$srcdir/$curfile" "$innerfile"; then - msg_error "$pkgver: extracting $curfile into $XBPS_BUILDDIR.\n" - fi - if ! $TAR_CMD -x --no-same-permissions --no-same-owner -f "${innerfile}"; then - msg_error "$pkgver: extracting $innerfile from $curfile into $XBPS_BUILDDIR.\n" - fi - rm "${innerfile}" - ) + msg_error "$pkgver: cannot find bsdtar for extraction.\n" fi ;; txt)