Github messages for voidlinux
 help / color / mirror / Atom feed
From: Chocimier <Chocimier@users.noreply.github.com>
To: ml@inbox.vuxu.org
Subject: Re: [PR PATCH] [Updated] xbps-src: -p argument for showing more variables
Date: Sat, 11 Jul 2020 22:33:18 +0200	[thread overview]
Message-ID: <20200711203318.27jPtZeanFs81VSUTSBgP4QbP00tgkL3t_fwGeTf0gQ@z> (raw)
In-Reply-To: <gh-mailinglist-notifications-41a7ca26-5023-4802-975b-f1789d68868e-void-packages-23457@inbox.vuxu.org>

[-- 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

  parent reply	other threads:[~2020-07-11 20:33 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-07-07 18:14 [PR PATCH] " Chocimier
2020-07-07 18:23 ` [PR REVIEW] " ericonr
2020-07-07 18:23 ` ericonr
2020-07-11 20:33 ` Chocimier [this message]
2020-07-11 20:33 ` [PR PATCH] [Updated] " Chocimier
2020-07-11 20:34 ` [PR REVIEW] " Chocimier
2020-07-11 20:34 ` Chocimier
2020-07-13 17:52 ` [PR PATCH] [Merged]: " Chocimier

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=20200711203318.27jPtZeanFs81VSUTSBgP4QbP00tgkL3t_fwGeTf0gQ@z \
    --to=chocimier@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).