[Top][All Lists]

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

[Chicken-users] Packaging eggs

From: Jim Pryor
Subject: [Chicken-users] Packaging eggs
Date: Mon, 30 Aug 2010 13:57:25 -0400
User-agent: Mutt/1.5.20 (2009-06-14)

I'm an occasional user of Chicken. However, my Linux distro only has
the main Chicken binary in its repositories, and no support for eggs. I
strongly prefer using a single package manager (my distro's) for all
my package-handling needs, rather than a different package manager for
each of vim, Lua, OCaml, Chicken, Python, Haskell, Perl, and so on. So
I'm looking to automate the extraction of metadata from the eggs' svn
repo into our distro's package-building-script format.

Actually, I've already done that---about nine months ago--- and I'm now
the maintainer of 200+ eggs in our Community package repository:


The scripts I use to do this are a real ugly, ad-hoc, taped-together
mess, but they get the job done.

The last time I updated these were around Chicken 4.2. I'm now trying to
update all the packages. I'm testing whether the eggs build and install
on my machine, using Chicken 4.5.0.

Now, I'd sure welcome any tips about extracting the metadata. I strongly
prefer to do this *without* ever using chicken-install to install the
egg into my real machine. If there were some way to run chicken-install
on a .setup and/or .meta file from the svn folder, and get a dump of the
egg's dependencies, version number, whether it has documentation on the
wiki, and so on, that'd simplify things a lot. At the moment, I'm just
doing an ad-hoc explicit parse of those files. (Not even a proper parse,
actually.) And the way this information is supplied, across the whole 366
folders in the svn repo, is quite varied.

However, that's a hopefully-someday-it'd-be-nice-to-have thing. What I'm
writing to ask about now is more specific.

Here's how a sample build script looks, for the check-errors egg.


are variables set by the packaging system. We manually unchunk the blob
henrietta sends us of the egg's source files into
$srcdir/check-errors, and the files that get installed
should all be installed under the
(otherwise empty) root directory $pkgdir.

The build() function below is run with user privileges, and the package()
function is run as fakeroot. As I said, all files that will ultimately
get installed by the packaging system under / should be installed by the
package() function underneath the directory $pkgdir instead. $pkgdir is
what we usually set as our DESTDIR when using Makefiles that honor that

Before the build() and package() functions get called,${pkgver}
has been downloaded and named
when such a file exists and is no empty, has been downloaded and named

build() {
        cd "$srcdir"

    # This is my manual unchunk-the-blob-that-henrietta-sends-me
    # function. If there's an easier way to do this, please let me know.
        cat "check-errors-${pkgver}.chunked" | while :; do
                while read -r bar fname len; do
                        [[ -n "$fname" ]] && break
                [[ -z "$fname" ]] && break
                fname="${fname:1:${#fname}-2}" # delete quotes around fname
                if [[ "${fname: -1}" == / ]]; then
                        mkdir -p "check-errors-${pkgver}/$fname" || return 1
                        dd of="check-errors-${pkgver}/$fname" ibs="$len" 
count=1 2>/dev/null || return 1
        cd "check-errors-${pkgver}"
        cp ../check-errors-${pkgver}.html check-errors.html
        CHICKEN_INSTALL_PREFIX="${pkgdir}/usr" chicken-install -n

package() {
        cd "$srcdir/check-errors-${pkgver}"
        chicken-install -p "${pkgdir}/usr"

My main questions for now concern the two invocations of check-install,
one with the -n (-no-install) flag at the end of build(), and the other
in package(). In both cases, they are operating on a .setup file in the
current directory.

What is the proper way to invoke these? I don't understand why the
CHICKEN_INSTALL_PREFIX should be needed at all for the first invocation,
since no installing should take place. And indeed for many eggs it's not
needed. However, many other eggs fail to build at this step complaining that
(since chicken-install is here running with user privileges). they don't
have permission to write to /usr/lib/chicken/5/something-or-other. As
indeed they shouldn't. At no point during the building of these packages
should anything be written to the machine's real /usr directory. That's
where the eggs should think they'll end up, but it's our Linux distro's
package manager that will (later) be installing the files there.

Are these bugs in the eggs themselves? Or is it a bug in
chicken-install, that it doesn't properly implement the -n flag?
Why is the CHICKEN_INSTALL_PREFIX needed at this stage?

Futhermore, from what I can tell, the use of CHICKEN_INSTALL_PREFIX or
the -p option in the second invocation of chicken-install *should* be
interchangeable. But they most certainly are not. Most eggs fail at this
point if I say instead:

        CHICKEN_INSTALL_PREFIX="${pkgdir}/usr" chicken-install

Am I right that CHICKEN_INSTALL_PREFIX *should* work the same as the -p
option? Is there a bug here in the implementation, or in my
understanding of what these do?

In general, what would the optimal use of chicken-install be in such

Jim Pryor

reply via email to

[Prev in Thread] Current Thread [Next in Thread]