tech-pkg archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: Script pkg_tsort



Hello,

On Mon, Apr 15, 2019 at 03:51:53PM -0400, Greg Troxel wrote:
> tlaronde%polynum.com@localhost writes:
> 
> > Here is a simple Bourne shell script that takes what is currently
> > installed on a node, takes the build dependencies and the running
> > dependencies and produce a series of records in topological order
> > with the following fields:
> 
> pkg_rolling-replace does a bit of this.  If you end up packaging it, it
> might make sense to depend on it instead.

But pkg_rolling-replace ignores +PRESERVE.

I don't know either if pkg_rolling-replace takes pkg-vulnerabilities
into account (when not doing things but telling what it would have
done).

I have tried it but this above and the fact that all is mixed: finding
dependencies and updating, is not to my taste.

I specifically wanted to have an utility to "sort" things and, based on
this listing, one can do whatever one sees fit with very simple
scripting (or edit the listing for ad hoc fixing).

> 
> With the -n option, it doesn't do the replaces, but will more or less
> produce a list of what it would have udpatd.
> 
> It looks like your script finds the run and build dependencies of the
> installed version.  pkg_rr finds the run and build dependencies of the
> new version, and now recently the tool dependencies also.   I don't know
> how you'd do that without running make show-depends three times.

You have probably to call make since there is no simple way to parse the
Makefile, with all the inclusions and the variable expansions---and 
this is what takes a huge amount of time---I don't know for the pkgsrc
version of the package if I could simply take the distinfo file without
bothering with make(1) and the Makefile.

But for the dependencies, one can perhaps avoid calling make by sed'ing 
the Makefile for the buildlink inclusions and then looking for the 
inclusions if this has not already be done for the packages (example:
one starts with a list of packages; the package itself is PROVIDE(d);
the dependencies are REQUIRE(d); after the first pass, sort(1) and
uniq(1) the REQUIRE(d); cat with PROVIDE(d), sort on name field and
if the pkg has no PROVIDE line, iterate with the list of not provided
---should be faster than using awk(1) to compare names even in an array).

As I said, the script is relatively simple now and should be expanded
to list, when one gives a specific package or a list of specific
packages, what packages have to be updated and what packages not
listed will have to be updated too.

But the principle of splitting between providing a list of records that
can be script processed, and treating the packages is, IMHO, the sound
one.

Best,
-- 
        Thierry Laronde <tlaronde +AT+ polynum +dot+ com>
                     http://www.kergis.com/
                       http://www.sbfa.fr/
Key fingerprint = 0FF7 E906 FBAF FE95 FD89  250D 52B1 AE95 6006 F40C


Home | Main Index | Thread Index | Old Index