oops. removed debugging output from xml.cpp
4 set -e # abort on errors
5 shopt -s nullglob # file globs that don't match expand
9 # Check if $EDITOR is set, otherwise set to "vi".
14 # Check for -f option ()
16 if [ "$1" = -f ]; then
22 # Detect the name of the file to edit
33 FILE=$(package_name $1).changelog
38 if [ -z "$FILE" ]; then
39 for f in *.changelog; do
40 if [ -n "$FILE" ]; then
48 if [ -z "$FILE" ]; then
50 if [ -n "$FILE" ]; then
56 if [ -n "$FILE" ]; then
57 FILE=$(package_name $FILE).changelog
61 if [ -z "$FILE" ]; then
62 echo "usage: ${0##*/} [filename[.changelog]|path [file_with_comment]]"
63 echo "If no <filename> is given, exactly one *.changelog or"
64 echo "*.spec file has to be in the cwd or in <path>."
75 # Create the lockfile and temporary file.
77 lockfile=.${FILE##*/}.lock
78 if [ "${FILE/\//}" != "$FILE" ]; then
79 lockfile=${FILE%/*}/.$lockfile
82 if [ ! -w "$(dirname "$FILE")" ]; then
83 echo "Write access to directory $(dirname "$FILE") required" >&2
87 if [ -e "$FILE" -a ! -w "$FILE" ]; then
88 echo "Write access to file $FILE required" >&2
93 while ! echo $$@$(hostname -f) 2> /dev/null > $lockfile; do
94 if [ -z "$retry_lock" ]; then
95 echo "$lockfile: Lock by process $(cat $lockfile)" >&2
96 echo "Please remove stale lockfiles manually" >&2
99 echo "$lockfile: Waiting for process $(cat $lockfile) to release lock" >&2
104 tmpfile=$(mktemp /tmp/${0##*/}.XXXXXX)
105 trap "rm -f $lockfile $tmpfile" EXIT
108 # Prepare the working copy and start the editor
111 { timestamp=$(LC_ALL=POSIX TZ=Europe/Berlin date)
112 echo "-------------------------------------------------------------------"
113 echo "$timestamp - $user"
115 if [ -z "$COMMENT_FILE" ]; then
121 if [ -f "$FILE" ]; then
127 if [ -z "$COMMENT_FILE" ]; then
129 CHKSUM_BEFORE=$(md5sum $tmpfile | awk '{print $1}')
131 lines=$(wc -l $COMMENT_FILE | awk '{print $1}')
132 CHKSUM_BEFORE=has_changed
135 $EDITOR +$((3+lines)) $tmpfile
137 if [ "$CHKSUM_BEFORE" = "$(md5sum $tmpfile | awk '{print $1}')" ]; then