GAR Wrapper

The Goal

All this being said, we envision a GAR wrapper utility that

  • makes it easy to initialize GAR and checkout package build descriptions
  • makes it easy to work within the repository (locate packages, switch working directories)
  • offers usage instructions (think —help) to guide beginners
  • installs sanity hooks on repository actions (commit message prefixed with pkg name? checksums up to date on commit?)

Get started

There's a packaged version of a prototype which is easy to setup for both cases, i.e. if you are starting from scratch or if you have an existing package build tree checkout in place. There's also a sort of longish screencast, which explains the concept behind the prototype. Feedback very much appreciated. Setup instructions:

$ pkgutil -i mgar
$ mgar help
Wrapper around the GAR build system. Usage: mgar <action> [options]

Main actions:
  init [dir]          Initialize package build tree, defaults to ~/opencsw/
  index               Build/update the package build tree index
  locate <name>       Search a package within the package build tree index
  up [--all]          Update current (or all) package build descriptions
...
$

Option 1 - Starting from scratch:

If you are completely new to packaging (i.e. you don't have a local copy of the package build tree) this is for you. This will prepare the package build tree and download the build system.

$ mgar init ~/opencsw/
Initializing the package build tree at /home/skayser/opencsw
A    /home/skayser/opencsw/.buildsys/gar.mk
A    /home/skayser/opencsw/.buildsys/category.mk
A    /home/skayser/opencsw/.buildsys/gar.lib.mk
...
 U   /home/skayser/opencsw/.buildsys
Checked out revision 11593.
Checked out revision 11593.

Initialized the package build tree at /home/skayser/opencsw.
Registering the package build tree location in ~/.garrc

Now you can fetch the package build descriptions via: "mgar up --all"
Please be advised that this will take some time. So grab yourself a cup
of tea/coffee :)

At this stage, you have a copy of the build system and a package build tree skeleton which will hold all build recipes. Next step is to download these recipes.

$ mgar up
...

Option 2 - Starting with an existing package build tree:

If you already have a fully checked out package build tree you can convert it for the use with mgar. This will checkout a central copy of the gar branches to /path/to/your/buildtree/.buildsys and remove the then obsolete gar symlinks from each package directory:

$ mgar init-existing /path/to/your/buildtree

Working with mgar / building packages

Usage

Now that everything has been setup, let's actually do something. Except for a couple of special commands displayed by "mgar help" all arguments given to mgar will simply be passed to "gmake", so adjusting your build habits should be as simple as forgetting about "gmake" and simply execute "mgar" instead.

General commands

$ mgar show-buildsys
/home/skayser/opencsw/.buildsys       (Revision: 11590)
$ mgar show-pkgtree
/home/skayser/opencsw
$ mgar index
...
$ mgar locate postfix 
/home/skayser/opencsw/postfix/trunk/Makefile
/home/skayser/opencsw/postfix/branches/postfix-2.6/Makefile
/home/skayser/opencsw/postfix/branches/postfix-2.4/Makefile
$ cd /home/skayser/opencsw/postfix/trunk/

Create a new package

$ pwd
/home/skayser/opencsw
$ mgar newpkg foo 1.2.3
Creating package skeleton for foo 1.2.3.
A         /home/skayser/opencsw/foo
A         /home/skayser/opencsw/foo/trunk
A         /home/skayser/opencsw/foo/trunk/files
A         /home/skayser/opencsw/foo/branches
A         /home/skayser/opencsw/foo/tags
A         foo/Makefile
A         foo/trunk/Makefile
A         foo/trunk/checksums
property 'svn:keywords' set on 'foo/trunk/Makefile'
property 'svn:ignore' set on 'foo/trunk'
property 'svn:externals' set on 'foo/trunk'

Created successfully at /home/skayser/opencsw/foo/trunk

$ cd foo/trunk/
$ cat Makefile 
# $Id: Makefile 13420 2011-02-20 21:04:03Z bdwalton $
# TODO (release-critical prefixed with !, non release-critical with *)
#
NAME = foo
VERSION = 1.2.3
GARTYPE = v2
CATEGORIES = category

DESCRIPTION = Brief description
define BLURB
  Long description
endef

MASTER_SITES = 
DISTFILES  = $(DISTNAME).tar.gz

CONFIGURE_ARGS = $(DIRPATHS)

include gar/category.mk

Build commands

$ mgar extract
[===== NOW BUILDING: postfix-2.7.1 =====]
ginstall -d work/solaris9-sparc/cookies/global
ginstall -d work/solaris9-sparc/download
ginstall -d work/solaris9-sparc/download/partial
==> Verifying installed package CSWxz: ok
...
$ mgar show-srcdir
work/solaris9-sparc/build-isa-sparcv8/postfix-2.7.1
$ mgar package

Challenges

  • A user might want to download GAR and then check-out a single package build description. How can we locate this non-checked-out package build description in the SVN repository?

References

See also

Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License