post-pkg failing

Joshua Root jmr at macports.org
Sun May 27 18:12:37 PDT 2012


(moving to -dev since this involves writing a portfile)

On 2012-5-28 10:43 , Paulo Moura wrote:
> Hi,
> 
> I'm using the latest versions of MacPorts, Xcode, and PackageMaker. I have a portfile where I define:
> 
> post-pkg {
> 	set resources ${workpath}/${name}-${version}.pkg/Contents/Resources/
> 	file copy -force -- ${workpath}/${worksrcdir}/scripts/macosx/License.html ${resources}
> 	file copy -force -- ${workpath}/${worksrcdir}/scripts/macosx/ReadMe.html ${resources}
> 	file copy -force -- ${workpath}/${worksrcdir}/scripts/macosx/Welcome.html ${resources}
> 	file copy -force -- ${workpath}/${worksrcdir}/scripts/macosx/postflight ${resources}
> }
> 
> Trying to create a package fails with the error:
> 
> Error: org.macports.pkg for port logtalk returned: error copying "/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_ports_lang_logtalk/logtalk/work/lgt2441/scripts/macosx/License.html" to "/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_ports_lang_logtalk/logtalk/work/logtalk-2.44.1.pkg/Contents/Resources/": not a directory
> 
> This worked before so I guess something change in the latest MacPorts and/or PackageMaker versions. Any hints?

MacPorts 2.1 will build flat packages by default on 10.6+. This means
you can't just copy files into the resources dir, since it's now inside
a xar archive.

You can get the old behaviour back by setting 'package.flat no'. To make
this work with flat packages, you should instead copy the html files to
${package.resources} in pre-pkg, and the postflight script to
${package.scripts}/postinstall. (Flat packages apparently don't support
postflight scripts as such. Apple tends to simulate them by adding a
dummy package that only contains a postinstall script to the enclosing
Distribution package.)

- Josh


More information about the macports-dev mailing list