Skip site navigation (1)Skip section navigation (2)
Date:      25 Sep 2000 12:28:15 +0200
From:      Dag-Erling Smorgrav <des@ofug.org>
To:        Will Andrews <will@physics.purdue.edu>
Cc:        Neil Blakey-Milner <nbm@mithrandr.moria.org>, FreeBSD Ports <ports@FreeBSD.ORG>
Subject:   Re: makeport part deux - automated port creation tools.
Message-ID:  <xzpd7hszry8.fsf@flood.ping.uio.no>
In-Reply-To: Will Andrews's message of "Mon, 25 Sep 2000 04:53:41 -0500"
References:  <20000924034526.A46867@mithrandr.moria.org> <20000925045341.N1054@puck.firepipe.net>

next in thread | previous in thread | raw e-mail | index | archive | help
Will Andrews <will@physics.purdue.edu> writes:
> Plus, have you considered using templates to do certain things?  Maybe
> adding a utility to the makeport script to generate PLISTs (nahh.. that
> ought to go in bsd.port.mk and called from makeport)?

Generating PLISTS is non-trivial. First, you need a complete list of
the files and directories the port creates. Here are a few ways to
obtain that:

 1) If the port uses install(1) consistently, hack install(1) to log
    everything it does to a log file specified in an environment
    variable. I've been meaning to do that for a while.

 2) Make sure all the port's dependencies are installed in
    ${LOCAL_BASE}. Create a temp tree, mtree(8) it to hell and back
    (you need BSD.{root,var,usr,local}.mtree and sometimes also
    BSD.x11.mtree), and point ${PREFIX} at it. Run 'find ${PREFIX}'
    and log the output to a file. Build and install your port (praying
    to the deity of your choice that it respects ${PREFIX}). Run 'find
    ${PREFIX}' again, log to a different file; the difference between
    the two is your file list (sort both files together and pipe the
    result through 'uniq -u' for a quick-and-dirty diff; another way
    is to sort both files separately, diff them, throw away everything
    except the addition lines, and cut away the '>' or '+')

 3) Build your port in a fully populated chroot tree, and use the
    technique described above to obtain a complete list of installed
    files. Slow and tedious, but has the advantage of working even if
    the port does not respect ${PREFIX}. You can ease the process by
    using a union mount so you can just throw away the changes your
    port did to the chroot tree without having to repopulate it.

Once you've done one of the above to obtain a file list, you need to
wave some chickens at it:

  - remove ${PREFIX}/ from the beginning of each file line

  - replace ${PREFIX}/ with @rmdir at the beginning of each directory
    line

  - replace 5.005/i386-freebsd or 5.6.0/mach or whatever with
    %%PERL_VER%%/%%PERL_ARCH%%, etc.)

  - remove @rmdir lines that reference shared directories (e.g.
    '@rmdir share/doc/inn' is OK, '@rmdir share/doc' is not)

  - sort the file lines alphabetically

  - sort the directory lines in reverse alphabetical order and put
    them at the end of the file

  - plenty of other stuff I've probably forgotten

Even then it probably still needs manual tweaking. Happy hacking!

(my previous employer used the FreeBSD ports system to build and
install components of their web hotelling platform, so I've done a lot
more ports work than FreeBSD's CVS logs might indicate)

DES
-- 
Dag-Erling Smorgrav - des@ofug.org


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-ports" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?xzpd7hszry8.fsf>