Re: Scallywag GH tzdata source build fails

Brian Inglis via Cygwin-apps <[email protected]> Mon, 15 Dec 2025 13:03:53 -0700
Newsgroups gmane.os.cygwin.applications
Organization Systematic Software
Message-ID <[email protected]>
On 2025-12-15 05:29, Jon Turney wrote:
> On 14/12/2025 16:25, Brian Inglis via Cygwin-apps wrote:
>> Hi folks,
>>
>> I noticed an issue with my most recent build of tzdata, where it is 
>> downloading leap-seconds.list, which changes every 6 months, so needs accessed 
>> with its unique id, which is the NTP timestamp suffixed name in the link on 
>> the FTP site.
>> So in tzdata.cygport I retrieve the verbatim symlink using wget and readlink 
>> the NTP timestamp suffixed name, adding that name to SRC_URI.
>> Everything works fine locally, including srcpkg, but Scallywag now complains 
>> it can not publish the artifacts because it puts a wget argument into a tar 
>> command line and fails?
>> For comparison, `cygport ... vars SRC_URI` displays the correct URIs.
>> See any failing tzdata job recently for more details than the failure:
>>
>> scallywag: publishing artifacts
>> scallywag: staging/tzdata/tzdata-2025c-1-src.hint
>> scallywag: staging/tzdata/tzdata-2025c-1-src.tar.xz
>> tar: unrecognized option '--retr-sym=no'
>> Try 'tar --help' or 'tar --usage' for more information.
>> Traceback (most recent call last):
>>    File "/cygdrive/d/a/scallywag/scallywag/./scallywag", line 195, in <module>
>>      subprocess.check_call('tar -Jcf %s *' % (os.path.join(mydir, 
>> 'builddir.tar.xz')),
>>    File "/usr/lib/python3.9/subprocess.py", line 373, in check_call
>>      raise CalledProcessError(retcode, cmd)
>> subprocess.CalledProcessError: Command 'tar -Jcf /cygdrive/d/a/ scallywag/ 
>> scallywag/builddir.tar.xz *' returned non-zero exit status 64.
>> Error: Process completed with exit code 1.
> 
> Huh. This is a weird one.
> 
> I think what's happening is that there's a file or directory named '--retr- 
> sym=no' which is being picked up by the glob here and then tar tries to 
> interpret it as an argument.
> 
> So I guess a '--' is needed here to protect against that.
> 
>> LS_URI=ftp://hpiers.obspm.fr/iers/bul/bulc/ntp/leap-seconds.list
>> LS_NTP=$(/usr/bin/wget -NqP ${T:-$TMPDIR} --retr-sym=no $LS_URI && readlink 
>> ${T-$TMPDIR}/${LS_URI##*/})
>> SRC_URI+=" ${LS_URI%/*}/$LS_NTP"
>> PATCH_URI=
> 
> Very clever, but I think this deserves a comment to explain what's going on!

Thanks Jon,

Will do: tz and USNO/NIST/IERS leap seconds upstreams have used FTP symlinks to 
latest tz archive versions and leap-seconds.list to NTP timestamp suffix for 
decades, so it was not unusual to use that technique on sites, and so in 
scripts, while all the world offered was FTP (/gopher/WAIS over dialup to X.25!)

> I guess that means that ${T:-$TMPDIR} is evaluating to empty, so '--retr-sym=no' 
> is taken as the argument to '-P'?
> 
> (In passing, I notice that the ':' is missing in the second instance in this 
> line, is that intended?)

Good catch; I missed that despite $T not being set locally, why I added $TMPDIR, 
but did not extend thought to GH, so I will add the usual cascade of temp dir 
options I was being lazy thinking I could skip.
And I did miss the second : in :- ;^<

I will split everything up, add some tests and option barriers as you suggested.

> Despite being described as "globals" $T and friends aren't set until after 
> the .cygport file has been sourced (so are only in scope for src_compile() etc. 
> (this all revolves around that we can't definitively know the name of our 
> working directory until after we've sourced the cygport to have it set NAME, 
> VERSION, RELEASE...)
> 
> It appears that only TMP and TEMP are set the the login profile in a default 
> installation, which seems like a bit of an omission?

Thanks, that's good to know for future packages.

-- 
Take care. Thanks, Brian Inglis              Calgary, Alberta, Canada

La perfection est atteinte                   Perfection is achieved
non pas lorsqu'il n'y a plus rien à ajouter  not when there is no more to add
mais lorsqu'il n'y a plus rien à retrancher  but when there is no more to cut
                                 -- Antoine de Saint-Exupéry