* Re: [PR REVIEW] xbps-src: -p argument for showing more variables
2020-07-07 18:14 [PR PATCH] xbps-src: -p argument for showing more variables Chocimier
@ 2020-07-07 18:23 ` ericonr
2020-07-07 18:23 ` ericonr
` (5 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: ericonr @ 2020-07-07 18:23 UTC (permalink / raw)
To: ml
[-- Attachment #1: Type: text/plain, Size: 170 bytes --]
New review comment by ericonr on void-packages repository
https://github.com/void-linux/void-packages/pull/23457#discussion_r451058725
Comment:
"is printed in its own"
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PR REVIEW] xbps-src: -p argument for showing more variables
2020-07-07 18:14 [PR PATCH] xbps-src: -p argument for showing more variables Chocimier
2020-07-07 18:23 ` [PR REVIEW] " ericonr
@ 2020-07-07 18:23 ` ericonr
2020-07-11 20:33 ` [PR PATCH] [Updated] " Chocimier
` (4 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: ericonr @ 2020-07-07 18:23 UTC (permalink / raw)
To: ml
[-- Attachment #1: Type: text/plain, Size: 191 bytes --]
New review comment by ericonr on void-packages repository
https://github.com/void-linux/void-packages/pull/23457#discussion_r451059209
Comment:
either "the whole value" or "all the values"
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PR PATCH] [Updated] xbps-src: -p argument for showing more variables
2020-07-07 18:14 [PR PATCH] xbps-src: -p argument for showing more variables Chocimier
2020-07-07 18:23 ` [PR REVIEW] " ericonr
2020-07-07 18:23 ` ericonr
@ 2020-07-11 20:33 ` Chocimier
2020-07-11 20:33 ` Chocimier
` (3 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: Chocimier @ 2020-07-11 20:33 UTC (permalink / raw)
To: ml
[-- Attachment #1: Type: text/plain, Size: 513 bytes --]
There is an updated pull request by Chocimier against master on the void-packages repository
https://github.com/Chocimier/void-packages-org xbps-src-p
https://github.com/void-linux/void-packages/pull/23457
xbps-src: -p argument for showing more variables
I use this to know if package is restricted when bulk parsing templates. show-pkg-var and show-pkg-var-dump lacks distfiles, and calling xbps-src twice is too slow.
A patch file from https://github.com/void-linux/void-packages/pull/23457.patch is attached
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-xbps-src-p-23457.patch --]
[-- Type: text/x-diff, Size: 3818 bytes --]
From 06d1f07d7995e0eb423902dac6e3323e6cad564b Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Piotr=20W=C3=B3jcik?= <chocimier@tlen.pl>
Date: Wed, 16 Oct 2019 21:57:17 +0200
Subject: [PATCH] xbps-src: -p argument for showing more variables
---
common/xbps-src/shutils/show.sh | 15 +++++++++++++++
xbps-src | 13 ++++++++++---
2 files changed, 25 insertions(+), 3 deletions(-)
diff --git a/common/xbps-src/shutils/show.sh b/common/xbps-src/shutils/show.sh
index 017a7ac7121..2f545ce6474 100644
--- a/common/xbps-src/shutils/show.sh
+++ b/common/xbps-src/shutils/show.sh
@@ -44,6 +44,21 @@ show_pkg() {
for i in ${conflicts}; do
[ -n "$i" ] && echo "conflicts: $i"
done
+ local OIFS="$IFS"
+ IFS=','
+ for var in $1; do
+ IFS=$OIFS
+ if [ ${var} != ${var/'*'} ]
+ then
+ var="${var/'*'}"
+ [ -n "${!var}" ] && echo "$var: ${!var//$'\n'/' '}"
+ else
+ for val in ${!var}; do
+ [ -n "$val" ] && echo "$var: $val"
+ done
+ fi
+ done
+ IFS="$OIFS"
[ -n "$long_desc" ] && echo "long_desc: $long_desc"
return 0
diff --git a/xbps-src b/xbps-src
index fb5d94c6310..9b86d429bbd 100755
--- a/xbps-src
+++ b/xbps-src
@@ -198,6 +198,11 @@ $(print_cross_targets)
Supported options can be shown with the 'show-options' target.
+-p <variable,variable2,...>
+ For show target, show specified variables in addition to default ones.
+ Variable is split and each word is print in own line by default. In order to
+ print whole value in one line, append asterisk to variable name.
+
-Q Enable running the check stage.
-q Suppress informational output of xbps-src (build output is still printed).
@@ -346,7 +351,7 @@ readonly XBPS_SRC_VERSION="113"
export XBPS_MACHINE=$(xbps-uhelper -C /dev/null arch)
XBPS_OPTIONS=
-XBPS_OPTSTRING="1a:c:CEfgGhH:iIj:Lm:No:qQr:tV"
+XBPS_OPTSTRING="1a:c:CEfgGhH:iIj:Lm:No:p:qQr:tV"
# Preprocess arguments in order to allow options before and after XBPS_TARGET.
eval set -- $(getopt "$XBPS_OPTSTRING" "$@");
@@ -373,6 +378,7 @@ while getopts "$XBPS_OPTSTRING" opt; do
m) XBPS_ARG_MASTERDIR="$OPTARG"; XBPS_OPTIONS+=" -m $OPTARG";;
N) XBPS_ARG_SKIP_REMOTEREPOS=1; XBPS_OPTIONS+=" -N";;
o) XBPS_ARG_PKG_OPTIONS="$OPTARG"; XBPS_OPTIONS+=" -o $OPTARG";;
+ p) XBPS_ARG_PRINT_VARIABLES="$OPTARG"; XBPS_OPTIONS+=" -p $OPTARG";;
q) XBPS_ARG_QUIET=1; XBPS_OPTIONS+=" -q";;
Q) XBPS_ARG_CHECK_PKGS=1; XBPS_OPTIONS+=" -Q";;
r) XBPS_ARG_ALT_REPOSITORY="$OPTARG"; XBPS_OPTIONS+=" -r $OPTARG";;
@@ -457,6 +463,7 @@ fi
[ -n "$XBPS_ARG_SKIP_DEPS" ] && XBPS_SKIP_DEPS=1
[ -n "$XBPS_ARG_KEEP_ALL" ] && XBPS_KEEP_ALL=1
[ -n "$XBPS_ARG_QUIET" ] && XBPS_QUIET=1
+[ -n "$XBPS_ARG_PRINT_VARIABLES" ] && XBPS_PRINT_VARIABLES="$XBPS_ARG_PRINT_VARIABLES"
[ -n "$XBPS_ARG_ALT_REPOSITORY" ] && XBPS_ALT_REPOSITORY="$XBPS_ARG_ALT_REPOSITORY"
[ -n "$XBPS_ARG_CROSS_BUILD" ] && XBPS_CROSS_BUILD="$XBPS_ARG_CROSS_BUILD"
[ -n "$XBPS_ARG_MAKEJOBS" ] && XBPS_MAKEJOBS="$XBPS_ARG_MAKEJOBS"
@@ -465,7 +472,7 @@ export XBPS_BUILD_ONLY_ONE_PKG XBPS_SKIP_REMOTEREPOS XBPS_BUILD_FORCEMODE \
XBPS_INFORMATIVE_RUN XBPS_TEMP_MASTERDIR XBPS_BINPKG_EXISTS \
XBPS_USE_GIT_REVS XBPS_CHECK_PKGS XBPS_DEBUG_PKGS XBPS_SKIP_DEPS \
XBPS_KEEP_ALL XBPS_QUIET XBPS_ALT_REPOSITORY XBPS_CROSS_BUILD \
- XBPS_MAKEJOBS
+ XBPS_MAKEJOBS XBPS_PRINT_VARIABLES
# The masterdir/hostdir variables are forced and readonly in chroot
if [ -z "$IN_CHROOT" ]; then
@@ -804,7 +811,7 @@ case "$XBPS_TARGET" in
;;
show)
read_pkg ignore-problems
- show_pkg
+ show_pkg $XBPS_PRINT_VARIABLES
;;
show-avail)
read_pkg &>/dev/null
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PR PATCH] [Updated] xbps-src: -p argument for showing more variables
2020-07-07 18:14 [PR PATCH] xbps-src: -p argument for showing more variables Chocimier
` (2 preceding siblings ...)
2020-07-11 20:33 ` [PR PATCH] [Updated] " Chocimier
@ 2020-07-11 20:33 ` Chocimier
2020-07-11 20:34 ` [PR REVIEW] " Chocimier
` (2 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: Chocimier @ 2020-07-11 20:33 UTC (permalink / raw)
To: ml
[-- Attachment #1: Type: text/plain, Size: 513 bytes --]
There is an updated pull request by Chocimier against master on the void-packages repository
https://github.com/Chocimier/void-packages-org xbps-src-p
https://github.com/void-linux/void-packages/pull/23457
xbps-src: -p argument for showing more variables
I use this to know if package is restricted when bulk parsing templates. show-pkg-var and show-pkg-var-dump lacks distfiles, and calling xbps-src twice is too slow.
A patch file from https://github.com/void-linux/void-packages/pull/23457.patch is attached
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-xbps-src-p-23457.patch --]
[-- Type: text/x-diff, Size: 3829 bytes --]
From 5be503bc78faf97c463d4e082571ed30b1835703 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Piotr=20W=C3=B3jcik?= <chocimier@tlen.pl>
Date: Wed, 16 Oct 2019 21:57:17 +0200
Subject: [PATCH] xbps-src: -p argument for showing more variables
---
common/xbps-src/shutils/show.sh | 15 +++++++++++++++
xbps-src | 13 ++++++++++---
2 files changed, 25 insertions(+), 3 deletions(-)
diff --git a/common/xbps-src/shutils/show.sh b/common/xbps-src/shutils/show.sh
index 017a7ac7121..2f545ce6474 100644
--- a/common/xbps-src/shutils/show.sh
+++ b/common/xbps-src/shutils/show.sh
@@ -44,6 +44,21 @@ show_pkg() {
for i in ${conflicts}; do
[ -n "$i" ] && echo "conflicts: $i"
done
+ local OIFS="$IFS"
+ IFS=','
+ for var in $1; do
+ IFS=$OIFS
+ if [ ${var} != ${var/'*'} ]
+ then
+ var="${var/'*'}"
+ [ -n "${!var}" ] && echo "$var: ${!var//$'\n'/' '}"
+ else
+ for val in ${!var}; do
+ [ -n "$val" ] && echo "$var: $val"
+ done
+ fi
+ done
+ IFS="$OIFS"
[ -n "$long_desc" ] && echo "long_desc: $long_desc"
return 0
diff --git a/xbps-src b/xbps-src
index fb5d94c6310..2462ddc0b89 100755
--- a/xbps-src
+++ b/xbps-src
@@ -198,6 +198,11 @@ $(print_cross_targets)
Supported options can be shown with the 'show-options' target.
+-p <variable,variable2,...>
+ For show target, show specified variables in addition to default ones.
+ Variable is split and each word is printed in separate line by default.
+ In order to print the whole value in one line, append asterisk to variable name.
+
-Q Enable running the check stage.
-q Suppress informational output of xbps-src (build output is still printed).
@@ -346,7 +351,7 @@ readonly XBPS_SRC_VERSION="113"
export XBPS_MACHINE=$(xbps-uhelper -C /dev/null arch)
XBPS_OPTIONS=
-XBPS_OPTSTRING="1a:c:CEfgGhH:iIj:Lm:No:qQr:tV"
+XBPS_OPTSTRING="1a:c:CEfgGhH:iIj:Lm:No:p:qQr:tV"
# Preprocess arguments in order to allow options before and after XBPS_TARGET.
eval set -- $(getopt "$XBPS_OPTSTRING" "$@");
@@ -373,6 +378,7 @@ while getopts "$XBPS_OPTSTRING" opt; do
m) XBPS_ARG_MASTERDIR="$OPTARG"; XBPS_OPTIONS+=" -m $OPTARG";;
N) XBPS_ARG_SKIP_REMOTEREPOS=1; XBPS_OPTIONS+=" -N";;
o) XBPS_ARG_PKG_OPTIONS="$OPTARG"; XBPS_OPTIONS+=" -o $OPTARG";;
+ p) XBPS_ARG_PRINT_VARIABLES="$OPTARG"; XBPS_OPTIONS+=" -p $OPTARG";;
q) XBPS_ARG_QUIET=1; XBPS_OPTIONS+=" -q";;
Q) XBPS_ARG_CHECK_PKGS=1; XBPS_OPTIONS+=" -Q";;
r) XBPS_ARG_ALT_REPOSITORY="$OPTARG"; XBPS_OPTIONS+=" -r $OPTARG";;
@@ -457,6 +463,7 @@ fi
[ -n "$XBPS_ARG_SKIP_DEPS" ] && XBPS_SKIP_DEPS=1
[ -n "$XBPS_ARG_KEEP_ALL" ] && XBPS_KEEP_ALL=1
[ -n "$XBPS_ARG_QUIET" ] && XBPS_QUIET=1
+[ -n "$XBPS_ARG_PRINT_VARIABLES" ] && XBPS_PRINT_VARIABLES="$XBPS_ARG_PRINT_VARIABLES"
[ -n "$XBPS_ARG_ALT_REPOSITORY" ] && XBPS_ALT_REPOSITORY="$XBPS_ARG_ALT_REPOSITORY"
[ -n "$XBPS_ARG_CROSS_BUILD" ] && XBPS_CROSS_BUILD="$XBPS_ARG_CROSS_BUILD"
[ -n "$XBPS_ARG_MAKEJOBS" ] && XBPS_MAKEJOBS="$XBPS_ARG_MAKEJOBS"
@@ -465,7 +472,7 @@ export XBPS_BUILD_ONLY_ONE_PKG XBPS_SKIP_REMOTEREPOS XBPS_BUILD_FORCEMODE \
XBPS_INFORMATIVE_RUN XBPS_TEMP_MASTERDIR XBPS_BINPKG_EXISTS \
XBPS_USE_GIT_REVS XBPS_CHECK_PKGS XBPS_DEBUG_PKGS XBPS_SKIP_DEPS \
XBPS_KEEP_ALL XBPS_QUIET XBPS_ALT_REPOSITORY XBPS_CROSS_BUILD \
- XBPS_MAKEJOBS
+ XBPS_MAKEJOBS XBPS_PRINT_VARIABLES
# The masterdir/hostdir variables are forced and readonly in chroot
if [ -z "$IN_CHROOT" ]; then
@@ -804,7 +811,7 @@ case "$XBPS_TARGET" in
;;
show)
read_pkg ignore-problems
- show_pkg
+ show_pkg $XBPS_PRINT_VARIABLES
;;
show-avail)
read_pkg &>/dev/null
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PR REVIEW] xbps-src: -p argument for showing more variables
2020-07-07 18:14 [PR PATCH] xbps-src: -p argument for showing more variables Chocimier
` (3 preceding siblings ...)
2020-07-11 20:33 ` Chocimier
@ 2020-07-11 20:34 ` Chocimier
2020-07-11 20:34 ` Chocimier
2020-07-13 17:52 ` [PR PATCH] [Merged]: " Chocimier
6 siblings, 0 replies; 8+ messages in thread
From: Chocimier @ 2020-07-11 20:34 UTC (permalink / raw)
To: ml
[-- Attachment #1: Type: text/plain, Size: 156 bytes --]
New review comment by Chocimier on void-packages repository
https://github.com/void-linux/void-packages/pull/23457#discussion_r453232277
Comment:
changed
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PR REVIEW] xbps-src: -p argument for showing more variables
2020-07-07 18:14 [PR PATCH] xbps-src: -p argument for showing more variables Chocimier
` (4 preceding siblings ...)
2020-07-11 20:34 ` [PR REVIEW] " Chocimier
@ 2020-07-11 20:34 ` Chocimier
2020-07-13 17:52 ` [PR PATCH] [Merged]: " Chocimier
6 siblings, 0 replies; 8+ messages in thread
From: Chocimier @ 2020-07-11 20:34 UTC (permalink / raw)
To: ml
[-- Attachment #1: Type: text/plain, Size: 153 bytes --]
New review comment by Chocimier on void-packages repository
https://github.com/void-linux/void-packages/pull/23457#discussion_r453232293
Comment:
done
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PR PATCH] [Merged]: xbps-src: -p argument for showing more variables
2020-07-07 18:14 [PR PATCH] xbps-src: -p argument for showing more variables Chocimier
` (5 preceding siblings ...)
2020-07-11 20:34 ` Chocimier
@ 2020-07-13 17:52 ` Chocimier
6 siblings, 0 replies; 8+ messages in thread
From: Chocimier @ 2020-07-13 17:52 UTC (permalink / raw)
To: ml
[-- Attachment #1: Type: text/plain, Size: 346 bytes --]
There's a merged pull request on the void-packages repository
xbps-src: -p argument for showing more variables
https://github.com/void-linux/void-packages/pull/23457
Description:
I use this to know if package is restricted when bulk parsing templates. show-pkg-var and show-pkg-var-dump lacks distfiles, and calling xbps-src twice is too slow.
^ permalink raw reply [flat|nested] 8+ messages in thread