[csw-maintainers] GAR: building a package from loose files, with checksumming

Dagobert Michelsen dam at opencsw.org
Mon Oct 12 20:10:20 CEST 2009


Hi Maciej,

Am 12.10.2009 um 15:10 schrieb Maciej (Matchek) Blizinski:
> I was trying to create a GAR build which would be done from loose
> files, with checksumming. Image this existing directory structure:
>
> $ tree
> .
> `-- opt
>    `-- csw
>        |-- bin
>        |   `-- foo
>        `-- share
>            `-- foo
>                |-- README
>                `-- examples
>                    `-- doing-it-right.conf
>
> (In other words: loose files which are already in the corresponding
> directories.)

Ok, for now I'll stick to /usr/bin/ls and /usr/share/man/man1/ls.1, ok?

> Suppose I'd like to create a GAR package from such files. I'd like to
> calculate a checksum of each single file.
>
> I was thinking about doing something like this, although it only
> allows to create a single checksum for all the files:
>
> - create a fake download file in DESTDIR
> - override its download target:
> $(DOWNLOADDIR)/fakefile:
>   ...copy the tree structure...
>   ...touch $(DOWNLOADDIR)/fakefile to make GAR happy; optionally put
> the checksums of all the copied files in there.

These steps are very valid and useful. I use it in automake to put
the list of versions in the README:

> $(DOWNLOADDIR)/README.CSW:
>         @echo " ==> Generating README.CSW"
>         @(exec > 
> $@;                                                             \
>           echo "This package contains the following automake  
> versions:";        \
>           for VERSION in $(MODULATIONS_GARVERSION);  
> do                                  \
>             echo "  automake-$ 
> $VERSION";                                        \
>           done)

However, as the files are already there you can use a more elegant
method wel'll see below.

> - in the extract step, copy the tree structure from $(DOWNLOADDIR) to
> $(WORKSRC).
> - skip the build step
> - in the install step, copy files once again from $(WORKSRC) to $ 
> (DESTDIR)
>
> That's my take, and it hardly works. Dago, how would you go about it?

Here's my small example:

> GARNAME = example
> GARVERSION = 1.0
> CATEGORIES = apps
>
> DESCRIPTION = An example
>
> FILES = /usr/bin/ls /usr/share/man/man1/ls.1

This is the list of files you want.

> MASTER_SITES = $(sort $(addprefix file://,$(dir $(FILES))))

Every data source from MASTER_SITES is searched for the files in  
DISTFILES.
It is in URL syntax, the sort is only to make the dirs unique if you  
have
multiple files from one dir (essentially not needed here).

> DISTFILES = $(notdir $(FILES))

There files get downloaded. Only the files as the data sources are
multiplexed as above. It would be nice to specify a location per file,
but historically it is not in there. AFAIK Ben requested that for
his zillion XML-sources-sites.

> CONFIGURE_SCRIPTS =
> BUILD_SCRIPTS =
> INSTALL_SCRIPTS = custom
> TEST_SCRIPTS =
>
> include gar/category.mk
>
> install-custom:
>         $(foreach F,$(FILES),ginstall -d $(DESTDIR)$(dir $F) &&  
> ginstall $(WORKDIR)/$(notdir $F) $(DESTDIR)$(dir $F);)
>         @$(MAKECOOKIE)


The install is pretty straight. Please note that install should
*always* copy from WORKDIR (or WORKSRC) to DESTDIR because that
is the flow of the data, instead of taking from DOWNLOADDIR
and installing to PKGROOT or something!


Best regards

   -- Dago



More information about the maintainers mailing list