From 254aadb51e2401e73be2edafea453079b2b761f2 Mon Sep 17 00:00:00 2001 From: rhatto Date: Thu, 27 Nov 2008 19:58:42 +0000 Subject: more binary repository management improvements git-svn-id: svn+slack://slack.fluxo.info/var/svn/simplepkg@545 04377dda-e619-0410-9926-eae83683ac58 --- trunk/lib/common.sh | 52 +++++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 51 insertions(+), 1 deletion(-) (limited to 'trunk/lib') diff --git a/trunk/lib/common.sh b/trunk/lib/common.sh index 857d01e..2fc49c9 100644 --- a/trunk/lib/common.sh +++ b/trunk/lib/common.sh @@ -753,7 +753,8 @@ function gen_md5_checksums { cwd="`pwd`" cd $1 - echo '' > CHECKSUMS.md5 + echo 'MD5 digest for files in this directory.' > CHECKSUMS.md5 + echo '' >> CHECKSUMS.md5 find . -type f -name '*.tgz' -exec md5sum {} \; >> CHECKSUMS.md5 cat CHECKSUMS.md5 | gzip -9 -c - > CHECKSUMS.md5.gz @@ -772,6 +773,37 @@ function gen_md5_checksums { } +function update_md5_checksum { + + # update CHECKSUMS.md5 + # usage: update_md5_checksums + + if [ -z "$2" ] || [ ! -d "$1" ] || [ ! -f "$file" ]; then + return 1 + fi + + if ! echo $2 | grep -q -e "^\.\/"; then + # add ./ in front of the file name + file="./$1" + else + file="$1" + fi + + if [ ! -f CHECKSUMS.md5 ]; then + gen_md5_checksums . + else + # remove the old entry and add a new one + sed -i "/ $(regexp_slash $file)$/d" CHECKSUMS.md5 + md5sum $file >> CHECKSUMS.md5 + fi + + cat CHECKSUMS.md5 | gzip -9 -c - > CHECKSUMS.md5.gz + + svn_add CHECKSUMS.md5 + svn_add CHECKSUMS.md5.gz + +} + function gen_meta { # generate metafiles @@ -1040,3 +1072,21 @@ function is_number { fi } + +function regexp_slash { + + # escape slashes + echo $1 | sed -e 's/\//\\\//g' + +} + +function su_svn { + + # execute svn using a different user + if [ ! -z "$SVN_USER" ]; then + su $SVN_USER -c "svn $*" + else + svn $* + fi + +} -- cgit v1.2.3