[Dev] [RFC] librefetch, a tool to streamline liberated source generation

Luke T. Shumaker lukeshu at sbcglobal.net
Fri Feb 8 16:09:22 GMT 2013

I have written a tool that I call librefetch that automates the
liberated source generation process.

It is compatible with both the old mksource method, and the SRCBUILD

It works by creating a slightly modified makepkg, and creating an
SRCBUILD from the PKGBUILD's mksource (or using an existing
SRCBUILD).  You can then simply add libre://filename.tar.gz to
source=(), and it will either fetch an already-created tarball from
repo.parabolagnulinux.org, or create it.

About using mksource():
 1. You can have makepkg fetch sources for you with the mksource=()
    array, instead of mucking around with wget.
    Related: mknoextract, mk*sums work with the mksource array.
 2. If mksource() has any dependencies for running, add them to the
    mkdepends=() array, not depends or makedepends.
 3. You can either copy files from ${srcdir} to ${pkgdir} yourself, or
    directories (but not files) will automatically be copied for you
    if ${pkgdir} is empty after mksource() is run.

The modifications made to makepkg are:
 1. Modify create_package()
    a. don't set pkg_file (so we can set it from the environment)
    b. do not run check_package
    c. do not include .{PKGINFO,INSTALL,CHANGELOG}
 2. Modify tidy_install
    a. allow PURGE_TARGETS to contain directories by adding a trailing
    b. set the time-stamp for all files to "1990-01-01 0:0:0 +0" (so
       that the output tarball is always identical. 
 3. Set srcdir and pkgdir differently (src-libre and pkg-libre)
 4. Do not run check_build_status

To use it:
 1. put it somewhere in your PATH
 2. Add it to DLAGENTS in makepkg.conf:
    "libre::$(which librefetch) -p \"\$BUILDFILE\" %u %o"
 3. Create /etc/libretools.d/librefetch.conf
    DOWNLOADER='/usr/bin/curl -fLC - --retry 3 --retry-delay 3 -o %o %u'

This is my second implementation of the program.  The first did some
really neat, clever things to load functions from makepkg, and be it's
own program.  Unfortunately, nitty-gritty details made the program
longer than I wanted it to be (if I remove all the necessary hacks,
it is a simple, elegant program).  This version is simpler by not getting
too low-level with makepkg by modifying the PKGBUILD instead.  I still
couldn't get out of modifying makepkg at all, but this version is
simpler and more capable.

I included an example PKGBUILD.  Note that it requires makepkg-git in
order to have an hg+https:// URL in mksource=()
Run it with

    export MAKEPKG=makepkg-git; ${MAKEPKG}

If reception of this is positive, I will add it to libretools.  I am
also open to suggestions for improvements.

Happy hacking,
~ Luke Shumaker

-------------- next part --------------
A non-text attachment was scrubbed...
Name: librefetch
Type: application/octet-stream
Size: 8252 bytes
Desc: not available
URL: <https://lists.parabola.nu/pipermail/dev/attachments/20130208/e1306da2/attachment.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Type: application/octet-stream
Size: 816 bytes
Desc: not available
URL: <https://lists.parabola.nu/pipermail/dev/attachments/20130208/e1306da2/attachment-0001.obj>

More information about the Dev mailing list