Subject: None
To: None <tech-pkg@netbsd.org>
From: Bernd Salbrechter <bernd@mycity.at>
List: tech-pkg
Date: 05/05/1999 23:47:13
~s RFC: In tree sources for local developed packages.

Hi All!

I like support to hold the sources of local developed packages in the
package tree (/usr/pkgsrc).  I really need to follow the GNU structure
(autoconf) in my own packages.

I like to hear some comments on my ideas and what you think of getting
this into the official tree.  I don't ask for it before 1.4 is delivered,
because I plan to use this as my base version.

My idea is to change the "extract" target, if a directory "distsrc" is
found in a package to make a shadow tree for work with symbolic links.
For a prof of concept I have symlinked "work/${DISTNAME}" to "../distsrc"
in the extract target. I know this will clobber my sources, But beside
of this I saw no problems. In addition I have changed the fetch target
to echo "local Package not fetched.".

Now I will describe it in more detail, especially how it should work
and how I plan to implement it.

1. Automatic switching between the normal package build and the in-tree
   source build.

  I will reserve the name "distsrc" for a directory in the BSD
  package part (beside files, pkg, patches, ...) and check for it in
  "bsd.srcpkg.mk" (I will call the "bsd.pkg.mk" with my additions so "in
  this mail). This will need to change the targets "extract" and "fetch".

  "fetch" shouldn't try to download anything, because the local side is
  the master side. An option would to extract the source from an version
  control system (i.e. CVS), but I'm not sure about this.

  "extract" should make an shadow-tree with symbolic links. This will
  leave "WRKOBJDIR" working. A open question here is should I use "find"
  and "sh" in the makefile to build the shadow tree or use the X11
  tool "lndir" for it. If the X11 tool, is it already installed, how
  the bootstrap of the "pkgsrc" work? The problem with the shadowtree
  is, that if a maintainer accidently create a new sourcefile in the
  buildtree it get lost at the next "make clean", but the risk to delete
  some changed files is already there. The "clean" target removes simply
  all it founds under "work".

2. Automatic conversion into a normal package in the "pkgsrc.tgz".

  The file "pkgsrc.tgz" should not be bloated by the in tree
  sources. Instated of putting the sources into "pkgsrc.tgz" they should
  be saved as a normal distfile and the directory "distdir" should be
  ignored when building "pkgsrc.tgz". Clear all NetBSD mirrors will be
  listed as "MASTERSITE". It can be done with a simple parameter to tar
  "--exclude \*/\*/distsrc", this will only effect subdirectories of
  packages, as long a we always use category/package for our packages.

  This will convert the package to a normal package at all sites, except
  the site, which maintain the distsrc directory. Will this be a problem
  for ftp://ftp.NetBSD.org/pub/NetBSD-current?

3. A target to create the distfile need for the previous point.

  To maintain the distfiles a new target "distfile" will be need. This
  must be available in all pkg related makefiles (bsd.pkg.mk,
  bsd.pkgsub.mk, ...), because there must be a way to trigger this from
  the rootdirectory of "pkgsrc". This target should also be triggered,
  when a binary package is made and this target have to create the
  right checksum.

  Because the GNU standards require a target to create the distfile, I
  will simply use the sources "distfile" target to create the distfile,
  as we already do with the build, ...

4. I should be implemented in "bsd.pkg.mk".

  In my proof of concept I used a different file "bsd.srcpkg.mk", which
  include "bsd.pkg.mk", which work fine for the basic functionality,
  but for some goals I need to access more deep into "bsd.pkg.mk". At
  least the "distfile" target will need to change "bsd.pkg.mk".

  Otherweis I would vote to do it in a separate file, because "bsd.pkg.mk"
  is already big enough.

Regards,
  Bernd