Subject: Re: pkgsrc - looking to learn how to create packages safely
To: Brad Volz <bradv@affectation.org>
From: Jeremy C. Reed <reed@reedmedia.net>
List: netbsd-help
Date: 05/12/2003 09:40:02
On Sun, 11 May 2003, Brad Volz wrote:

> It is my impression that pkgsrc does all of its work in a subdirectory
> called 'work' ( with the exception of the source download that goes into
> distfiles ) and that the rest of the system is untouched until one issues
> the 'make install'.  Is this correct?

That is the goal. But not always true when creating new packages, because
the original developers have different ideas on how their software is
built.

If you really want to be sure, then do it in a chrooted environment. See
the other message about mksandbox.

What I do:

I do a "make extract"
Read the READMEs and INSTALL documents in the unextracted directory.

Then sometimes review any Makefiles to see what they might do.

Then I do a "make configure" if it uses that.

Then I do a "make" and I save all the output to a log file so I can review
it.

> > Then build a PLIST with:
> >
> > make print-PLIST | tee PLIST

Then be sure to manually review and edit (as needed) the PLIST file.

> If that is the case, then is there a possibility to reverse the creation
> of the PLIST with the 'make install' ?  The reason I ask this is that I
> assume that the job of the PLIST file is for when it comes time to clean
> things up during a pkg_delete.  Basically, if there is a way for me to be
> able to cleanly remove failed attempts at building this package, that will
> make me feel a whole lot safer.

The first time (in my example), the files will not be registered --
because no PLIST existed before the install. You could run install again
(with FORCE_PKG_REGISTER defined) to overwrite (when you have a good
PLIST). And then a "make deinstall" or "pkg_delete" should work.

> If tech-pkg would be a better place for this question, then I am happy to
> ask it there.

tech-pkg is for pkgsrc discussions.

   Jeremy C. Reed
   http://bsd.reedmedia.net/