ports/158179: some packages do not fully honor -P dir option in pkg_add(1)

Stephen Montgomery-Smith stephen at missouri.edu
Sat Jul 16 16:04:50 UTC 2011


On 07/16/2011 10:53 AM, Chris Rees wrote:
>
> On 16 Jul 2011 16:38, "Stephen Montgomery-Smith" <stephen at missouri.edu
> <mailto:stephen at missouri.edu>> wrote:
>  >
>  > On 07/16/2011 04:26 AM, Stefan Bethke wrote:
>  >>
>  >> Am 16.07.2011 um 04:43 schrieb Stephen Montgomery-Smith:
>  >>
>  >>> I was looking through the source code of pkg_add.  Personally I
> don't see how the "-P" or "-p" option could be made to work with
> pkg_add. Many of the installation commands involve scripts which have
> ${PREFIX} hard coded into them.  ${PREFIX} is often hard coded when trhe
> package is created by the port.  In my opinion, the options "-p" and
> "-P" should be removed from pkg_add.
>  >>>
>  >>> Either that, or provide the port a way to access "@cwd" in any
> scripts it installs.  But this would require a major overhaul of the
> whole ports system, and probably much of the software it installs as well.
>  >>>
>  >>> Am I missing something?
>  >>
>  >>
>  >> Yes.  Not honoring the prefix is a bug in the port.  If you do need
> to do prefix-specific things during install, use pkg-install, see
> http://www.freebsd.org/doc/en/books/porters-handbook/pkg-install.html
>  >>
>  >> I suspect that many ports are not well tested outside of
> "/usr/local", but the infrastructure is there and available.
>  >
>  >
>  > You are correct, this needs to be done on a port by port basis.  In
> some ports this is going to be a big job, because in some cases the
> "/usr/local" is hard coded into certain binaries.
>  >
>  > For example, suppose the C source code contains something like:
>  > char applications_dir = "/usr/local/share/applications";
>  > and this is filled in by the ./configure script.
>  >
>  > How is that handled?
>  >
>
> It's not.
>
> Remember what a package is, literally the files from the plist tarred
> with some magic +FILEs and the pkg-*install files- if paths are
> hardcoded in objects that's how it'll be installed.

What if some of the installation programs are binaries, and "/usr/local" 
is hard coded into installation binaries or scripts provided by the 
software itself.

> Don't touch the -p option! It's only useful for.... um.... someone help
> here?

I am thinking the same thing!


More information about the freebsd-current mailing list