* [PR PATCH] common/xbps-src/shutils/show.sh: display `$license` one-per-line
@ 2022-12-12 6:25 classabbyamp
2022-12-15 20:50 ` meator
` (10 more replies)
0 siblings, 11 replies; 12+ messages in thread
From: classabbyamp @ 2022-12-12 6:25 UTC (permalink / raw)
To: ml
[-- Attachment #1: Type: text/plain, Size: 1027 bytes --]
There is a new pull request by classabbyamp against master on the void-packages repository
https://github.com/classabbyamp/void-packages license-show
https://github.com/void-linux/void-packages/pull/41032
common/xbps-src/shutils/show.sh: display `$license` one-per-line
previously, if there was a newline in `$license`, it would not format
properly in `xbps-src show`. This fixes it by splitting it by word and
removing commas and displaying it like some other variables.
fixes #40996
Example:
```
$ ./xbps-src show keepassxc
pkgname: keepassxc
...
License(s): GPL-3.0-or-later
License(s): BSD-3-Clause
License(s): CC0-1.0
License(s): LGPL-2.0-only
License(s): LGPL-2.1-only
License(s): LGPL-3.0-or-later
License(s): Nokia-Qt-exception-1.1
License(s): MIT
License(s): BSL-1.0
```
<!-- Uncomment relevant sections and delete options which are not applicable -->
#### Testing the changes
- I tested the changes in this PR: **YES**
A patch file from https://github.com/void-linux/void-packages/pull/41032.patch is attached
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-license-show-41032.patch --]
[-- Type: text/x-diff, Size: 1469 bytes --]
From 9860b7cf81b1a5b104b37f2b09c6ff3875571806 Mon Sep 17 00:00:00 2001
From: classabbyamp <void@placeviolette.net>
Date: Mon, 12 Dec 2022 01:21:29 -0500
Subject: [PATCH] common/xbps-src/shutils/show.sh: display `$license`
one-per-line
previously, if there was a newline in `$license`, it would not format
properly in `xbps-src show`. This fixes it by splitting it by word and
removing commas and displaying it like some other variables.
fixes #40996
Example:
```
$ ./xbps-src show keepassxc
pkgname: keepassxc
...
License(s): GPL-3.0-or-later
License(s): BSD-3-Clause
License(s): CC0-1.0
License(s): LGPL-2.0-only
License(s): LGPL-2.1-only
License(s): LGPL-3.0-or-later
License(s): Nokia-Qt-exception-1.1
License(s): MIT
License(s): BSL-1.0
```
---
common/xbps-src/shutils/show.sh | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/common/xbps-src/shutils/show.sh b/common/xbps-src/shutils/show.sh
index d781d07aae86..f16ae24e5697 100644
--- a/common/xbps-src/shutils/show.sh
+++ b/common/xbps-src/shutils/show.sh
@@ -17,7 +17,9 @@ show_pkg() {
done
echo "maintainer: $maintainer"
[ -n "$homepage" ] && echo "Upstream URL: $homepage"
- [ -n "$license" ] && echo "License(s): $license"
+ for i in ${license//,/}; do
+ [ -n "$i" ] && echo "License(s): $i"
+ done
[ -n "$changelog" ] && echo "Changelog: $changelog"
[ -n "$build_style" ] && echo "build_style: $build_style"
for i in $build_helper; do
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: common/xbps-src/shutils/show.sh: display `$license` one-per-line
2022-12-12 6:25 [PR PATCH] common/xbps-src/shutils/show.sh: display `$license` one-per-line classabbyamp
@ 2022-12-15 20:50 ` meator
2022-12-15 21:52 ` meator
` (9 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: meator @ 2022-12-15 20:50 UTC (permalink / raw)
To: ml
[-- Attachment #1: Type: text/plain, Size: 220 bytes --]
New comment by meator on void-packages repository
https://github.com/void-linux/void-packages/pull/41032#issuecomment-1353691621
Comment:
I have closed #40996 in favor of this PR. I think this is the correct solution.
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: common/xbps-src/shutils/show.sh: display `$license` one-per-line
2022-12-12 6:25 [PR PATCH] common/xbps-src/shutils/show.sh: display `$license` one-per-line classabbyamp
2022-12-15 20:50 ` meator
@ 2022-12-15 21:52 ` meator
2022-12-15 21:55 ` classabbyamp
` (8 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: meator @ 2022-12-15 21:52 UTC (permalink / raw)
To: ml
[-- Attachment #1: Type: text/plain, Size: 1034 bytes --]
New comment by meator on void-packages repository
https://github.com/void-linux/void-packages/pull/41032#issuecomment-1353755346
Comment:
`Changelog` should be also considered a multi value entry (again with only a single package which does this)
```
> ./xbps-src show noto-fonts-cjk
pkgname: noto-fonts-cjk
version: 20220127
revision: 1
distfiles: https://github.com/googlefonts/noto-cjk/releases/download/Sans2.004/03_NotoSansCJK-OTC.zip
distfiles: https://github.com/googlefonts/noto-cjk/releases/download/Serif2.001/04_NotoSerifCJKOTC.zip
checksum: 528f4e1b25ff3badb0321b38d015d954c4c0de926c7830ef50e4a1948f6a3eed
checksum: 2f0630f88752d50b11a427bdd71f20f7178219e647c56cbaf36c032dbe1ed9d0
maintainer: classabbyamp <void@placeviolette.net>
Upstream URL: https://www.google.com/get/noto/help/cjk/
License(s): OFL-1.1
Changelog: https://raw.githubusercontent.com/googlefonts/noto-cjk/main/Sans/NEWS.md
https://raw.githubusercontent.com/googlefonts/noto-cjk/main/Serif/NEWS.md
short_desc: Google Noto CJK Fonts
```
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: common/xbps-src/shutils/show.sh: display `$license` one-per-line
2022-12-12 6:25 [PR PATCH] common/xbps-src/shutils/show.sh: display `$license` one-per-line classabbyamp
2022-12-15 20:50 ` meator
2022-12-15 21:52 ` meator
@ 2022-12-15 21:55 ` classabbyamp
2022-12-16 3:29 ` [PR PATCH] [Updated] " classabbyamp
` (7 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: classabbyamp @ 2022-12-15 21:55 UTC (permalink / raw)
To: ml
[-- Attachment #1: Type: text/plain, Size: 204 bytes --]
New comment by classabbyamp on void-packages repository
https://github.com/void-linux/void-packages/pull/41032#issuecomment-1353757938
Comment:
yeah i marked this as draft to consider other variables
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PR PATCH] [Updated] common/xbps-src/shutils/show.sh: display `$license` one-per-line
2022-12-12 6:25 [PR PATCH] common/xbps-src/shutils/show.sh: display `$license` one-per-line classabbyamp
` (2 preceding siblings ...)
2022-12-15 21:55 ` classabbyamp
@ 2022-12-16 3:29 ` classabbyamp
2022-12-16 3:44 ` [PR REVIEW] common/xbps-src/shutils/show.sh: make show display consistent CameronNemo
` (6 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: classabbyamp @ 2022-12-16 3:29 UTC (permalink / raw)
To: ml
[-- Attachment #1: Type: text/plain, Size: 1032 bytes --]
There is an updated pull request by classabbyamp against master on the void-packages repository
https://github.com/classabbyamp/void-packages license-show
https://github.com/void-linux/void-packages/pull/41032
common/xbps-src/shutils/show.sh: display `$license` one-per-line
previously, if there was a newline in `$license`, it would not format
properly in `xbps-src show`. This fixes it by splitting it by word and
removing commas and displaying it like some other variables.
fixes #40996
Example:
```
$ ./xbps-src show keepassxc
pkgname: keepassxc
...
License(s): GPL-3.0-or-later
License(s): BSD-3-Clause
License(s): CC0-1.0
License(s): LGPL-2.0-only
License(s): LGPL-2.1-only
License(s): LGPL-3.0-or-later
License(s): Nokia-Qt-exception-1.1
License(s): MIT
License(s): BSL-1.0
```
<!-- Uncomment relevant sections and delete options which are not applicable -->
#### Testing the changes
- I tested the changes in this PR: **YES**
A patch file from https://github.com/void-linux/void-packages/pull/41032.patch is attached
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-license-show-41032.patch --]
[-- Type: text/x-diff, Size: 4572 bytes --]
From 1678ac811ec270d066abf447e255523326a15e4c Mon Sep 17 00:00:00 2001
From: classabbyamp <void@placeviolette.net>
Date: Mon, 12 Dec 2022 01:21:29 -0500
Subject: [PATCH] common/xbps-src/shutils/show.sh: make show display consistent
previously, if there was a newline in some variables, it would not format
properly in `xbps-src show`. This fixes it by always splitting it by word
in some cases, like if there is a new line in the variable's value, and
removing internal commas in some cases.
This logic was split into a function for consistency.
fixes #40996
Example:
```
$ ./xbps-src show keepassxc
pkgname: keepassxc
...
License(s): GPL-3.0-or-later
License(s): BSD-3-Clause
License(s): CC0-1.0
License(s): LGPL-2.0-only
License(s): LGPL-2.1-only
License(s): LGPL-3.0-or-later
License(s): Nokia-Qt-exception-1.1
License(s): MIT
License(s): BSL-1.0
```
---
common/xbps-src/shutils/show.sh | 87 ++++++++++++++++-----------------
1 file changed, 42 insertions(+), 45 deletions(-)
diff --git a/common/xbps-src/shutils/show.sh b/common/xbps-src/shutils/show.sh
index d781d07aae86..d639d7c12324 100644
--- a/common/xbps-src/shutils/show.sh
+++ b/common/xbps-src/shutils/show.sh
@@ -1,49 +1,27 @@
# vim: set ts=4 sw=4 et:
show_pkg() {
- local i=
-
- echo "pkgname: $pkgname"
- echo "version: $version"
- echo "revision: $revision"
- for i in ${distfiles}; do
- [ -n "$i" ] && echo "distfiles: $i"
- done
- for i in ${checksum}; do
- [ -n "$i" ] && echo "checksum: $i"
- done
- for i in ${archs}; do
- [ -n "$i" ] && echo "archs: $i"
- done
- echo "maintainer: $maintainer"
- [ -n "$homepage" ] && echo "Upstream URL: $homepage"
- [ -n "$license" ] && echo "License(s): $license"
- [ -n "$changelog" ] && echo "Changelog: $changelog"
- [ -n "$build_style" ] && echo "build_style: $build_style"
- for i in $build_helper; do
- [ -n "$i" ] && echo "build_helper: $i"
- done
- for i in ${configure_args}; do
- [ -n "$i" ] && echo "configure_args: $i"
- done
- echo "short_desc: $short_desc"
- for i in ${subpackages}; do
- [ -n "$i" ] && echo "subpackages: $i"
- done
+ show_pkg_var "pkgname" "$pkgname"
+ show_pkg_var "version" "$version"
+ show_pkg_var "revision" "$revision"
+ show_pkg_var "distfiles" "$distfiles" 1
+ show_pkg_var "checksum" "$checksum" 1
+ show_pkg_var "archs" "$archs" 1
+ show_pkg_var "maintainer" "${maintainer}"
+ show_pkg_var "Upstream URL" "$homepage"
+ show_pkg_var "License(s)" "${license//,/ }" 1
+ show_pkg_var "Changelog" "$changelog"
+ show_pkg_var "build_style" "$build_style"
+ show_pkg_var "build_helper" "$build_helper" 1
+ show_pkg_var "configure_args" "$configure_args" 1
+ show_pkg_var "short_desc" "$short_desc"
+ show_pkg_var "subpackages" "$subpackages" 1
set -f
- for i in ${conf_files}; do
- [ -n "$i" ] && echo "conf_files: $i"
- done
+ show_pkg_var "conf_files" "$conf_files" 1
set +f
- for i in ${replaces}; do
- [ -n "$i" ] && echo "replaces: $i"
- done
- for i in ${provides}; do
- [ -n "$i" ] && echo "provides: $i"
- done
- for i in ${conflicts}; do
- [ -n "$i" ] && echo "conflicts: $i"
- done
+ show_pkg_var "replaces" "$replaces" 1
+ show_pkg_var "provides" "$provides" 1
+ show_pkg_var "conflicts" "$conflicts" 1
local OIFS="$IFS"
IFS=','
for var in $1; do
@@ -51,11 +29,9 @@ show_pkg() {
if [ ${var} != ${var/'*'} ]
then
var="${var/'*'}"
- [ -n "${!var}" ] && echo "$var: ${!var//$'\n'/' '}"
+ show_pkg_var "$var" "${!var//$'\n'/' '}"
else
- for val in ${!var}; do
- [ -n "$val" ] && echo "$var: $val"
- done
+ show_pkg_var "$var" "${!var}" 1
fi
done
IFS="$OIFS"
@@ -63,6 +39,27 @@ show_pkg() {
return 0
}
+show_pkg_var() {
+ local _sep i=
+ local _label="$1"
+ local _value="$2"
+ local _always_split="$3"
+ if [ -n "$_value" ] && [ -n "$_label" ]; then
+ if [ "${#_label}" -lt 7 ]; then
+ sep=" "
+ else
+ sep=" "
+ fi
+ if [ -n "$_always_split" ] || [[ "$_value" =~ $'\n' ]]; then
+ for i in ${_value}; do
+ [ -n "$i" ] && echo "${_label}:${sep}${i}"
+ done
+ else
+ echo "${_label}:${sep}${_value}"
+ fi
+ fi
+}
+
show_pkg_deps() {
[ -f "${PKGDESTDIR}/rdeps" ] && cat ${PKGDESTDIR}/rdeps
}
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PR REVIEW] common/xbps-src/shutils/show.sh: make show display consistent
2022-12-12 6:25 [PR PATCH] common/xbps-src/shutils/show.sh: display `$license` one-per-line classabbyamp
` (3 preceding siblings ...)
2022-12-16 3:29 ` [PR PATCH] [Updated] " classabbyamp
@ 2022-12-16 3:44 ` CameronNemo
2022-12-16 3:45 ` classabbyamp
` (5 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: CameronNemo @ 2022-12-16 3:44 UTC (permalink / raw)
To: ml
[-- Attachment #1: Type: text/plain, Size: 204 bytes --]
New review comment by CameronNemo on void-packages repository
https://github.com/void-linux/void-packages/pull/41032#discussion_r1050344079
Comment:
local _sep, but _sep not otherwise used in function.
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PR REVIEW] common/xbps-src/shutils/show.sh: make show display consistent
2022-12-12 6:25 [PR PATCH] common/xbps-src/shutils/show.sh: display `$license` one-per-line classabbyamp
` (4 preceding siblings ...)
2022-12-16 3:44 ` [PR REVIEW] common/xbps-src/shutils/show.sh: make show display consistent CameronNemo
@ 2022-12-16 3:45 ` classabbyamp
2022-12-16 3:46 ` [PR PATCH] [Updated] " classabbyamp
` (4 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: classabbyamp @ 2022-12-16 3:45 UTC (permalink / raw)
To: ml
[-- Attachment #1: Type: text/plain, Size: 194 bytes --]
New review comment by classabbyamp on void-packages repository
https://github.com/void-linux/void-packages/pull/41032#discussion_r1050344406
Comment:
whoops i used it as `sep` everywhere else
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PR PATCH] [Updated] common/xbps-src/shutils/show.sh: make show display consistent
2022-12-12 6:25 [PR PATCH] common/xbps-src/shutils/show.sh: display `$license` one-per-line classabbyamp
` (5 preceding siblings ...)
2022-12-16 3:45 ` classabbyamp
@ 2022-12-16 3:46 ` classabbyamp
2022-12-16 3:49 ` [PR REVIEW] " CameronNemo
` (3 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: classabbyamp @ 2022-12-16 3:46 UTC (permalink / raw)
To: ml
[-- Attachment #1: Type: text/plain, Size: 1142 bytes --]
There is an updated pull request by classabbyamp against master on the void-packages repository
https://github.com/classabbyamp/void-packages license-show
https://github.com/void-linux/void-packages/pull/41032
common/xbps-src/shutils/show.sh: make show display consistent
previously, if there was a newline in some variables, it would not format
properly in `xbps-src show`. This fixes it by always splitting it by word
in some cases, like if there is a new line in the variable's value, and
removing internal commas in some cases.
This logic was split into a function for consistency.
fixes #40996
Example:
```
$ ./xbps-src show keepassxc
pkgname: keepassxc
...
License(s): GPL-3.0-or-later
License(s): BSD-3-Clause
License(s): CC0-1.0
License(s): LGPL-2.0-only
License(s): LGPL-2.1-only
License(s): LGPL-3.0-or-later
License(s): Nokia-Qt-exception-1.1
License(s): MIT
License(s): BSL-1.0
```
<!-- Uncomment relevant sections and delete options which are not applicable -->
#### Testing the changes
- I tested the changes in this PR: **YES**
A patch file from https://github.com/void-linux/void-packages/pull/41032.patch is attached
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-license-show-41032.patch --]
[-- Type: text/x-diff, Size: 4576 bytes --]
From d7a84e8335ad1c9494c96c0fe94132573116bb00 Mon Sep 17 00:00:00 2001
From: classabbyamp <void@placeviolette.net>
Date: Mon, 12 Dec 2022 01:21:29 -0500
Subject: [PATCH] common/xbps-src/shutils/show.sh: make show display consistent
previously, if there was a newline in some variables, it would not format
properly in `xbps-src show`. This fixes it by always splitting it by word
in some cases, like if there is a new line in the variable's value, and
removing internal commas in some cases.
This logic was split into a function for consistency.
fixes #40996
Example:
```
$ ./xbps-src show keepassxc
pkgname: keepassxc
...
License(s): GPL-3.0-or-later
License(s): BSD-3-Clause
License(s): CC0-1.0
License(s): LGPL-2.0-only
License(s): LGPL-2.1-only
License(s): LGPL-3.0-or-later
License(s): Nokia-Qt-exception-1.1
License(s): MIT
License(s): BSL-1.0
```
---
common/xbps-src/shutils/show.sh | 87 ++++++++++++++++-----------------
1 file changed, 42 insertions(+), 45 deletions(-)
diff --git a/common/xbps-src/shutils/show.sh b/common/xbps-src/shutils/show.sh
index d781d07aae86..95ba55ddb4d4 100644
--- a/common/xbps-src/shutils/show.sh
+++ b/common/xbps-src/shutils/show.sh
@@ -1,49 +1,27 @@
# vim: set ts=4 sw=4 et:
show_pkg() {
- local i=
-
- echo "pkgname: $pkgname"
- echo "version: $version"
- echo "revision: $revision"
- for i in ${distfiles}; do
- [ -n "$i" ] && echo "distfiles: $i"
- done
- for i in ${checksum}; do
- [ -n "$i" ] && echo "checksum: $i"
- done
- for i in ${archs}; do
- [ -n "$i" ] && echo "archs: $i"
- done
- echo "maintainer: $maintainer"
- [ -n "$homepage" ] && echo "Upstream URL: $homepage"
- [ -n "$license" ] && echo "License(s): $license"
- [ -n "$changelog" ] && echo "Changelog: $changelog"
- [ -n "$build_style" ] && echo "build_style: $build_style"
- for i in $build_helper; do
- [ -n "$i" ] && echo "build_helper: $i"
- done
- for i in ${configure_args}; do
- [ -n "$i" ] && echo "configure_args: $i"
- done
- echo "short_desc: $short_desc"
- for i in ${subpackages}; do
- [ -n "$i" ] && echo "subpackages: $i"
- done
+ show_pkg_var "pkgname" "$pkgname"
+ show_pkg_var "version" "$version"
+ show_pkg_var "revision" "$revision"
+ show_pkg_var "distfiles" "$distfiles" 1
+ show_pkg_var "checksum" "$checksum" 1
+ show_pkg_var "archs" "$archs" 1
+ show_pkg_var "maintainer" "${maintainer}"
+ show_pkg_var "Upstream URL" "$homepage"
+ show_pkg_var "License(s)" "${license//,/ }" 1
+ show_pkg_var "Changelog" "$changelog"
+ show_pkg_var "build_style" "$build_style"
+ show_pkg_var "build_helper" "$build_helper" 1
+ show_pkg_var "configure_args" "$configure_args" 1
+ show_pkg_var "short_desc" "$short_desc"
+ show_pkg_var "subpackages" "$subpackages" 1
set -f
- for i in ${conf_files}; do
- [ -n "$i" ] && echo "conf_files: $i"
- done
+ show_pkg_var "conf_files" "$conf_files" 1
set +f
- for i in ${replaces}; do
- [ -n "$i" ] && echo "replaces: $i"
- done
- for i in ${provides}; do
- [ -n "$i" ] && echo "provides: $i"
- done
- for i in ${conflicts}; do
- [ -n "$i" ] && echo "conflicts: $i"
- done
+ show_pkg_var "replaces" "$replaces" 1
+ show_pkg_var "provides" "$provides" 1
+ show_pkg_var "conflicts" "$conflicts" 1
local OIFS="$IFS"
IFS=','
for var in $1; do
@@ -51,11 +29,9 @@ show_pkg() {
if [ ${var} != ${var/'*'} ]
then
var="${var/'*'}"
- [ -n "${!var}" ] && echo "$var: ${!var//$'\n'/' '}"
+ show_pkg_var "$var" "${!var//$'\n'/' '}"
else
- for val in ${!var}; do
- [ -n "$val" ] && echo "$var: $val"
- done
+ show_pkg_var "$var" "${!var}" 1
fi
done
IFS="$OIFS"
@@ -63,6 +39,27 @@ show_pkg() {
return 0
}
+show_pkg_var() {
+ local _sep i=
+ local _label="$1"
+ local _value="$2"
+ local _always_split="$3"
+ if [ -n "$_value" ] && [ -n "$_label" ]; then
+ if [ "${#_label}" -lt 7 ]; then
+ _sep=" "
+ else
+ _sep=" "
+ fi
+ if [ -n "$_always_split" ] || [[ "$_value" =~ $'\n' ]]; then
+ for i in ${_value}; do
+ [ -n "$i" ] && echo "${_label}:${_sep}${i}"
+ done
+ else
+ echo "${_label}:${_sep}${_value}"
+ fi
+ fi
+}
+
show_pkg_deps() {
[ -f "${PKGDESTDIR}/rdeps" ] && cat ${PKGDESTDIR}/rdeps
}
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PR REVIEW] common/xbps-src/shutils/show.sh: make show display consistent
2022-12-12 6:25 [PR PATCH] common/xbps-src/shutils/show.sh: display `$license` one-per-line classabbyamp
` (6 preceding siblings ...)
2022-12-16 3:46 ` [PR PATCH] [Updated] " classabbyamp
@ 2022-12-16 3:49 ` CameronNemo
2022-12-16 3:51 ` [PR PATCH] [Updated] " classabbyamp
` (2 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: CameronNemo @ 2022-12-16 3:49 UTC (permalink / raw)
To: ml
[-- Attachment #1: Type: text/plain, Size: 238 bytes --]
New review comment by CameronNemo on void-packages repository
https://github.com/void-linux/void-packages/pull/41032#discussion_r1050345551
Comment:
Consider adding a comment above this branch, e.g. "increase padding for short labels".
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PR PATCH] [Updated] common/xbps-src/shutils/show.sh: make show display consistent
2022-12-12 6:25 [PR PATCH] common/xbps-src/shutils/show.sh: display `$license` one-per-line classabbyamp
` (7 preceding siblings ...)
2022-12-16 3:49 ` [PR REVIEW] " CameronNemo
@ 2022-12-16 3:51 ` classabbyamp
2022-12-16 4:26 ` CameronNemo
2022-12-19 0:27 ` [PR PATCH] [Merged]: " classabbyamp
10 siblings, 0 replies; 12+ messages in thread
From: classabbyamp @ 2022-12-16 3:51 UTC (permalink / raw)
To: ml
[-- Attachment #1: Type: text/plain, Size: 1142 bytes --]
There is an updated pull request by classabbyamp against master on the void-packages repository
https://github.com/classabbyamp/void-packages license-show
https://github.com/void-linux/void-packages/pull/41032
common/xbps-src/shutils/show.sh: make show display consistent
previously, if there was a newline in some variables, it would not format
properly in `xbps-src show`. This fixes it by always splitting it by word
in some cases, like if there is a new line in the variable's value, and
removing internal commas in some cases.
This logic was split into a function for consistency.
fixes #40996
Example:
```
$ ./xbps-src show keepassxc
pkgname: keepassxc
...
License(s): GPL-3.0-or-later
License(s): BSD-3-Clause
License(s): CC0-1.0
License(s): LGPL-2.0-only
License(s): LGPL-2.1-only
License(s): LGPL-3.0-or-later
License(s): Nokia-Qt-exception-1.1
License(s): MIT
License(s): BSL-1.0
```
<!-- Uncomment relevant sections and delete options which are not applicable -->
#### Testing the changes
- I tested the changes in this PR: **YES**
A patch file from https://github.com/void-linux/void-packages/pull/41032.patch is attached
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-license-show-41032.patch --]
[-- Type: text/x-diff, Size: 4644 bytes --]
From e4d1c51b9a1e89cc7596e1ae309a611b828fd392 Mon Sep 17 00:00:00 2001
From: classabbyamp <void@placeviolette.net>
Date: Mon, 12 Dec 2022 01:21:29 -0500
Subject: [PATCH] common/xbps-src/shutils/show.sh: make show display consistent
previously, if there was a newline in some variables, it would not format
properly in `xbps-src show`. This fixes it by always splitting it by word
in some cases, like if there is a new line in the variable's value, and
removing internal commas in some cases.
This logic was split into a function for consistency.
fixes #40996
Example:
```
$ ./xbps-src show keepassxc
pkgname: keepassxc
...
License(s): GPL-3.0-or-later
License(s): BSD-3-Clause
License(s): CC0-1.0
License(s): LGPL-2.0-only
License(s): LGPL-2.1-only
License(s): LGPL-3.0-or-later
License(s): Nokia-Qt-exception-1.1
License(s): MIT
License(s): BSL-1.0
```
---
common/xbps-src/shutils/show.sh | 88 ++++++++++++++++-----------------
1 file changed, 43 insertions(+), 45 deletions(-)
diff --git a/common/xbps-src/shutils/show.sh b/common/xbps-src/shutils/show.sh
index d781d07aae86..6ae0f4e6d7df 100644
--- a/common/xbps-src/shutils/show.sh
+++ b/common/xbps-src/shutils/show.sh
@@ -1,49 +1,27 @@
# vim: set ts=4 sw=4 et:
show_pkg() {
- local i=
-
- echo "pkgname: $pkgname"
- echo "version: $version"
- echo "revision: $revision"
- for i in ${distfiles}; do
- [ -n "$i" ] && echo "distfiles: $i"
- done
- for i in ${checksum}; do
- [ -n "$i" ] && echo "checksum: $i"
- done
- for i in ${archs}; do
- [ -n "$i" ] && echo "archs: $i"
- done
- echo "maintainer: $maintainer"
- [ -n "$homepage" ] && echo "Upstream URL: $homepage"
- [ -n "$license" ] && echo "License(s): $license"
- [ -n "$changelog" ] && echo "Changelog: $changelog"
- [ -n "$build_style" ] && echo "build_style: $build_style"
- for i in $build_helper; do
- [ -n "$i" ] && echo "build_helper: $i"
- done
- for i in ${configure_args}; do
- [ -n "$i" ] && echo "configure_args: $i"
- done
- echo "short_desc: $short_desc"
- for i in ${subpackages}; do
- [ -n "$i" ] && echo "subpackages: $i"
- done
+ show_pkg_var "pkgname" "$pkgname"
+ show_pkg_var "version" "$version"
+ show_pkg_var "revision" "$revision"
+ show_pkg_var "distfiles" "$distfiles" 1
+ show_pkg_var "checksum" "$checksum" 1
+ show_pkg_var "archs" "$archs" 1
+ show_pkg_var "maintainer" "${maintainer}"
+ show_pkg_var "Upstream URL" "$homepage"
+ show_pkg_var "License(s)" "${license//,/ }" 1
+ show_pkg_var "Changelog" "$changelog"
+ show_pkg_var "build_style" "$build_style"
+ show_pkg_var "build_helper" "$build_helper" 1
+ show_pkg_var "configure_args" "$configure_args" 1
+ show_pkg_var "short_desc" "$short_desc"
+ show_pkg_var "subpackages" "$subpackages" 1
set -f
- for i in ${conf_files}; do
- [ -n "$i" ] && echo "conf_files: $i"
- done
+ show_pkg_var "conf_files" "$conf_files" 1
set +f
- for i in ${replaces}; do
- [ -n "$i" ] && echo "replaces: $i"
- done
- for i in ${provides}; do
- [ -n "$i" ] && echo "provides: $i"
- done
- for i in ${conflicts}; do
- [ -n "$i" ] && echo "conflicts: $i"
- done
+ show_pkg_var "replaces" "$replaces" 1
+ show_pkg_var "provides" "$provides" 1
+ show_pkg_var "conflicts" "$conflicts" 1
local OIFS="$IFS"
IFS=','
for var in $1; do
@@ -51,11 +29,9 @@ show_pkg() {
if [ ${var} != ${var/'*'} ]
then
var="${var/'*'}"
- [ -n "${!var}" ] && echo "$var: ${!var//$'\n'/' '}"
+ show_pkg_var "$var" "${!var//$'\n'/' '}"
else
- for val in ${!var}; do
- [ -n "$val" ] && echo "$var: $val"
- done
+ show_pkg_var "$var" "${!var}" 1
fi
done
IFS="$OIFS"
@@ -63,6 +39,28 @@ show_pkg() {
return 0
}
+show_pkg_var() {
+ local _sep i=
+ local _label="$1"
+ local _value="$2"
+ local _always_split="$3"
+ if [ -n "$_value" ] && [ -n "$_label" ]; then
+ # on short labels, use more padding so everything lines up
+ if [ "${#_label}" -lt 7 ]; then
+ _sep=" "
+ else
+ _sep=" "
+ fi
+ if [ -n "$_always_split" ] || [[ "$_value" =~ $'\n' ]]; then
+ for i in ${_value}; do
+ [ -n "$i" ] && echo "${_label}:${_sep}${i}"
+ done
+ else
+ echo "${_label}:${_sep}${_value}"
+ fi
+ fi
+}
+
show_pkg_deps() {
[ -f "${PKGDESTDIR}/rdeps" ] && cat ${PKGDESTDIR}/rdeps
}
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: common/xbps-src/shutils/show.sh: make show display consistent
2022-12-12 6:25 [PR PATCH] common/xbps-src/shutils/show.sh: display `$license` one-per-line classabbyamp
` (8 preceding siblings ...)
2022-12-16 3:51 ` [PR PATCH] [Updated] " classabbyamp
@ 2022-12-16 4:26 ` CameronNemo
2022-12-19 0:27 ` [PR PATCH] [Merged]: " classabbyamp
10 siblings, 0 replies; 12+ messages in thread
From: CameronNemo @ 2022-12-16 4:26 UTC (permalink / raw)
To: ml
[-- Attachment #1: Type: text/plain, Size: 216 bytes --]
New comment by CameronNemo on void-packages repository
https://github.com/void-linux/void-packages/pull/41032#issuecomment-1354186233
Comment:
Overall I think the implementation looks clean and the output as well.
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PR PATCH] [Merged]: common/xbps-src/shutils/show.sh: make show display consistent
2022-12-12 6:25 [PR PATCH] common/xbps-src/shutils/show.sh: display `$license` one-per-line classabbyamp
` (9 preceding siblings ...)
2022-12-16 4:26 ` CameronNemo
@ 2022-12-19 0:27 ` classabbyamp
10 siblings, 0 replies; 12+ messages in thread
From: classabbyamp @ 2022-12-19 0:27 UTC (permalink / raw)
To: ml
[-- Attachment #1: Type: text/plain, Size: 971 bytes --]
There's a merged pull request on the void-packages repository
common/xbps-src/shutils/show.sh: make show display consistent
https://github.com/void-linux/void-packages/pull/41032
Description:
previously, if there was a newline in some variables, it would not format
properly in `xbps-src show`. This fixes it by always splitting it by word
in some cases, like if there is a new line in the variable's value, and
removing internal commas in some cases.
This logic was split into a function for consistency.
fixes #40996
Example:
```
$ ./xbps-src show keepassxc
pkgname: keepassxc
...
License(s): GPL-3.0-or-later
License(s): BSD-3-Clause
License(s): CC0-1.0
License(s): LGPL-2.0-only
License(s): LGPL-2.1-only
License(s): LGPL-3.0-or-later
License(s): Nokia-Qt-exception-1.1
License(s): MIT
License(s): BSL-1.0
```
<!-- Uncomment relevant sections and delete options which are not applicable -->
#### Testing the changes
- I tested the changes in this PR: **YES**
^ permalink raw reply [flat|nested] 12+ messages in thread
end of thread, other threads:[~2022-12-19 0:27 UTC | newest]
Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-12-12 6:25 [PR PATCH] common/xbps-src/shutils/show.sh: display `$license` one-per-line classabbyamp
2022-12-15 20:50 ` meator
2022-12-15 21:52 ` meator
2022-12-15 21:55 ` classabbyamp
2022-12-16 3:29 ` [PR PATCH] [Updated] " classabbyamp
2022-12-16 3:44 ` [PR REVIEW] common/xbps-src/shutils/show.sh: make show display consistent CameronNemo
2022-12-16 3:45 ` classabbyamp
2022-12-16 3:46 ` [PR PATCH] [Updated] " classabbyamp
2022-12-16 3:49 ` [PR REVIEW] " CameronNemo
2022-12-16 3:51 ` [PR PATCH] [Updated] " classabbyamp
2022-12-16 4:26 ` CameronNemo
2022-12-19 0:27 ` [PR PATCH] [Merged]: " classabbyamp
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).