Bug 239806

Summary: pkgbase: Unset dependencies in some pkgbase packages
Product: Base System Reporter: Martin <martin.jakob>
Component: miscAssignee: freebsd-pkgbase (Nobody) <pkgbase>
Status: Closed DUPLICATE    
Severity: Affects Only Me CC: emaste, freebsd, markj, pkgbase
Priority: --- Keywords: patch, pkgbase
Version: CURRENT   
Hardware: Any   
OS: Any   

Description Martin 2019-08-12 19:23:53 UTC
I am trying to visualize the dependencies of the pkgbase packages.
To produce the dot file for use with graphviz, i used a shell script greping
and seding the ucl files in the worldstage directory (see below). After some
fiddling i got a dot file graphviz could work with.

You can create one by your self, running the script and using the resulting
output in a online graphviz tool like http://www.webgraphviz.com/ or 
https://stamm-wilbrandt.de/GraphvizFiddle/# 

I will describe some ascpects of the resulting diagramm.

- the biggest node is the runtime package, a lot of packages depend on it.

- runtime itself depends only on the clibs package.

- clibs has dependent packages:
  clibs-debug, clibs-development, clibs-lib32, clibs-lib32-debug,
  clibs-lib32-development, clibs-lib32-profile, clibs-profile

- some packages depend on runtime, as mentioned, and have some
  dependent packages, e.g
  -> ssh depends on runtime
  -> these packages depend on the ssh packages:
     ssh-debug, ssh-development, ssh-lib32, ssh-lib32-debug,
	 ssh-lib32-development, ssh-lib32-profile, ssh-profile

- there are other packages which depend on runtime, but the "subpackages"
  do not depend on the package itself, e.g
  -> jail depends on runtime
  -> these packages depend also on runtime instead of jail:
     jail-debug, jail-development, jail-lib32, jail-lib32-debug,
     jail-lib32-development

- there are a LOT of packages which are standalone in the diagramm, e.g
  sendmail, the dependent packages sendmail-debug, sendmail-development,
  sendmail-lib32, sendmail-lib32-debug, sendmail-lib32-development,
  sendmail-lib32-profile, sendmail-profile are standalone as well.

- there is a mixture of the above, for example the runtime has dependent 
  packages as mentioned above and these standalone packages:
  runtime-lib32-debug, runtime-lib32-development, runtime-lib32-profile


as far as i can see, the dependencies are defined in the script
/usr/src/release/packages/generate-ucl.sh. In there, some names are
hardcoded, like "runtime", "runtime_*", "jail_*". Others are handled as
wildcards, like "*_lib32", "*_lib32_development", "*_lib32_debug", ...
which often do not depend on their "root" package. While the "named"
packages have their own ucl file, these wildcard packages are using
the template.ucl file, which does not contain the "deps:" attribute.

 
Script to create the graphviz dot file:
---8<---8<---8<---8<---8<---8<---8<---8<---8<

#!/bin/sh

echo "digraph pkgdeps {"
echo "    graph [center=0 rankdir=TD ];"

(
    for PKG in /usr/obj/usr/src/amd64.amd64/worldstage/*.ucl
    {
        PKG_NAME=${PKG##*/}
        PKG_DEPS=$(grep -h -A 1 deps ${PKG} | tail -n 1 | sed -e 's/^[ \t]*//' -e 's/FreeBSD-//g' -e 's/"//g' -e 's/: {//g')
        if [ ! ${PKG_DEPS} = "" ]; then
            echo "    \"${PKG_NAME%.ucl}\" -> \"${PKG_DEPS}\";"
        else
            echo "    \"${PKG_NAME%.ucl}\";"
        fi
    }
) | sort

echo "}"

--->8--->8--->8--->8--->8--->8--->8--->8--->8


--
Martin
Comment 1 Martin 2019-08-12 19:25:02 UTC
After adding this patch to /usr/src/release/packages/template.ucl

--- template.ucl_       2019-06-02 09:09:55.109358000 +0200
+++ template.ucl        2019-08-04 17:40:34.305308000 +0200
@@ -15,3 +15,9 @@
 desc = <<EOD
 %DESC%
 EOD
+deps: {
+    FreeBSD-%PKGDEPS%: {
+        origin: "base",
+        version: "%VERSION%"
+    }
+}

Almost all libraries are now depending on runtime, except:
- liby
- libpmcstat
- libpam
- libifconfig
the "subpackages", e.g *-development, *-profile, however are depending
on their root package. For example:
liby-devlopment -> liby
liby-profile    -> liby
etc.

Also, the clibs subpackages clibs-profile, clibs-development,...
are still standalone.

i rebuilt my pkgbase repo with "make -j4 packages", this finished
without error and a created jail with these packages startet without problem.

--
Martin
Comment 2 Martin 2020-09-01 17:26:20 UTC
Hi, i want to revisit this ticket with a run of the script on an 13 system ().
There are still some "standalone" packages namely these:

    "clibs";
    "clibs-dbg" -> "clibs";
    "clibs-dbg-lib32" -> "clibs-dbg";
    "clibs-dev" -> "clibs";
    "clibs-dev-lib32" -> "clibs-dev";
    "clibs-lib32" -> "clibs";

    "libcompiler_rt" -> "runtime";
    "libcompiler_rt-dev" -> "libcompiler-rt";
    "libcompiler_rt-dev-lib32" -> "libcompiler-rt-dev";
    "libcompiler_rt-lib32" -> "libcompiler-rt";

    "librpcsec_gss" -> "runtime";
    "librpcsec_gss-dbg" -> "librpcsec-gss";
    "librpcsec_gss-dbg-lib32" -> "librpcsec-gss-dbg";
    "librpcsec_gss-dev" -> "librpcsec-gss";
    "librpcsec_gss-dev-lib32" -> "librpcsec-gss-dev";
    "librpcsec_gss-lib32" -> "librpcsec-gss";

    "libthread_db" -> "runtime";
    "libthread_db-dbg" -> "libthread-db";
    "libthread_db-dbg-lib32" -> "libthread-db-dbg";
    "libthread_db-dev" -> "libthread-db";
    "libthread_db-dev-lib32" -> "libthread-db-dev";
    "libthread_db-lib32" -> "libthread-db";

    "liby-dev" -> "liby";
    "liby-dev-lib32" -> "liby-dev";

You can see naming inconsistencies in some packages with "-" and "_".

e.g. in libcompiler_rt-dev.ucl

#
# $FreeBSD: head/release/packages/template.ucl 364103 2020-08-11 08:42:24Z manu $
#

name = "FreeBSD-libcompiler_rt-dev"
origin = "base"
version = "13.0.r364958"
comment = "libcompiler package (Development Files)"
categories = [ base ]
maintainer = "re@FreeBSD.org"
www = "https://www.FreeBSD.org"
prefix = "/"
licenselogic = "single"
licenses = [ BSD2CLAUSE ]
desc = <<EOD
libcompiler package
EOD
deps: {
        FreeBSD-libcompiler-rt: {
                origin: "base",
                version: "13.0.r364958"
        }
}
Comment 3 Martin 2020-09-01 17:38:06 UTC
Quick follow up:

after changing the names of the libs in the ucl files

sed -i '' 's/libcompiler-rt/libcompiler_rt/g' *.ucl
sed -i '' 's/librpcsec-gss/librpcsec_gss/g' *.ucl
sed -i '' 's/libthread-db/libthread_db/g' *.ucl

the dependencies are correct.

just "clibs" and "liby" are still free floating...
Comment 4 Martin 2020-11-14 17:45:40 UTC
The above mentioned naming inconsistencies in some dependencies is caused in the script generate-ucl.sh

In Revision base r364009 the line

pkgdeps="$(echo ${pkgdeps} | tr '_' '-')"

was added. This is a problem for packages with an "_" in their names like 

libcompiler_rt-*.plist
librpcsec_gss-*.plist
libthread_db-*.plist
Comment 5 Mark Johnston freebsd_committer freebsd_triage 2022-04-13 19:38:27 UTC

*** This bug has been marked as a duplicate of bug 254797 ***