Port clean, but just for destroot?
ryandesign at macports.org
Tue Jul 13 00:21:59 UTC 2021
On Jul 12, 2021, at 18:19, Jim DeLaHunt wrote:
> Is there a command like "port clean", but which just reverses the effect of "port destroot" but does not reverse the effect of "port build"?
> I am developing a portfile, and I'm at the stage where I debug the destroot and post-destroot activities. I want a way to be able to change the Portfile and retry "port destroot", without having to do the configure and build phases over again.
> Here is what has not worked:
> • Edit Portfile, then command "sudo port destroot myport". MacPorts notices that the Portfile has changed, does a "port clean", and then redoes the configure and build phases unnecessarily.
> • Edit Portfile, then command "sudo port -o destroot myport". MacPorts disregards the change to the Portfile, but also thinks that the destroot is complete, so does nothing.
Correct, if you want to edit a Portfile and then have MacPorts not automatically clean the work directory, you use the `-o` flag.
> • Delete $(port work myport)/destroot/ dir, then command "sudo port destroot myport". MacPorts appears not to notice that the destroot/ dir is gone.
Correct, it's best to delete $(port work myport)/destroot prior to re-attempting the destroot phase, since portfile authors do not typically expect a destroot phase to be re-attempted and may not have written such destroot phases to work correctly if you do.
If the destroot phase did not error but has instead been marked as completed, you can unmark that completion by editing the file $(port work myport)/.macports.myport.state and delete the line that reads "target: org.macports.destroot".
I do these steps often.
More information about the macports-users