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/conf/repos.conf | 2 +- trunk/doc/CHANGELOG | 2 +- trunk/lib/common.sh | 52 ++++++++++++++++++++++++++++++++++++++++++++++++++- trunk/src/createpkg | 28 ++++++++++++++++++++++++--- 4 files changed, 78 insertions(+), 6 deletions(-) diff --git a/trunk/conf/repos.conf b/trunk/conf/repos.conf index 4f38663..c6f806f 100644 --- a/trunk/conf/repos.conf +++ b/trunk/conf/repos.conf @@ -11,7 +11,7 @@ ROOT-powerpc="local%file:///var/simplepkg/repos/slackintosh" ROOT-s390="local%file:///var/simplepkg/repos/slack390" # slackware root repositories -#ROOT-i386="sarava%http://slack.sarava.org/slackware/" +ROOT-i386="sarava%http://slack.sarava.org/packages/slackware/" ROOT-i386="tds%http://slackware.mirrors.tds.net/pub/slackware/" ROOT-i386="easynews%http://slackware.mirrors.easynews.com/linux/slackware/" ROOT-i386="gwdg%http://ftp.gwdg.de/pub/linux/slackware/" diff --git a/trunk/doc/CHANGELOG b/trunk/doc/CHANGELOG index 08bae3f..593a0e2 100644 --- a/trunk/doc/CHANGELOG +++ b/trunk/doc/CHANGELOG @@ -7,7 +7,7 @@ simplepkg changelog - common.sh: - other minor changes - repository metainformationg is now added at svn control if applicable - - new functions default_distro and svn_add + - new functions su_svn, regexp_slash, default_distro and svn_add - new config parameter "TMP" - renamed function use_svn to templates_under_svn - simplaret: simplaret_search_and_process_patch do not donwload a package with the same 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 + +} diff --git a/trunk/src/createpkg b/trunk/src/createpkg index 2661788..f158a21 100644 --- a/trunk/src/createpkg +++ b/trunk/src/createpkg @@ -544,7 +544,7 @@ if [ $REMOVE_OLD_PACKAGE -eq $on ]; then PACKAGE_ARCH="`package_arch $PKG_NAME`" PACKAGE_BUILD="`package_build $PKG_NAME`" - for file in `ls $PACKAGE-*-*-*.tgz`; do + for file in `find . -name "$PACKAGE-*-*-*.*"`; do if svn_check $file; then # Just delete packages with different arch, version or build number if [ "`package_version $file`" != "$PACKAGE_VERSION" ] || \ @@ -556,11 +556,22 @@ if [ $REMOVE_OLD_PACKAGE -eq $on ]; then rm $file fi done + + for file in `find $MAKEPKG_REPOS -name "$PACKAGE.slack-required"`; do + if svn_check $file; then + if [ $MOVE_SLACK_REQUIRED -eq $off ]; then + svn del --force $file + elif [ ! -z "$SLACK_REQUIRED" ] && [ "$NEW_REPOS/$PACKAGE.slack-required" != "$file" ]; then + svn del --force $file + else + rm $file + fi cd $cwd else - rm $NEW_REPOS/$PACKAGE-*-*-*.tgz 2>/dev/null + find $MAKEPKG_REPOS -name "$PACKAGE-*-*-*.*" -exec rm {} 2>/dev/null \; + find $MAKEPKG_REPOS -name "$PACKAGE.slack-required" -exec rm {} 2>/dev/null \; fi fi @@ -597,10 +608,21 @@ fi # Update repository FILELIST.TXT, ... ( + cd $MAKEPKG_REPOS gen_filelist - gen_md5_checksums . gen_patches_filelist patches + + SUBFOLDER="`echo $NEW_REPOS | sed -e "s/^$(regexp_slash $MAKEPKG_REPOS)//"`" + update_md5_checksum $MAKEPKG_REPOS $SUBFOLDER/$PKG_NAME + gen_meta $SUBFOLDER/$PKG_NAME + + # update md5 file from patches/ folder if needed + for file in `find patches/ -name "$PACKAGE-*-*-*.tgz"`; do + SUBFOLDER="`echo $NEW_REPOS | sed -e "s/^$(regexp_slash $MAKEPKG_REPOS/patches)//"`" + update_md5_checksum $MAKEPKG_REPOS/patches $SUBFOLDER/$PKG_NAME + done + ) exit $EXIT_CODE -- cgit v1.2.3