[Slackbuilds-users] 'Correct' download link from Github?

Dave Woodfall dave at slackbuilds.org
Sun Apr 17 15:53:34 UTC 2022


On 17/04/22 14:42,
Ruben Schuller <sb at rbn.im> put forth the proposition:
> Hi,
> 2022-04-17 Ozan Türkyılmaz <ozan.turkyilmaz at gmail.com>:
> > Paz, 2022-04-17 tarihinde 09:33 +0100 saatinde, Dave Woodfall yazdı:
> > > No policy yet AFAIK but you can find the release tag (add /tags/ to
> > > the end of the URL) and then do something like:
> > >
> > >
> > I remember a talk about content disposition (and how wget ignores it
> > by default) and github links should give same file with or without
> > content disposition. I dont remember when thou. My memory is not as
> > it used to be.

I think what you're referring to is that github will tend to send any
name tarball that you ask for from some links, but using the release
source links sends the format 1.2.3.tar.gz by default.  This isn't
very useful if you use sbopkg and /var/cache/sbopkg fills up with
1.2.3.tar.gz, 3.4.5.tar.gz etc., because at some point you might need
to find some source and seeing them named like that is unhelpful.

> I think the decision was that scripts should assume content disposition
> is used. I usually use
> tar xvf v${VERSION}.tar.gz || tar ${PRGNAM}-${VERSION}.tar.gz
> (or the other way around..) in my scripts to catch the case when it
> isn't. I think it's fine, either of those tarballs should be MD5-checked

We can't assume that it is always used.  Content-Disposition doesn't
always work, and is still marked as experimental in wget(1), and in
curl can give errors when mixed with other flags like -C.

"--content-disposition
     If this is set to on, experimental (not fully-functional) support for
     "Content-Disposition" headers is enabled. This can currently result in
     extra round-trips to the server for a "HEAD" request, and is known to
     suffer from a few bugs, which is why it is not currently enabled by
     default."

The method I showed should always download $PRGNAM-$VERSION.tar.gz
and I change github URLs in submissions when I come across one.

One simple way to do this (test without -i first):

source the .info
sed -E "s,(https://github.com/[^/]+/$PRGNAM)/archive/refs/tags/v?($VERSION)(.tar.gz),\1/archive/v\2/$PRGNAM-\2\3," -i $PRGNAM.info

--
Dave


More information about the SlackBuilds-users mailing list