# Ports dependencies



## n0.0 (Mar 20, 2022)

It wouldn't be great that someone develop a way, or a port/package to solve dependencies on ports? Or there are some problems about what I talk of?


----------



## grahamperrin@ (Mar 20, 2022)

Not an answer to your questions, but <https://www.freebsd.org/portmgr/> might be of interest. An overview, of sorts.


----------



## sidetone (Mar 21, 2022)

I wish there was a software, that gave indications of which libraries weren't being used, and a vague sense of percentages of it for ports.


----------



## zirias@ (Mar 21, 2022)

What should "solve dependencies" mean here? I kind of sense an XY-problem here... please describe the problem you want to solve.

sidetone, `poudriere testport` tests lib dependencies...


----------



## grahamperrin@ (Mar 21, 2022)

sidetone said:


> … indications of which libraries weren't being used, …



Do you mean, ports that have no dependency? 

For example: devel/got, net/gitup, …

Like, the first two are below are dependency-free, the third has a few dependencies: 

<https://www.freshports.org/devel/got/#dependencies>
<https://www.freshports.org/net/gitup/#dependencies>
<https://www.freshports.org/x11/autorandr/#dependencies>



Spoiler: x11/autorandr built in around seventy seconds (twenty-one packages fetched)





```
root@mowa219-gjp4-8570p-freebsd:~ # poudriere ports -u && poudriere bulk -j main -Ctv x11/autorandr
[00:00:00] Updating portstree "default" with git+https... done
[00:00:00] Creating the reference jail... done
[00:00:04] Mounting system devices for main-default
[00:00:04] Stashing existing package repository
[00:00:04] Mounting ccache from: /var/cache/ccache
[00:00:04] Mounting ports from: /usr/local/poudriere/ports/default
[00:00:04] Mounting packages from: /usr/local/poudriere/data/packages/main-default
[00:00:04] Mounting distfiles from: /usr/ports/distfiles
[00:00:04] Copying /var/db/ports from: /usr/local/etc/poudriere.d/options
[00:00:04] Appending to make.conf: /usr/local/etc/poudriere.d/make.conf
/etc/resolv.conf -> /usr/local/poudriere/data/.m/main-default/ref/etc/resolv.conf
[00:00:04] Starting jail main-default
[00:00:04] Will build as nobody:nobody (65534:65534)
[00:00:05] Logs: /usr/local/poudriere/data/logs/bulk/main-default/2022-03-21_07h15m37s
[00:00:05] Loading MOVED for /usr/local/poudriere/data/.m/main-default/ref/usr/ports
[00:00:05] Ports supports: FLAVORS SELECTED_OPTIONS
[00:00:05] Inspecting ports tree for modifications to git checkout... yes
[00:00:07] Ports top-level git hash: 2c27922c7e (dirty)
[00:00:07] Gathering ports metadata
[00:00:07] x11/autorandr depends on devel/ccache
[00:00:07] x11/autorandr depends on devel/gmake
[00:00:07] x11/autorandr depends on devel/pkgconf
[00:00:07] x11/autorandr depends on devel/py-setuptools@py38
[00:00:07] x11/autorandr depends on lang/python38
[00:00:07] x11/autorandr depends on ports-mgmt/pkg
[00:00:07] x11/autorandr depends on textproc/gsed
[00:00:07] x11/autorandr depends on x11/libxcb
[00:00:07] x11/autorandr depends on x11/xrandr
[00:00:07] devel/pkgconf depends on devel/ccache
[00:00:07] devel/pkgconf depends on ports-mgmt/pkg
[00:00:07] devel/gmake depends on devel/ccache
[00:00:07] devel/gmake depends on devel/gettext-runtime
[00:00:07] devel/gmake depends on ports-mgmt/pkg
[00:00:07] devel/gmake depends on print/indexinfo
[00:00:07] devel/ccache depends on ports-mgmt/pkg
[00:00:07] textproc/gsed depends on devel/ccache
[00:00:07] textproc/gsed depends on devel/gettext-runtime
[00:00:07] textproc/gsed depends on devel/gettext-tools
[00:00:07] textproc/gsed depends on ports-mgmt/pkg
[00:00:07] textproc/gsed depends on print/indexinfo
[00:00:07] textproc/gsed depends on print/texinfo
[00:00:07] lang/python38 depends on devel/ccache
[00:00:07] lang/python38 depends on devel/gettext-runtime
[00:00:07] lang/python38 depends on devel/gettext-tools
[00:00:07] lang/python38 depends on devel/libffi
[00:00:07] lang/python38 depends on devel/pkgconf
[00:00:07] lang/python38 depends on devel/readline
[00:00:07] lang/python38 depends on math/mpdecimal
[00:00:07] lang/python38 depends on ports-mgmt/pkg
[00:00:07] x11/libxcb depends on devel/ccache
[00:00:07] x11/libxcb depends on devel/libpthread-stubs
[00:00:07] x11/libxcb depends on devel/pkgconf
[00:00:07] x11/xrandr depends on devel/ccache
[00:00:07] x11/libxcb depends on devel/xorg-macros
[00:00:07] x11/xrandr depends on devel/pkgconf
[00:00:07] x11/xrandr depends on devel/xorg-macros
[00:00:07] x11/libxcb depends on lang/python38
[00:00:07] x11/xrandr depends on ports-mgmt/pkg
[00:00:07] x11/libxcb depends on ports-mgmt/pkg
[00:00:07] x11/xrandr depends on x11/libX11
[00:00:07] x11/xrandr depends on x11/libXrandr
[00:00:07] x11/libxcb depends on x11/libXau
[00:00:07] x11/xrandr depends on x11/libXrender
[00:00:07] x11/libxcb depends on x11/libXdmcp
[00:00:07] x11/libxcb depends on x11/xcb-proto
[00:00:07] devel/libffi depends on devel/ccache
[00:00:07] devel/libffi depends on ports-mgmt/pkg
[00:00:07] devel/libffi depends on print/indexinfo
[00:00:07] devel/gettext-runtime depends on devel/ccache
[00:00:07] devel/gettext-runtime depends on ports-mgmt/pkg
[00:00:07] devel/gettext-runtime depends on print/indexinfo
[00:00:07] devel/gettext-tools depends on devel/ccache
[00:00:07] devel/gettext-tools depends on devel/gettext-runtime
[00:00:07] devel/gettext-tools depends on devel/libtextstyle
[00:00:07] devel/gettext-tools depends on ports-mgmt/pkg
[00:00:07] devel/gettext-tools depends on print/indexinfo
[00:00:07] devel/libpthread-stubs depends on devel/ccache
[00:00:07] devel/libpthread-stubs depends on ports-mgmt/pkg
[00:00:07] devel/readline depends on devel/ccache
[00:00:07] devel/readline depends on ports-mgmt/pkg
[00:00:07] devel/readline depends on print/indexinfo
[00:00:07] devel/xorg-macros depends on devel/ccache
[00:00:07] devel/xorg-macros depends on devel/pkgconf
[00:00:07] devel/xorg-macros depends on ports-mgmt/pkg
[00:00:07] math/mpdecimal depends on devel/ccache
[00:00:07] math/mpdecimal depends on devel/gmake
[00:00:07] math/mpdecimal depends on ports-mgmt/pkg
[00:00:07] print/indexinfo depends on devel/ccache
[00:00:07] print/indexinfo depends on ports-mgmt/pkg
[00:00:07] x11/libX11 depends on devel/ccache
[00:00:07] x11/libX11 depends on devel/pkgconf
[00:00:07] x11/libX11 depends on devel/xorg-macros
[00:00:07] x11/libX11 depends on ports-mgmt/pkg
[00:00:07] x11/libX11 depends on x11/libxcb
[00:00:07] x11/libX11 depends on x11/xorgproto
[00:00:07] x11/libX11 depends on x11/xtrans
[00:00:07] print/texinfo depends on converters/p5-Text-Unidecode
[00:00:07] print/texinfo depends on devel/ccache
[00:00:07] print/texinfo depends on devel/gettext-runtime
[00:00:07] print/texinfo depends on devel/gettext-tools
[00:00:07] print/texinfo depends on devel/gmake
[00:00:07] print/texinfo depends on devel/p5-Locale-libintl
[00:00:07] print/texinfo depends on lang/perl5.32
[00:00:07] x11/libXau depends on devel/ccache
[00:00:07] x11/libXau depends on devel/pkgconf
[00:00:07] x11/libXau depends on devel/xorg-macros
[00:00:07] print/texinfo depends on misc/help2man
[00:00:07] x11/libXau depends on ports-mgmt/pkg
[00:00:07] print/texinfo depends on ports-mgmt/pkg
[00:00:07] print/texinfo depends on print/indexinfo
[00:00:07] x11/libXau depends on x11/xorgproto
[00:00:07] print/texinfo depends on textproc/p5-Unicode-EastAsianWidth
[00:00:07] x11/libXdmcp depends on devel/ccache
[00:00:07] x11/libXdmcp depends on devel/pkgconf
[00:00:07] x11/libXdmcp depends on devel/xorg-macros
[00:00:07] x11/libXdmcp depends on ports-mgmt/pkg
[00:00:07] x11/libXdmcp depends on x11/xorgproto
[00:00:07] x11/libXrender depends on devel/ccache
[00:00:07] x11/libXrender depends on devel/pkgconf
[00:00:07] x11/libXrender depends on devel/xorg-macros
[00:00:07] x11/libXrender depends on ports-mgmt/pkg
[00:00:07] x11/libXrender depends on x11/libX11
[00:00:07] x11/libXrender depends on x11/xorgproto
[00:00:07] x11/libXrandr depends on devel/ccache
[00:00:07] x11/libXrandr depends on devel/pkgconf
[00:00:07] x11/libXrandr depends on devel/xorg-macros
[00:00:07] x11/libXrandr depends on ports-mgmt/pkg
[00:00:07] x11/libXrandr depends on x11/libX11
[00:00:07] x11/libXrandr depends on x11/libXext
[00:00:07] x11/libXrandr depends on x11/libXrender
[00:00:07] x11/libXrandr depends on x11/xorgproto
[00:00:07] x11/xcb-proto depends on devel/ccache
[00:00:07] x11/xcb-proto depends on devel/pkgconf
[00:00:07] x11/xcb-proto depends on devel/xorg-macros
[00:00:07] x11/xcb-proto depends on lang/python38
[00:00:07] x11/xcb-proto depends on ports-mgmt/pkg
[00:00:07] x11/xcb-proto depends on textproc/libxml2
[00:00:07] converters/p5-Text-Unidecode depends on devel/ccache
[00:00:07] converters/p5-Text-Unidecode depends on lang/perl5.32
[00:00:07] converters/p5-Text-Unidecode depends on ports-mgmt/pkg
[00:00:07] devel/libtextstyle depends on devel/ccache
[00:00:07] devel/libtextstyle depends on ports-mgmt/pkg
[00:00:07] devel/libtextstyle depends on print/indexinfo
[00:00:07] devel/p5-Locale-libintl depends on converters/libiconv
[00:00:07] devel/p5-Locale-libintl depends on devel/ccache
[00:00:07] devel/p5-Locale-libintl depends on devel/gettext-runtime
[00:00:07] devel/p5-Locale-libintl depends on devel/gettext-tools
[00:00:07] devel/p5-Locale-libintl depends on lang/perl5.32
[00:00:07] devel/p5-Locale-libintl depends on ports-mgmt/pkg
[00:00:07] misc/help2man depends on devel/ccache
[00:00:07] misc/help2man depends on devel/gettext-runtime
[00:00:07] misc/help2man depends on devel/gettext-tools
[00:00:07] misc/help2man depends on devel/gmake
[00:00:07] misc/help2man depends on devel/p5-Locale-gettext
[00:00:07] misc/help2man depends on lang/perl5.32
[00:00:07] misc/help2man depends on ports-mgmt/pkg
[00:00:07] misc/help2man depends on print/indexinfo
[00:00:07] lang/perl5.32 depends on devel/ccache
[00:00:07] lang/perl5.32 depends on ports-mgmt/pkg
[00:00:07] textproc/libxml2 depends on devel/ccache
[00:00:07] textproc/libxml2 depends on devel/pkgconf
[00:00:07] textproc/libxml2 depends on ports-mgmt/pkg
[00:00:07] textproc/p5-Unicode-EastAsianWidth depends on devel/ccache
[00:00:07] textproc/p5-Unicode-EastAsianWidth depends on lang/perl5.32
[00:00:07] textproc/p5-Unicode-EastAsianWidth depends on ports-mgmt/pkg
[00:00:07] x11/xorgproto depends on devel/ccache
[00:00:07] x11/xorgproto depends on devel/pkgconf
[00:00:07] x11/xorgproto depends on devel/xorg-macros
[00:00:07] x11/xorgproto depends on ports-mgmt/pkg
[00:00:07] x11/libXext depends on devel/ccache
[00:00:07] x11/libXext depends on devel/pkgconf
[00:00:07] x11/libXext depends on devel/xorg-macros
[00:00:07] x11/libXext depends on ports-mgmt/pkg
[00:00:07] x11/libXext depends on x11/libX11
[00:00:07] x11/libXext depends on x11/libXau
[00:00:07] x11/libXext depends on x11/xorgproto
[00:00:07] x11/xtrans depends on devel/ccache
[00:00:07] x11/xtrans depends on devel/pkgconf
[00:00:07] x11/xtrans depends on devel/xorg-macros
[00:00:07] x11/xtrans depends on ports-mgmt/pkg
[00:00:07] devel/p5-Locale-gettext depends on devel/ccache
[00:00:07] devel/p5-Locale-gettext depends on devel/gettext-runtime
[00:00:07] devel/p5-Locale-gettext depends on devel/gettext-tools
[00:00:07] devel/p5-Locale-gettext depends on lang/perl5.32
[00:00:07] devel/p5-Locale-gettext depends on ports-mgmt/pkg
[00:00:07] converters/libiconv depends on devel/ccache
[00:00:07] converters/libiconv depends on ports-mgmt/pkg
[00:00:07] devel/py-setuptools depends on devel/ccache
[00:00:07] devel/py-setuptools depends on lang/python38
[00:00:07] devel/py-setuptools depends on ports-mgmt/pkg
[00:00:07] Calculating ports order and dependencies
[00:00:07] -C specified, cleaning listed packages
[00:00:07] (-C) Flushing package deletions
[00:00:08] Trimming IGNORED and blacklisted ports
[00:00:08] Package fetch: Looking for missing packages to fetch from pkg+http://pkg.FreeBSD.org/${ABI}/latest
Updating FreeBSD repository catalogue...
[main-default] Fetching meta.conf: 100%    163 B   0.2kB/s    00:01   
[main-default] Fetching packagesite.pkg: 100%    6 MiB   6.7MB/s    00:01   
Processing entries: 100%
FreeBSD repository update completed. 31146 packages processed.
All repositories are up to date.
[00:00:19] Package fetch: Will fetch gsed-4.8
[00:00:19] Package fetch: Will fetch python38-3.8.12_2
[00:00:19] Package fetch: Will fetch libxcb-1.14_1
[00:00:19] Package fetch: Will fetch pkgconf-1.8.0,1
[00:00:19] Package fetch: Will fetch libffi-3.3_1
[00:00:19] Package fetch: Will fetch xrandr-1.5.1
[00:00:19] Package fetch: Will fetch libpthread-stubs-0.4
[00:00:19] Package fetch: Will fetch readline-8.1.2
[00:00:19] Package fetch: Will fetch libX11-1.7.2,1
[00:00:19] Package fetch: Will fetch mpdecimal-2.5.1
[00:00:19] Package fetch: Will fetch xorg-macros-1.19.3
[00:00:19] Package fetch: Will fetch libXdmcp-1.1.3
[00:00:19] Package fetch: Will fetch libXrender-0.9.10_2
[00:00:19] Package fetch: Will fetch libXau-1.0.9
[00:00:19] Package fetch: Will fetch libXrandr-1.5.2
[00:00:20] Package fetch: Will fetch libxml2-2.9.12
[00:00:20] Package fetch: Will fetch xcb-proto-1.14.1
[00:00:20] Package fetch: Will fetch xorgproto-2021.5
[00:00:20] Package fetch: Will fetch libXext-1.3.4,1
[00:00:20] Package fetch: Will fetch xtrans-1.4.0
[00:00:20] Package fetch: Will fetch py38-setuptools-57.0.0
[00:00:20] Package fetch: Will fetch 21 packages from remote or local pkg cache

No packages are required to be fetched.
Integrity check was successful.
[00:00:20] Package fetch: Using cached copy of gsed-4.8
[00:00:20] Package fetch: Using cached copy of python38-3.8.12_2
[00:00:20] Package fetch: Using cached copy of libxcb-1.14_1
[00:00:20] Package fetch: Using cached copy of pkgconf-1.8.0,1
[00:00:20] Package fetch: Using cached copy of libffi-3.3_1
[00:00:20] Package fetch: Using cached copy of xrandr-1.5.1
[00:00:20] Package fetch: Using cached copy of libpthread-stubs-0.4
[00:00:20] Package fetch: Using cached copy of readline-8.1.2
[00:00:20] Package fetch: Using cached copy of libX11-1.7.2,1
[00:00:20] Package fetch: Using cached copy of mpdecimal-2.5.1
[00:00:20] Package fetch: Using cached copy of xorg-macros-1.19.3
[00:00:20] Package fetch: Using cached copy of libXdmcp-1.1.3
[00:00:20] Package fetch: Using cached copy of libXrender-0.9.10_2
[00:00:20] Package fetch: Using cached copy of libXau-1.0.9
[00:00:20] Package fetch: Using cached copy of libXrandr-1.5.2
[00:00:20] Package fetch: Using cached copy of libxml2-2.9.12
[00:00:20] Package fetch: Using cached copy of xcb-proto-1.14.1
[00:00:20] Package fetch: Using cached copy of xorgproto-2021.5
[00:00:20] Package fetch: Using cached copy of libXext-1.3.4,1
[00:00:20] Package fetch: Using cached copy of xtrans-1.4.0
[00:00:20] Package fetch: Using cached copy of py38-setuptools-57.0.0
[00:00:20] Sanity checking the repository
[00:00:20] Checking for stale cache files
[00:00:20] Checking packages for incremental rebuild needs
[00:00:20] Checking packages for missing dependencies
[00:00:20] Deleting stale symlinks... done
[00:00:20] Deleting empty directories... done
[00:00:20] Package fetch: Generating logs for fetched packages
[00:00:35] Unqueueing existing packages
[00:00:35] Unqueueing orphaned build dependencies
[00:00:35] Sanity checking build queue
[00:00:35] Processing PRIORITY_BOOST
[00:00:35] Balancing pool
[main-default] [2022-03-21_07h15m37s] [balancing_pool:] Queued: 22 Built: 0  Failed: 0  Skipped: 0  Ignored: 0  Fetched: 21 Tobuild: 1   Time: 00:00:31
[00:00:35] Recording filesystem state for prepkg... done
[00:00:44] Building 1 packages using up to 1 builders
[00:00:44] Hit CTRL+t at any time to see build progress and stats
[00:00:44] [01] [00:00:00] Builder starting
[00:00:45] [01] [00:00:01] Builder started
[00:00:45] [01] [00:00:00] Building x11/autorandr@py38 | autorandr-1.12.1
[00:00:45] [01] [00:00:00] Status   x11/autorandr@py38 | autorandr-1.12.1: check-sanity
[00:00:45] [01] [00:00:00] Status   x11/autorandr@py38 | autorandr-1.12.1: pkg-depends
[00:00:47] [01] [00:00:02] Status   x11/autorandr@py38 | autorandr-1.12.1: fetch-depends
[00:00:47] [01] [00:00:02] Status   x11/autorandr@py38 | autorandr-1.12.1: fetch
[00:00:48] [01] [00:00:03] Status   x11/autorandr@py38 | autorandr-1.12.1: checksum
[00:00:48] [01] [00:00:03] Status   x11/autorandr@py38 | autorandr-1.12.1: extract-depends
[00:00:48] [01] [00:00:03] Status   x11/autorandr@py38 | autorandr-1.12.1: extract
[00:00:48] [01] [00:00:03] Status   x11/autorandr@py38 | autorandr-1.12.1: patch-depends
[00:00:48] [01] [00:00:03] Status   x11/autorandr@py38 | autorandr-1.12.1: patch
[00:00:48] [01] [00:00:03] Status   x11/autorandr@py38 | autorandr-1.12.1: build-depends
[00:00:53] [01] [00:00:08] Status   x11/autorandr@py38 | autorandr-1.12.1: lib-depends
[00:00:53] [01] [00:00:08] Status   x11/autorandr@py38 | autorandr-1.12.1: configure
[00:00:54] [01] [00:00:09] Status   x11/autorandr@py38 | autorandr-1.12.1: build
[00:01:02] [01] [00:00:17] Status   x11/autorandr@py38 | autorandr-1.12.1: run-depends
[00:01:03] [01] [00:00:18] Status   x11/autorandr@py38 | autorandr-1.12.1: stage
[00:01:04] [01] [00:00:19] Status   x11/autorandr@py38 | autorandr-1.12.1: package
[00:01:05] [01] [00:00:20] Status   x11/autorandr@py38 | autorandr-1.12.1: install
[00:01:06] [01] [00:00:21] Status   x11/autorandr@py38 | autorandr-1.12.1: deinstall
[00:01:06] [01] [00:00:21] Finished x11/autorandr@py38 | autorandr-1.12.1: Success
[00:01:07] Stopping 1 builders
main-default-job-01: removed
main-default-job-01-n: removed
[00:01:08] Creating pkg repository
Creating repository in /tmp/packages: 100%
Packing files for repository: 100%
[00:01:12] Committing packages to repository: /usr/local/poudriere/data/packages/main-default/.real_1647847008 via .latest symlink
[00:01:12] Removing old packages
[00:01:12] Built ports: x11/autorandr@py38
[00:01:12] Fetched ports: lang/python38 textproc/gsed x11/libxcb x11/xrandr devel/libffi devel/readline devel/libpthread-stubs devel/pkgconf x11/libX11 math/mpdecimal x11/libXdmcp x11/libXrender x11/libXau x11/libXrandr textproc/libxml2 x11/xcb-proto x11/xorgproto x11/xtrans x11/libXext devel/xorg-macros devel/py-setuptools@py38
[main-default] [2022-03-21_07h15m37s] [committing:] Queued: 22 Built: 1  Failed: 0  Skipped: 0  Ignored: 0  Fetched: 21 Tobuild: 0   Time: 00:01:07
[00:01:12] Logs: /usr/local/poudriere/data/logs/bulk/main-default/2022-03-21_07h15m37s
[00:01:12] Cleaning up
main-default: removed
main-default-n: removed
[00:01:12] Unmounting file systems
root@mowa219-gjp4-8570p-freebsd:~ # pkg install x11/autorandr
Updating FreeBSD repository catalogue...
FreeBSD repository is up to date.
Updating poudriere repository catalogue...
Fetching meta.conf: 100%    163 B   0.2kB/s    00:01   
Fetching packagesite.pkg: 100%   15 KiB  15.4kB/s    00:01   
Processing entries: 100%
The provides database is up-to-date.
poudriere repository update completed. 52 packages processed.
All repositories are up to date.
Checking integrity... done (0 conflicting)
The following 1 package(s) will be affected (of 0 checked):

New packages to be INSTALLED:
        autorandr: 1.12.1 [poudriere]

Number of packages to be installed: 1

Proceed with this action? [y/N]: y
[1/1] Installing autorandr-1.12.1...
[1/1] Extracting autorandr-1.12.1: 100%
root@mowa219-gjp4-8570p-freebsd:~ #
```


----------



## sidetone (Mar 21, 2022)

I didn't have my thought refined.

For basics, a program that looks through the sourcecode of a program, and lists which file dependency file names are asked for, both mandatory and optional. The package is needed, but the focus would be on files/library names themselves, than that. This would go a long way, even if this is as far as it goes.

What I wrote in the previous entry would be more difficult. Maybe taking the statistics of installed ports on any computer or of the entire portstree, and including rough percentages of how much their headers and libraries are used. This one could be difficult, maybe not as intensive as compiling, but so much is taken for compiling anyway. This one is like some fantasy idea, which would have abstract implementations and could be far from perfect in practice.


----------



## SirDice (Mar 21, 2022)

I've been playing with graph databases, like neo4j. The ports tree and dependency chains appear to be ideal to put in a graph DB. That should result in an interesting model to work with. I can remember somebody made tool that used similar graph theory to string all the ports together, but I can't remember the tool or who made it.


----------



## bsduck (Mar 22, 2022)

n0.0 said:


> solve dependencies on ports


What do you mean? When you build a port, dependencies will be built automatically if not already installed.
If you prefer to install dependencies from pkg rather then build them you can use `make install-missing-packages` before running `make`.


----------



## SirDice (Mar 22, 2022)

Suddenly remembered something and found this thread: https://forums.freebsd.org/threads/how-can-i-visually-view-a-ports-dependencies.71129/


----------



## n0.0 (Apr 8, 2022)

Oh well. Just in case you wonder why I asked this... While I install from ports, I cannot install the desired program from once time. The logs shows that I need to port manually to another program, install those, the whole, and then install the program I wanted. Just that. Obviously pkg does it very fine, but, what if it happens in ports?


----------



## bsduck (Apr 8, 2022)

n0.0 said:


> The logs shows that I need to port manually to another program, install those, the whole, and then install the program I wanted.


Please share the output you get when trying to `make` a port.


----------



## Jose (Apr 8, 2022)

SirDice said:


> Suddenly remembered something and found this thread: https://forums.freebsd.org/threads/how-can-i-visually-view-a-ports-dependencies.71129/


Yeah, I've looked at that several times. Those don't answer the question I have most often which is "what is pulling in {some-port}?"

Edit: Something like this https://wiki.gentoo.org/wiki/Equery#Listing_all_packages_depending_on_a_package_with_depends_.28d.29


----------



## bsduck (Apr 8, 2022)

Jose said:


> Those don't answer the question I have most often which is "what is pulling in {some-port}?"


I think you'll enjoy `pkg query %ro yourpackage` in such cases!


----------



## Jose (Apr 8, 2022)

bsduck said:


> I think you'll enjoy `pkg query %ro yourpackage` in such cases!


Thanks, but that shows you just the immediate dependencies. I'd like to see all the transitive dependencies up to the non-automatic package that pulls in packagename.


----------



## SirDice (Apr 8, 2022)

Jose said:


> Thanks, but that shows you just the immediate dependencies. I'd like to see all the transitive dependencies up to the non-automatic package that pulls in packagename.


That's the main idea why I thought about putting the ports tree in a graph database. You could click on any port and it would, visually, show you the whole dependency chain. Both forwards and backwards. I also wanted to add the OPTIONS in it too. So if you enabled/disabled an option you could see how that would cascade up and down the chain. It could also help identifying conflicting options, or those dreaded dependency loops.


----------



## sidetone (Apr 8, 2022)

One that has an option to show only common dependencies of 2 or more of the asked for programs, and leaves out other dependencies.

If you've seen libcanberra with portgraph, the image won't even fit on my over 30” TV in a viewable size, or I need a magnifying glass if it all fits on my screen.


----------



## grahamperrin@ (Apr 8, 2022)

Jose said:


> 𠉧… see all the transitive dependencies up to the non-automatic package that pulls in packagename.



Which package, for example?

I'm not sure what's meant by _transitive_ here.


----------



## mer (Apr 8, 2022)

If one looks at Makefiles for a port, you often seen different types of dependencies.  Buildtime and runtime come immediately to mind.  Looking at source code doesn't always pick them all up (X depends on Y, Y depends on Z, looking at source code you see dependency on Y but not on Z), then when you look at a port that has different config options leading to different dependencies, the problem becomes even more "interesting".

Also, is the starting point a package that is installed or just built or just the source code?  Big difference in how you get your information.


----------



## sidetone (Apr 8, 2022)

The dependency of the next dependency will pick up that dependency by looking at the source code of those combined, especially for those which aren't optional.


----------



## mer (Apr 8, 2022)

sidetone said:


> The dependency of the next dependency will pick up that dependency by looking at the source code of those combined, especially for those which aren't optional.


But only if the source code of that dependency is installed, no?

That's why I asked "what is the starting point".
In theory, any specific port has it's dependencies correctly defined, so looking at a port source tree, for any given port, dependencies should be defined in Makefiles (I'm ignoring things like standard libraries for gcc/c++/etc).
But a binary package may have been built with non default ports so if you are looking at the binary package you need to walk all the binaries.

Two different use cases:
"I want to install a port from source, using a specific configuration which may be default" and
"I want to install a prebuilt binary package from an existing repo which was built with a configuration"

The dependency tree for these two use cases may be the same or may be be different and different tools are used to make that tree.


----------



## sidetone (Apr 8, 2022)

If it downloads the compressed sourcecode files like `make fetch-recursive` does except as it finds the call for them in source code. Additional ones can be for required ports, but also for optional ones. It would be intensive, but not as much as compiling.

Going further than the sourcecode of 1 port may need a combination of knowing which packages have the neededfiles. It would have to rely on the package names listed in Makefile's, though to check the sourcecode for certainty of the filenames, not ports.


----------



## Jose (Apr 9, 2022)

SirDice said:


> That's the main idea why I thought about putting the ports tree in a graph database. You could click on any port and it would, visually, show you the whole dependency chain. Both forwards and backwards. I also wanted to add the OPTIONS in it too. So if you enabled/disabled an option you could see how that would cascade up and down the chain. It could also help identifying conflicting options, or those dreaded dependency loops.


bsduck 's answer makes me think a lot of this information might already be in the pkg(8) database.


----------



## Deleted member 70435 (Apr 9, 2022)

the problem is that you mix use ports or use the ready binary, good or something or another, in relation to the library the version you are compiling may be the most recent, and there may be some problems if you are compiling a newer version of a port of a software that is a common gtk library

and for example you have a stable version of gtk, and you want to update only that you have some libraries that depend on each other, on a version and that would definitely break your door.

what you have to do before I come to ask a question and study well, how should I ask a technical question, and that some of the FreeBSD engineers, can understand, and give me an answer that is technical and evaluative.

well I have different custom, since I develop for NetBSD. and I know how ABI system libraries work, elements that depend on a library, be it a library that has a wide dependency, may have possible problems, with others, there we have a serious problem


----------



## Deleted member 70435 (Apr 9, 2022)

SirDice said:


> I've been playing with graph databases, like neo4j. The ports tree and dependency chains appear to be ideal to put in a graph DB. That should result in an interesting model to work with. I can remember somebody made tool that used similar graph theory to string all the ports together, but I can't remember the tool or who made it.


and graph theory is an efficient way to some extent. please tell me what is your experience with graphs


----------



## sidetone (Apr 9, 2022)

Portgraph depends on what you set the configuration options to, no matter if it's from ports or packages. Packages probably sets them, then, they can be set again through ports, no matter what's installed on the system. Portgraph will show dependencies of the current set options on the ports, regardless of what the options of the installed package are, or even if they're not installed. It will show, based on what was last set in `make config` no matter what's installed or not installed.


----------



## PMc (Apr 9, 2022)

Jose said:


> Yeah, I've looked at that several times. Those don't answer the question I have most often which is "what is pulling in {some-port}?"


Yes, I asked this many times. Now I have some scripting that builds my ports, and it creates the dependency tree on the way, so there is an output file with that information.
Basically you go into the port's dir under /usr/ports (which is shown in `pkg info [I]portname[/I]`), and there do

```
# for i in PKG EXTRACT PATCH FETCH BUILD LIB RUN; do
> make -V ${i}_DEPENDS
> done
```
This gives a bunch of required ports; do the same for each of them, and make a dependency graph from that.

I do it with awk. That one invokes `make config-conditional` on the way (because dependencies vary with different port options).
Further down it builds the whole crap. It does NOT trust in a downloaded Index file, it does NOT trust in make automatically invoking builds of prerequisites, it does NOT build a port with other things installed that are not needed by this specific port. Which means, it runs a stack of ZFS snapshots up and down and re-installs the already built packages as required.

One thing I have not yet figured out is: if something with a port changes, which and how many of the dependent ports should be recreated? Because, there are often small changes on some widespread libs, or an option is changed - and then usually the whole gang of llvm13 and rust and all the graphics stuff gets recreated. That is not a real problem, but my server gets noisy when running full load.


----------



## n0.0 (Apr 9, 2022)

bsduck said:


> Please share the output you get when trying to `make` a port.


Excuse me, this happens to me which around the majority of ports. In previous installations also. Now I won't leave `pkg` for nothing! Even if the ports are fine, I prefer pkg. Or, if it is a program that I want exclusively from ports, after doing `pkg ins portmaster && portsnap fetch auto && portsnap fetch update`, well, the case is different. Sorry if this appears from a quote inside a quote. I have no experience in the system right now... In fact, I am installing something for programming. Who knows what monster I make


----------



## grahamperrin@ (Apr 9, 2022)

sidetone said:


> Portgraph depends on what you set the configuration options to, no matter if it's from ports or packages. …



I assume that portgraph can not take account of files written by poudriere-options(8), true? 

<https://github.com/freebsd/poudriere/wiki/poudriere-options.8>


```
% ls -hl /usr/local/etc/poudriere.d/options/
total 1
drwxr-xr-x  2 root  wheel     3B 24 Jan 01:06 devel_libvirt
drwxr-xr-x  2 root  wheel     3B  1 Apr 02:22 editors_libreoffice
drwxr-xr-x  2 root  wheel     3B 10 Nov 03:01 emulators_wine
drwxr-xr-x  2 root  wheel     3B 23 Dec 15:03 multimedia_webcamd
drwxr-xr-x  2 root  wheel     2B 25 Jan 10:16 net_samba413
drwxr-xr-x  2 root  wheel     3B  4 Mar 04:59 www_chromium
drwxr-xr-x  2 root  wheel     3B 23 Dec 23:28 www_falkon
% cat /usr/local/etc/poudriere.d/options/multimedia_webcamd/options
# This file is auto-generated by 'make config'.
# Options for webcamd-5.13.2.8
_OPTIONS_READ=webcamd-5.13.2.8
_FILE_COMPLETE_OPTIONS_LIST=COMPAT32 DEBUG DVB INPUT KEYBOARD MOUSE RADIO V4L2LOOPBACK VT_CLIENT VT_SERVER WEBCAM
OPTIONS_FILE_SET+=COMPAT32
OPTIONS_FILE_SET+=DEBUG
OPTIONS_FILE_SET+=DVB
OPTIONS_FILE_SET+=INPUT
OPTIONS_FILE_UNSET+=KEYBOARD
OPTIONS_FILE_UNSET+=MOUSE
OPTIONS_FILE_SET+=RADIO
OPTIONS_FILE_SET+=V4L2LOOPBACK
OPTIONS_FILE_UNSET+=VT_CLIENT
OPTIONS_FILE_UNSET+=VT_SERVER
OPTIONS_FILE_SET+=WEBCAM
%
```


----------



## sidetone (Apr 10, 2022)

Regular ports options might be in /var/db/pkgs/ or /var/db/ports/. Does Poudriere have its own? If portgraph can use a custom directory for displaying.

It should be doable in the console of a Bastille jail. I don't believe I've tried this, bc I would have remembered it shown in a nested display. Can't try it right now, bc my harddrive went bad or something.


----------



## SirDice (Apr 11, 2022)

sidetone said:


> Does Poudriere have its own?


It does.

```
root@molly:/usr/local/etc/poudriere.d # ls -ld *-options
drwxr-xr-x  316 root  wheel  316 Jan  3  2021 122-release-server-options
drwxr-xr-x  269 root  wheel  269 Nov 20 23:01 13-stable-desktop-options
drwxr-xr-x  184 root  wheel  184 Oct 16 14:20 13-stable-server-options
drwxr-xr-x  422 root  wheel  422 Dec 26 18:54 130-release-desktop-options
drwxr-xr-x  375 root  wheel  375 Feb 23 11:23 130-release-server-options
```


----------



## sidetone (Apr 11, 2022)

ports-mgmt/portgraph --> https://gitlab.com/lbartoletti/portgraph


> -h or --help: Show this help
> *-l my_dir or --localbase my_dir: Sets my_dir as the directory where ports are located (/usr/ports by default)*


So, portgraph can be used with Poudriere and any other jail that has directory. Maybe, making a softlink to /usr/local/etc/poudriere.d/options/, then referencing the specific directory under it would make it more convenient. I missed the directory in the previous post for poudriere's options. I was thinking about it being within the jail, but that is meant to work while being outside of it.

More specifically from portgraph's webpage:


> *Using a specific local ports, like poudriere:*
> portgraph -l /usr/local/poudriere/ports/default



Rest of help display from portgraph:


> -p my_port or --port my_port: Sets my_port as the port to produce the graph (ports-mgmt/py-portgraph by default).
> -b or --build: build-depends-list (if -b or -r is not present, -b is actived by default).
> -r or --run: run-depends-list (if -b or -r is not present, -b is actived by default).
> -f my_flavor or --flavor my_flavor: Sets the flavor for the port.
> ...


I couldn't find a manpage, so the website and the --help display are where the information about it is at.


----------



## grahamperrin@ (Apr 11, 2022)

Note, the quite different paths:



grahamperrin said:


> ```
> % ls -hl /usr/local/etc/poudriere.d/options/
> …
> ```



/usr/local/poudriere/ports/default


----------



## sidetone (Apr 11, 2022)

That directory is a quote from the Portgraph webpage. I also had the correct directory written above as noted in two previous posts. The one from the website was probably symbolic. I don't have my system up and I don't use Poudriere, there could be symbolic links or multiple locations as well. It's nice to know how the options directory could be referenced for different jails, so I had interest in commenting and showing the Portgraph page.

The point was, that Portgraph can be used with Poudriere options by using a custom directory:


> -l my_dir or --localbase my_dir: Sets my_dir as the directory where ports are located (/usr/ports by default)


Also, that that a softlink can be made to simply calls to the correct directory and subsequent subdirectories, and that Portgraph had consideration for use with Poudriere.


----------



## grahamperrin@ (Apr 12, 2022)

I mean, I assume that Portgraph can *not* take account of the contents of the directory that's used by poudriere-options(8), which is (by design) separate from the directory where ports are located.


----------



## sidetone (Apr 12, 2022)

I'm not sure you read my last two responses.
`portgraph -l [location to poudriere's options directory]`
This is to use Portgraph on a custom directory, in this case Poudriere's. Portgraph is made for Poudriere's use of options as well as regular ports, even if they listed the wrong directory on their website.

Unless, poudriere-options(8) doesn't set up options in a Poudriere directory anywhere.

Type: `portgraph -h`


----------



## grahamperrin@ (Apr 12, 2022)

`-l my_dir or --localbase my_dir: Sets my_dir as the directory where ports are located (/usr/ports by default)`

The directory where ports are located (by poudriere) is _not_ the directory where options files are located (by poudriere); see the /usr/local/etc/poudriere.d/options/multimedia_webcamd/options example above.


----------



## sidetone (Apr 13, 2022)

Maybe they put the wrong directory, or maybe it goes to Poudriere's ports, then selects a different directory where options are based on that.

Try the -l option on portgraph with the Poudriere options directories, then, try it where Poudriere's actual ports are.

If it's supposed to be the options directory, which everyone here understands above, then, confirm it, so someone can look it up, or let them know.


----------



## grahamperrin@ (Apr 13, 2022)

```
root@mowa219-gjp4-8570p-freebsd:/tmp # portgraph -p editors/nano
root@mowa219-gjp4-8570p-freebsd:/tmp # file ./nano && rm ./nano*
./nano: ASCII text
root@mowa219-gjp4-8570p-freebsd:/tmp # portgraph -p editors/nano -l /usr/local/etc/poudriere.d/options
make: chdir /usr/local/etc/poudriere.d/options/editors/nano: No such file or directory
root@mowa219-gjp4-8570p-freebsd:/tmp # portgraph -p editors/nano -l /usr/local/poudriere/ports/default
root@mowa219-gjp4-8570p-freebsd:/tmp # file ./nano && rm ./nano*
./nano: ASCII text
root@mowa219-gjp4-8570p-freebsd:/tmp #
```

Telling dependencies, without a graph, with `DEBUG=on` set for multimedia/webcamd:



Spoiler: poudriere bulk -j main -b latest -nv multimedia/webcamd





```
root@mowa219-gjp4-8570p-freebsd:~ # poudriere options -n -s multimedia/webcamd
[00:00:00] Working on options directory /usr/local/etc/poudriere.d/options
===> The following configuration options are available for webcamd-5.17.1.0:
     COMPAT32=on: Enable 32-bit compatibility support
     DEBUG=on: Build with debugging support
     DVB=on: Build with USB DVB support (DVB-X, analog TV, ...)
     INPUT=on: Build with USB input support (tablet, joystick, HID, IR, ...)
     KEYBOARD=off: Build with USB keyboard support
     MOUSE=off: Build with USB mouse support
     RADIO=on: Build with USB radio support
     V4L2LOOPBACK=on: Build with V4L2 loopback support
     VT_CLIENT=off: Build with vTuner client support
     VT_SERVER=off: Build with vTuner server support
     WEBCAM=on: Build with USB webcam support (UVC, gspca, ...)
===> Use 'make config' to modify these settings
root@mowa219-gjp4-8570p-freebsd:~ # time poudriere ports -u
[00:00:00] Updating portstree "default" with git+https... done
0.951u 4.890s 0:30.95 18.8%     3254+450k 25360+660io 1652pf+0w
root@mowa219-gjp4-8570p-freebsd:~ # poudriere bulk -j main -b latest -nv multimedia/webcamd
[00:00:00] [Dry Run] Creating the reference jail... done
[00:01:30] [Dry Run] Mounting system devices for main-default
[00:01:31] [Dry Run] Stashing existing package repository
[00:01:31] [Dry Run] Mounting ccache from: /var/cache/ccache
[00:01:31] [Dry Run] Mounting ports from: /usr/local/poudriere/ports/default
[00:01:31] [Dry Run] Mounting packages from: /usr/local/poudriere/data/packages/main-default
[00:01:31] [Dry Run] Mounting distfiles from: /usr/ports/distfiles
[00:01:31] [Dry Run] Copying /var/db/ports from: /usr/local/etc/poudriere.d/options
/etc/resolv.conf -> /usr/local/poudriere/data/.m/main-default/ref/etc/resolv.conf
[00:01:31] [Dry Run] Starting jail main-default
[00:01:31] [Dry Run] Will build as nobody:nobody (65534:65534)
[00:01:33] [Dry Run] Logs: /usr/local/poudriere/data/logs/bulk/main-default/2022-04-13_07h43m01s
[00:01:33] [Dry Run] Loading MOVED for /usr/local/poudriere/data/.m/main-default/ref/usr/ports
[00:01:34] [Dry Run] Ports supports: FLAVORS SELECTED_OPTIONS
[00:01:34] [Dry Run] Inspecting ports tree for modifications to git checkout... yes
[00:01:59] [Dry Run] Ports top-level git hash: 101d4e1e39 (dirty)
[00:01:59] [Dry Run] Gathering ports metadata
[00:01:59] [Dry Run] multimedia/webcamd depends on devel/ccache
[00:01:59] [Dry Run] multimedia/webcamd depends on devel/pkgconf
[00:01:59] [Dry Run] multimedia/webcamd depends on multimedia/v4l_compat
[00:01:59] [Dry Run] multimedia/webcamd depends on ports-mgmt/pkg
[00:01:59] [Dry Run] devel/pkgconf depends on devel/ccache
[00:01:59] [Dry Run] devel/pkgconf depends on ports-mgmt/pkg
[00:01:59] [Dry Run] devel/ccache depends on ports-mgmt/pkg
[00:01:59] [Dry Run] multimedia/v4l_compat depends on devel/evdev-proto
[00:01:59] [Dry Run] multimedia/v4l_compat depends on ports-mgmt/pkg
[00:01:59] [Dry Run] devel/evdev-proto depends on ports-mgmt/pkg
[00:01:59] [Dry Run] Calculating ports order and dependencies
[00:01:59] [Dry Run] Trimming IGNORED and blacklisted ports
[00:01:59] [Dry Run] Package fetch: Looking for missing packages to fetch from pkg+http://pkg.FreeBSD.org/${ABI}/latest
Updating FreeBSD repository catalogue...
[main-default] Fetching meta.conf: 100%    163 B   0.2kB/s    00:01  
[main-default] Fetching packagesite.pkg: 100%    6 MiB   2.2MB/s    00:03  
Processing entries: 100%
FreeBSD repository update completed. 30988 packages processed.
All repositories are up to date.
[00:02:14] [Dry Run] Package fetch: Skipping webcamd-5.17.1.0: options wanted: +COMPAT32 +DEBUG +DVB +INPUT -KEYBOARD -MOUSE +RADIO +V4L2LOOPBACK -VT_CLIENT -VT_SERVER +WEBCAM
[00:02:14] [Dry Run] Package fetch: Skipping webcamd-5.17.1.0: options remote: +COMPAT32 -DEBUG +DVB +INPUT -KEYBOARD -MOUSE +RADIO +V4L2LOOPBACK -VT_CLIENT -VT_SERVER +WEBCAM
[00:02:14] [Dry Run] Package fetch: Will fetch evdev-proto-5.8
[00:02:14] [Dry Run] Package fetch: Will fetch v4l_compat-1.23.0
[00:02:14] [Dry Run] Package fetch: Will fetch 2 packages from remote or local pkg cache
The following packages will be fetched:

New packages to be FETCHED:
        evdev-proto: 5.8 (22 KiB: 19.80% of the 109 KiB to download)
        v4l_compat: 1.23.0 (88 KiB: 80.20% of the 109 KiB to download)

Number of packages to be fetched: 2

109 KiB to be downloaded.
[main-default] Fetching evdev-proto-5.8.pkg: 100%   22 KiB  22.2kB/s    00:01  
[main-default] Fetching v4l_compat-1.23.0.pkg: 100%   88 KiB  89.9kB/s    00:01  
[00:02:14] [Dry Run] Package fetch: Using cached copy of evdev-proto-5.8
[00:02:14] [Dry Run] Package fetch: Using cached copy of v4l_compat-1.23.0
[00:02:14] [Dry Run] Sanity checking the repository
[00:02:14] [Dry Run] Checking for stale cache files
[00:02:14] [Dry Run] Checking packages for incremental rebuild needs
[00:02:14] [Dry Run] Checking packages for missing dependencies
[00:02:14] [Dry Run] Deleting stale symlinks... done
[00:02:15] [Dry Run] Deleting empty directories... done
[00:02:15] [Dry Run] Package fetch: Generating logs for fetched packages
[00:02:21] [Dry Run] Unqueueing existing packages
[00:02:21] [Dry Run] Unqueueing orphaned build dependencies
[00:02:21] [Dry Run] Sanity checking build queue
[00:02:21] [Dry Run] Processing PRIORITY_BOOST
[main-default] [2022-04-13_07h43m01s] [load_priorities:] Queued: 3  Built: 0  Failed: 0  Skipped: 0  Ignored: 0  Fetched: 2  Tobuild: 1   Time: 00:00:48
[00:02:21] [Dry Run] Dry run mode, cleaning up and exiting
[00:02:21] [Dry Run] Would build 1 packages using 1 builders
[00:02:21] [Dry Run] Ports to build: multimedia/webcamd
[00:02:21] [Dry Run] Logs: /usr/local/poudriere/data/logs/bulk/main-default/2022-04-13_07h43m01s
[00:02:21] [Dry Run] Cleaning up
main-default: removed
main-default-n: removed
[00:02:21] [Dry Run] Unmounting file systems
root@mowa219-gjp4-8570p-freebsd:~ #
```




Condensed: 

`[00:01:59] [Dry Run] multimedia/webcamd depends on devel/ccache
[00:01:59] [Dry Run] multimedia/webcamd depends on devel/pkgconf
[00:01:59] [Dry Run] multimedia/webcamd depends on multimedia/v4l_compat
[00:01:59] [Dry Run] multimedia/webcamd depends on ports-mgmt/pkg
[00:01:59] [Dry Run] devel/pkgconf depends on devel/ccache
[00:01:59] [Dry Run] devel/pkgconf depends on ports-mgmt/pkg
[00:01:59] [Dry Run] devel/ccache depends on ports-mgmt/pkg
[00:01:59] [Dry Run] multimedia/v4l_compat depends on devel/evdev-proto
[00:01:59] [Dry Run] multimedia/v4l_compat depends on ports-mgmt/pkg
[00:01:59] [Dry Run] devel/evdev-proto depends on ports-mgmt/pkg`


----------



## n0.0 (Apr 26, 2022)

Thanks you all. The info, born in a simple question, gets into a debate between high status guys. I've learned so much... Well, I only thanks. Weeks had passed since I wrote this post, and... Well, just thanks


----------

