Hi,

Since this thread has moved to the ports list
here is a summary:

In this post 
(http://marc.info/?l=openbsd-bugs&m=145857291803335&w=2)
to the bugs list I reported that when building with a read-only
ports tree the ports tree was written to.  At least
when building with a read-only ports tree as a regular
user as I detailed.

I suggested that
  Perhaps BULK_COOKIES_DIR, UPDATE_COOKIES_DIR, and
  PLIST_DB in bsd.port.mk should all be based off of
  PACKAGE_REPOSITORY rather than PORTSDIR...
to fix the problem.

After a couple of exchanges the thread got moved here
as below:

On Tue, 22 Mar 2016 00:25:04 +0000
Raf Czlonka <rczlo...@gmail.com> wrote:

> On Tue, Mar 22, 2016 at 12:19:37AM GMT, Karl O. Pinc wrote:
> > Hi Raf,
> > 
> > Thanks for the reply.
> > 
> > On Tue, 22 Mar 2016 00:02:58 +0000
> > Raf Czlonka <rczlo...@gmail.com> wrote:
> >   
> > > On Mon, Mar 21, 2016 at 03:03:15PM GMT, Karl O. Pinc wrote:  
> >   
> > > > OpenBSD 5.8-stable.
> > > > 
> > > > I tried following the instructions in ports(7)
> > > > and the FAQ to build ports as an ordinary user.
> > > > I added to /etc/mk.conf:
> > > > 
> > > > WRKOBJDIR=/usr/obj/ports
> > > > DISTDIR=/usr/distfiles
> > > > PACKAGE_REPOSITORY=/usr/packages    
> > > 
> > > If you leave the defaults and don't explicitly set any of the
> > > above, all the relevant directories will be under /usr/ports,
> > > which can make your life easier (see below):
> > > 
> > > PORTSDIR=/usr/ports
> > > DISTDIR=${PORTSDIR}/distfiles
> > > WRKOBJDIR=${PORTSDIR}/pobj
> > > PACKAGE_REPOSITORY=${PORTSDIR}/packages  
> > 
> > But if I do this I have to make /usr/ports writable by my
> > user.   Or parts thereof.  See below.
> >   
> > > > I then tried to build a port with:
> > > > 
> > > > make package LOCKDIR= BULK=Yes
> > > > 
> > > > I got permission errors writing the package list
> > > > since my user does not have permissions to write
> > > > in /usr/ports/.  Apologies, I did not copy the
> > > > exact error.    
> > > 
> > > This is not a bug - the FAQ clearly states[0] what you need to
> > > do.  
> > 
> > I followed the FAQ where it says:
> > 
> >  It is possible to use a read-only ports tree by separating
> > directories that are written to during port building:
> > 
> >     The working directory of ports. This is controlled by the
> > WRKOBJDIR variable, which specifies the directory which will
> > contain the working directories. The directory containing
> > distribution files. This is controlled by the DISTDIR variable. The
> > directory containing newly built binary packages. This is
> > controlled by the PACKAGE_REPOSITORY variable. 
> > 
> >  For example, you could add the following lines to /etc/mk.conf:
> > 
> >     WRKOBJDIR=/usr/obj/ports
> >     DISTDIR=/usr/distfiles
> >     PACKAGE_REPOSITORY=/usr/packages
> > 
> >  If desired, you can also change the ownership of these directories
> > to your local username and group, so that the ports system can
> > create the underlying working directories as a regular user.
> > 
> > But the above is wrong, since setting PACKAGE_REPOSITORY is not
> > enough. If you follow the above you must be root (unless
> > frobbing the ownership of /usr/ports).  In any case /usr/ports
> > is written to, although not the subdirectories that come in the
> > ports tarball.
> > 
> > Of course it may not be possible to both build ports as an ordinary
> > user and have a read-only /usr/ports/ -- but this is not clear
> > from the FAQ.   Hence my email.
> > 
> > Regards,
> > 
> > Karl <k...@meme.com>
> > Free Software:  "You don't pay back, you pay forward."
> >                  -- Robert A. Heinlein  
> 
> You have included a link which seems you have missed. Read it,
> please.

I've not been able to discern what to read to fix this problem
at my end.  You'll have to point me to some specific text
for me to 

To confirm that the problem is not specific to building
ports as a regular user I built some ports as root,
following the quoted instructions above.  But I mounted /usr/ports/
read-only.  Here's the output for building autoconf
(with "make package LOCKFILE="):

===>  Building package for autoconf-2.13p3
Create /usr/packages/i386/all/autoconf-2.13p3.tgz
checksumming|*************************************************************|100%\
mkdir /usr/ports/plist: Read-only file system
at /usr/libdata/perl5/OpenBSD/Pkg\ Create.pm line 1390.
*** Error 1 in 2.13 (/usr/ports/infrastructure/mk/bsd.port.mk:1956
'/usr/packag\ es/i386/all/autoconf-2.13p3.tgz')
*** Error 1 in 2.13 (/usr/ports/infrastructure/mk/bsd.port.mk:2508
'_internal-p\ ackage')
===> Exiting devel/autoconf/2.13 with an error
*** Error 1 in /usr/ports/devel/autoconf
(/usr/ports/infrastructure/mk/bsd.port\ .subdir.mk:147 'package')

Hacking /etc/mk.conf (in lieu of changing bsd.port.mk 
per my suggestion for a real fix at top, since /usr/ports/
was read-only) with the following lines fixed the problem.
I could then build autoconf as root with /usr/ports/
mounted read-only using "make package LOCKFILE=".

MACHINE_ARCH=i386
BULK_COOKIES_DIR=${PACKAGE_REPOSITORY}/bulk/${MACHINE_ARCH}
PLIST_DB=${PACKAGE_REPOSITORY}/plist/${MACHINE_ARCH}/

(I don't know what happens when the lockfile default is
used.)

I just don't know what I could have missed in the FAQ
regards building ports from a read-only ports tree.


Since this is no longer a bug report but is instead focused
on my difficulties with the FAQ I'll also mention here that
the following part of the FAQ I find confusing:

 15.3.1 - How does it work?

 ...

 When a user issues make(1) in the subdirectory of a specific port, the
 system will recursively walk its dependency tree, check whether the
 required dependencies are installed, build and install any missing
 dependencies, and then continue the build of the desired port. All of
 the building happens inside the working directory that the port
 creates.  ...

 Note: Ports are never directly installed on your system. They use a
 fake installation directory. Everything that gets installed there is
 bundled together into a package that gets stored in the packages/
 subdirectory of the ports tree, as mentioned earlier. Installing a port
 really means "creating a package and then installing that package." 

The word "never" here seems a bit strong.  While it's true that building
a single package does not install that package, if you tell the ports
system to also build dependencies these dependencies are installed.
(At least this is what I saw when using BULK=Yes.)
The docs say installation happens, then they say that installation
does not happen -- that installation always happens in a fake location.

I think this could be clearer.

Regards,

Karl <k...@meme.com>
Free Software:  "You don't pay back, you pay forward."
                 -- Robert A. Heinlein

Reply via email to