Github messages for voidlinux
 help / color / mirror / Atom feed
From: Johnnynator <Johnnynator@users.noreply.github.com>
To: ml@inbox.vuxu.org
Subject: [PR PATCH] shutils/show.sh: never show self deps for depends
Date: Thu, 31 Dec 2020 15:59:25 +0100	[thread overview]
Message-ID: <gh-mailinglist-notifications-41a7ca26-5023-4802-975b-f1789d68868e-void-packages-27577@inbox.vuxu.org> (raw)

[-- 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() {

             reply	other threads:[~2020-12-31 14:59 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-12-31 14:59 Johnnynator [this message]
2021-01-06 20:19 ` [PR PATCH] [Merged]: " Johnnynator

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=gh-mailinglist-notifications-41a7ca26-5023-4802-975b-f1789d68868e-void-packages-27577@inbox.vuxu.org \
    --to=johnnynator@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).