On 2021-07-12 11:29, Rainer Müller wrote:

On 12/07/2021 11.49, Jim DeLaHunt wrote:
I am breaking a single upstream codebase into subports. I want each
subport to contribute some of the overall complement of files. But the
"make install" of the codebase installs more files than I want. Thus I
think the right thing to do is to declare a post-destroot which delete
the excess files from each subport.
Sounds reasonable, but be aware … With the same
build command, each subport will take the same time to compile from
source, even if you later only need a few files in destroot. Therefore
it would still be a good idea to only build what you need for each subport.

I understand. I have modified the configure args for each subport to prevent what build activity I can. Unfortunately, the upstream code does not give me configure args to prevent building these particular items.

My Portfile has an entry like this:

     post-destroot {
         set sharedir ${prefix}/share
         delete ${prefix}/lib/libfreeciv.a
         delete ${sharedir}/doc ${sharedir}/man ${sharedir}/locale
     }
At this point, the files are still not installed on the system, but
reside in the staging directory named ${destroot}, which is at
work/destroot/ as you already found out below.

You need to use absolute paths ${destroot}${prefix}/... here. ${prefix}
is always an absolute path, that's why it can be combined without an
explicit separator. For example, it should look like this:

   delete ${destroot}${prefix}/lib/libfreeciv.a

But, when I run "sudo port destroot freeciv-server", then look at what I
believe is the destroot:

ls $(port work freeciv-server)/destroot/opt/local/share

the directories which I wanted to delete are still present.

I look in the main.log for this subport. I don't see any diagnostics
from those delete directives.
This was an attempt to delete files directly from the prefix, which is
/opt/local by default. But trying to delete non-existing files will not
result in an error. Therefore it silently passed doing nothing.

Thank you for the help.  I figured it out. It was worse than I thought. The delete was not just effective, it was _too_ effective! It was deleting parts of my live installation: /opt/local/share/doc for all ports, /opt/local/share/man for all man pages, etc. It's at moments like this that I'm glad to have good backups from which to restore the parts I blew away.

What I missed is that "delete" operates in the context of the entire filesystem, not of the destroot path. Thus, it is very important to include ${destroot} at the start of every path I pass to "delete".

For example,

    post-destroot {
        set sharedir ${destroot}${prefix}/share
        delete ${destroot}${prefix}/lib/libfreeciv.a
        delete ${sharedir}/doc ${sharedir}/man ${sharedir}/locale
    }

I can now delete files as needed from the destroot. I now get to encounter the next obstacle. :-)

Thank you for the help, Rainer! Best regards,
      —Jim DeLaHunt


Reply via email to