Changeset 481 for branches/confman-1.9
- Timestamp:
- 11/11/2009 14:09:39 (2 years ago)
- Location:
- branches/confman-1.9
- Files:
-
- 9 edited
- 1 copied
-
. (modified) (1 prop)
-
Makefile.am (modified) (1 diff)
-
confman.8.in (modified) (5 diffs)
-
confman.conf.5.in (modified) (1 diff)
-
confman.conf.in (modified) (1 diff)
-
confman.in (modified) (6 diffs)
-
confmancommon.sh.in (modified) (1 diff)
-
confmandoc.sh (modified) (4 diffs)
-
confmanlib.sh.in (modified) (5 diffs)
-
recipe.template (copied) (copied from trunk/recipe.template)
Legend:
- Unmodified
- Added
- Removed
-
branches/confman-1.9
- Property svn:mergeinfo changed
/trunk merged: 462,464,469
- Property svn:mergeinfo changed
-
branches/confman-1.9/Makefile.am
r458 r481 12 12 sysconf_DATA = confman.conf.sample 13 13 sysconfdefaults_DATA = confman.conf 14 dist_sysconfdefaults_DATA = recipe.template 14 15 bashcomp_DATA = confman_completion 15 16 man_MANS = confman.8 confman.conf.5 -
branches/confman-1.9/confman.8.in
r461 r481 36 36 .Op Fl v | Cm version 37 37 .Nm 38 . Ar command Oo Ar command_opts Oc Op Ar command_args38 .Oo Ar flags Oc Ar command Oo Ar command_opts Oc Op Ar command_args 39 39 .Sh DESCRIPTION 40 40 The … … 96 96 operations can bring the system up-to-date. 97 97 .El 98 .\" TODO 98 .Ss FLAGS 99 .Bl -tag -width "FLAGS " 100 .It Global flags 101 The following flags can be specified before the commands: 102 .Bl -tag -width indent 103 .It Fl h Op Ar command 104 Synonymous to the 105 .Ar help 106 command below. 107 .It Fl v 108 Causes 109 .Nm 110 to print the version string and exit. 111 .El 112 .It Log flags 113 The following flags can be used where 114 .Ar log_flags 115 appears in the usage statements (See 116 .Sx COMMANDS ) : 117 .Bl -tag -width indent 118 .It Fl m Ar message 119 The string in the 120 .Ar message 121 argument will be used instead of prompting the user for a log message for 122 .Cm commit 123 and 124 .Cm install 125 operations. 126 .It Fl F Ar filename 127 Like 128 .Fl m , 129 except the log's contents are read from 130 .Ar filename 131 instead of the command line. 132 .El 133 .El 99 134 .Ss COMMANDS 100 135 The following commands are supported by … … 125 160 that will cause the latest repository revision to be reflected in your working 126 161 copy. command does not alter the repository or the system. 127 .It Cm commit 162 .It Cm commit Oo log_flags Oc 128 163 The commit command causes your changes to take effect. 129 164 .Bl -bullet … … 171 206 working copy of 172 207 .Ar module . 173 .It Cm install Ar208 .It Cm install Oo Ar log_flags Oc Ar 174 209 Roll out the specified working files and directories to the live filesystem. 175 210 Note that recipe ordering will be respected, so using install in a low-priority 176 211 module will still cause the highest priority module's copy of the file to 177 212 ultimately be installed. 178 .It Cm status [ Ar working_copy ]213 .It Cm status Oo Ar working_copy Oc 179 214 Look at the status entries for the file or directory specified by 180 215 .Ar working_copy . … … 183 218 .It Cm recipe 184 219 .Brq Cm get | list 185 .It Cm recipe 186 .Brq Cm create | edit | print | remove | set 187 .Ar recipe 220 .It Cm recipe create Oo Fl R Ar filename Oc Oo Ar log_flags Oc Ar recipe 221 .It Cm recipe print Ar recipe 222 .It Cm recipe Bro Cm edit | remove Brc Oo Ar log_flags Oc Ar recipe 223 .It Cm recipe set Ar recipe 188 224 .Bl -tag -width indent 189 225 .It Cm create 190 226 Create a recipe named 191 .Ar recipe 227 .Ar recipe. 228 Use -R to specify a file with the recipe's contents to bypass interactive 229 mode. 192 230 .It Cm edit 193 231 Open -
branches/confman-1.9/confman.conf.5.in
r439 r481 137 137 .It CONF_WARNING 138 138 This is the first line of confman banners for managed files. 139 .It LOG_TEMPLATE 140 If defined, the contents of this file will be the default log message visible 141 in a user's editor for repository commits. This can be useful if you use 142 hooks to log commits into an external issue tracker and you want to remind 143 your users to fill in the ticket number. 144 .It RECIPE_TEMPLATE 145 When new recipes are created, the contents of this file will be used. The 146 string 147 .Ar __NAME__ 148 will be replaced with the name of the recipe. This defaults to 149 @sysconfdefaultsdir@/recipe.template. 139 150 .It DEFAULT_MODE_DIRECTORY 140 151 Defaults to "0555". When new directories are created in -
branches/confman-1.9/confman.conf.in
r436 r481 45 45 # The template for log messages 46 46 LOG_TEMPLATE="/dev/null" 47 48 # The template for new recipes 49 RECIPE_TEMPLATE="@sysconfdefaultsdir@/recipe.template" 47 50 48 51 # The warning message for all files -
branches/confman-1.9/confman.in
r480 r481 111 111 } 112 112 113 # Either by prompting or respecting -m/-F, returns a filename on stdout 114 # with a log message in it 115 # $1 contains a file with the output of svn status to display in interactive 116 # log messages 117 # Returns 1 if an abort was requested by the user 118 # Returns 0 if the returned filename is good for a commit 119 function get_log { 120 local status="$1" 121 local finished=false 122 local ignoreline="--This line, and those below, will be ignored--" 123 local orig_log logfile 124 125 # local seems to return true, overwriting the return of the nested 126 # call for && evaluation 127 logfile=$(conf_log_message) && finished=true 128 129 if $finished ; then 130 echo "$logfile" 131 return 0 132 fi 133 134 orig_log=$(conf_tmp_file) 135 printf "\n$ignoreline\n" >> "$logfile" 136 cat "$status" >> "$logfile" 137 cp "$logfile" "$orig_log" 138 139 # I apologize for the redirect, but stdout is being written into a 140 # variable, and at least vim (probably other editors too) gets cranky when 141 # stdout doesn't go to the user. Luckily, the fork in the common section 142 # leaves a copy of the original stdout in fd 3. 143 ${EDITOR} "$logfile" >&3 144 145 while diff "$logfile" "$orig_log" >/dev/null 2>&1 ; do 146 echo "Log message unchanged. (E)dit / (a)bort / (c)ontinue?" 147 read response 148 case "$response" in 149 [cC]*) break;; 150 [aA]*) return 1;; 151 ""|[eE]*) ${EDITOR} "$logfile";; 152 esac 153 done 154 rm -f "$orig_log" 155 ${sed_cmd} -i '' -e "/${ignoreline}/,\$d" "$logfile" 2>/dev/null 156 echo "$logfile" 157 return 0 158 } 159 160 # Arguments are full paths to files within $WORK_PATH to check via svn status. 161 # Returns 1 if the files are unchanged 162 # Returns 0 if the files are changed and prints a filename to stdout 163 # with status info suitable for log message footers 164 function get_status { 165 local status=$(conf_tmp_file) 166 local ABS_WORK=$(${readlink_cmd} -m "$WORK_PATH") 167 168 # Using a subshell to preserve CWD 169 ( 170 cd "$WORK_PATH" 171 until [ -z "$1" ] ; do 172 @SVN@ status "${1#${ABS_WORK}/}" >> "$status" 173 shift 174 done 175 ) 176 177 if [ $(wc -l < "$status") -eq 0 ] ; then 178 rm -f "$status" 179 return 1 180 fi 181 182 echo "$status" 183 return 0 184 } 185 113 186 function commit { 114 if [ -z "$*" ] ; then 115 conf_require_recipe 116 conf_lock_system 117 conf_lock_wcopy 118 local msg=$(conf_tmp_file) 119 local orig_msg=$(conf_tmp_file) 120 local status=$(conf_tmp_file) 121 local modules=$(conf_get_recipe | tr '\n' ',') 122 local ignoreline="--This line, and those below, will be ignored--" 123 # Moved up per Ian's request. 124 $SUDO ${SUDO:+-v} 125 cat $LOG_TEMPLATE > $msg 126 printf "\n${ignoreline}\n" >> $msg 127 conf_get_recipe | tr ' ' '\n' | xargs -I % @SVN@ status \ 128 ${WORK_PATH}/% >> $status 129 cat $status >> $msg 130 cp $msg $orig_msg 131 if [ $(wc -l < $status) -gt 0 ] ; then 132 ${EDITOR} $msg 133 if diff $msg $orig_msg >/dev/null 2>&1 ; then 134 echo "Log message unchanged. (a)bort / (C)ontinue?" 135 read response 136 if [ "${response}" = "a" ] ; then 137 conf_unlock_wcopy 138 conf_unlock_system 139 return 1 140 fi 141 fi 142 fi 143 rm -f $status $orig_msg 144 ${sed_cmd} -i '' -e '/'"$ignoreline"'/,$d' $msg 2>/dev/null 145 $SUDO ${SUDO:+-v} 146 147 #Changed this from just update to fix locking issue - arjun 148 conf_update_tree || conf_cleanExit 149 150 echo "Commit operation started" >&2 151 conf_commit "$(conf_get_recipe)" $msg || return $? 152 for layer in $(conf_get_recipe) ; do 153 echo "Rolling on $layer..." 154 conf_rollout $layer || return $? 155 done 156 for file in $SINGULARITIES ; do 157 conf_assemble_sing $file || return $? 158 done 159 conf_recordAction commit 160 conf_markclean 161 echo "Commit operation finished successfully" >&2 162 rm -f $msg 163 conf_unlock_wcopy 164 conf_unlock_system 165 else 166 print_usage 1 167 fi 187 local msg status modules module modpath 188 local nocommit=true 189 local opt OPTIND OPTARG 190 191 while getopts ":m:F:" opt ; do 192 case $opt in 193 m) LOG_MESSAGE="$OPTARG"; LOG_MESSAGE_SET="true" ;; 194 F) LOG_FILE="$OPTARG" ;; 195 *) echo "Invalid option '-${OPTARG}'." >&4 196 print_usage 1 197 ;; 198 esac 199 done 200 shift $(($OPTIND - 1)) 201 202 [ -z "$1" ] || print_usage 1 203 204 conf_require_recipe 205 conf_lock_system 206 conf_lock_wcopy 207 208 for module in $(conf_get_recipe) ; do 209 modpath=$(${readlink_cmd} -m ${WORK_PATH}/${module}) 210 modules=${modules:+${modules} }${modpath} 211 done 212 213 $SUDO ${SUDO:+-v} 214 conf_update_tree || conf_cleanExit 215 216 if status=$(get_status $modules) ; then 217 nocommit=false 218 msg=$(get_log "$status") || conf_cleanExit 219 rm -f "$status" 220 fi 221 222 $SUDO ${SUDO:+-v} 223 224 echo "Commit operation started" >&2 225 $nocommit || conf_commit "$(conf_get_recipe)" $msg || return $? 226 for layer in $(conf_get_recipe) ; do 227 echo "Rolling on $layer..." 228 conf_rollout $layer || return $? 229 done 230 for file in $SINGULARITIES ; do 231 conf_assemble_sing $file || return $? 232 done 233 conf_recordAction commit 234 conf_markclean 235 echo "Commit operation finished successfully" >&2 236 rm -f $msg 237 conf_unlock_wcopy 238 conf_unlock_system 168 239 } 169 240 … … 171 242 function inst { 172 243 local file livefile 173 174 if [ -z "$*" ] ; then 175 print_usage 1 176 else 177 conf_require_recipe 178 conf_lock_wcopy 179 conf_lock_system 180 local msg=$(conf_tmp_file) 181 local orig_msg=$(conf_tmp_file) 182 local status=$(conf_tmp_file) 183 local modules=$(conf_get_recipe | tr '\n' ',') 184 local ignoreline="---Everything after this line will be ignored---" 185 local files 186 # Moved up per Ian's request. 187 cat $LOG_TEMPLATE > $msg 188 printf "\n${ignoreline}\n" >> $msg 189 for file in "$@"; do 190 if [ -L "$file" ]; then 191 files="$files `${readlink_cmd} -m $file`" 192 fi 193 files="$files $file" 194 done 195 @SVN@ status $files >> $status 196 cat $status >> $msg 197 cp $msg $orig_msg 198 if [ $(wc -l < $status) -gt 0 ] ; then 199 ${EDITOR} $msg 200 if diff $msg $orig_msg >/dev/null 2>&1 ; then 201 echo "Log message unchanged. (a)bort / (C)ontinue?" 202 read response 203 if [ "${response}" = "a" ] ; then 204 conf_unlock_wcopy 205 conf_unlock_system 206 return 1 207 fi 208 fi 209 fi 210 rm $status $orig_msg 211 ${sed_cmd} -i '' -e '/'"$ignoreline"'/,$d' $msg 2>/dev/null 212 $SUDO ${SUDO:+-v} 213 #changed from update to conf_update_tree to implement locking - arjun 214 conf_update_tree || conf_cleanExit 215 216 echo "Installation operation started." >&2 217 conf_commit_file "$msg" "$files" || return $? 218 for layer in $(conf_get_recipe) ; do 219 conf_install $layer "$@" 220 done 221 for file in $SINGULARITIES ; do 222 conf_assemble_sing $file || conf_cleanExit 223 done 224 conf_recordAction install 225 if ! conf_isclean ; then 226 echo "WARNING: Recent 'install' operations prevented a 'sync'" >&2 227 echo "Running a 'commit' is highly recommended." >&2 228 fi 229 echo "Installation operation succeeded." >&2 230 conf_unlock_wcopy 231 conf_unlock_system 232 fi 244 local msg status files file 245 local nocommit=true 246 local opt OPTIND OPTARG 247 248 while getopts ":m:F:" opt ; do 249 case $opt in 250 m) LOG_MESSAGE="$OPTARG"; LOG_MESSAGE_SET="true" ;; 251 F) LOG_FILE="$OPTARG" ;; 252 *) echo "Invalid option '-${OPTARG}'." >&4 253 print_usage 1 254 ;; 255 esac 256 done 257 shift $(($OPTIND - 1)) 258 259 conf_require_recipe 260 conf_lock_wcopy 261 conf_lock_system 262 263 for file in "$@"; do 264 files="${files:+${files} }$(${readlink_cmd} -m "$file")" 265 done 266 267 268 $SUDO ${SUDO:+-v} 269 conf_update_tree || conf_cleanExit 270 271 if status=$(get_status $files) ; then 272 nocommit=false 273 msg=$(get_log "$status") || conf_cleanExit 274 rm -f "$status" 275 fi 276 277 echo "Installation operation started." >&2 278 $nocommit || conf_commit_file "$msg" "$files" || return $? 279 for layer in $(conf_get_recipe) ; do 280 conf_install $layer "$@" 281 done 282 for file in $SINGULARITIES ; do 283 conf_assemble_sing $file || conf_cleanExit 284 done 285 conf_recordAction install 286 if ! conf_isclean ; then 287 echo "WARNING: Recent 'install' operations prevented a 'sync'" >&2 288 echo "Running a 'commit' is highly recommended." >&2 289 fi 290 echo "Installation operation succeeded." >&2 291 conf_unlock_wcopy 292 conf_unlock_system 233 293 } 234 294 … … 894 954 895 955 function recipe_edit { 956 local recipe 957 local new_recipe_file recipe_file 958 local repeat msg status 959 local opt OPTIND OPTARG 960 961 while getopts ":m:F:" opt ; do 962 case $opt in 963 m) LOG_MESSAGE="$OPTARG"; LOG_MESSAGE_SET="true" ;; 964 F) LOG_FILE="$OPTARG" ;; 965 *) echo "Invalid option '-${OPTARG}'." >&4 966 print_usage 1 967 ;; 968 esac 969 done 970 shift $(($OPTIND - 1)) 971 896 972 if [ -z "$1" ] ; then print_usage 1 ; fi 897 local recipe="$1" 898 local recipe_file=$(conf_tmp_file) 899 cat "$(conf_recipe_dir)/${recipe}" > "$recipe_file" 900 $EDITOR "$recipe_file" 901 for module in $(conf_get_recipe ${recipe_file}) ; do 902 if ! [ -d "${WORK_PATH}/${module}" ] ; then 903 echo "Error: recipe references non-existent module $module" >&2 973 974 conf_lock_wcopy 975 recipe="$1" 976 recipe_file=$(conf_recipe_dir)/${recipe} 977 new_recipe_file=$(conf_tmp_file) 978 979 cat "$recipe_file" > "$new_recipe_file" 980 $EDITOR "$new_recipe_file" 981 until conf_recipe_verify "$new_recipe_file" ; do 982 echo -n "(E)dit / (c)ancel? " 983 read repeat 984 case "$repeat" in 985 [Cc]*) return 1;; 986 *) $EDITOR "$new_recipe_file";; 987 esac 988 done 989 990 cat "$new_recipe_file" > "$recipe_file" 991 992 if status=$(get_status "${recipe_file#${WORK_PATH}/}") ; then 993 msg=$(get_log "$status") || return 1 994 conf_commit_recipe "$msg" "$recipe" 995 fi 996 rm -f "$new_recipe_file" 997 conf_unlock_wcopy 998 } 999 1000 function recipe_create { 1001 local recipe recipe_file opt OPTIND msg status 1002 while getopts ":m:F:R:" opt ; do 1003 case $opt in 1004 R) new_recipe_file="$OPTARG" ;; 1005 m) LOG_MESSAGE="$OPTARG"; LOG_MESSAGE_SET="true" ;; 1006 F) LOG_FILE="$OPTARG" ;; 1007 *) echo "Invalid option '-${OPTARG}' for recipe create." >&4 1008 print_usage 1 1009 ;; 1010 esac 1011 done 1012 shift $(($OPTIND - 1)) 1013 1014 eval recipe=$1 1015 1016 if [ -z "$recipe" ] ; then 1017 print_usage 1 1018 fi 1019 1020 conf_lock_wcopy 1021 recipe_file=$(conf_recipe_dir)/${recipe} 1022 conf_recipe_create "$recipe" || return 1 1023 1024 if [ -z "$new_recipe_file" ] ; then 1025 if ! recipe_edit "$recipe" ; then 1026 conf_rm_file --force "${new_recipe_file}" 1027 conf_unlock_wcopy 904 1028 return 1 905 1029 fi 906 done 907 conf_update_recipe "$recipe" "$recipe_file" 908 rm -f "$recipe_file" 909 } 910 911 function recipe_create { 912 if [ -z "$1" ] ; then print_usage 1 ; fi 913 local recipe="$1" 914 conf_recipe_create "$recipe" 915 recipe_edit "$recipe" 1030 conf_unlock_wcopy 1031 return 0 1032 fi 1033 1034 if conf_recipe_verify "$new_recipe_file" ; then 1035 cp "$new_recipe_file" "$recipe_file" 1036 if status=$(get_status "${recipe_file#${WORK_PATH}/}") ; then 1037 msg=$(get_log "$status") || return 1 1038 conf_commit_recipe "$msg" "$recipe" 1039 fi 1040 conf_unlock_wcopy 1041 return 0 1042 else 1043 conf_rm_file --force "${recipe_file}" 1044 conf_unlock_wcopy 1045 return 1 1046 fi 916 1047 } 917 1048 918 1049 function recipe_remove { 919 if [ -z "$*" ] ; then print_usage 1 ; fi 1050 local opt OPTIND OPTARG 1051 local msg status recipes recipe 1052 local nocommit=true 1053 while getopts ":m:F:" opt ; do 1054 case $opt in 1055 m) LOG_MESSAGE="$OPTARG"; LOG_MESSAGE_SET="true" ;; 1056 F) LOG_FILE="$OPTARG" ;; 1057 *) echo "Invalid option '-${OPTARG}'." >&4 1058 print_usage 1 1059 ;; 1060 esac 1061 done 1062 shift $(($OPTIND - 1)) 1063 1064 conf_lock_wcopy 1065 920 1066 conf_remove_recipes "$@" || exit 1 1067 1068 for recipe in "$@" ; do 1069 recipes="${recipes:+${recipes} }$(conf_recipe_dir)/${recipe}" 1070 done 1071 1072 if status=$(get_status $recipes) ; then 1073 nocommit=false 1074 msg=$(get_log "$status") || conf_cleanExit 1075 rm -f "$status" 1076 fi 1077 1078 $nocommit || conf_commit_recipes "$msg" "$@" 1079 1080 conf_unlock_wcopy 921 1081 } 922 1082 … … 935 1095 exit 1 936 1096 fi 1097 conf_lock_wcopy 1098 conf_lock_system 937 1099 conf_set_recipe "$recipe" 1100 conf_unlock_system 1101 conf_unlock_wcopy 938 1102 } 939 1103 … … 949 1113 950 1114 function recipe_list { 951 cd $(conf_recipe_dir) 952 ls 1115 ( 1116 cd $(conf_recipe_dir) 1117 ls 1118 ) 953 1119 } 954 1120 … … 973 1139 974 1140 # Debug mode? 975 while getopts " hdv-" opt ; do1141 while getopts ":h:dv-" opt ; do 976 1142 case $opt in 977 d) DEBUG="true" ; shift ;;978 h) shift ; print_help "$@" ; conf_cleanExit 0 ;;1143 d) DEBUG="true" ;; 1144 h) print_help "$OPTARG" ; conf_cleanExit 0 ;; 979 1145 v) print_version ; conf_cleanExit 0 ;; 980 *) print_usage 1 ;; 1146 *) echo "Invalid options '-${OPTARG}'." >&4 1147 print_usage 1 1148 ;; 981 1149 esac 982 1150 done 983 1151 1152 # Argument checking 1153 if [ -n "$LOG_FILE" ] && ! [ -r "$LOG_FILE" ] ; then 1154 echo "Log file $LOG_FILE does not exist or is not readable." >&4 1155 conf_cleanExit 1 1156 fi 1157 1158 if $LOG_MESSAGE_SET && [ -n "$LOG_FILE" ] ; then 1159 echo "Cannot specify both a message with -m and a file with -F." >&4 1160 conf_cleanExit 1 1161 fi 1162 984 1163 # Dispatch the subcommand. This must happen last and in the global context. 985 subcommand=$1 986 shift 1164 eval subcommand=\$$OPTIND 1165 shift $OPTIND 1166 987 1167 trap "conf_interrupt_trap" HUP INT QUIT TERM 988 1168 case $subcommand in -
branches/confman-1.9/confmancommon.sh.in
r459 r481 40 40 # we re-spawn confman inside a pipe. 41 41 if (true >&5) 2>/dev/null ; then 42 exec 4>&2 2>&5 >&3 -42 exec 4>&2 2>&5 >&3 43 43 else 44 44 exec 3>&1 -
branches/confman-1.9/confmandoc.sh
r459 r481 224 224 225 225 Usage: 226 $MYNAME commit226 $MYNAME commit [ -F filename | -m message ] 227 227 228 228 The commit command causes your changes to take effect. This means that … … 238 238 ORDER OF APPEARANCE. 239 239 240 If -F or -m are used, the log message will be read from the filename or 241 the commandline, respectively, instead of prompting the user. 242 240 243 EOF 241 244 ;; … … 257 260 258 261 Usage: 259 $MYNAME install workingfile [ workingfile ...]262 $MYNAME install [-F filename | -m message] workingfile [workingfile [...]] 260 263 261 264 The install subcommand allows you to roll out a single file from your working 262 265 copy. 266 267 If -F or -m are used, the log message will be read from the filename or 268 the commandline, respectively, instead of prompting the user. 263 269 264 270 EOF … … 495 501 Usage: 496 502 $MYNAME recipe [ get | list ] 497 $MYNAME recipe [ create | edit | print | remove | set ] recipe_name 503 $MYNAME recipe set recipe_name 504 $MYNAME recipe [ create | edit | remove ] [ -F file | -m msg ] recipe_name 498 505 499 506 The recipe command provides an interface to manage confman recipes. -
branches/confman-1.9/confmanlib.sh.in
r474 r481 32 32 WCOPY_DIRTY="false" 33 33 CONF_EXPORT="false" 34 LOG_MESSAGE_SET="false" 34 35 35 36 VERSION='@VERSION@' … … 698 699 699 700 function conf_rm_file { 700 @SVN@ rm $*701 @SVN@ rm "$@" 701 702 } 702 703 … … 963 964 return 1 964 965 fi 965 touch"$recipe_file"966 ${sed_cmd} -e "s:__NAME__:${recipe}:" $RECIPE_TEMPLATE > "$recipe_file" 966 967 @SVN@ add "$recipe_file" 967 968 } 968 969 969 function conf_update_recipe { 970 local recipe="$1" 971 local recipe_file="$2" 972 cat "$recipe_file" > "$(conf_recipe_dir)/${recipe}" 973 @SVN@ commit "$(conf_recipe_dir)/${recipe}" 970 function conf_recipe_verify { 971 local recipe_file="$1" 972 local module 973 for module in $(conf_get_recipe ${recipe_file}) ; do 974 if ! [ -d "${WORK_PATH}/${module}" ] ; then 975 echo "Error: recipe references non-existent module $module" >&2 976 return 1 977 fi 978 done 979 return 0 980 } 981 982 function conf_commit_recipes { 983 local recipe recipes 984 985 local logfile="$1" 986 shift 987 988 for recipe in "$@" ; do 989 recipes="${recipes:+${recipes} }$(conf_recipe_dir)/${recipe}" 990 done 991 992 @SVN@ commit -F "$logfile" $recipes 974 993 } 975 994 976 995 function conf_remove_recipes { 977 local recipe 996 local recipe recipe_file 978 997 local oldrecipes 979 998 local rc=0 … … 981 1000 for recipe in "$@"; do 982 1001 if conf_remove_recipe "$recipe"; then 983 # Keep track of the recipes that were successfully removed 984 # to avoid inadvertent commits 985 if [ -z "$oldrecipes" ]; then 986 oldrecipes="$recipe" 987 else 988 oldrecipes="$oldrecipes,$recipe" 989 fi 1002 recipe_file="$(conf_recipe_dir)/${recipe}" 1003 oldrecipes="${oldrecipes:+${oldrecipes} }${recipe_file}" 990 1004 else 991 1005 rc=1 992 1006 fi 993 1007 done 994 995 # $oldrecipes is in the form foo,bar,baz. This eval trick forces996 # curly brace expansion.997 if echo "$oldrecipes" | grep -q ','; then998 @SVN@ commit $(eval echo $(conf_recipe_dir)/{$oldrecipes})999 else1000 @SVN@ commit "$(conf_recipe_dir)/$oldrecipes"1001 fi1002 1008 1003 1009 return $rc … … 1012 1018 fi 1013 1019 @SVN@ rm "${recipe_file}" || return 1 1020 return 0 1021 } 1022 1023 # Implements logic for selecting logfile based on -m/-F or interactive mode 1024 # Returns 0 if the log is "complete", 1 if the log needs editing 1025 # Prints filename containing the log on stdout 1026 function conf_log_message { 1027 local logfile 1028 1029 if [ -n "$LOG_FILE" ] ; then 1030 echo "$LOG_FILE" 1031 return 0 1032 fi 1033 1034 logfile=$(conf_tmp_file) 1035 echo "$logfile" 1036 1037 if $LOG_MESSAGE_SET ; then 1038 echo "$LOG_MESSAGE" > "$logfile" 1039 else 1040 cat "$LOG_TEMPLATE" > "$logfile" 1041 return 1 1042 fi 1014 1043 return 0 1015 1044 }
Note: See TracChangeset
for help on using the changeset viewer.
