Github messages for voidlinux
 help / color / mirror / Atom feed
* [PR PATCH] xbps-src: retire XBPS_PKGDESTDIR
@ 2021-07-03  4:03 sgn
  2021-07-11  9:21 ` [PR PATCH] [Merged]: " sgn
  0 siblings, 1 reply; 2+ messages in thread
From: sgn @ 2021-07-03  4:03 UTC (permalink / raw)
  To: ml

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

There is a new pull request by sgn against master on the void-packages repository

https://github.com/sgn/void-packages retire-XBPS_PKGDESTDIR
https://github.com/void-linux/void-packages/pull/31772

xbps-src: retire XBPS_PKGDESTDIR
Historically, PKGDESTDIR was only set during pkg_install, and
XBPS_PKGDESTDIR was set to indicate that we're in subpkg's
pkg_install.

However, from 0b95cb8f5d, (Merge xbps-src code to make it usable in
a standalone mode., 2014-03-22), PKGDESTDIR is always set,
regardless of states.

Let's drop all usages of XBPS_PKGDESTDIR.

While we're at it, error out of vmove is used outside of subpkg.

<!-- Mark items with [x] where applicable -->

#### General
- [ ] This is a new package and it conforms to the [quality requirements](https://github.com/void-linux/void-packages/blob/master/Manual.md#quality-requirements)

#### Have the results of the proposed changes been tested?
- [ ] I use the packages affected by the proposed changes on a regular basis and confirm this PR works for me
- [ ] I generally don't use the affected packages but briefly tested this PR

<!--
If GitHub CI cannot be used to validate the build result (for example, if the
build is likely to take several hours), make sure to
[skip CI](https://github.com/void-linux/void-packages/blob/master/CONTRIBUTING.md#continuous-integration).
When skipping CI, uncomment and fill out the following section.
Note: for builds that are likely to complete in less than 2 hours, it is not
acceptable to skip CI.
-->
<!-- 
#### Does it build and run successfully? 
(Please choose at least one native build and, if supported, at least one cross build. More are better.)
- [ ] 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/31772.patch is attached

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

From b038dacf8acaab2f4e3aa9f011cd8defb855b7f9 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: Sat, 3 Jul 2021 10:50:39 +0700
Subject: [PATCH] xbps-src: retire XBPS_PKGDESTDIR

Historically, PKGDESTDIR was only set during pkg_install, and
XBPS_PKGDESTDIR was set to indicate that we're in subpkg's
pkg_install.

However, from 0b95cb8f5d, (Merge xbps-src code to make it usable in
a standalone mode., 2014-03-22), PKGDESTDIR is always set,
regardless of states.

Let's drop all usages of XBPS_PKGDESTDIR.

While we're at it, error out of vmove is used outside of subpkg.
---
 common/environment/setup/install.sh           | 73 ++++++-------------
 common/xbps-src/libexec/xbps-src-doinstall.sh |  1 -
 2 files changed, 22 insertions(+), 52 deletions(-)

diff --git a/common/environment/setup/install.sh b/common/environment/setup/install.sh
index 742f13075f8f..f533212b7daf 100644
--- a/common/environment/setup/install.sh
+++ b/common/environment/setup/install.sh
@@ -144,10 +144,9 @@ _vlicense() {
 
 _vinstall() {
 	local file="$1" mode="$2" targetdir="$3" targetfile="$4"
-	local _destdir=
 
-	if [ -z "$DESTDIR" ]; then
-		msg_red "$pkgver: vinstall: DESTDIR unset, can't continue...\n"
+	if [ -z "$PKGDESTDIR" ]; then
+		msg_red "$pkgver: vinstall: PKGDESTDIR unset, can't continue...\n"
 		return 1
 	fi
 
@@ -161,24 +160,18 @@ _vinstall() {
 		return 1
 	fi
 
-	if [ -n "$XBPS_PKGDESTDIR" ]; then
-		_destdir="$PKGDESTDIR"
-	else
-		_destdir="$DESTDIR"
-	fi
-
 	if [ -z "$targetfile" ]; then
-		install -Dm${mode} "${file}" "${_destdir}/${targetdir}/${file##*/}"
+		install -Dm${mode} "${file}" "${PKGDESTDIR}/${targetdir}/${file##*/}"
 	else
-		install -Dm${mode} "${file}" "${_destdir}/${targetdir}/${targetfile##*/}"
+		install -Dm${mode} "${file}" "${PKGDESTDIR}/${targetdir}/${targetfile##*/}"
 	fi
 }
 
 _vcopy() {
-	local files="$1" targetdir="$2" _destdir
+	local files="$1" targetdir="$2"
 
-	if [ -z "$DESTDIR" ]; then
-		msg_red "$pkgver: vcopy: DESTDIR unset, can't continue...\n"
+	if [ -z "$PKGDESTDIR" ]; then
+		msg_red "$pkgver: vcopy: PKGDESTDIR unset, can't continue...\n"
 		return 1
 	fi
 	if [ $# -ne 2 ]; then
@@ -186,17 +179,11 @@ _vcopy() {
 		return 1
 	fi
 
-	if [ -n "$XBPS_PKGDESTDIR" ]; then
-		_destdir="$PKGDESTDIR"
-	else
-		_destdir="$DESTDIR"
-	fi
-
-	cp -a $files ${_destdir}/${targetdir}
+	cp -a $files ${PKGDESTDIR}/${targetdir}
 }
 
 _vmove() {
-	local f files="$1" _destdir _pkgdestdir _targetdir
+	local f files="$1" _targetdir
 
 	if [ -z "$DESTDIR" ]; then
 		msg_red "$pkgver: vmove: DESTDIR unset, can't continue...\n"
@@ -204,6 +191,9 @@ _vmove() {
 	elif [ -z "$PKGDESTDIR" ]; then
 		msg_red "$pkgver: vmove: PKGDESTDIR unset, can't continue...\n"
 		return 1
+	elif [ "$DESTDIR" = "$PKGDESTDIR" ]; then
+		msg_red "$pkgver: vmove is intended to be used in pkg_install\n"
+		return 1
 	fi
 	if [ $# -ne 1 ]; then
 		msg_red "$pkgver: vmove: 1 argument expected: <files>\n"
@@ -214,30 +204,22 @@ _vmove() {
 		break
 	done
 
-	if [ -n "$XBPS_PKGDESTDIR" ]; then
-		_pkgdestdir="$PKGDESTDIR"
-		_destdir="$DESTDIR"
-	else
-		_pkgdestdir="$DESTDIR"
-		_destdir="$DESTDIR"
-	fi
-
 	if [ -z "${_targetdir}" ]; then
-		[ ! -d ${_pkgdestdir} ] && install -d ${_pkgdestdir}
-		mv ${_destdir}/$files ${_pkgdestdir}
+		[ ! -d ${PKGDESTDIR} ] && install -d ${PKGDESTDIR}
+		mv ${DESTDIR}/$files ${PKGDESTDIR}
 	else
-		if [ ! -d ${_pkgdestdir}/${_targetdir} ]; then
-			install -d ${_pkgdestdir}/${_targetdir}
+		if [ ! -d ${PKGDESTDIR}/${_targetdir} ]; then
+			install -d ${PKGDESTDIR}/${_targetdir}
 		fi
-		mv ${_destdir}/$files ${_pkgdestdir}/${_targetdir}
+		mv ${DESTDIR}/$files ${PKGDESTDIR}/${_targetdir}
 	fi
 }
 
 _vmkdir() {
-	local dir="$1" mode="$2" _destdir
+	local dir="$1" mode="$2"
 
-	if [ -z "$DESTDIR" ]; then
-		msg_red "$pkgver: vmkdir: DESTDIR unset, can't continue...\n"
+	if [ -z "$PKGDESTDIR" ]; then
+		msg_red "$pkgver: vmkdir: PKGDESTDIR unset, can't continue...\n"
 		return 1
 	fi
 
@@ -246,16 +228,10 @@ _vmkdir() {
 		return 1
 	fi
 
-	if [ -n "$XBPS_PKGDESTDIR" ]; then
-		_destdir="$PKGDESTDIR"
-	else
-		_destdir="$DESTDIR"
-	fi
-
 	if [ -z "$mode" ]; then
-		install -d ${_destdir}/${dir}
+		install -d ${PKGDESTDIR}/${dir}
 	else
-		install -dm${mode} ${_destdir}/${dir}
+		install -dm${mode} ${PKGDESTDIR}/${dir}
 	fi
 }
 
@@ -265,11 +241,6 @@ _vcompletion() {
 	local _fish_completion_dir=usr/share/fish/vendor_completions.d/
 	local _zsh_completion_dir=usr/share/zsh/site-functions/
 
-	if [ -z "$DESTDIR" ]; then
-		msg_red "$pkgver: vcompletion: DESTDIR unset, can't continue...\n"
-		return 1
-	fi
-
 	if [ $# -lt 2 ]; then
 		msg_red "$pkgver: vcompletion: 2 arguments expected: <file> <shell>\n"
 		return 1
diff --git a/common/xbps-src/libexec/xbps-src-doinstall.sh b/common/xbps-src/libexec/xbps-src-doinstall.sh
index 14e117a923b9..fb5d35d1a59a 100755
--- a/common/xbps-src/libexec/xbps-src-doinstall.sh
+++ b/common/xbps-src/libexec/xbps-src-doinstall.sh
@@ -58,7 +58,6 @@ if [ ! -f $XBPS_SUBPKG_INSTALL_DONE ]; then
 
         install -d $PKGDESTDIR
         if declare -f pkg_install >/dev/null; then
-            export XBPS_PKGDESTDIR=1
             run_pkg_hooks pre-install
             run_func pkg_install
         fi

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PR PATCH] [Merged]: xbps-src: retire XBPS_PKGDESTDIR
  2021-07-03  4:03 [PR PATCH] xbps-src: retire XBPS_PKGDESTDIR sgn
@ 2021-07-11  9:21 ` sgn
  0 siblings, 0 replies; 2+ messages in thread
From: sgn @ 2021-07-11  9:21 UTC (permalink / raw)
  To: ml

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

There's a merged pull request on the void-packages repository

xbps-src: retire XBPS_PKGDESTDIR
https://github.com/void-linux/void-packages/pull/31772

Description:
Historically, PKGDESTDIR was only set during pkg_install, and
XBPS_PKGDESTDIR was set to indicate that we're in subpkg's
pkg_install.

However, from 0b95cb8f5d, (Merge xbps-src code to make it usable in
a standalone mode., 2014-03-22), PKGDESTDIR is always set,
regardless of states.

Let's drop all usages of XBPS_PKGDESTDIR.

While we're at it, error out of vmove is used outside of subpkg.

<!-- Mark items with [x] where applicable -->

#### General
- [ ] This is a new package and it conforms to the [quality requirements](https://github.com/void-linux/void-packages/blob/master/Manual.md#quality-requirements)

#### Have the results of the proposed changes been tested?
- [ ] I use the packages affected by the proposed changes on a regular basis and confirm this PR works for me
- [ ] I generally don't use the affected packages but briefly tested this PR

<!--
If GitHub CI cannot be used to validate the build result (for example, if the
build is likely to take several hours), make sure to
[skip CI](https://github.com/void-linux/void-packages/blob/master/CONTRIBUTING.md#continuous-integration).
When skipping CI, uncomment and fill out the following section.
Note: for builds that are likely to complete in less than 2 hours, it is not
acceptable to skip CI.
-->
<!-- 
#### Does it build and run successfully? 
(Please choose at least one native build and, if supported, at least one cross build. More are better.)
- [ ] 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
-->


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-07-11  9:21 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-07-03  4:03 [PR PATCH] xbps-src: retire XBPS_PKGDESTDIR sgn
2021-07-11  9:21 ` [PR PATCH] [Merged]: " sgn

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).