3
0
Fork 0
forked from mirrors/nixpkgs
nixpkgs/strategoxt-dist/svn-to-nix.sh
Eelco Visser bad05cd2b6 A first attempt at generic release management. The goal
is to fully automate the building of distributions and
their release for distribution through a web-site, ftp
directory, etc. Inspired by nix-dist, but more generic
in order to deal with StrategoXT and related packages. 

The assumptions are the following:

  - package source is a subversion repository
  - the package is under autotool configuration
    (at least it has a configure.in with an AC_INIT)
  - standard autotools build interface:
    - bootstrap; configure; make install; 
      make check; make dist
  - optionally the release status can be indicated by
    a status="..." definition in configure.in

Creation of distributions is a two-step process:

  urls-to-nix.sh  # nix expressions for most recent commits
  build+upload.sh # instantiate the expressions

svn-to-nix.sh 

   Generates nix expression for head revision of the
   package; revision number, package name, and version
   are obtained from the source and do not have to
   be declared.

urls-to-nix.sh

   Contains a list of URLs to which svn-to-nix.sh is applied.

build+upload.sh

   Builds the packages and creates distributions in a www
   directory. Including the log of the build process (buildfarm)
   and files such as NEWS and README (for release management).
   (upload part of the script is currently turned off)

do-it.nix

   Top nix expression; collects pointers to required packages
   (e.g., stdenv, autotools, aterms, ...) and binds them
   to the parameters of the source-dist.nix packages.

package-source-dist.nix

   Generic Nix expression for a package parameterized with
   version info from svn and dependency info from do-it.nix.

package-dist.nix

   Generated; just imports 

package-version-rev.nix

   Generated; instantiates package-source-dist.nix with version,
   name, packagename, rev.

build-from-svn.sh

   Generic build script; obtains configuration flags from
   with... and enable... attributes of the Nix expression.
   Creates logs of the various parts of the build process.
   Creates distribution

Generalizations:

- Currently some information about a package resides in
  this directory, e.g., the generic Nix expression for
  a package, and the composition of the overall do-it.nix
  This information should also be obtained from the source
  tree.

- Upload facility lacking.
 



svn path=/nixpkgs/trunk/; revision=605
2003-12-30 21:14:48 +00:00

72 lines
1.4 KiB
Bash
Executable file

#! /bin/sh -v
# Generate a Nix expression for the head revision of a directory in
# a subversion repository. The directory is assumed to contain
# a package with a configure.in file.
#
# Usage :
#
# svn-to-nix.sh url
#
# where url points to a subversion repository
# Obtain version information from repository
# Revision
url=$1
rev=`svn log ${url} \
| head -n 2 \
| grep rev \
| sed "s/rev \([0-9]*\):.*$/\1/"`
# The configure.in file
configure="/tmp/$$configure.in"
svn cat -r ${rev} ${url}/configure.in > $configure
# Version number from AC_INIT
version=`grep AC_INIT $configure \
| awk -F , -- "{print \\$2}" \
| sed "s/[[]//" \
| sed "s/[]]//"`
# Package name from AC_INIT
packagename=`grep AC_INIT $configure \
| awk -F , -- "{print \\$1}" \
| sed "s/AC_INIT([[]//" \
| sed "s/[]]//"`
# Status
status=`grep status $configure \
| sed "s/^status=\(.*\)/\1/"`
# The name of the distribution
name="${packagename}-${version}-${rev}"
rm $configure
###########################
# Generate Nix expressions
cat > ${packagename}-dist.nix <<EOF
import ./${name}.nix
EOF
cat > ${name}.nix <<EOF
(import ./${packagename}-source-dist.nix) {
name = "${name}";
packagename = "${packagename}";
version = "${version}";
rev = "${rev}";
url = "${url}";
}
EOF