Re: [macports-base] branch master updated: Honour startupitem.install at activation time

2018-04-08 Thread Joshua Root
On 2018-4-9 10:20 , Rainer Müller wrote:
> On 2018-04-09 01:20, Joshua Root wrote:
>> On 2018-4-9 08:43 , Rainer Müller wrote:
>>> This handles ports that create .plist files via startupitem.* or the new
>>> startupitems. However, there are also ports that install custom .plist
>>> file to ${destroot}/Library/Launch*. Some ports even do that
>>> unconditionally.
>>
>> Ports that do this should set 'startupitem.create no' and
>> 'startupitem.type launchd', plus whatever other variables like
>> startupitem.name are needed based on what they called their plist.
> 
> I found no port in or ports tree that does it that way.

That's because you can't do it with the released version of base.

> As far as I can see, 'startupitem.create no' is not required right now
> and not used. I do not think Portfile authors will understand why it
> would be necessary. We should find a solution without it.

You don't have to actually set it to no, that's the default, so you just
don't set it to yes.

- Josh


Re: [macports-base] branch master updated: Honour startupitem.install at activation time

2018-04-08 Thread Rainer Müller
On 2018-04-09 01:20, Joshua Root wrote:
> On 2018-4-9 08:43 , Rainer Müller wrote:
>> This handles ports that create .plist files via startupitem.* or the new
>> startupitems. However, there are also ports that install custom .plist
>> file to ${destroot}/Library/Launch*. Some ports even do that
>> unconditionally.
> 
> Ports that do this should set 'startupitem.create no' and
> 'startupitem.type launchd', plus whatever other variables like
> startupitem.name are needed based on what they called their plist.

I found no port in or ports tree that does it that way.

There are only exactly two ports that use 'startupitem.create no':
mpstats and certsync.

But these do not set startupitem.type either. And even they create the
symlink in /Library/Launch* manually...

Other ports just install a .plist to
${prefix}/etc/Launch*/org.macports.${name}/*.plist and creates the
symlink at /Library/Launch*/*.plist without setting any startupitem.*
option. For example, mysql*-server (and the percona and mariadb forks).

As far as I can see, 'startupitem.create no' is not required right now
and not used. I do not think Portfile authors will understand why it
would be necessary. We should find a solution without it.

> I've been wondering if we should also have an option called something
> like startupitem.file that could be set to a path, e.g.
> ${filespath}/my_job.plist, and then base would install it to the right
> place.

This could work, except for ports where the upstream build system
already installs the .plist. For example, xinit.

https://github.com/macports/macports-ports/blob/master/x11/xinit/Portfile#L53

Rainer


Re: [macports-base] branch master updated: Honour startupitem.install at activation time

2018-04-08 Thread Joshua Root
On 2018-4-9 08:43 , Rainer Müller wrote:
> This handles ports that create .plist files via startupitem.* or the new
> startupitems. However, there are also ports that install custom .plist
> file to ${destroot}/Library/Launch*. Some ports even do that
> unconditionally.

Ports that do this should set 'startupitem.create no' and
'startupitem.type launchd', plus whatever other variables like
startupitem.name are needed based on what they called their plist.

I've been wondering if we should also have an option called something
like startupitem.file that could be set to a path, e.g.
${filespath}/my_job.plist, and then base would install it to the right
place.

- Josh


Re: [macports-base] branch master updated: Honour startupitem.install at activation time

2018-04-08 Thread Rainer Müller
On 2018-04-09 00:06, Joshua Root wrote:
> On 2018-4-9 07:55 , Rainer Müller wrote:
>> On 2018-04-08 03:26, Joshua Root wrote:
>>> Joshua Root (jmroot) pushed a commit to branch master
>>> in repository macports-base.
>>>
>>> https://github.com/macports/macports-base/commit/3dde77d7d6c66dbb8fcc1d4b1b4972a2ac8b1947
>>>
>>> The following commit(s) were added to refs/heads/master by this push:
>>> new 3dde77d Honour startupitem.install at activation time 3dde77d is 
>>> described below
>>>
>>> commit 3dde77d7d6c66dbb8fcc1d4b1b4972a2ac8b1947 Author: Joshua Root 
>>> 
>>> AuthorDate: Sun Apr 8 11:16:22 2018 +1000
>>>
>>> Honour startupitem.install at activation time When activating files,
>>> move plists from /Library/Launch* to ${prefix}/etc/Launch* if the port
>>> was built with startupitem_install on but it is currently off, and
>>> vice versa in the opposite case.
>> Somehow this seems complicated. Wouldn't it be simpler to always ship
>> the .plists in ${prefix}/etc/Launch* and only add symlinks in
>> /Library/Launch* on activation if startupitem_install allows it?
> 
> Not that much simpler, strangely enough.

Maybe not in the implementation, but simpler for me to grasp what's
going on. :-)

>> But I guess you did it this way to be compatible with older archives?
> 
> Indeed. It doesn't matter how startupitem.install was set when the
> archives were built, this will DTRT either way.

This handles ports that create .plist files via startupitem.* or the new
startupitems. However, there are also ports that install custom .plist
file to ${destroot}/Library/Launch*. Some ports even do that
unconditionally.

Maybe we could rename all *.plist files in these directories to avoid
recreating this logic in many ports? If we handled this automatically at
activation time, ports would no longer have to deal with
${startupitem.install} at all.

Rainer


Re: [macports-base] branch master updated: Honour startupitem.install at activation time

2018-04-08 Thread Joshua Root
On 2018-4-9 07:55 , Rainer Müller wrote:
> On 2018-04-08 03:26, Joshua Root wrote:
>> Joshua Root (jmroot) pushed a commit to branch master
>> in repository macports-base.
>>
>> https://github.com/macports/macports-base/commit/3dde77d7d6c66dbb8fcc1d4b1b4972a2ac8b1947
>>
>> The following commit(s) were added to refs/heads/master by this push:
>> new 3dde77d Honour startupitem.install at activation time 3dde77d is 
>> described below
>>
>> commit 3dde77d7d6c66dbb8fcc1d4b1b4972a2ac8b1947 Author: Joshua Root 
>> 
>> AuthorDate: Sun Apr 8 11:16:22 2018 +1000
>>
>> Honour startupitem.install at activation time When activating files,
>> move plists from /Library/Launch* to ${prefix}/etc/Launch* if the port
>> was built with startupitem_install on but it is currently off, and
>> vice versa in the opposite case.
> Somehow this seems complicated. Wouldn't it be simpler to always ship
> the .plists in ${prefix}/etc/Launch* and only add symlinks in
> /Library/Launch* on activation if startupitem_install allows it?

Not that much simpler, strangely enough.

> But I guess you did it this way to be compatible with older archives?

Indeed. It doesn't matter how startupitem.install was set when the
archives were built, this will DTRT either way.

- Josh


Re: [macports-base] branch master updated: Honour startupitem.install at activation time

2018-04-08 Thread Rainer Müller
On 2018-04-08 03:26, Joshua Root wrote:
> Joshua Root (jmroot) pushed a commit to branch master
> in repository macports-base.
>
> https://github.com/macports/macports-base/commit/3dde77d7d6c66dbb8fcc1d4b1b4972a2ac8b1947
>
> The following commit(s) were added to refs/heads/master by this push:
> new 3dde77d Honour startupitem.install at activation time 3dde77d is 
> described below
>
> commit 3dde77d7d6c66dbb8fcc1d4b1b4972a2ac8b1947 Author: Joshua Root 
> 
> AuthorDate: Sun Apr 8 11:16:22 2018 +1000
>
> Honour startupitem.install at activation time When activating files,
> move plists from /Library/Launch* to ${prefix}/etc/Launch* if the port
> was built with startupitem_install on but it is currently off, and
> vice versa in the opposite case.
Somehow this seems complicated. Wouldn't it be simpler to always ship
the .plists in ${prefix}/etc/Launch* and only add symlinks in
/Library/Launch* on activation if startupitem_install allows it?

But I guess you did it this way to be compatible with older archives?

Rainer