Q about post-extract recent commit breakage

Ryan Schmidt ryandesign at macports.org
Tue Dec 4 07:04:34 UTC 2018



On Dec 3, 2018, at 19:35, Michael Dickens wrote:

> Here's the error (just do "sudo port extract cmake-devel"; it results in this error on every OS I tested, from 10.5 to 10.14):
> {{{
> Error: Failed to extract cmake-devel: error renaming "/opt/local/var/macports/build/_opt_sources_MacPorts_ports_github_macports_devel_cmake/cmake-devel/work/cmake-772edffbf0c08fc0a6fcf74fb98545b7afcfee13-772edffbf0c08fc0a6fcf74fb98545b7afcfee13" to "/opt/local/var/macports/build/_opt_sources_MacPorts_ports_github_macports_devel_cmake/cmake-devel/work/cmake-772edffbf0c08fc0a6fcf74fb98545b7afcfee13/cmake-772edffbf0c08fc0a6fcf74fb98545b7afcfee13-772edffbf0c08fc0a6fcf74fb98545b7afcfee13": trying to rename a volume or move a directory into itself
> Error: See /opt/local/var/macports/logs/_opt_sources_MacPorts_ports_github_macports_devel_cmake/cmake-devel/main.log for details.
> }}}

Ok, that's because cmake-devel does this:

    post-extract {
        move ${workpath}/${name}-${commit}-${commit} ${workpath}/${name}-${commit}
    }

Now that base has been changed, MacPorts has already made a ${worksrcdir} (in this case ${name}-${commit}) symlink for you. So for compatibility with both the released version of MacPorts and master, you should ensure it doesn't already exist before moving it:

    post-extract {
        if {![file exists ${worksrcpath}]} {
            move ${workpath}/${name}-${commit}-${commit} ${worksrcpath}
        }
    }

which is basically what's done in the remaining commit for libao in this PR:

https://github.com/macports/macports-ports/pull/1760

After compatibility with the current version of MacPorts is no longer needed, the entire post-extract block can be removed.



More information about the macports-dev mailing list