pkgsrc-Users archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: [patch] package.mk: use cp without -p if it fails



On Aug 20, 2021, at 6:55 PM, Rhialto <rhialto%falu.nl@localhost> wrote:
> 
> On Thu 19 Aug 2021 at 11:22:03 +0200, Sijmen J. Mulder wrote:
>> "Amitai Schleier" <schmonz%schmonz.com@localhost>:
>>> FWIW, I've been running for a long time with a similar local diff for 
>>> similar reasons (many VMs building binary packages into an NFS 
>>> location):
>>> 
>>> --- mk/pkgformat/pkg/package.mk
>>> +++ mk/pkgformat/pkg/package.mk
>>> @@ -66,7 +66,8 @@ ${PKGFILE}: ${STAGE_PKGFILE}
>>>         @${STEP_MSG} "Creating binary package ${.TARGET}"
>>>         ${RUN} ${MKDIR} ${.TARGET:H};                                   
>>> \
>>>         ${LN} -f ${STAGE_PKGFILE} ${PKGFILE} 2>/dev/null ||             
>>> \
>>> -               ${CP} -pf ${STAGE_PKGFILE} ${PKGFILE}
>>> +               ${CP} -pf ${STAGE_PKGFILE} ${PKGFILE} 2>/dev/null ||    
>>> \
>>> +               ${CMP} ${STAGE_PKGFILE} ${PKGFILE}
>>>  .endif
>> 
>> I'm afraid I don't know how that works. From what I can
>> see /usr/bin/cmp (which CMP is set to here) compares two files, how
>> does this fix the issue?
> 
> Maybe it is intended to fail with an error code if the destination file
> exists but is not the same? Or it is a subtle typo, where another ${CP}
> was meant.

It’s been a while, but I think the behavior I was desiring (and that this produces) is:

1. ${CP} won’t fail just because -p sometimes does
2. But ${CMP} will fail if the bytes weren’t copied

- Amitai


Home | Main Index | Thread Index | Old Index