ASSP out of date

Ryan Schmidt ryandesign at macports.org
Tue Nov 11 16:10:40 PST 2008


On Nov 11, 2008, at 17:43, Scott Haneda wrote:

> On Nov 11, 2008, at 1:57 AM, Bryan Blackburn wrote:
>> On Tue, Nov 11, 2008 at 01:20:51AM -0800, Scott Haneda said:
>>> Hello, had some more spare time this evening, working on the assp  
>>> port,
>>> thanks to all who are entertaining me in this training process.
>>>
>>> I am working on the port as it started, so I issue sudo port edit  
>>> assp.
>>> If I run:
>>> clear; sudo port -d install assp
>>> I generally get a bunch of errors, certainly a lot less if I  
>>> uninstall
>>> the port first.  In the interest of learning, can someone explain  
>>> what is
>>> going on, here is the output:
>>> http://pastebin.com/m61fea40e
>>> ( I have a good deal of ui_info " MY DEBUG: *" in there )
>>
>> The basic problem is that you're trying to install stuff directly,  
>> but
>> everything needs initially to be underneath ${destroot} so port  
>> can then
>> figure out what files belong to the software.  Your destroot phase  
>> should
>> get rid of the 'file delete ...' and change the copy to be
>>
>>   file copy "${worksrcpath}" "${destroot}${prefix}/var/ASSP"
>>
>> [...]
>
> My destroot path is:
> /opt/local/var/macports/build/ 
> _opt_local_var_macports_sources_rsync.macports.org_release_ports_mail_ 
> assp/work/destroot
>
> prefix is /opt/local
>
> So the entire final path would be
> /opt/local/var/macports/build/ 
> _opt_local_var_macports_sources_rsync.macports.org_release_ports_mail_ 
> assp/work/destroot/opt/local/var/ASSP

Yes, exactly.


> I do not at all understand that.  I want assp to end up in /opt/ 
> local/var/ASSP so unless file copy does something special to a  
> destination path, I am lost on that one.

"file copy" does nothing special.

What is special, in a way, is the destroot and install phases.

In the destroot phase, the port puts everything it wants to install  
somewhere under ${destroot}, usually under ${destroot}${prefix} as  
Bryan said.

Then in the install phase, MacPorts (with no special instructions  
from the portfile) copies everything from ${destroot} into /

(That's a simplification that is only actually true in direct mode,  
which is not the default and not really recommended. In image mode,  
what actually happens during the install phase is that everything  
from ${destroot} gets copied into ${prefix}/var/macports/software/$ 
{name}/${version}_${revision}. Then the activate phase runs, which  
makes hardlinks from there into /.)

The whole purpose is for MacPorts to be able to track what a port  
installs, so that things like "port contents" and "port uninstall"  
work right.


> Also, the errors I am seeing, sometimes they go away if I issue an  
> uninstall, sometimes it seems more erratic.  At the paste url  
> http://pastebin.com/m61fea40e look at lines 96 and beyond, that is  
> what I am trying to learn what they are all about.

Before it runs the destroot phase, MacPorts creates various empty  
directories for you in the destroot.


>>> pre-patch, configrue, build, and destroot all appear to be what I  
>>> would
>>> call tcl functions, does the order of placement in the port file  
>>> make any
>>> difference at all, or are the parsed and ran in the order they  
>>> need to be?
>>> I think the logical order would be
>>
>> Order in the Portfile doesn't matter for those, they are run in  
>> the logical
>> order (fetch, extract, patch, configure, build, destroot, install,  
>> activate)
>> with pre- and post- phases for each available.
>
> Ahh nice, thanks.  I am not entirely sure, you guys can be the  
> gauge of this, but I feel my questions are not that out of the  
> ordinary for a new port maker.  I do look at the docs before I ask  
> here, either I am a bad searcher in the docs, or the data is  
> missing.  Google tends to mostly point the the tracker, so that is  
> of little use.
>
> If I wanted to start adding stuff like this to the docs, would you  
> agree it is beneficial, or am I asking questions most people  
> understand?  If you do think it is beneficial, what is the best  
> procedure for making changes and additions to the docs?
>
> A good example is fs-traverse, which I think is just awesome, and  
> in looking over other ports, trying to learn, there are clear cases  
> where it would be a better choice to use than some of the for each  
> loops people are doing in tcl.  I do not think fs-traverse is even  
> mentioned on the docs.

The Guide is still relatively new; it could still use a lot of work.  
Please file tickets in the guide component / website & documentation  
milestone about anything that needs to be added or changed. For  
example, filing a ticket to get fs-traverse documented would be good.


>>> Thanks, once this works, I will work on the destroot and making  
>>> sure it
>>> does not nuke config and bayes database and other files, that  
>>> should leave
>>> me with figuring out what perl modules need ports.
>>
>> Note that during development of a port, it's best to initially run  
>> through
>> the destroot phase, and if at all possible, as a user who can't  
>> write to the
>> MacPorts install location.  Eg,
>
> If that user can not write to the /opt/local, what would this  
> accomplish, aside from erroring out on a permission error?

That's the point. Your port should not touch anything ${prefix}  
directly, until MacPorts copies stuff there for you during activation  
phase (or install phase, if in direct mode). During destroot phase,  
it should only write into ${destroot}. By running with a user that  
does not have permission to write into ${prefix}, you will  
immediately see, via a permission error, if the port is writing to  
the wrong place during destroot phase.


>> $ port -d destroot
>>
>> in the Portfile directory, as you, this way if your uid doesn't  
>> have write
>> access, it will fail to write things directly to ${prefix} so you  
>> know
>> there's something that needs to be updated so it goes into
>> ${destroot}${prefix} instead.
>
> Where is this portfile directory?

The directory the Portfile that you're editing is in.


> Is there a list of all port commands, in short form, that I can use  
> as a references?  Things like `port dir MacPorts` are tremendously  
> useful, but hard to remember and learn about.

Type "man port"




More information about the macports-users mailing list