Re: Test in local repository without privileges

2020-01-19 Thread Joshua Root
Dave Allured wrote:
> Is there an easy way to get macports to go through the motions of "port
> install -s" for a single port, using macports infrastructure, and taking
> port dependencies from /opt/local, but writing only inside a user
> directory?

You can't install or activate without write access to the registry,
which is under /opt/local. You can probably do everything before that,
up to the destroot phase, provided you have writable places to put the
distfile(s) and build the port. You might be able to do that by
overriding distpath and portbuildpath. Logging won't work without write
access, so you'll want to use -d to get all output on the terminal.

So your command would look like:

port -ds destroot someport distpath=/some/path portbuildpath=/other/path

But I think you'll still run into checks like this:


They can be commented out in the Tcl... if you have write access to
/opt/local.

- Josh


Re: Test in local repository without privileges

2020-01-19 Thread Ryan Schmidt



On Jan 19, 2020, at 17:47, Dave Allured wrote:

> Is there an easy way to get macports to go through the motions of "port 
> install -s" for a single port, using macports infrastructure, and taking port 
> dependencies from /opt/local, but writing only inside a user directory?  This 
> would only be for testing that port's build process, not for actually 
> installing into the real port tree.  My now-hypothetical case is a package 
> that fails parallel build under macports, but never fails when parallel 
> building externally, with only autotools.  I would like to find what the 
> differences are, to help make a simpler reproducer.

It used to be that if you did not use "sudo", then "port install ..." would 
write into ~/.macports instead of /opt/local/var/macports. I don't know if 
that's still the case. I did not appear to work when I tried it just now but 
maybe I have something configured differently.




Re: Test in local repository without privileges

2020-01-19 Thread Dave Allured - NOAA Affiliate via macports-users
On Sat, Jan 18, 2020 at 3:20 AM Mojca Miklavec  wrote:

> On Fri, 17 Jan 2020 at 23:44, Christopher Jones
>  wrote:
> > On 17 Jan 2020, at 10:36 pm, Dave Allured - NOAA Affiliate via
> macports-users  wrote:
> >
> > Chris, thanks for the quick reply.  You are correct, a private macports
> installation would enable testing ports without special privilege.
> Actually I have already done this many times for testing and debugging
> other cases.
> >
> > However, I would like to find an intermediate solution that avoids full
> build-up from sources.  My main reasons are (1) test sensitivity to
> installed ports in the system prefix; (2) save time and effort; and (3) be
> able to provide compact, uncomplicated reproducers to third parties.
> >
> > If not currently possible, it would be nice to have a new feature to
> enable local repository testing, with fallback to the system prefix for
> everything not found in the local repository.
> >
> > What you are asking for is I am afraid really not possible, I suspect.
> The installation prefix is a fundamental parameter in most port builds.
> Many directly use this via the ${prefix} variable, which is a single valued
> path. What you are asking for is for a port use to use one location for
> some ports and a second one from others. I just don’t see how that could
> work.
> >
> > I think your only option is really to go with a second installation
> using a custom prefix.
>
> The only thing we could potentially do (but sadly I don't see it
> coming any time soon unless we get a devoted developer with sufficient
> time and skillset willing to work on this) is to support
> "relocatability" of packages to avoid building everything from source.
> It should be possible to a certain extent (at least our competitors
> did it).
>
> However installing some packages in one prefix and others in another
> is going to lead to countless troubles. Binaries have absolute links
> to their dependencies. So if you have library A, library B which
> depends on A, and binary C which depends on B, you install all three
> to /opt/local and then decide to test B in local installation using A
> from global prefix, this will generate a mess and will stop working as
> soon as A in global prefix is updated. Moreover you also need to
> install C to local prefix, else the test won't be "complete". I could
> keep on talking about problems, but long story short: not an option.
>
> Mojca
>

Chris and Mojca,

Thank you for carefully considering this request.  I understand the
problems that you described.  I can get by without this feature.

Here is a similar question that might help my current debugging scenario.
This is hypothetical because the source of my current issue was just fixed
upstream, so I do not really need to debug this one any further.

Is there an easy way to get macports to go through the motions of "port
install -s" for a single port, using macports infrastructure, and taking
port dependencies from /opt/local, but writing only inside a user
directory?  This would only be for testing that port's build process, not
for actually installing into the real port tree.  My now-hypothetical case
is a package that fails parallel build under macports, but never fails when
parallel building externally, with only autotools.  I would like to find
what the differences are, to help make a simpler reproducer.


Re: Test in local repository without privileges

2020-01-18 Thread Mojca Miklavec
On Fri, 17 Jan 2020 at 23:44, Christopher Jones
 wrote:
> On 17 Jan 2020, at 10:36 pm, Dave Allured - NOAA Affiliate via macports-users 
>  wrote:
>
> Chris, thanks for the quick reply.  You are correct, a private macports 
> installation would enable testing ports without special privilege.  Actually 
> I have already done this many times for testing and debugging other cases.
>
> However, I would like to find an intermediate solution that avoids full 
> build-up from sources.  My main reasons are (1) test sensitivity to installed 
> ports in the system prefix; (2) save time and effort; and (3) be able to 
> provide compact, uncomplicated reproducers to third parties.
>
> If not currently possible, it would be nice to have a new feature to enable 
> local repository testing, with fallback to the system prefix for everything 
> not found in the local repository.
>
> What you are asking for is I am afraid really not possible, I suspect. The 
> installation prefix is a fundamental parameter in most port builds. Many 
> directly use this via the ${prefix} variable, which is a single valued path. 
> What you are asking for is for a port use to use one location for some ports 
> and a second one from others. I just don’t see how that could work.
>
> I think your only option is really to go with a second installation using a 
> custom prefix.

The only thing we could potentially do (but sadly I don't see it
coming any time soon unless we get a devoted developer with sufficient
time and skillset willing to work on this) is to support
"relocatability" of packages to avoid building everything from source.
It should be possible to a certain extent (at least our competitors
did it).

However installing some packages in one prefix and others in another
is going to lead to countless troubles. Binaries have absolute links
to their dependencies. So if you have library A, library B which
depends on A, and binary C which depends on B, you install all three
to /opt/local and then decide to test B in local installation using A
from global prefix, this will generate a mess and will stop working as
soon as A in global prefix is updated. Moreover you also need to
install C to local prefix, else the test won't be "complete". I could
keep on talking about problems, but long story short: not an option.

Mojca


Re: Test in local repository without privileges

2020-01-17 Thread Christopher Jones

> On 17 Jan 2020, at 10:36 pm, Dave Allured - NOAA Affiliate via macports-users 
>  wrote:
> 
> Chris, thanks for the quick reply.  You are correct, a private macports 
> installation would enable testing ports without special privilege.  Actually 
> I have already done this many times for testing and debugging other cases.
> 
> However, I would like to find an intermediate solution that avoids full 
> build-up from sources.  My main reasons are (1) test sensitivity to installed 
> ports in the system prefix; (2) save time and effort; and (3) be able to 
> provide compact, uncomplicated reproducers to third parties.
> 
> If not currently possible, it would be nice to have a new feature to enable 
> local repository testing, with fallback to the system prefix for everything 
> not found in the local repository.

What you are asking for is I am afraid really not possible, I suspect. The 
installation prefix is a fundamental parameter in most port builds. Many 
directly use this via the ${prefix} variable, which is a single valued path. 
What you are asking for is for a port use to use one location for some ports 
and a second one from others. I just don’t see how that could work.

I think your only option is really to go with a second installation using a 
custom prefix.

Chris

> 
> 
> On Fri, Jan 17, 2020 at 3:09 PM Christopher Jones  > wrote:
> Hi,
> 
> I might be wrong, but I do not believe it is possible to temporarily change 
> the install prefix, for a single port.
> 
> Most probably you will need to start a new installation, using a custom 
> installation prefix, from scratch. see
> 
> https://www.macports.org/install.php#source 
> 
> 
> on installing from source, which you will need to do to change the 
> installation prefix, as its a configure time option.
> 
> Chris
> 
>> On 17 Jan 2020, at 9:33 pm, Dave Allured - NOAA Affiliate via macports-users 
>> > > wrote:
>> 
>> I am on a corporate network with ports installed normally in /opt/local, 
>> controlled by system admins.  Users do not have any write access into system 
>> directories.  I would like to use a local portfile repository in user space, 
>> as described in Macports guide 4.6.
>> 
>> How can I test ports in the local repository?  The "portindex" command works 
>> as expected in this directory.  However, "port install" fails with 
>> "Insufficient privileges to write to MacPorts install prefix".  I need a way 
>> to tell "port install" to use a local prefix, rather than the default system 
>> prefix, for only the port under test.
>> 
>> I figured that I could avoid tampering with the protected sources.conf, by 
>> manually pre-staging the desired distfiles in the local repository.  Here is 
>> my embryonic directory structure:
>> 
>> $HOME/portx/science/netcdf-fortran/Portfile
>> $HOME/portx/science/netcdf-fortran/files/patch-Makefile.in.diff
>> $HOME/portx/var/macports/distfiles/netcdf-fortran/netcdf-fortran-4.5.2.tar.gz
>> 
>> Thank you for any advice.



smime.p7s
Description: S/MIME cryptographic signature


Re: Test in local repository without privileges

2020-01-17 Thread Dave Allured - NOAA Affiliate via macports-users
Chris, thanks for the quick reply.  You are correct, a private macports
installation would enable testing ports without special privilege.
Actually I have already done this many times for testing and debugging
other cases.

However, I would like to find an intermediate solution that avoids full
build-up from sources.  My main reasons are (1) test sensitivity to
installed ports in the system prefix; (2) save time and effort; and (3) be
able to provide compact, uncomplicated reproducers to third parties.

If not currently possible, it would be nice to have a new feature to enable
local repository testing, with fallback to the system prefix for everything
not found in the local repository.


On Fri, Jan 17, 2020 at 3:09 PM Christopher Jones 
wrote:

> Hi,
>
> I might be wrong, but I do not believe it is possible to temporarily
> change the install prefix, for a single port.
>
> Most probably you will need to start a new installation, using a custom
> installation prefix, from scratch. see
>
> https://www.macports.org/install.php#source
>
> on installing from source, which you will need to do to change the
> installation prefix, as its a configure time option.
>
> Chris
>
> On 17 Jan 2020, at 9:33 pm, Dave Allured - NOAA Affiliate via
> macports-users  wrote:
>
> I am on a corporate network with ports installed normally in /opt/local,
> controlled by system admins.  Users do not have any write access into
> system directories.  I would like to use a local portfile repository in
> user space, as described in Macports guide 4.6.
>
> How can I test ports in the local repository?  The "portindex" command
> works as expected in this directory.  However, "port install" fails with
> "Insufficient privileges to write to MacPorts install prefix".  I need a
> way to tell "port install" to use a local prefix, rather than the default
> system prefix, for only the port under test.
>
> I figured that I could avoid tampering with the protected sources.conf, by
> manually pre-staging the desired distfiles in the local repository.  Here
> is my embryonic directory structure:
>
> $HOME/portx/science/netcdf-fortran/Portfile
> $HOME/portx/science/netcdf-fortran/files/patch-Makefile.in.diff
>
> $HOME/portx/var/macports/distfiles/netcdf-fortran/netcdf-fortran-4.5.2.tar.gz
>
> Thank you for any advice.
>
>


Re: Test in local repository without privileges

2020-01-17 Thread Christopher Jones
Hi,

I might be wrong, but I do not believe it is possible to temporarily change the 
install prefix, for a single port.

Most probably you will need to start a new installation, using a custom 
installation prefix, from scratch. see

https://www.macports.org/install.php#source 


on installing from source, which you will need to do to change the installation 
prefix, as its a configure time option.

Chris

> On 17 Jan 2020, at 9:33 pm, Dave Allured - NOAA Affiliate via macports-users 
>  wrote:
> 
> I am on a corporate network with ports installed normally in /opt/local, 
> controlled by system admins.  Users do not have any write access into system 
> directories.  I would like to use a local portfile repository in user space, 
> as described in Macports guide 4.6.
> 
> How can I test ports in the local repository?  The "portindex" command works 
> as expected in this directory.  However, "port install" fails with 
> "Insufficient privileges to write to MacPorts install prefix".  I need a way 
> to tell "port install" to use a local prefix, rather than the default system 
> prefix, for only the port under test.
> 
> I figured that I could avoid tampering with the protected sources.conf, by 
> manually pre-staging the desired distfiles in the local repository.  Here is 
> my embryonic directory structure:
> 
> $HOME/portx/science/netcdf-fortran/Portfile
> $HOME/portx/science/netcdf-fortran/files/patch-Makefile.in.diff
> $HOME/portx/var/macports/distfiles/netcdf-fortran/netcdf-fortran-4.5.2.tar.gz
> 
> Thank you for any advice.



smime.p7s
Description: S/MIME cryptographic signature