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] do-extract: Don't create extra layer for single directory with other files in top-level
Date: Thu, 05 Jan 2023 03:24:31 +0100	[thread overview]
Message-ID: <20230105022431.a-7OjIrk25qUmeY0koOSq6Loe7YStYIyF1kUkmZfgIY@z> (raw)
In-Reply-To: <gh-mailinglist-notifications-41a7ca26-5023-4802-975b-f1789d68868e-void-packages-40409@inbox.vuxu.org>

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

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

https://github.com/sgn/void-packages do-extract-reduce-layer
https://github.com/void-linux/void-packages/pull/40409

do-extract: Don't create extra layer for single directory with other files in top-level
<!-- Uncomment relevant sections and delete options which are not applicable -->

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

<!--
#### 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/40409.patch is attached

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-do-extract-reduce-layer-40409.patch --]
[-- Type: text/x-diff, Size: 10281 bytes --]

From 33a52f4be49ed3bce8031ce427e9228d1838b36f 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: Thu, 5 Jan 2023 09:13:55 +0700
Subject: [PATCH 1/3] do-extract: change cwd to $extractdir to check number of
 files

In order to simplify the next change, to simplify the processing steps
for PHP and/or Macintosh metadata.
---
 common/hooks/do-extract/00-distfiles.sh | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/common/hooks/do-extract/00-distfiles.sh b/common/hooks/do-extract/00-distfiles.sh
index 14503de3ed76..22fcb2eec24d 100644
--- a/common/hooks/do-extract/00-distfiles.sh
+++ b/common/hooks/do-extract/00-distfiles.sh
@@ -163,13 +163,14 @@ hook() {
 		esac
 	done
 
+	cd "$extractdir"
 	# find "$extractdir" -mindepth 1 -maxdepth 1 -printf '1\n' | wc -l
 	# However, it requires GNU's find
 	num_dirs=0
-	for f in "$extractdir"/* "$extractdir"/.*; do
+	for f in * .*; do
 		if [ -e "$f" ] || [ -L "$f" ]; then
 			case "$f" in
-			*/. | */..) ;;
+			. | ..) ;;
 			*)
 				innerdir="$f"
 				num_dirs=$(( num_dirs + 1 ))
@@ -178,6 +179,8 @@ hook() {
 		fi
 	done
 	rm -rf "$wrksrc"
+	innerdir="$extractdir/$innerdir"
+	cd "$XBPS_BUILDDIR"
 	if [ "$num_dirs" = 1 ] && [ -d "$innerdir" ] && [ -z "$create_wrksrc" ]; then
 		# rename the subdirectory (top-level of distfiles) to $wrksrc
 		mv "$innerdir" "$wrksrc" &&

From 316dea0499923cc30d48616fe0bfec1101828106 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, 9 Nov 2022 18:54:00 +0700
Subject: [PATCH 2/3] do-extract: don't add layer for Macintosh and php
 metadata

Some softwares insisted on have some manifest in top-level directory,
like package.xml for php packages. Some other packages was zipped on
macOS, which will insert some macOS metadata files into zoom.

See-also: dc73556cf3 and its parents.
See-also: 94fe74e506

Those files doesn't justify the need of adding a layer automatically
in extraction step.

Let's move them up.
---
 common/hooks/do-extract/00-distfiles.sh | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)

diff --git a/common/hooks/do-extract/00-distfiles.sh b/common/hooks/do-extract/00-distfiles.sh
index 22fcb2eec24d..13d42fd9b328 100644
--- a/common/hooks/do-extract/00-distfiles.sh
+++ b/common/hooks/do-extract/00-distfiles.sh
@@ -178,6 +178,26 @@ hook() {
 			esac
 		fi
 	done
+	# Special case for num_dirs = 2, and it contains metadata
+	if [ "$num_dirs" != 2 ] || [ "$create_wrksrc" ]; then
+		:
+	elif grep -q 'xmlns="http://pear[.]php[.]net/dtd/package' package.xml 2>/dev/null
+	then
+		# PHP modules' metadata
+		rm -f package.xml
+		for f in */; do innerdir="$f"; done
+		num_dirs=1
+	else
+		for f in *; do
+			# AppleDouble encoded Macintosh file
+			if [ -e "$f" ] && [ -e "._$f" ]; then
+				rm -f "._$f"
+				num_dirs=1
+				innerdir="$f"
+				break
+			fi
+		done
+	fi
 	rm -rf "$wrksrc"
 	innerdir="$extractdir/$innerdir"
 	cd "$XBPS_BUILDDIR"

From 5c849ae8639b8ea9bb0104dc1a7395f43a59708b 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: Thu, 5 Jan 2023 09:18:48 +0700
Subject: [PATCH 3/3] *: fix for previous steps

---
 srcpkgs/chuck/template          | 2 --
 srcpkgs/php-apcu/template       | 1 -
 srcpkgs/php-ast/template        | 4 ----
 srcpkgs/php-igbinary/template   | 1 -
 srcpkgs/php-imagick/template    | 4 ----
 srcpkgs/php8.0-apcu/template    | 4 ----
 srcpkgs/php8.0-ast/template     | 4 ----
 srcpkgs/php8.0-imagick/template | 4 ----
 srcpkgs/php8.1-apcu/template    | 4 ----
 srcpkgs/php8.1-ast/template     | 4 ----
 srcpkgs/php8.1-imagick/template | 4 ----
 srcpkgs/xdebug/template         | 4 ----
 srcpkgs/xdebug8.0/template      | 4 ----
 srcpkgs/xdebug8.1/template      | 4 ----
 14 files changed, 48 deletions(-)

diff --git a/srcpkgs/chuck/template b/srcpkgs/chuck/template
index 59a4f787545b..d3e8b67c77a6 100644
--- a/srcpkgs/chuck/template
+++ b/srcpkgs/chuck/template
@@ -2,7 +2,6 @@
 pkgname=chuck
 version=1.4.1.1
 revision=1
-create_wrksrc=yes
 build_wrksrc=src
 build_style=gnu-makefile
 make_use_env=yes
@@ -19,7 +18,6 @@ checksum=4459ee6f151da72dcde1525e0afe05329d61086356b168ecfc0bc3a570290f63
 
 
 post_extract() {
-	mv chuck-${version}/* .
 	# use CC, CXX and LD from environment
 	vsed -e '/^CC=/d' -e '/^CXX=/d' -e '/^LD=/d' -i src/makefile -i src/core/makefile
 	# fix parallel builds for make in sub directories
diff --git a/srcpkgs/php-apcu/template b/srcpkgs/php-apcu/template
index 143322579e0b..dfb0e9da2fca 100644
--- a/srcpkgs/php-apcu/template
+++ b/srcpkgs/php-apcu/template
@@ -2,7 +2,6 @@
 pkgname=php-apcu
 version=5.1.22
 revision=1
-build_wrksrc=apcu-$version
 build_style=gnu-configure
 make_check_target=test
 hostmakedepends="autoconf pcre2-devel php-devel"
diff --git a/srcpkgs/php-ast/template b/srcpkgs/php-ast/template
index 615361fe50fe..11c50fe190b0 100644
--- a/srcpkgs/php-ast/template
+++ b/srcpkgs/php-ast/template
@@ -16,10 +16,6 @@ distfiles="https://pecl.php.net/get/ast-${version}.tgz"
 checksum=ee3d4f67e24d82e4d340806a24052012e4954d223122949377665427443e6d13
 make_check_pre="env NO_INTERACTION=1"
 
-post_extract() {
-	mv ast-$version/* .
-}
-
 pre_configure() {
 	phpize
 }
diff --git a/srcpkgs/php-igbinary/template b/srcpkgs/php-igbinary/template
index d8b3e1aa25dd..ee6586747683 100644
--- a/srcpkgs/php-igbinary/template
+++ b/srcpkgs/php-igbinary/template
@@ -2,7 +2,6 @@
 pkgname=php-igbinary
 version=3.2.12
 revision=1
-build_wrksrc=igbinary-$version
 build_style=gnu-configure
 hostmakedepends="autoconf php-devel"
 makedepends="php-devel"
diff --git a/srcpkgs/php-imagick/template b/srcpkgs/php-imagick/template
index 1f3248f28884..bfd5393ea055 100644
--- a/srcpkgs/php-imagick/template
+++ b/srcpkgs/php-imagick/template
@@ -14,10 +14,6 @@ homepage="https://pecl.php.net/package/imagick"
 distfiles="https://pecl.php.net/get/imagick-$version.tgz"
 checksum=8dd5aa16465c218651fc8993e1faecd982e6a597870fd4b937e9ece02d567077
 
-post_extract() {
-	mv imagick-$version/* .
-}
-
 pre_configure() {
 	phpize
 }
diff --git a/srcpkgs/php8.0-apcu/template b/srcpkgs/php8.0-apcu/template
index 39b3360b86d0..67418074afb5 100644
--- a/srcpkgs/php8.0-apcu/template
+++ b/srcpkgs/php8.0-apcu/template
@@ -15,10 +15,6 @@ homepage="https://pecl.php.net/package/APCu"
 distfiles="https://pecl.php.net/get/apcu-${version}.tgz"
 checksum=010a0d8fd112e1ed7a52a356191da3696a6b76319423f7b0dfdeaeeafcb41a1e
 
-post_extract() {
-	mv apcu-$version/* .
-}
-
 pre_configure() {
 	phpize8.0
 }
diff --git a/srcpkgs/php8.0-ast/template b/srcpkgs/php8.0-ast/template
index 1464394b9385..1b1c437c2e85 100644
--- a/srcpkgs/php8.0-ast/template
+++ b/srcpkgs/php8.0-ast/template
@@ -17,10 +17,6 @@ distfiles="https://pecl.php.net/get/ast-${version}.tgz"
 checksum=ee3d4f67e24d82e4d340806a24052012e4954d223122949377665427443e6d13
 make_check_pre="env NO_INTERACTION=1"
 
-post_extract() {
-	mv ast-$version/* .
-}
-
 pre_configure() {
 	phpize8.0
 }
diff --git a/srcpkgs/php8.0-imagick/template b/srcpkgs/php8.0-imagick/template
index b4c566f1c0ad..f916c8c8ce4d 100644
--- a/srcpkgs/php8.0-imagick/template
+++ b/srcpkgs/php8.0-imagick/template
@@ -15,10 +15,6 @@ homepage="https://pecl.php.net/package/imagick"
 distfiles="https://pecl.php.net/get/imagick-$version.tgz"
 checksum=5a364354109029d224bcbb2e82e15b248be9b641227f45e63425c06531792d3e
 
-post_extract() {
-	mv imagick-$version/* .
-}
-
 pre_configure() {
 	phpize8.0
 }
diff --git a/srcpkgs/php8.1-apcu/template b/srcpkgs/php8.1-apcu/template
index 2b1ed3a177ed..73a1876ec1cf 100644
--- a/srcpkgs/php8.1-apcu/template
+++ b/srcpkgs/php8.1-apcu/template
@@ -15,10 +15,6 @@ homepage="https://pecl.php.net/package/APCu"
 distfiles="https://pecl.php.net/get/apcu-${version}.tgz"
 checksum=010a0d8fd112e1ed7a52a356191da3696a6b76319423f7b0dfdeaeeafcb41a1e
 
-post_extract() {
-	mv apcu-$version/* .
-}
-
 pre_configure() {
 	phpize8.1
 }
diff --git a/srcpkgs/php8.1-ast/template b/srcpkgs/php8.1-ast/template
index d7620467e2ee..ce81061c6c1f 100644
--- a/srcpkgs/php8.1-ast/template
+++ b/srcpkgs/php8.1-ast/template
@@ -17,10 +17,6 @@ distfiles="https://pecl.php.net/get/ast-${version}.tgz"
 checksum=ee3d4f67e24d82e4d340806a24052012e4954d223122949377665427443e6d13
 make_check_pre="env NO_INTERACTION=1"
 
-post_extract() {
-	mv ast-$version/* .
-}
-
 pre_configure() {
 	phpize8.1
 }
diff --git a/srcpkgs/php8.1-imagick/template b/srcpkgs/php8.1-imagick/template
index c0f8456855ca..45c7bc8066b1 100644
--- a/srcpkgs/php8.1-imagick/template
+++ b/srcpkgs/php8.1-imagick/template
@@ -15,10 +15,6 @@ homepage="https://pecl.php.net/package/imagick"
 distfiles="https://pecl.php.net/get/imagick-$version.tgz"
 checksum=5a364354109029d224bcbb2e82e15b248be9b641227f45e63425c06531792d3e
 
-post_extract() {
-	mv imagick-$version/* .
-}
-
 pre_configure() {
 	phpize8.1
 }
diff --git a/srcpkgs/xdebug/template b/srcpkgs/xdebug/template
index cab8e455139f..af14853304e2 100644
--- a/srcpkgs/xdebug/template
+++ b/srcpkgs/xdebug/template
@@ -12,10 +12,6 @@ homepage="http://xdebug.org"
 distfiles="http://xdebug.org/files/${pkgname}-${version,,}.tgz"
 checksum=a63f567f2238d75a2244c2a4bd6f5abee817280b3567f9006c99481488dc977c
 
-post_extract() {
-	mv xdebug-$version/* .
-}
-
 pre_configure() {
 	phpize
 }
diff --git a/srcpkgs/xdebug8.0/template b/srcpkgs/xdebug8.0/template
index e97ac1a41404..2d052f84bfdf 100644
--- a/srcpkgs/xdebug8.0/template
+++ b/srcpkgs/xdebug8.0/template
@@ -14,10 +14,6 @@ changelog="https://xdebug.org/updates"
 distfiles="http://xdebug.org/files/xdebug-${version}.tgz"
 checksum=55f6ef381245da079b2fc5ce1cfbcb7961197d0c0e04f9d977613cf9aa969a79
 
-post_extract() {
-	mv xdebug-$version/* .
-}
-
 pre_configure() {
 	phpize8.0
 }
diff --git a/srcpkgs/xdebug8.1/template b/srcpkgs/xdebug8.1/template
index 626a59f7210c..d80f991990ca 100644
--- a/srcpkgs/xdebug8.1/template
+++ b/srcpkgs/xdebug8.1/template
@@ -14,10 +14,6 @@ changelog="https://xdebug.org/updates"
 distfiles="http://xdebug.org/files/xdebug-${version}.tgz"
 checksum=55f6ef381245da079b2fc5ce1cfbcb7961197d0c0e04f9d977613cf9aa969a79
 
-post_extract() {
-	mv xdebug-$version/* .
-}
-
 pre_configure() {
 	phpize8.1
 }

  parent reply	other threads:[~2023-01-05  2:24 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-09 12:45 [PR PATCH] " sgn
2023-01-05  1:22 ` [PR PATCH] [Closed]: " sgn
2023-01-05  2:24 ` sgn [this message]
2023-02-25  3:48 ` [PR PATCH] [Merged]: " 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=20230105022431.a-7OjIrk25qUmeY0koOSq6Loe7YStYIyF1kUkmZfgIY@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).