1#!/bin/sh 2# 3# aegis - project change supervisor 4# Copyright (C) 2006, 2008 Peter Miller 5# 6# This program is free software; you can redistribute it and/or modify 7# it under the terms of the GNU General Public License as published by 8# the Free Software Foundation; either version 3 of the License, or 9# (at your option) any later version. 10# 11# This program is distributed in the hope that it will be useful, 12# but WITHOUT ANY WARRANTY; without even the implied warranty of 13# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14# GNU General Public License for more details. 15# 16# You should have received a copy of the GNU General Public License 17# along with this program. If not, see 18# <http://www.gnu.org/licenses/>. 19# 20output= 21here=`pwd` 22test $? -eq 0 || exit 1 23tmp=${TMP_DIR:-/tmp}/$$ 24 25fail() { 26 cd $here 27 rm -rf $tmp 28 exit 1 29} 30trap "fail" 1 2 3 15 31 32set -x 33mkdir $tmp $tmp/lib 34test $? -eq 0 || fail 35cd $tmp 36test $? -eq 0 || fail 37 38arch=$1 39shift 40bin=$here/$arch/bin 41 42AEGIS_PATH=$tmp/lib 43export AEGIS_PATH 44 45chmod 0777 $tmp/lib 46test $? -eq 0 || fail 47 48AEGIS_PROJECT=example 49export AEGIS_PROJECT 50 51USER=`whoami` 52export USER 53 54AEGIS_FLAGS="delete_file_preference = no_keep; \ 55 lock_wait_preference = always; \ 56 diff_preference = automatic_merge; \ 57 pager_preference = never; \ 58 persevere_preference = all; \ 59 log_file_preference = never;" 60 61# 62# Create a new project 63# 64$bin/aegis -new-project $AEGIS_PROJECT --version=- --dir=$tmp/proj.dir 65test $? -eq 0 || fail 66 67# 68# add minimal staff, we wont actually be completing any change sets. 69# 70$bin/aegis --new-dev --project=$AEGIS_PROJECT $USER 71test $? -eq 0 || fail 72 73AEGIS_CHANGE=1 74export AEGIS_CHANGE 75 76# 77# Create a change set. 78# 79cat > caf << 'fubar' 80brief_description = "minimum initial configuration"; 81description = 82 "This change set creates the minimum Aegis configuration to get a " 83 "small project up and running quickly. It does not include any " 84 "source files, as those are expected to be supplied by release " 85 "tarballs imported using the aetar command." 86 ; 87cause = internal_enhancement; 88test_baseline_exempt = true; 89fubar 90test $? -eq 0 || fail 91 92$bin/aegis --new-change -f caf \ 93 --project=$AEGIS_PROJECT --change=$AEGIS_CHANGE 94test $? -eq 0 || fail 95 96# 97# Begin development of the change 98# 99$bin/aegis --develop-begin -dir $tmp/chan.dir -v -nolog \ 100 --project=$AEGIS_PROJECT --change=$AEGIS_CHANGE 101test $? -eq 0 || fail 102 103# 104# Create the top-level aegis.conf file, 105# pointing into the aegis.conf.d directory. 106# 107$bin/aegis -nf $tmp/chan.dir/aegis.conf -v -nolog \ 108 --project=$AEGIS_PROJECT --change=$AEGIS_CHANGE \ 109 > log 2>&1 110if test $? -ne 0 ; then cat log; fail; fi 111 112echo 'configuration_directory = "aegis.conf.d";' > $tmp/chan.dir/aegis.conf 113test $? -eq 0 || fail 114 115# 116# Create the build file. It says we don't do builds at all. 117# We will have to wait until there is some content for that to be useful. 118# 119$bin/aegis -nf $tmp/chan.dir/aegis.conf.d/build -v -nolog \ 120 --project=$AEGIS_PROJECT --change=$AEGIS_CHANGE \ 121 > log 2>&1 122if test $? -ne 0 ; then cat log; fail; fi 123 124echo 'build_command = "exit 0";' > $tmp/chan.dir/aegis.conf.d/build 125test $? -eq 0 || fail 126 127# 128# Add anything else given on the command line. 129# (This includes history, diff, merge, etc.) 130# 131while [ $# -ge 1 ] 132do 133 case "$1" in 134 output=*) 135 output=`echo $1 | sed 's|.*=||'` 136 ;; 137 138 *=*) 139 name=`echo $1 | sed 's|=.*||'` 140 value=`echo $1 | sed 's|.*=||'` 141 142 $bin/aegis -nf $tmp/chan.dir/$name -v -nolog \ 143 --project=$AEGIS_PROJECT --change=$AEGIS_CHANGE \ 144 > log 2>&1 145 if test $? -ne 0 ; then cat log; fail; fi 146 147 cp $here/$value $tmp/chan.dir/$name 148 test $? -eq 0 || fail 149 ;; 150 151 *) 152 echo "$0 name=value ..." 1>&2 153 fail 154 ;; 155 esac 156 shift 157 158done 159 160if test -z "$output" 161then 162 echo "No output=[target] option given." 163 fail 164fi 165 166# 167# Package the change set. 168# 169$bin/aedist -send -ndh -mh -naa -comp-alg=gzip \ 170 --ignore-uuid \ 171 --output="$here/$output" \ 172 --project=$AEGIS_PROJECT --change=$AEGIS_CHANGE 173 174cd $here 175rm -rf $tmp 176 177exit 0 178