On Mon, May 10 2021, Rafael Sadowski <raf...@sizeofvoid.org> wrote:
> Fix draw_lib_dependencies which is a handy to to create such kind of
> graphs:
>
> https://sizeofvoid.org/pub/OpenBSD/libKF5Attica.so.5.0.png
>
> $ draw_lib_dependencies /usr/local/lib/libKF5Attica.so.5.0 
> /tmp/libKF5Attica.so.5.0.png
> Analyzing dependencies of: /usr/local/lib/libKF5Attica.so.5.0
> Creating output as:        Downloads/libKF5Attica.so.5.0.png
>
> Parsing file:              /usr/local/lib/libKF5Attica.so.5.0
> Parsing file:              /usr/local/lib/libQt5Network.so.4.0
> Parsing file:              /usr/local/lib/qt5/libQt5Core.so.3.0
> Parsing file:              /usr/local/lib/libexecinfo.so.2.0
> Parsing file:              /usr/lib/libm.so.10.1
> Parsing file:              /usr/lib/libz.so.5.0
> Parsing file:              /usr/local/lib/libdouble-conversion.so.0.0
> Parsing file:              /usr/lib/libc++.so.8.0
> Parsing file:              /usr/lib/libc++abi.so.5.0
> Parsing file:              /usr/lib/libpthread.so.26.1
> Parsing file:              /usr/local/lib/libicui18n.so.20.0
> Parsing file:              /usr/local/lib/libicuuc.so.20.0
> Parsing file:              /usr/local/lib/libicudata.so.20.0
> Parsing file:              /usr/local/lib/libpcre2-16.so.0.5
> Parsing file:              /usr/local/lib/libzstd.so.5.0
> Parsing file:              /usr/local/lib/libgthread-2.0.so.4200.12
> Parsing file:              /usr/local/lib/libglib-2.0.so.4201.5
> Parsing file:              /usr/local/lib/libpcre.so.3.0
> Parsing file:              /usr/local/lib/libintl.so.7.0
> Parsing file:              /usr/local/lib/libiconv.so.7.0
> Parsing file:              /usr/lib/libssl.so.48.2
> Parsing file:              /usr/lib/libcrypto.so.46.2
>
> ... some other tools need bash as run dependency.
>
> OK?

Mostly, see below.

> Index: Makefile
> ===================================================================
> RCS file: /cvs/ports/x11/kde-applications/kde-dev-scripts/Makefile,v
> retrieving revision 1.7
> diff -u -p -u -p -r1.7 Makefile
> --- Makefile  27 Apr 2021 05:26:59 -0000      1.7
> +++ Makefile  10 May 2021 17:32:30 -0000
> @@ -3,6 +3,7 @@
>  COMMENT =    KDE development helper scripts
>  DISTNAME =   kde-dev-scripts-${VERSION}
>  CATEGORIES = devel
> +REVISION =   0
>  
>  HOMEPAGE =   https://kde.org/applications/development/
>  
> @@ -12,7 +13,8 @@ MODKDE5_DOCS = yes
>  MODULES +=   lang/python \
>               perl
>  
> -RUN_DEPENDS =        math/graphviz
> +RUN_DEPENDS =        math/graphviz \
> +             shells/bash
>  
>  MODPERL_ADJ_FILES = \
>       colorsvn \
> Index: patches/patch-draw_lib_dependencies
> ===================================================================
> RCS file: patches/patch-draw_lib_dependencies
> diff -N patches/patch-draw_lib_dependencies
> --- /dev/null 1 Jan 1970 00:00:00 -0000
> +++ patches/patch-draw_lib_dependencies       10 May 2021 17:32:30 -0000
> @@ -0,0 +1,30 @@
> +$OpenBSD$
> +
> +
> +Index: draw_lib_dependencies
> +--- draw_lib_dependencies.orig
> ++++ draw_lib_dependencies
> +@@ -1,4 +1,4 @@
> +-#!/bin/bash
> ++#!/bin/ksh

Since you added a dep on bash, you could use /usr/local/bin/bash here,

> + # Copyright 2013 Dominik Seichter <domseich...@googlemail.com>
> + # 
> +@@ -24,7 +24,7 @@ LDDTMPFILE=
> + 
> + cleanup() {
> +     for _v in TMPFILE READELFTMPFILE LDDTMPFILE; do
> +-            [ -n "${!_v}" ] && rm -f -- "${!_v}"
> ++            [ -n "${_v}" ] && rm -f -- "${_v}"

... which would remove the need for this (now incorrect) hunk.

If you want to keep keep using ksh in this script, you could just
replace the loop with:

      rm -f "${TMPFILE}" "${READELFTMPFILE}" "${LDDTMPFILE}"

but I don't see the point.

> +     done
> + }
> + 
> +@@ -95,7 +95,7 @@ analyze()
> +                 exit 1
> +             fi
> +  
> +-            DEPPATH=$(grep -- "$DEP" "$LDDTMPFILE" | awk '{print $3}')
> ++            DEPPATH=$(grep -- "$DEP" "$LDDTMPFILE" | awk '{print $7}')

Makes sense.

> +             if [ -n "$DEPPATH" ];
> +             then
> +                 echo "  \"$NAME\" -> \"$DEP\";" >> $OUT
>

-- 
jca | PGP : 0x1524E7EE / 5135 92C1 AD36 5293 2BDF  DDCC 0DFA 74AE 1524 E7EE

Reply via email to