Re: ${INSTALL_DATA} problems

2016-09-10 Thread Aristedes Maniatis
My apologies for not explaining in enough detail.

On 10/09/2016 10:18pm, Mathieu Arnold wrote:
> The plist can be generated automatically with "make makeplist" there is
> no way it is hard to do, or maintain.
> 
>> > I really only want one folder installed with the correct permissions, but 
>> > do I need to move my chmod code into the rc.d startup script instead and 
>> > tying it into the pkg install?
> If it is an empty folder, or you just want the folder itself to have the
> permissions, do:
> 
> @dir(%%owner%%,%%group%%,optional mode) the/dir

I can see how to use makeplist and to edit the results. However maintaining 
large lists of files can be cumbersome if you have to manually edit that list 
every time you upgrade. So I see you have the PLIST_SUB option in Makefile as a 
way to automatically simplify the plist when it is generated with makeplist.

I had also thought from my reading of the Drupal 'uses' makefile that I could 
use PLIST_FILE += as a way to inject additional lines into the plist when you 
run makeplist, but it doesn't work like that when I try it.

PLIST_FILES+=   "@owner www" \
"@group www" \


I also note that the docs [1] indicate that COPYTREE_SHARE doesn't add files to 
pkg-plist, but I note that for me makeplist does generate them as I'd expect. 
Maybe it is my misunderstanding of what "add" means.



Anyhow, thanks for all your help. The end result of this conversation is:

1. I now know that INSTALL_DATA and COPYTREE_SHARE are two macros which are 
fairly particular in how they work. One can only do single files and the other 
requires CD to work correctly. Error messages and portlint don't help much.

2. INSTALL_DATA has switches for user and group, but they should not be used

3. If only a specific folder needs to be owned by a certain user, then it is 
less effort to add that to a prestart() command in the rc.d script rather than 
maintaining a plist which is different in one line out of a thousand from the 
output from makeplist. Many rc.d scripts already do that for /var/run/portname/ 
or /var/log/portname/ anyhow, so this is an established technique.



Cheers
Ari






[1] https://www.freebsd.org/doc/en/books/porters-handbook/install.html -> 5.15.3



-- 
-->
Aristedes Maniatis
GPG fingerprint CBFB 84B4 738D 4E87 5E5C  5EFA EF6A 7D2E 3E49 102A
___
freebsd-ports@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-ports
To unsubscribe, send any mail to "freebsd-ports-unsubscr...@freebsd.org"


Re: ${INSTALL_DATA} problems

2016-09-10 Thread Mathieu Arnold
Le 10/09/2016 à 05:32, Aristedes Maniatis a écrit :
> On 8/09/2016 10:47pm, Mathieu Arnold wrote:
>> Now, I'm seeing something else that is a bad idea, it is using the -o
>> flag.  Ports must build as a regular user.  A regular user will not be
>> able to change the owner of the files.  This must be done in the
>> pkg-plist file, using @owner/@group as described in the Porter's
>> Handbook:
>> https://www.freebsd.org/doc/en/books/porters-handbook/plist-keywords.html
>
> I've just tried this but ran into some difficulty. Specifically I have a 
> plist which is many hundreds of lines long. There is no way this will be 
> maintained into the future without mistake.

The plist can be generated automatically with "make makeplist" there is
no way it is hard to do, or maintain.

> I really only want one folder installed with the correct permissions, but do 
> I need to move my chmod code into the rc.d startup script instead and tying 
> it into the pkg install?

If it is an empty folder, or you just want the folder itself to have the
permissions, do:

@dir(%%owner%%,%%group%%,optional mode) the/dir

like described in the page I sent you to.

If you also need to files, add a:

@owner %%owner%%
@group %%group%%

block before the files of that directory, and add:

@owner
@group

after it.


-- 
Mathieu Arnold




signature.asc
Description: OpenPGP digital signature


Re: ${INSTALL_DATA} problems

2016-09-10 Thread Bob Eager
On Sat, 10 Sep 2016 13:32:30 +1000
Aristedes Maniatis  wrote:

> > https://www.freebsd.org/doc/en/books/porters-handbook/plist-keywords.html  
> 
> 
> I've just tried this but ran into some difficulty. Specifically I
> have a plist which is many hundreds of lines long. There is no way
> this will be maintained into the future without mistake.
> 
> So I found in Mk/Uses/drupal.mk, this syntx:
> 
> PLIST_FILES+=   "@owner www" \
> "@group www" \
> 
> When I added this to my Makefile
> 
> PLIST_FILES+=   "@owner {$SOLR_USER}" \
> "@group {$SOLR_GROUP}" \
> 
> nothing happened.

If you refer back to the Porter's Handbook (section 3.2.2):

"If the port installs just a handful of files, list them in
PLIST_FILES"

Note the word 'handful'. Also, PLIST_FILES *replaces* pkg-plist; you
can't have both. In any case, I am not sure that PLIST_FILES works to
change ownership - it is meant for small ports with simple needs.

> I really only want one folder installed with the correct permissions,
> but do I need to move my chmod code into the rc.d startup script
> instead and tying it into the pkg install?

Really, the pkg-plist is the way.
___
freebsd-ports@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-ports
To unsubscribe, send any mail to "freebsd-ports-unsubscr...@freebsd.org"


Re: ${INSTALL_DATA} problems

2016-09-09 Thread Aristedes Maniatis
On 8/09/2016 10:47pm, Mathieu Arnold wrote:
> Now, I'm seeing something else that is a bad idea, it is using the -o
> flag.  Ports must build as a regular user.  A regular user will not be
> able to change the owner of the files.  This must be done in the
> pkg-plist file, using @owner/@group as described in the Porter's
> Handbook:
> https://www.freebsd.org/doc/en/books/porters-handbook/plist-keywords.html


I've just tried this but ran into some difficulty. Specifically I have a plist 
which is many hundreds of lines long. There is no way this will be maintained 
into the future without mistake.

So I found in Mk/Uses/drupal.mk, this syntx:

PLIST_FILES+=   "@owner www" \
"@group www" \


When I added this to my Makefile


PLIST_FILES+=   "@owner {$SOLR_USER}" \
"@group {$SOLR_GROUP}" \


nothing happened.


I really only want one folder installed with the correct permissions, but do I 
need to move my chmod code into the rc.d startup script instead and tying it 
into the pkg install?


Ari



-- 
-->
Aristedes Maniatis
GPG fingerprint CBFB 84B4 738D 4E87 5E5C  5EFA EF6A 7D2E 3E49 102A
___
freebsd-ports@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-ports
To unsubscribe, send any mail to "freebsd-ports-unsubscr...@freebsd.org"


Re: ${INSTALL_DATA} problems

2016-09-08 Thread Aristedes Maniatis
On 9/09/2016 9:13am, Mark Linimon wrote:
> On Fri, Sep 09, 2016 at 08:29:12AM +1000, Aristedes Maniatis wrote:
>> Maybe the Makefile language will become clearer to me one day, but
>> I've been using FreeBSD since 4.0 and it hasn't clicked yet.
> 
> Don't worry, the FreeBSD ports framework does things with the Makefile
> language that was never intended by make's designers :-)
> 
> We do try to document things in the Porter's Handbook, but sometimes
> the only thing to do is wade into bsd.port.mk and friends and read the
> code.  (Not recomended for the faint of heart, though.)

I think the most useful thing that could be done is more examples. Even a list 
of ports which implement things in the recommended ways and do the full range 
of common things.

/var/poudriere/ports/default # grep -R {CP} * | wc -l
1504

So me copying how mariadb101 does it (for example), gives me the wrong result. 
If I had a dozen "best practices" Makefiles I could copy them.


The second most useful thing would be to enhance portlint. Right now it feels 
like 95% of what it does is enforce some arbitrary ordering of keywords. But if 
it instead gave you hints "I see you are using {INSTALL_DATA} with a wildcard 
or directory, instead you should use {COPYTREE_SHARE}" then much time would be 
saved.


Cheers
Ari





-- 
-->
Aristedes Maniatis
GPG fingerprint CBFB 84B4 738D 4E87 5E5C  5EFA EF6A 7D2E 3E49 102A
___
freebsd-ports@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-ports
To unsubscribe, send any mail to "freebsd-ports-unsubscr...@freebsd.org"


Re: ${INSTALL_DATA} problems

2016-09-08 Thread Mark Linimon
On Fri, Sep 09, 2016 at 08:29:12AM +1000, Aristedes Maniatis wrote:
> Maybe the Makefile language will become clearer to me one day, but
> I've been using FreeBSD since 4.0 and it hasn't clicked yet.

Don't worry, the FreeBSD ports framework does things with the Makefile
language that was never intended by make's designers :-)

We do try to document things in the Porter's Handbook, but sometimes
the only thing to do is wade into bsd.port.mk and friends and read the
code.  (Not recomended for the faint of heart, though.)

mcl
___
freebsd-ports@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-ports
To unsubscribe, send any mail to "freebsd-ports-unsubscr...@freebsd.org"


Re: ${INSTALL_DATA} problems

2016-09-08 Thread Aristedes Maniatis
Thanks Mathieu

On 8/09/2016 10:47pm, Mathieu Arnold wrote:
> Like Matthew said, INSTALL_DATA is for installing one file, not a
> directory hierarchy, this is done using COPYTREE_SHARE. As a side not,
> we never use CP -R to install files.

I'm trying to do my best to follow the rules, but the rules are very hard to 
find. For example if the docs mentioned the one file thing for INSTALL_DATA 
that would be helpful. Or if the error message was clear... I also don't 
understand the need for a recursive COPYTREE_SHARE which I believe requires a 
"cd" first, and a non-recursive INSTALL_*. Maybe the Makefile language will 
become clearer to me one day, but I've been using FreeBSD since 4.0 and it 
hasn't clicked yet.

 
> Now, I'm seeing something else that is a bad idea, it is using the -o
> flag.  Ports must build as a regular user.  A regular user will not be
> able to change the owner of the files.

Then why does INSTALL_DATA have an -o flag at all? I copied this idea from 
another port I found.

>  This must be done in the
> pkg-plist file, using @owner/@group as described in the Porter's
> Handbook:
> https://www.freebsd.org/doc/en/books/porters-handbook/plist-keywords.html

OK, thanks. I appreciate your help and I'll try your suggestions.


Ari



-- 
-->
Aristedes Maniatis
GPG fingerprint CBFB 84B4 738D 4E87 5E5C  5EFA EF6A 7D2E 3E49 102A
___
freebsd-ports@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-ports
To unsubscribe, send any mail to "freebsd-ports-unsubscr...@freebsd.org"


Re: ${INSTALL_DATA} problems

2016-09-08 Thread Mathieu Arnold
Le 08/09/2016 à 14:27, Aristedes Maniatis a écrit :
> I'm trying to create a port with a command like this:
>
> do-install:
> ${MKDIR} ${STAGEDIR}${SOLR_HOME}
> ${INSTALL_DATA} ${WRKSRC}/dist ${STAGEDIR}${SOLR_HOME}
>
> However the output is
>
> /bin/mkdir -p 
> /var/poudriere/ports/default/textproc/apache-solr/work/stage/usr/local/solr
> install  -m 0644 
> /var/poudriere/ports/default/textproc/apache-solr/work/solr-5.5.2/dist 
> /var/poudriere/ports/default/textproc/apache-solr/work/stage/usr/local/solr
> install: 
> /var/poudriere/ports/default/textproc/apache-solr/work/solr-5.5.2/dist: 
> Inappropriate file type or format
> *** Error code 71
>
> {CP} works fine, but I want to use {INSTALL_DATA} so I can also add the -o 
> flag.
>
>
> What am I doing wrong?


Like Matthew said, INSTALL_DATA is for installing one file, not a
directory hierarchy, this is done using COPYTREE_SHARE. As a side not,
we never use CP -R to install files.

Now, I'm seeing something else that is a bad idea, it is using the -o
flag.  Ports must build as a regular user.  A regular user will not be
able to change the owner of the files.  This must be done in the
pkg-plist file, using @owner/@group as described in the Porter's
Handbook:
https://www.freebsd.org/doc/en/books/porters-handbook/plist-keywords.html

--
Mathieu Arnold




signature.asc
Description: OpenPGP digital signature


Re: ${INSTALL_DATA} problems

2016-09-08 Thread Matthew Seaman
On 09/08/16 13:27, Aristedes Maniatis wrote:
> I'm trying to create a port with a command like this:
> 
> do-install:
> ${MKDIR} ${STAGEDIR}${SOLR_HOME}
> ${INSTALL_DATA} ${WRKSRC}/dist ${STAGEDIR}${SOLR_HOME}
> 
> However the output is
> 
> /bin/mkdir -p 
> /var/poudriere/ports/default/textproc/apache-solr/work/stage/usr/local/solr
> install  -m 0644 
> /var/poudriere/ports/default/textproc/apache-solr/work/solr-5.5.2/dist 
> /var/poudriere/ports/default/textproc/apache-solr/work/stage/usr/local/solr
> install: 
> /var/poudriere/ports/default/textproc/apache-solr/work/solr-5.5.2/dist: 
> Inappropriate file type or format
> *** Error code 71
> 
> {CP} works fine, but I want to use {INSTALL_DATA} so I can also add the -o 
> flag.
> 
> 
> What am I doing wrong?
> 
> 
> 
> Please cc me as I'm not on the list.

If ${WRKSRC}/dist is a directory and you want to copy it and its
contents recursively into the staging area, then you want one of
COPYTREE_BIN or COPYTREE_SHARE instead of INSTALL_DATA

Cheers,

Matthew




signature.asc
Description: OpenPGP digital signature


${INSTALL_DATA} problems

2016-09-08 Thread Aristedes Maniatis
I'm trying to create a port with a command like this:

do-install:
${MKDIR} ${STAGEDIR}${SOLR_HOME}
${INSTALL_DATA} ${WRKSRC}/dist ${STAGEDIR}${SOLR_HOME}

However the output is

/bin/mkdir -p 
/var/poudriere/ports/default/textproc/apache-solr/work/stage/usr/local/solr
install  -m 0644 
/var/poudriere/ports/default/textproc/apache-solr/work/solr-5.5.2/dist 
/var/poudriere/ports/default/textproc/apache-solr/work/stage/usr/local/solr
install: 
/var/poudriere/ports/default/textproc/apache-solr/work/solr-5.5.2/dist: 
Inappropriate file type or format
*** Error code 71

{CP} works fine, but I want to use {INSTALL_DATA} so I can also add the -o flag.


What am I doing wrong?



Please cc me as I'm not on the list.


Thanks
Ari



-- 
-->
Aristedes Maniatis
GPG fingerprint CBFB 84B4 738D 4E87 5E5C  5EFA EF6A 7D2E 3E49 102A
___
freebsd-ports@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-ports
To unsubscribe, send any mail to "freebsd-ports-unsubscr...@freebsd.org"