[BRAINSTORMING] simplifying maintainer's life

Matthias Andree mandree at FreeBSD.org
Wed Sep 3 21:32:38 UTC 2014


Am 03.09.2014 um 10:25 schrieb Baptiste Daroussin:
> Hi all,
> 
> On of the most borring thing IMHO in the plist maintainance is all the
> directories.
> 
> I have been working on some evolutions I want to share and discuss before making
> them official.
> 
> First you have to know that since pkg 1.3 @dirrm and @dirrmtry are equivalent.
> 
> Evolutions:
> 1/ stop prepending directories in plist with @dir*: let pkg discover the path
> correspond to a directory and handle it as such (easy)
> 
> 2/ make pkg automatically remove directories under PREFIX without the need of
> adding them in plist, such as only empty directories and directories not under
> PREFIX will have to be listed. Of course pkg will not try to remove directories
> owned by another package.
> 
> To achieve the point 2 that will mean we will stop using the mtree inside
> packages and create a "hier" package that will have the default hierarchy and
> every package but pkg will depend on this hier package (except if PREFIX !=
> LOCALBASE)
> 
> 2 bonus of this approach:
> - it will speed up pkg operation by avoiding to have to extract the mtree for
>   each package installation
> - it will simplify a lot check-plist
> 
> Any opinion here?

Note that plist errors are rather rare compared to other error classes,
so we might be optimizing prematurely here.

I object to 1.

I support 2 under the proviso that we tread carefully.

I object to globbing in pkg-plist because that totally spoils matching
actual build/stage result to expectation.  We might have missing files
without the builders ever noticing.

* I am assuming that directories that pkg installs files into are
automatically created and registered, and removed on deinstall.

* do not introduce misnomers. @dirrm is not suitable to list empty
directories in pkg-plist.  It may technically work, but confuses the
casual porter -- especially since you know that our documentation is
always worse than it could be because people always prefer hacking on
software to hacking away on documentation.  Something like @dir or
@emptydir would work.

* make sure that directories remain listed with explicit markup, such as
trailing slashes, leading "@dir", "@emptydir" or however.  This is to
ease maintenance of pkg-plist and that there is no ambiguity.

  Else an entry of etc/PORTNAME might be a directory, or a file - the
pkg-plist should tell me that.  I do not want to have to build a port to
see if a line describes a directory or a file.

* it was mentioned in IRC that in such cases we might need to list links
specially as well, but I don't think we need to.

It is important if the installed item behaves like a directory and I can
tack on pathnames, or if it behaves like a file and represents its
contents, or if the installed item is only a placeholder for special
behaviour, like socket, named pipe, character/block special, or
directory.  I know some of these types would be rejected by pkg, but

* if you want to auto-remove directories, you may need to implement
reference counting in the pkg database so you know when a directory
should be empty after deinstalls (as opposed to upgrades).  Note that
pkg may be unable to distinguish a deinstall from an upgrade, for
instance, with portmaster.


* On a related note, since it was mentioned on IRC (don't go hunting,
this is my conclusion), we may want to introduce a @file escape so as to
list files explicitly if their name starts the same as one of our
pkg-plist macros.



More information about the freebsd-ports mailing list