[Slackbuilds-users] DOWNLOAD advice for github

David Spencer baildon.research at googlemail.com
Sat May 14 16:35:31 UTC 2016


Hi everybody,

For maintainers, here's some advice about what to put in DOWNLOAD in
the .info file for github URLs.

NOTE: you don't need to change any of your existing files, this is
just some general advice that we hope you will find helpful and
interesting and useful. Also, this is not related to 14.2, it is
actually some new advice about github that Heinz worked out yesterday
:)

Hopefully, most of you know already that github is "clever" with
download URLs. It uses an HTTP "content disposition" header to tell
browsers the name of the archive that githib has dynamically created.
But by default wget and curl do not use the "content disposition"
header and use the last component of the URL as a filename. Therefore
(until now) our SlackBuilds have needed to try both possible names for
the download, e.g.

tar xvf $CWD/v$VERSION.tar.gz || tar xvf $CWD/$PRGNAM-$VERSION.tar.gz

So, here's the new advice: Heinz has worked out that if we use (for example)

DOWNLOAD="https://github.com/trizen/clyrics/archive/0.04/clyrics-0.04.tar.gz"

then the archive will *always* be named clyrics-0.04.tar.gz, even if
we use wget or curl, and so we can just do the usual tar command in
the SlackBuild:

tar xvf $CWD/$PRGNAM-$VERSION.tar.gz

Apparently this will even work nicely for projects that include the
project name in the git tag, e.g.

DOWNLOAD="https://github.com/christophgysin/pasystray/archive/0.5.2/pasystray-0.5.2.tar.gz"

so we can now stop using confusing and ugly commands like these:

rm -rf $PRGNAM-$PRGNAM-$VERSION
tar xvf $CWD/$PRGNAM-$PRGNAM-$VERSION.tar.gz
cd $PRGNAM-$PRGNAM-$VERSION

I hope this is helpful to you.  Thanks to Heinz for finally working
out the right way of handling this!

Best regards to everybody
-D.

ps. If I've made any mistakes above, corrections will be gratefully received :D


More information about the SlackBuilds-users mailing list