darcs-all 1.47 KB
Newer Older
1 2 3 4
#!/bin/sh

top_dirs="nofib testsuite"

Simon Marlow's avatar
Simon Marlow committed
5 6 7
default_repo_root="http://darcs.haskell.org/"
default_lib_repo_root=$default_repo_root/packages

8 9
function darcsall()
{
Simon Marlow's avatar
Simon Marlow committed
10 11
  echo == running darcs $* at the top level
  darcs $*
12 13 14
  for dir in $top_dirs; do
    if test -d $dir -a -d $dir/_darcs; then
	echo "== running darcs $* in $dir"
Simon Marlow's avatar
Simon Marlow committed
15
	darcs $* --repodir $dir
16 17 18 19
    else
	echo "== $dir not present or not a repository; skipping"
    fi
  done
Simon Marlow's avatar
Simon Marlow committed
20 21 22 23
  for pkg in `cat libraries/default-packages`; do
    if test -d libraries/$pkg; then
	echo "== running darcs $* in libraries/$pkg"
	darcs $* --repodir libraries/$pkg
24 25 26 27 28 29 30 31 32 33 34 35 36
    else
	echo "warning: $dir doesn't seem to exist, use 'darcs-all get' to get it"
    fi
  done
}

function darcsget()
{
  case $* in
    *--partial*) ;;
    *) echo "warning: adding --partial, to override use --complete"
  esac

Simon Marlow's avatar
Simon Marlow committed
37 38 39 40 41 42
  repo_root=`cat _darcs/prefs/defaultrepo`
  case $repo_root in
    /*) lib_repos=$repo_root/libraries;;
    *)  lib_repos=$default_lib_repo_root;;
  esac

43
  cd libraries
Simon Marlow's avatar
Simon Marlow committed
44 45 46
  for pkg in `cat default-packages`; do
    if test -d $pkg; then
	echo "warning: $pkg already present; omitting"
47
    else
Simon Marlow's avatar
Simon Marlow committed
48
	repo=$lib_repos/$pkg
49 50 51 52 53 54 55 56 57 58 59 60
	echo "== running darcs get --partial $* $repo"
	darcs get --partial $* $repo
    fi
  done
}

if test ! -d _darcs -o ! -d ghc; then
  echo "error: darcs-all must be run from the top level of the ghc tree."
  exit 1;
fi

case $1 in
Simon Marlow's avatar
Simon Marlow committed
61
  push|pull|wh*) darcsall $*;;
62
  get)  shift; darcsget $*;;
Simon Marlow's avatar
Simon Marlow committed
63
  *)    echo "syntax: ./darcs-all push|pull|whatsnew|get"; exit 1;;
64
esac