mpkg/mdmg and scripts

Craig Treleaven ctreleaven at macports.org
Fri Jan 13 20:01:51 UTC 2017


Hi:

A few months ago, I had been working on a new mpkg installer for my mythtv.28 ports and I’m trying to get back to it.  A new element was using Preinstall and Postinstall scripts to automate some of initialization steps.  I was puzzled as the installer log showed that these scripts were being executed twice in the install.  I think I know why, now, but I want to discuss how to fix the issue.  I have nearly no experience on modifying base.

The situation is that MythTV uses an sql database;  mythtv-core.28 depends on mariadb for the client software.  mythtv-.28 depends on mariadb-server to install the database server.  I proposed Preinstall and Postinstall scripts for the mariadb-server port.  mariadb-server is a subport in the mariadb Portfile.  

Suppose I create an mpkg installer just for mariadb-server.  The scripts are included for the mariadb-server component, as expected.  However, when ‘port mpkg’ builds the installer component for the mariadb (client) software is ALSO includes the Pre/Postinstall scripts—it doesn’t know that they’re only intended for the server side.  When I then use the created installer, it has two copies of each script and runs them.  

I think the way to fix this is to modify base and add an option or options that control whether the scripts are copied into the package or not.  Since the default behaviour is now to always copy the scripts, I would keep it that way.  Thus the syntax for the mariadb subport would be something like:

pkg.scripts    no

I suppose there could be separate options for ‘pkg.Preinstall yes|no’ and pkg.Postinstall yes|no’ but the need for that fine-grained control seems exceedingly unlikely.

My mythtv-core.28, mythtv-plugins.28 and mythtv.28 are all subports defined in one Portfile.  The scripts only need to operate in the mythtv.28 subport and therefore the other two should also be set to not copy the scripts.

Does this make sense?  If so, I’ll have a go at modifying the packaging code.

Craig


More information about the macports-dev mailing list