Github messages for voidlinux
 help / color / mirror / Atom feed
* [PR PATCH] shutils/show.sh: never show self deps for depends
@ 2020-12-31 14:59 Johnnynator
  2021-01-06 20:19 ` [PR PATCH] [Merged]: " Johnnynator
  0 siblings, 1 reply; 2+ messages in thread
From: Johnnynator @ 2020-12-31 14:59 UTC (permalink / raw)
  To: ml

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

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

https://github.com/Johnnynator/void-packages xbps-src-show-deps
https://github.com/void-linux/void-packages/pull/27577

shutils/show.sh: never show self deps for depends
xbps-src always ignore self deps in depends and in hostmakedepends
when not cross compiling. The old behaviour did only check for cross.
This now also ignores them in makedepends, but they are either way
disallowed in there, and returning an error would be correct, but
./xbps-src show-* is and never was suitable for linting, so ignore for now.

A patch file from https://github.com/void-linux/void-packages/pull/27577.patch is attached

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-xbps-src-show-deps-27577.patch --]
[-- Type: text/x-diff, Size: 3362 bytes --]

From 3a9f4b70499c602a2ede77dd277bc802e4d70d4f Mon Sep 17 00:00:00 2001
From: John <me@johnnynator.dev>
Date: Thu, 31 Dec 2020 15:49:51 +0100
Subject: [PATCH] shutils/show.sh: never show self deps for depends

xbps-src always ignore self deps in depends and in hostmakedepends
when not cross compiling. The old behaviour did only check for cross.
This now also ignores them in makedepends, but they are either way
disallowed in there, and returning an error would be correct, but
./xbps-src show-* is and never was suitable for linting, so ignore for now.
---
 common/xbps-src/shutils/show.sh | 57 ++++++++++++++++++++-------------
 1 file changed, 34 insertions(+), 23 deletions(-)

diff --git a/common/xbps-src/shutils/show.sh b/common/xbps-src/shutils/show.sh
index 2f545ce6474..e2f50f618ad 100644
--- a/common/xbps-src/shutils/show.sh
+++ b/common/xbps-src/shutils/show.sh
@@ -76,48 +76,59 @@ show_avail() {
     check_pkg_arch "$XBPS_CROSS_BUILD" 2>/dev/null
 }
 
+show_eval_dep() {
+    local f x _pkgname _srcpkg found
+    local _dep="$1"
+    local _host="$2"
+    if [ -z "$CROSS_BUILD" ] || [ -z "$_host" ]; then
+        # ignore dependency on itself
+        [[ $_dep == $sourcepkg ]] && return
+    fi
+    if [ ! -f $XBPS_SRCPKGDIR/$_dep/template ]; then
+        msg_error "$pkgver: dependency '$_dep' does not exist!\n"
+    fi
+    # ignore virtual dependencies
+    [[ ${_dep%\?*} != ${_dep#*\?} ]] && _dep=${_dep#*\?}
+    unset found
+    # check for subpkgs
+    for x in ${subpackages}; do
+        [[ $_dep == $x ]] && found=1 && break
+    done
+    [[ $found ]] && return
+    _pkgname=${_dep/-32bit}
+    _srcpkg=$(readlink -f ${XBPS_SRCPKGDIR}/${_pkgname})
+    _srcpkg=${_srcpkg##*/}
+    echo $_srcpkg
+}
+
 show_pkg_build_depends() {
-    local f x _pkgname _srcpkg found result
+    local f result
     local _deps="$1"
+    local _hostdeps="$2"
 
     result=$(mktemp) || exit 1
 
     # build time deps
     for f in ${_deps}; do
-        if [ -z "$CROSS_BUILD" ]; then
-            # ignore dependency on itself
-            [[ $f == $sourcepkg ]] && continue
-        fi
-        if [ ! -f $XBPS_SRCPKGDIR/$f/template ]; then
-            msg_error "$pkgver: dependency '$f' does not exist!\n"
-        fi
-        # ignore virtual dependencies
-        [[ ${f%\?*} != ${f#*\?} ]] && f=${f#*\?}
-        unset found
-        # check for subpkgs
-        for x in ${subpackages}; do
-            [[ $f == $x ]] && found=1 && break
-        done
-        [[ $found ]] && continue
-        _pkgname=${f/-32bit}
-        _srcpkg=$(readlink -f ${XBPS_SRCPKGDIR}/${_pkgname})
-        _srcpkg=${_srcpkg##*/}
-        echo "${_srcpkg}" >> $result
+        show_eval_dep $f "" >> $result
+    done
+    for f in ${_hostdeps}; do
+        show_eval_dep $f "hostdep" >> $result
     done
     sort -u $result
     rm -f $result
 }
 
 show_pkg_build_deps() {
-    show_pkg_build_depends "${hostmakedepends} ${makedepends} $(setup_pkg_depends '' 1 1)"
+    show_pkg_build_depends "${makedepends} $(setup_pkg_depends '' 1 1)" "${hostmakedepends}"
 }
 
 show_pkg_hostmakedepends() {
-    show_pkg_build_depends "${hostmakedepends}"
+    show_pkg_build_depends "" "${hostmakedepends}"
 }
 
 show_pkg_makedepends() {
-    show_pkg_build_depends "${makedepends}"
+    show_pkg_build_depends "${makedepends}" ""
 }
 
 show_pkg_build_options() {

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

* Re: [PR PATCH] [Merged]: shutils/show.sh: never show self deps for depends
  2020-12-31 14:59 [PR PATCH] shutils/show.sh: never show self deps for depends Johnnynator
@ 2021-01-06 20:19 ` Johnnynator
  0 siblings, 0 replies; 2+ messages in thread
From: Johnnynator @ 2021-01-06 20:19 UTC (permalink / raw)
  To: ml

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

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

shutils/show.sh: never show self deps for depends
https://github.com/void-linux/void-packages/pull/27577

Description:
xbps-src always ignore self deps in depends and in hostmakedepends
when not cross compiling. The old behaviour did only check for cross.
This now also ignores them in makedepends, but they are either way
disallowed in there, and returning an error would be correct, but
./xbps-src show-* is and never was suitable for linting, so ignore for now.

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

end of thread, other threads:[~2021-01-06 20:19 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-12-31 14:59 [PR PATCH] shutils/show.sh: never show self deps for depends Johnnynator
2021-01-06 20:19 ` [PR PATCH] [Merged]: " Johnnynator

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