Github messages for voidlinux
 help / color / mirror / Atom feed
From: sgn <sgn@users.noreply.github.com>
To: ml@inbox.vuxu.org
Subject: Re: [PR PATCH] [Updated] vsrcextract
Date: Mon, 17 Jul 2023 05:01:19 +0200	[thread overview]
Message-ID: <20230717030119.GFeSWBnyjB1GEUoa4zw1-hjSdNaZ3FAplnTNNb5n1PI@z> (raw)
In-Reply-To: <gh-mailinglist-notifications-41a7ca26-5023-4802-975b-f1789d68868e-void-packages-44982@inbox.vuxu.org>

[-- Attachment #1: Type: text/plain, Size: 1228 bytes --]

There is an updated pull request by sgn against master on the void-packages repository

https://github.com/sgn/void-packages vsrcextract
https://github.com/void-linux/void-packages/pull/44982

vsrcextract
<!-- Uncomment relevant sections and delete options which are not applicable -->

#### Testing the changes
- I tested the changes in this PR: **briefly**

<!--
#### New package
- This new package conforms to the [package requirements](https://github.com/void-linux/void-packages/blob/master/CONTRIBUTING.md#package-requirements): **YES**|**NO**
-->

<!-- Note: If the build is likely to take more than 2 hours, please add ci skip tag as described in
https://github.com/void-linux/void-packages/blob/master/CONTRIBUTING.md#continuous-integration
and test at least one native build and, if supported, at least one cross build.
Ignore this section if this PR is not skipping CI.
-->
<!--
#### Local build testing
- I built this PR locally for my native architecture, (ARCH-LIBC)
- I built this PR locally for these architectures (if supported. mark crossbuilds):
  - aarch64-musl
  - armv7l
  - armv6l-musl
-->


A patch file from https://github.com/void-linux/void-packages/pull/44982.patch is attached

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-vsrcextract-44982.patch --]
[-- Type: text/x-diff, Size: 25265 bytes --]

From 09b0e767ac6b81cc0d3ed6537fdd4262ffdffead Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=C4=90o=C3=A0n=20Tr=E1=BA=A7n=20C=C3=B4ng=20Danh?=
 <congdanhqx@gmail.com>
Date: Tue, 11 Jul 2023 23:02:44 +0700
Subject: [PATCH 1/7] do-extract: move main logic into helper function

---
 common/environment/setup/archive.sh     | 164 ++++++++++++++++++++++++
 common/hooks/do-extract/00-distfiles.sh | 123 +-----------------
 2 files changed, 165 insertions(+), 122 deletions(-)
 create mode 100644 common/environment/setup/archive.sh

diff --git a/common/environment/setup/archive.sh b/common/environment/setup/archive.sh
new file mode 100644
index 0000000000000..161e2859cd9ab
--- /dev/null
+++ b/common/environment/setup/archive.sh
@@ -0,0 +1,164 @@
+vextract() {
+	local sc=--strip-components=1
+	local dst=
+	while [ "$#" -ne 1 ]; do
+		case "$1" in
+		-C)
+			if [ -z "$2" ]; then
+				msg_error "$pkgver: vextract -C <directory>.\n"
+			fi
+			dst="$2"
+			mkdir -p "$dst"
+			shift 2
+			;;
+		--no-strip-components)
+			sc=
+			shift
+			;;
+		--strip-components=*)
+			sc="$1"
+			shift
+			;;
+		--)
+			shift; break ;;
+		*)
+			break ;;
+		esac
+	done
+
+	local TAR_CMD sfx
+	local archive="$1"
+	local ret=0
+
+	TAR_CMD="$(command -v bsdtar)"
+	[ -z "$TAR_CMD" ] && TAR_CMD="$(command -v tar)"
+	[ -z "$TAR_CMD" ] && msg_error "xbps-src: no suitable tar cmd (bsdtar, tar)\n"
+	case "$archive" in
+	*.tar.lzma)   sfx="txz";;
+	*.tar.lz)     sfx="tlz";;
+	*.tlz)        sfx="tlz";;
+	*.tar.xz)     sfx="txz";;
+	*.txz)        sfx="txz";;
+	*.tar.bz2)    sfx="tbz";;
+	*.tbz)        sfx="tbz";;
+	*.tar.gz)     sfx="tgz";;
+	*.tgz)        sfx="tgz";;
+	*.tar.zst)    sfx="tzst";;
+	*.tzst)       sfx="tzst";;
+	*.gz)         sfx="gz";;
+	*.xz)         sfx="xz";;
+	*.bz2)        sfx="bz2";;
+	*.zst)        sfx="zst";;
+	*.tar)        sfx="tar";;
+	*.zip)        sfx="zip";;
+	*.rpm)        sfx="rpm";;
+	*.deb)        sfx="deb";;
+	*.patch)      sfx="txt";;
+	*.diff)       sfx="txt";;
+	*.txt)        sfx="txt";;
+	*.sh)         sfx="txt";;
+	*.7z)	      sfx="7z";;
+	*.gem)	      sfx="gem";;
+	*.crate)      sfx="crate";;
+	*) msg_error "$pkgver: unknown distfile suffix for $archive.\n";;
+	esac
+
+	case ${sfx} in
+	tar|txz|tbz|tlz|tgz|tzst|crate)
+		$TAR_CMD ${sc:+"$sc"} ${dst:+-C "$dst"} -x \
+			--no-same-permissions --no-same-owner \
+			-f $archive
+		;;
+	gz|bz2|xz|zst)
+		cp -f $archive "$dst"
+		(
+			if [ "$dst" ]; then cd "$dst"; fi
+			case ${sfx} in
+			gz)
+				gunzip -f $archive
+				;;
+			bz2)
+				bunzip2 -f $archive
+				;;
+			xz)
+				unxz -f $archive
+				;;
+			zst)
+				unzstd $archive
+				;;
+			esac
+		)
+		;;
+	zip)
+		if command -v unzip &>/dev/null; then
+			unzip -o -q $archive ${dst:+-d "$dst"}
+		elif command -v bsdtar &>/dev/null; then
+			bsdtar ${sc:+"$sc"} ${dst:+-C "$dst"} -xf $archive
+		else
+			msg_error "$pkgver: cannot find unzip or bsdtar bin for extraction.\n"
+		fi
+		;;
+	rpm)
+		if ! command -v bsdtar &>/dev/null; then
+			msg_error "$pkgver: cannot find bsdtar for extraction.\n"
+		fi
+		bsdtar ${sc:+"$sc"} ${dst:+-C "$dst"} -x \
+			--no-same-permissions --no-same-owner -f $archive
+		;;
+	deb)
+		if command -v bsdtar &>/dev/null; then
+			bsdtar -x -O -f "$archive" "data.tar.*" |
+			bsdtar ${sc:+"$sc"} ${dst:+-C "$dst"} -x \
+				--no-same-permissions --no-same-owner -f -
+		else
+			msg_error "$pkgver: cannot find bsdtar for extraction.\n"
+		fi
+		;;
+	txt)
+		cp -f $archive "$dst"
+		;;
+	7z)
+		if command -v 7z &>/dev/null; then
+			7z x $archive -o"$dst"
+		elif command -v bsdtar &>/dev/null; then
+			bsdtar ${sc:+"$sc"} ${dst:+-C "$dst"} -xf $archive
+		else
+			msg_error "$pkgver: cannot find 7z or bsdtar bin for extraction.\n"
+		fi
+		;;
+	gem)
+		$TAR_CMD -xOf $archive data.tar.gz |
+			$TAR_CMD ${sc:+"$sc"} ${dst:+-C "$dst"} -xz -f -
+		;;
+	*)
+		msg_error "$pkgver: cannot guess $archive extract suffix. ($sfx)\n"
+		;;
+	esac
+	if [ "$?" -ne 0 ]; then
+		msg_error "$pkgver: extracting $archive.\n"
+	fi
+}
+
+vsrcextract() {
+	local sc=--strip-components=1
+	local dst=
+	while [ "$#" -ge 1 ]; do
+		case "$1" in
+		-C)
+			if [ -z "$2" ]; then
+				msg_error "$pkgver: vextract -C <directory>.\n"
+			fi
+			dst="$2"
+			shift 2
+			;;
+		--no-strip-components|--strip-components=*)
+			sc="$1"
+			shift
+			;;
+		*)
+			break ;;
+		esac
+	done
+	vextract "$sc" ${dst:+-C "$dst"} \
+		"${XBPS_SRCDISTDIR}/${pkgname}-${version}/$1"
+}
diff --git a/common/hooks/do-extract/00-distfiles.sh b/common/hooks/do-extract/00-distfiles.sh
index 07e987a6862be..445346299e34d 100644
--- a/common/hooks/do-extract/00-distfiles.sh
+++ b/common/hooks/do-extract/00-distfiles.sh
@@ -45,128 +45,7 @@ hook() {
 			unset found
 			continue
 		fi
-
-		case $curfile in
-		*.tar.lzma)   cursufx="txz";;
-		*.tar.lz)     cursufx="tlz";;
-		*.tlz)        cursufx="tlz";;
-		*.tar.xz)     cursufx="txz";;
-		*.txz)        cursufx="txz";;
-		*.tar.bz2)    cursufx="tbz";;
-		*.tbz)        cursufx="tbz";;
-		*.tar.gz)     cursufx="tgz";;
-		*.tgz)        cursufx="tgz";;
-		*.tar.zst)    cursufx="tzst";;
-		*.tzst)       cursufx="tzst";;
-		*.gz)         cursufx="gz";;
-		*.xz)         cursufx="xz";;
-		*.bz2)        cursufx="bz2";;
-		*.zst)        cursufx="zst";;
-		*.tar)        cursufx="tar";;
-		*.zip)        cursufx="zip";;
-		*.rpm)        cursufx="rpm";;
-		*.deb)        cursufx="deb";;
-		*.patch)      cursufx="txt";;
-		*.diff)       cursufx="txt";;
-		*.txt)        cursufx="txt";;
-		*.sh)         cursufx="txt";;
-		*.7z)	      cursufx="7z";;
-		*.gem)	      cursufx="gem";;
-		*.crate)      cursufx="crate";;
-		*) msg_error "$pkgver: unknown distfile suffix for $curfile.\n";;
-		esac
-
-		case ${cursufx} in
-		tar|txz|tbz|tlz|tgz|tzst|crate)
-			$TAR_CMD -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
-			;;
-		gz|bz2|xz|zst)
-			cp -f $srcdir/$curfile "$extractdir"
-			cd "$extractdir"
-			case ${cursufx} in
-			gz)
-				gunzip -f $curfile
-				;;
-			bz2)
-				bunzip2 -f $curfile
-				;;
-			xz)
-				unxz -f $curfile
-				;;
-			zst)
-				unzstd $curfile
-				;;
-			esac
-			;;
-		zip)
-			if command -v unzip &>/dev/null; then
-				unzip -o -q $srcdir/$curfile -d "$extractdir"
-				if [ $? -ne 0 ]; then
-					msg_error "$pkgver: extracting $curfile into $XBPS_BUILDDIR.\n"
-				fi
-			elif command -v bsdtar &>/dev/null; then
-				bsdtar -xf $srcdir/$curfile -C "$extractdir"
-				if [ $? -ne 0 ]; then
-					msg_error "$pkgver: extracting $curfile into $XBPS_BUILDDIR.\n"
-				fi
-			else
-				msg_error "$pkgver: cannot find unzip or bsdtar bin for extraction.\n"
-			fi
-			;;
-		rpm)
-			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
-			;;
-		deb)
-			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
-				msg_error "$pkgver: cannot find bsdtar for extraction.\n"
-			fi
-			;;
-		txt)
-			cp -f $srcdir/$curfile "$extractdir"
-			;;
-		7z)
-			if command -v 7z &>/dev/null; then
-				7z x $srcdir/$curfile -o"$extractdir"
-				if [ $? -ne 0 ]; then
-					msg_error "$pkgver: extracting $curfile into $XBPS_BUILDDIR.\n"
-				fi
-			elif command -v bsdtar &>/dev/null; then
-				bsdtar -xf $srcdir/$curfile -C "$extractdir"
-				if [ $? -ne 0 ]; then
-					msg_error "$pkgver: extracting $curfile into $XBPS_BUILDDIR.\n"
-				fi
-			else
-				msg_error "$pkgver: cannot find 7z or bsdtar bin for extraction.\n"
-			fi
-			;;
-		gem)
-			innerdir="$extractdir/${wrksrc##*/}"
-			mkdir -p "$innerdir"
-			$TAR_CMD -xOf $srcdir/$curfile data.tar.gz |
-				$TAR_CMD -xz -C "$innerdir" -f -
-			if [ $? -ne 0 ]; then
-				msg_error "$pkgver: extracting $curfile into $XBPS_BUILDDIR.\n"
-			fi
-			;;
-		*)
-			msg_error "$pkgver: cannot guess $curfile extract suffix. ($cursufx)\n"
-			;;
-		esac
+		vsrcextract --no-strip-components -C "$extractdir" "$curfile"
 	done
 
 	cd "$extractdir"

From d871a5a6dc77eb379711976e31dd45da68c49013 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=C4=90o=C3=A0n=20Tr=E1=BA=A7n=20C=C3=B4ng=20Danh?=
 <congdanhqx@gmail.com>
Date: Tue, 11 Jul 2023 23:13:54 +0700
Subject: [PATCH 2/7] kexec-tools: drop custom do_extract

---
 common/environment/setup/archive.sh |  7 ++++++-
 srcpkgs/kexec-tools/template        | 10 ----------
 2 files changed, 6 insertions(+), 11 deletions(-)

diff --git a/common/environment/setup/archive.sh b/common/environment/setup/archive.sh
index 161e2859cd9ab..e1ca4c13956c6 100644
--- a/common/environment/setup/archive.sh
+++ b/common/environment/setup/archive.sh
@@ -30,7 +30,12 @@ vextract() {
 	local archive="$1"
 	local ret=0
 
-	TAR_CMD="$(command -v bsdtar)"
+	# When tar is explicitly put in hostmakedepends
+	# if tar is eol, it might work or not
+	case " $hostmakedepends " in
+	*" tar "*)   TAR_CMD="tar" ;;
+	esac
+	[ -z "$TAR_CMD" ] && TAR_CMD="$(command -v bsdtar)"
 	[ -z "$TAR_CMD" ] && TAR_CMD="$(command -v tar)"
 	[ -z "$TAR_CMD" ] && msg_error "xbps-src: no suitable tar cmd (bsdtar, tar)\n"
 	case "$archive" in
diff --git a/srcpkgs/kexec-tools/template b/srcpkgs/kexec-tools/template
index 6bd5b65e18206..aa68b6f60a56f 100644
--- a/srcpkgs/kexec-tools/template
+++ b/srcpkgs/kexec-tools/template
@@ -2,7 +2,6 @@
 pkgname=kexec-tools
 version=2.0.26
 revision=1
-create_wrksrc=yes
 build_style=gnu-configure
 hostmakedepends="tar xz"
 makedepends="zlib-devel liblzma-devel"
@@ -12,7 +11,6 @@ license="GPL-2.0-only"
 homepage="http://kernel.org/pub/linux/utils/kernel/kexec/"
 distfiles="${KERNEL_SITE}/utils/kernel/kexec/${pkgname}-${version}.tar.xz"
 checksum=7fe36a064101cd5c515e41b2be393dce3ca88adce59d6ee668e0af7c0c4570cd
-skip_extraction="${pkgname}-${version}.tar.xz"
 
 CFLAGS="-fcommon"
 
@@ -20,14 +18,6 @@ case "$XBPS_TARGET_MACHINE" in
 	ppc-musl) nopie=yes;; # textrels not supported
 esac
 
-do_extract() {
-	# bsdtar fails to extract version 2.0.20 tarball which
-	# contains (buggy) hard links from files to themselves.
-	tar --strip-components 1 --no-same-owner --extract --file \
-		${XBPS_SRCDISTDIR}/${pkgname}-${version}/${pkgname}-${version}.tar.xz \
-		--directory ${wrksrc}
-}
-
 pre_build() {
 	rm ${XBPS_WRAPPERDIR}/strip
 	case "$XBPS_TARGET_MACHINE" in

From 167b0d84c0a00452c1d8c9abf9b54314ff57371c Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=C4=90o=C3=A0n=20Tr=E1=BA=A7n=20C=C3=B4ng=20Danh?=
 <congdanhqx@gmail.com>
Date: Tue, 11 Jul 2023 23:46:41 +0700
Subject: [PATCH 3/7] epson-inkjet-printer-escpr2: abstract bsdtar usage

---
 srcpkgs/epson-inkjet-printer-escpr2/template | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/srcpkgs/epson-inkjet-printer-escpr2/template b/srcpkgs/epson-inkjet-printer-escpr2/template
index 6fa318254b1e8..818217056b926 100644
--- a/srcpkgs/epson-inkjet-printer-escpr2/template
+++ b/srcpkgs/epson-inkjet-printer-escpr2/template
@@ -18,8 +18,7 @@ restricted=yes
 repository=nonfree
 
 post_extract() {
-	bsdtar --strip-components=1 -xf \
-		epson-inkjet-printer-escpr2-${version}-1lsb3.2.tar.gz
+	vextract epson-inkjet-printer-escpr2-${version}-1lsb3.2.tar.gz
 }
 
 post_install() {

From caf9c493a31035118fdcb16f7e6de82e28678ca0 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=C4=90o=C3=A0n=20Tr=E1=BA=A7n=20C=C3=B4ng=20Danh?=
 <congdanhqx@gmail.com>
Date: Tue, 11 Jul 2023 23:47:16 +0700
Subject: [PATCH 4/7] qbittorrent: hide bsdtar usage

---
 srcpkgs/qbittorrent/template | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/srcpkgs/qbittorrent/template b/srcpkgs/qbittorrent/template
index c5067b733ac48..87d58e8a502e1 100644
--- a/srcpkgs/qbittorrent/template
+++ b/srcpkgs/qbittorrent/template
@@ -22,8 +22,8 @@ CXXFLAGS=-std=gnu++17
 do_extract() {
 	local n=${pkgname}-${version}
 	mkdir -p build-nox build-x11
-	bsdtar xf ${XBPS_SRCDISTDIR}/${n}/${n}.tar.xz --strip-components=1 -C build-x11
-	bsdtar xf ${XBPS_SRCDISTDIR}/${n}/${n}.tar.xz --strip-components=1 -C build-nox
+	vsrcextract -C build-x11 ${n}.tar.xz
+	vsrcextract -C build-nox ${n}.tar.xz
 }
 
 do_configure() {

From 6ae315af1d7604d8f9cab156ca54d9868393cbfc Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=C4=90o=C3=A0n=20Tr=E1=BA=A7n=20C=C3=B4ng=20Danh?=
 <congdanhqx@gmail.com>
Date: Wed, 12 Jul 2023 00:08:14 +0700
Subject: [PATCH 5/7] mozc: use new vsrcextract

---
 srcpkgs/mozc/patches/abseil.patch      | 12 +++++-----
 srcpkgs/mozc/patches/common.patch      |  4 ++--
 srcpkgs/mozc/patches/cross.patch       |  4 ++--
 srcpkgs/mozc/patches/cxx-stdlib.patch  |  4 ++--
 srcpkgs/mozc/patches/fcitx.patch       |  4 ++--
 srcpkgs/mozc/patches/latomic.patch     | 32 +++++++++++++-------------
 srcpkgs/mozc/patches/no-parallel.patch |  4 ++--
 srcpkgs/mozc/template                  | 25 ++++++++------------
 8 files changed, 42 insertions(+), 47 deletions(-)

diff --git a/srcpkgs/mozc/patches/abseil.patch b/srcpkgs/mozc/patches/abseil.patch
index a41507550f950..2702158f3b483 100644
--- a/srcpkgs/mozc/patches/abseil.patch
+++ b/srcpkgs/mozc/patches/abseil.patch
@@ -7,8 +7,8 @@ An all-in-one patch that fixes several issues:
 2) powerpc stacktrace implementation only works on glibc (disabled on musl)
 4) examine_stack.cpp makes glibc assumptions on powerpc (fixed)
 
---- a/abseil-cpp/absl/base/internal/unscaledcycleclock.h
-+++ b/abseil-cpp/absl/base/internal/unscaledcycleclock.h
+--- a/src/third_party/abseil-cpp/absl/base/internal/unscaledcycleclock.h
++++ b/src/third_party/abseil-cpp/absl/base/internal/unscaledcycleclock.h
 @@ -46,8 +46,8 @@
  
  // The following platforms have an implementation of a hardware counter.
@@ -20,8 +20,8 @@ An all-in-one patch that fixes several issues:
  #define ABSL_HAVE_UNSCALED_CYCLECLOCK_IMPLEMENTATION 1
  #else
  #define ABSL_HAVE_UNSCALED_CYCLECLOCK_IMPLEMENTATION 0
---- a/abseil-cpp/absl/debugging/internal/examine_stack.cc
-+++ b/abseil-cpp/absl/debugging/internal/examine_stack.cc
+--- a/src/third_party/abseil-cpp/absl/debugging/internal/examine_stack.cc
++++ b/src/third_party/abseil-cpp/absl/debugging/internal/examine_stack.cc
 @@ -27,6 +27,10 @@
  #include <csignal>
  #include <cstdio>
@@ -45,8 +45,8 @@ An all-in-one patch that fixes several issues:
  #elif defined(__riscv)
      return reinterpret_cast<void*>(context->uc_mcontext.__gregs[REG_PC]);
  #elif defined(__s390__) && !defined(__s390x__)
---- a/abseil-cpp/absl/debugging/internal/stacktrace_config.h
-+++ b/abseil-cpp/absl/debugging/internal/stacktrace_config.h
+--- a/src/third_party/abseil-cpp/absl/debugging/internal/stacktrace_config.h
++++ b/src/third_party/abseil-cpp/absl/debugging/internal/stacktrace_config.h
 @@ -59,7 +59,7 @@
  #elif defined(__i386__) || defined(__x86_64__)
  #define ABSL_STACKTRACE_INL_HEADER \
diff --git a/srcpkgs/mozc/patches/common.patch b/srcpkgs/mozc/patches/common.patch
index 1b7bb395948bf..2754cf4694319 100644
--- a/srcpkgs/mozc/patches/common.patch
+++ b/srcpkgs/mozc/patches/common.patch
@@ -1,5 +1,5 @@
---- a/mozc/src/config.bzl
-+++ b/mozc/src/config.bzl
+--- a/src/config.bzl
++++ b/src/config.bzl
 @@ -34,7 +34,7 @@ LINUX_MOZC_SERVER_DIR = "/usr/lib/mozc"
  LINUX_MOZC_DOCUMENT_DIR = LINUX_MOZC_SERVER_DIR + "/documents"
  IBUS_MOZC_INSTALL_DIR = "/usr/share/ibus-mozc"
diff --git a/srcpkgs/mozc/patches/cross.patch b/srcpkgs/mozc/patches/cross.patch
index a7e38fd9b346e..c4b5cba7dd28a 100644
--- a/srcpkgs/mozc/patches/cross.patch
+++ b/srcpkgs/mozc/patches/cross.patch
@@ -1,5 +1,5 @@
---- a/mozc/src/gyp/common.gypi
-+++ b/mozc/src/gyp/common.gypi
+--- a/src/gyp/common.gypi
++++ b/src/gyp/common.gypi
 @@ -409,12 +409,12 @@
    'conditions': [
      ['target_platform=="Linux"', {
diff --git a/srcpkgs/mozc/patches/cxx-stdlib.patch b/srcpkgs/mozc/patches/cxx-stdlib.patch
index 0b77ea1f052c5..6c61061a2bde5 100644
--- a/srcpkgs/mozc/patches/cxx-stdlib.patch
+++ b/srcpkgs/mozc/patches/cxx-stdlib.patch
@@ -1,5 +1,5 @@
---- a/mozc/src/gyp/common.gypi
-+++ b/mozc/src/gyp/common.gypi
+--- a/src/gyp/common.gypi
++++ b/src/gyp/common.gypi
 @@ -73,9 +73,6 @@
        '-Wno-deprecated-declarations',
        '-Wwrite-strings',
diff --git a/srcpkgs/mozc/patches/fcitx.patch b/srcpkgs/mozc/patches/fcitx.patch
index 720e6b2c2c27a..01f85749d5419 100644
--- a/srcpkgs/mozc/patches/fcitx.patch
+++ b/srcpkgs/mozc/patches/fcitx.patch
@@ -1,5 +1,5 @@
---- a/mozc/src/unix/fcitx/fcitx.gyp
-+++ b/mozc/src/unix/fcitx/fcitx.gyp
+--- a/src/unix/fcitx/fcitx.gyp
++++ b/src/unix/fcitx/fcitx.gyp
 @@ -96,7 +96,7 @@
          '<@(fcitx_dep_include_dirs)',
        ],
diff --git a/srcpkgs/mozc/patches/latomic.patch b/srcpkgs/mozc/patches/latomic.patch
index 1d3aab9ab9049..99d979ed3616b 100644
--- a/srcpkgs/mozc/patches/latomic.patch
+++ b/srcpkgs/mozc/patches/latomic.patch
@@ -1,5 +1,5 @@
---- a/mozc/src/gui/gui.gyp
-+++ b/mozc/src/gui/gui.gyp
+--- a/src/gui/gui.gyp
++++ b/src/gui/gui.gyp
 @@ -794,6 +794,13 @@
              'tool/mozc_tool_main_noqt.cc',
            ],
@@ -14,8 +14,8 @@
          # For Mac, ConfigDialog is the host app for necessary frameworks.
          ['OS=="win"', {
            'product_name': '<(tool_product_name_win)',
---- a/mozc/src/gyp/defines.gypi
-+++ b/mozc/src/gyp/defines.gypi
+--- a/src/gyp/defines.gypi
++++ b/src/gyp/defines.gypi
 @@ -68,6 +68,9 @@
      # use_libibus represents if ibus library is used or not.
      # This option is only for Linux.
@@ -26,8 +26,8 @@
    },
    'target_defaults': {
      'defines': [
---- a/mozc/src/renderer/renderer.gyp
-+++ b/mozc/src/renderer/renderer.gyp
+--- a/src/renderer/renderer.gyp
++++ b/src/renderer/renderer.gyp
 @@ -600,6 +600,15 @@
              '../base/base.gyp:crash_report_handler',
              'mozc_renderer_lib',
@@ -44,8 +44,8 @@
          },
          {
            'target_name': 'gtk_renderer_test',
---- a/mozc/src/server/server.gyp
-+++ b/mozc/src/server/server.gyp
+--- a/src/server/server.gyp
++++ b/src/server/server.gyp
 @@ -55,6 +55,13 @@
          'mozc_server_lib',
        ],
@@ -60,8 +60,8 @@
          ['OS=="mac"', {
            'product_name': '<(branding)Converter',
            'sources': [
---- a/mozc/src/unix/emacs/emacs.gyp
-+++ b/mozc/src/unix/emacs/emacs.gyp
+--- a/src/unix/emacs/emacs.gyp
++++ b/src/unix/emacs/emacs.gyp
 @@ -47,6 +47,15 @@
          '../../protocol/protocol.gyp:config_proto',
          'mozc_emacs_helper_lib',
@@ -78,8 +78,8 @@
      },
      {
        'target_name': 'mozc_emacs_helper_lib',
---- a/mozc/src/unix/fcitx/fcitx.gyp
-+++ b/mozc/src/unix/fcitx/fcitx.gyp
+--- a/src/unix/fcitx/fcitx.gyp
++++ b/src/unix/fcitx/fcitx.gyp
 @@ -98,6 +98,15 @@
        'defines': [
          'LOCALEDIR="/usr/share/locale/"',
@@ -96,8 +96,8 @@
      },
    ],
    }, {
---- a/mozc/src/unix/fcitx5/fcitx5.gyp
-+++ b/mozc/src/unix/fcitx5/fcitx5.gyp
+--- a/src/unix/fcitx5/fcitx5.gyp
++++ b/src/unix/fcitx5/fcitx5.gyp
 @@ -105,6 +105,15 @@
        'defines': [
          'FCITX_GETTEXT_DOMAIN="fcitx5-mozc"',
@@ -114,8 +114,8 @@
      },
    ],
    }, {
---- a/mozc/src/unix/ibus/ibus.gyp
-+++ b/mozc/src/unix/ibus/ibus.gyp
+--- a/src/unix/ibus/ibus.gyp
++++ b/src/unix/ibus/ibus.gyp
 @@ -241,6 +241,15 @@
          'ibus_mozc_lib',
          'ibus_mozc_metadata',
diff --git a/srcpkgs/mozc/patches/no-parallel.patch b/srcpkgs/mozc/patches/no-parallel.patch
index 9220808c9b319..54a5a76dae650 100644
--- a/srcpkgs/mozc/patches/no-parallel.patch
+++ b/srcpkgs/mozc/patches/no-parallel.patch
@@ -1,5 +1,5 @@
---- a/mozc/src/build_mozc.py
-+++ b/mozc/src/build_mozc.py
+--- a/src/build_mozc.py
++++ b/src/build_mozc.py
 @@ -494,6 +494,7 @@ def GypMain(options, unused_args):
    gyp_options.extend(['--generator-output=.'])
    short_basename = GetBuildShortBaseName(target_platform)
diff --git a/srcpkgs/mozc/template b/srcpkgs/mozc/template
index 3fdb986b3213c..4c4e67baa440f 100644
--- a/srcpkgs/mozc/template
+++ b/srcpkgs/mozc/template
@@ -8,8 +8,7 @@ _commit=056163a5fddbb261b258beb8444998e4882f0cc5
 _abseil=20211102.0
 _gyp=0.1+20220404git9ecf45e
 _jpn_dict=e5b3425575734c323e1d947009dd74709437b684
-create_wrksrc=yes
-build_wrksrc=mozc/src
+build_wrksrc=src
 hostmakedepends="gettext ninja pkg-config protobuf protobuf-devel
  python3-six which qt5-qmake qt5-host-tools"
 makedepends="gtk+-devel ibus-devel libzinnia-devel protobuf-devel qt5-devel
@@ -32,6 +31,11 @@ checksum="259d87bfd7535ad03bd554185677d7345a90166353a6db0b6a3606183ad2923d
 
 CXXFLAGS="-D_GNU_SOURCE"
 lib32disabled=yes
+skip_extraction="
+ $_abseil.tar.gz
+ gyp_$_gyp.orig.tar.xz
+ $_jpn_dict.tar.gz
+"
 
 if [ "$XBPS_TARGET_ENDIAN" = "be" ]; then
 	broken="Does not build"
@@ -42,19 +46,10 @@ if [ "$XBPS_TARGET_NO_ATOMIC8" ]; then
 fi
 
 post_extract() {
-	mv mozc-* mozc
-
-	# symlink "submodules" into place
-	for _src_dest in gyp \
-		abseil-cpp \
-		japanese-usage-dictionary:japanese_usage_dictionary
-	do
-		_src=${_src_dest%:*}
-		_dst=${_src_dest#*:}
-		mv $_src-* $_dst
-		rmdir mozc/src/third_party/$_dst
-		ln -sr $_dst mozc/src/third_party
-	done
+	vsrcextract -C src/third_party/abseil-cpp "$_abseil.tar.gz"
+	vsrcextract -C src/third_party/gyp "gyp_$_gyp.orig.tar.xz"
+	vsrcextract -C src/third_party/japanese_usage_dictionary \
+		"$_jpn_dict.tar.gz"
 }
 
 do_configure() {

From 6077c6338f31e578839ff234a4d8c08fff468a98 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=C4=90o=C3=A0n=20Tr=E1=BA=A7n=20C=C3=B4ng=20Danh?=
 <congdanhqx@gmail.com>
Date: Wed, 12 Jul 2023 12:42:07 +0700
Subject: [PATCH 6/7] xen: use vsrcextract

---
 common/environment/setup/archive.sh | 17 +++++++++++++++++
 srcpkgs/xen/template                | 28 ++++++++++++----------------
 2 files changed, 29 insertions(+), 16 deletions(-)

diff --git a/common/environment/setup/archive.sh b/common/environment/setup/archive.sh
index e1ca4c13956c6..a04669ee9da19 100644
--- a/common/environment/setup/archive.sh
+++ b/common/environment/setup/archive.sh
@@ -167,3 +167,20 @@ vsrcextract() {
 	vextract "$sc" ${dst:+-C "$dst"} \
 		"${XBPS_SRCDISTDIR}/${pkgname}-${version}/$1"
 }
+
+vtar() {
+	bsdtar "$@"
+}
+
+vsrccopy() {
+	local _tgt
+	if [ $# -lt 2 ]; then
+		msg_error "vsrccopy <file>... <target>"
+	fi
+	_tgt="${@:-1}"
+	mkdir -p "$_tgt"
+	while [ $# -gt 1 ]; do
+		cp -a "${XBPS_SRCDISTDIR}/${pkgname}-${version}/$1" "$_tgt"
+		shift
+	done
+}
diff --git a/srcpkgs/xen/template b/srcpkgs/xen/template
index 160db8e659295..9f08f0eb13868 100644
--- a/srcpkgs/xen/template
+++ b/srcpkgs/xen/template
@@ -104,15 +104,11 @@ conf_files="
  /etc/xen/xl.conf"
 
 post_extract() {
-	local _src="${XBPS_SRCDISTDIR}/${pkgname}-${version}"
-
 	msg_normal "Extracting etherboot ipxe files ...\n"
 	mkdir tools/firmware/etherboot/ipxe
-	tar --strip-components=1 -x \
-		-f ${_src}/${_git_tag_ipxe}.tar.gz \
-		-C tools/firmware/etherboot/ipxe/
+	vsrcextract -C tools/firmware/etherboot/ipxe ${_git_tag_ipxe}.tar.gz
 	# Create a tarball w/o the git tag
-	tar -czf tools/firmware/etherboot/ipxe.tar.gz \
+	vtar -czf tools/firmware/etherboot/ipxe.tar.gz \
 		-C tools/firmware/etherboot/ ipxe
 
 	if [ "$build_option_stubdom" ]; then
@@ -121,16 +117,16 @@ post_extract() {
 			-e"/RAW_ADDR/s/(int) grub_scratch_mem/(long) grub_scratch_mem/"
 		mkdir -p stubdom/mini-os-x86_64-grub/{arch/x86,console,lib,xenbus}
 		msg_normal "Copying stubdom files ...\n"
-		cp -pv \
-			${_src}/grub-${_grub_version}.tar.gz \
-			${_src}/gmp-${_gmp_version}.tar.bz2 \
-			${_src}/zlib-${_zlib_version}.tar.gz \
-			${_src}/lwip-${_lwip_version}.tar.gz \
-			${_src}/polarssl-${_polarssl_version}-gpl.tgz \
-			${_src}/newlib-${_newlib_version}.tar.gz \
-			${_src}/pciutils-${_libpci_version}.tar.bz2 \
-			${_src}/tpm_emulator-${_tpmemu_version}.tar.gz \
-			${_src}/ocaml-${_ocaml_version}.tar.gz \
+		vsrccopy \
+			grub-${_grub_version}.tar.gz \
+			gmp-${_gmp_version}.tar.bz2 \
+			zlib-${_zlib_version}.tar.gz \
+			lwip-${_lwip_version}.tar.gz \
+			polarssl-${_polarssl_version}-gpl.tgz \
+			newlib-${_newlib_version}.tar.gz \
+			pciutils-${_libpci_version}.tar.bz2 \
+			tpm_emulator-${_tpmemu_version}.tar.gz \
+			ocaml-${_ocaml_version}.tar.gz \
 			stubdom/
 	fi
 }

From 0664f3f69be11e9580d366e81f570f127ad79883 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=C4=90o=C3=A0n=20Tr=E1=BA=A7n=20C=C3=B4ng=20Danh?=
 <sgn.danh@gmail.com>
Date: Mon, 17 Jul 2023 10:01:17 +0700
Subject: [PATCH 7/7] Update common/environment/setup/archive.sh

Co-authored-by: classabbyamp <5366828+classabbyamp@users.noreply.github.com>
---
 common/environment/setup/archive.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/common/environment/setup/archive.sh b/common/environment/setup/archive.sh
index a04669ee9da19..96eefc0bbb78c 100644
--- a/common/environment/setup/archive.sh
+++ b/common/environment/setup/archive.sh
@@ -151,7 +151,7 @@ vsrcextract() {
 		case "$1" in
 		-C)
 			if [ -z "$2" ]; then
-				msg_error "$pkgver: vextract -C <directory>.\n"
+				msg_error "$pkgver: vsrcextract -C <directory>.\n"
 			fi
 			dst="$2"
 			shift 2

  parent reply	other threads:[~2023-07-17  3:01 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-07-11 17:11 [PR PATCH] vsrcextract sgn
2023-07-11 23:43 ` [PR REVIEW] vsrcextract classabbyamp
2023-07-11 23:44 ` classabbyamp
2023-07-12  6:00 ` [PR PATCH] [Updated] vsrcextract sgn
2023-07-12 18:37 ` [PR REVIEW] vsrcextract classabbyamp
2023-07-17  3:01 ` sgn [this message]
2023-07-28 16:04 ` [PR PATCH] [Updated] vsrcextract sgn
2023-08-01 13:32 ` sgn
2023-08-21  4:27 ` [PR PATCH] [Merged]: vsrcextract sgn

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230717030119.GFeSWBnyjB1GEUoa4zw1-hjSdNaZ3FAplnTNNb5n1PI@z \
    --to=sgn@users.noreply.github.com \
    --cc=ml@inbox.vuxu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).