aboutsummaryrefslogtreecommitdiff
path: root/trunk
diff options
context:
space:
mode:
authorrhatto <rhatto@04377dda-e619-0410-9926-eae83683ac58>2008-11-28 14:27:36 +0000
committerrhatto <rhatto@04377dda-e619-0410-9926-eae83683ac58>2008-11-28 14:27:36 +0000
commita15bd6db33d0432040a1075569d70c59c9402530 (patch)
tree2ba349d7a2774941b2cdeaf696197f02107405a8 /trunk
parente5d18166fca61be2a4262fcb0e0c8faaa0ede2e5 (diff)
downloadsimplepkg-a15bd6db33d0432040a1075569d70c59c9402530.tar.gz
simplepkg-a15bd6db33d0432040a1075569d70c59c9402530.tar.bz2
cleanup
git-svn-id: svn+slack://slack.fluxo.info/var/svn/simplepkg@599 04377dda-e619-0410-9926-eae83683ac58
Diffstat (limited to 'trunk')
-rw-r--r--trunk/lib/common.sh139
-rw-r--r--trunk/src/createpkg67
2 files changed, 105 insertions, 101 deletions
diff --git a/trunk/lib/common.sh b/trunk/lib/common.sh
index e34ce8e..8f78468 100644
--- a/trunk/lib/common.sh
+++ b/trunk/lib/common.sh
@@ -510,31 +510,25 @@ function svn_check {
# check if a file is under svn
# usage: svn_check <file>
- local cwd folder retval
-
- cwd="`pwd`"
folder="`dirname $1`"
file="`basename $1`"
if [ -d "$folder/.svn" ]; then
- cd $folder
+ (
+ cd $folder
- if [ "`svn status $file | awk '{ print $1 }'`" == "?" ]; then
- retval="1"
- else
- retval="0"
- fi
+ if [ "`svn status $file | awk '{ print $1 }'`" == "?" ]; then
+ return 1
+ else
+ return 0
+ fi
+ )
else
-
- retval="1"
-
+ return 1
fi
- cd $cwd
- return $retval
-
}
function build_repo {
@@ -613,10 +607,7 @@ function svn_copy {
cp $orig/$file $dest
if [ -d "`dirname $dest`/.svn" ]; then
chown_svn $dest && chgrp_svn $dest
- cwd="`pwd`"
- cd `dirname $dest`
- svn_add `basename $dest`
- cd $cwd
+ ( cd `dirname $dest` && svn_add `basename $dest` )
fi
}
@@ -799,15 +790,18 @@ function gen_patches_filelist {
if [ ! -z "$1" ] && [ -d "$1" ]; then
- cwd="`pwd`"
- cd $1
+ folder="$1"
+
+ (
- find . -type f -name '*.tgz' -follow -print | sort | tr '\n' '\0' | \
- xargs -0r ls -ldL --time-style=long-iso > FILE_LIST
+ cd $folder
- svn_add FILE_LIST
+ find . -type f -name '*.tgz' -follow -print | sort | tr '\n' '\0' | \
+ xargs -0r ls -ldL --time-style=long-iso > FILE_LIST
- cd $cwd
+ svn_add FILE_LIST
+
+ )
if [ "$1" == "." ]; then
echo "Created new FILE_LIST"
@@ -826,17 +820,20 @@ function gen_packages_txt {
if [ ! -z "$1" ] && [ -d "$1" ]; then
- cwd="`pwd`"
- cd $1
+ folder="$1"
+
+ (
+
+ cd $folder
- echo '' > PACKAGES.TXT
- find . -type f -name '*.meta' -exec cat {} \; >> PACKAGES.TXT
- cat PACKAGES.TXT | gzip -9 -c - > PACKAGES.TXT.gz
+ echo '' > PACKAGES.TXT
+ find . -type f -name '*.meta' -exec cat {} \; >> PACKAGES.TXT
+ cat PACKAGES.TXT | gzip -9 -c - > PACKAGES.TXT.gz
- svn_add PACKAGES.TXT
- svn_add PACKAGES.TXT.gz
+ svn_add PACKAGES.TXT
+ svn_add PACKAGES.TXT.gz
- cd $cwd
+ )
if [ "$1" == "." ]; then
echo "Created new PACKAGES.TXT and PACKAGES.TXT.gz"
@@ -855,18 +852,21 @@ function gen_md5_checksums {
if [ -d "$1" ]; then
- cwd="`pwd`"
- cd $1
+ folder="$1"
- 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
+ (
- svn_add CHECKSUMS.md5
- svn_add CHECKSUMS.md5.gz
+ cd $folder
- cd $cwd
+ 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
+
+ svn_add CHECKSUMS.md5
+ svn_add CHECKSUMS.md5.gz
+
+ )
if [ "$1" == "." ]; then
echo "Created new CHECKSUMS.md5 and CHECKSUMS.md5.gz"
@@ -890,26 +890,27 @@ function update_md5_checksum {
folder="$1"
fi
- cwd="`pwd`"
- cd $folder
+ (
- 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
- file="`echo $file | sed -e 's/\.*\/*//'`" # remove additional ./
- md5sum ./$file >> CHECKSUMS.md5
- fi
+ cd $folder
+
+ 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
+ file="`echo $file | sed -e 's/\.*\/*//'`" # remove additional ./
+ md5sum ./$file >> CHECKSUMS.md5
+ fi
- cat CHECKSUMS.md5 | gzip -9 -c - > CHECKSUMS.md5.gz
+ cat CHECKSUMS.md5 | gzip -9 -c - > CHECKSUMS.md5.gz
- echo "Updated CHECKSUMS.md5"
+ echo "Updated CHECKSUMS.md5"
- svn_add CHECKSUMS.md5
- svn_add CHECKSUMS.md5.gz
+ svn_add CHECKSUMS.md5
+ svn_add CHECKSUMS.md5.gz
- cd $cwd
+ )
}
@@ -920,19 +921,21 @@ function gen_meta {
if [ ! -f $1 ]; then
return 1
+ else
+ file="$1"
fi
- if [ "`echo $1|grep -E '(.*{1,})\-(.*[\.\-].*[\.\-].*).tgz[ ]{0,}$'`" == "" ]; then
+ if [ "`echo $file | grep -E '(.*{1,})\-(.*[\.\-].*[\.\-].*).tgz[ ]{0,}$'`" == "" ]; then
return
fi
- NAME=$(echo $1 | sed -re "s/(.*\/)(.*.tgz)$/\2/")
- LOCATION=$(echo $1 | sed -re "s/(.*)\/(.*.tgz)$/\1/")
- SIZE=$( expr `gunzip -l $1 | tail -n 1 | awk '{print $1}'` / 1024 )
- USIZE=$( expr `gunzip -l $1 | tail -n 1 | awk '{print $2}'` / 1024 )
- REQUIRED=$(tar xzfO $1 install/slack-required 2>/dev/null | grep -v -e "^#" | xargs -r -iZ echo -n "Z," | sed -e "s/,$//")
- CONFLICTS=$(tar xzfO $1 install/slack-conflicts 2>/dev/null | grep -v -e "^#" | xargs -r -iZ echo -n "Z," | sed -e "s/,$//")
- SUGGESTS=$(tar xzfO $1 install/slack-suggests 2>/dev/null | grep -v -e "^#" | xargs -r )
+ NAME=$(echo $file | sed -re "s/(.*\/)(.*.tgz)$/\2/")
+ LOCATION=$(echo $file | sed -re "s/(.*)\/(.*.tgz)$/\1/")
+ SIZE=$( expr `gunzip -l $file | tail -n 1 | awk '{ print $1 }'` / 1024 )
+ USIZE=$( expr `gunzip -l $file | tail -n 1 | awk '{ print $2 }'` / 1024 )
+ REQUIRED=$(tar xzfO $file install/slack-required 2>/dev/null | grep -v -e "^#" | xargs -r -iZ echo -n "Z," | sed -e "s/,$//")
+ CONFLICTS=$(tar xzfO $file install/slack-conflicts 2>/dev/null | grep -v -e "^#" | xargs -r -iZ echo -n "Z," | sed -e "s/,$//")
+ SUGGESTS=$(tar xzfO $file install/slack-suggests 2>/dev/null | grep -v -e "^#" | xargs -r )
METAFILE=${NAME%tgz}meta
echo "PACKAGE NAME: $NAME" > $LOCATION/$METAFILE
@@ -949,12 +952,12 @@ function gen_meta {
echo "PACKAGE SUGGESTS: $SUGGESTS" >> $LOCATION/$METAFILE
echo "PACKAGE DESCRIPTION:" >> $LOCATION/$METAFILE
- tar xzfO $1 install/slack-desc | grep -E '\w+\:' | grep -v '^#' >> $LOCATION/$METAFILE
+ tar xzfO $file install/slack-desc | grep -E '\w+\:' | grep -v '^#' >> $LOCATION/$METAFILE
echo "" >> $LOCATION/$METAFILE
- echo "Created metafile for `basename $1`"
+ echo "Created metafile for `basename $file`"
- ( cd `dirname $1` && svn_add `basename $1 .tgz`.meta )
+ ( cd `dirname $file` && svn_add `basename $file .tgz`.meta )
}
diff --git a/trunk/src/createpkg b/trunk/src/createpkg
index 5c82f7f..a11a101 100644
--- a/trunk/src/createpkg
+++ b/trunk/src/createpkg
@@ -527,11 +527,11 @@ PKG_NAME="`ls -1 -c $MAKEPKG_REPOS/$PACKAGE-*-*-*.tgz | head -n 1 | xargs basena
# Create repository directory
if [ ! -e $NEW_REPOS ]; then
if [ -d "$MAKEPKG_REPOS/.svn" ] && ! svn_check $NEW_REPOS; then
- cwd="`pwd`"
- cd $MAKEPKG_REPOS
- chown_svn $MAKEPKG_REPOS && chgrp_svn $MAKEPKG_REPOS
- svn_mkdir $( echo ${SCRIPT_BASE#$SLACKBUILDS_DIR/} )
- cd $cwd
+ (
+ cd $MAKEPKG_REPOS
+ chown_svn $MAKEPKG_REPOS && chgrp_svn $MAKEPKG_REPOS
+ svn_mkdir $( echo ${SCRIPT_BASE#$SLACKBUILDS_DIR/} )
+ )
else
mkdir -p $NEW_REPOS
fi
@@ -553,33 +553,34 @@ if [ $REMOVE_OLD_PACKAGE -eq $on ]; then
# Using subversion
if [ -d "$MAKEPKG_REPOS/.svn" ]; then
- cwd="`pwd`"
- cd $MAKEPKG_REPOS
+ (
- PACKAGE_VERSION="`package_version $PKG_NAME`"
- PACKAGE_ARCH="`package_arch $PKG_NAME`"
- PACKAGE_BUILD="`package_build $PKG_NAME`"
+ cd $MAKEPKG_REPOS
- # Using -mindepth 2 so it doesn't delete the new package
- for file in `find . -mindepth 2 -name "$PACKAGE-*-*-*.tgz" -o -name "$PACKAGE-*-*-*.meta"`; do
- candidate="`echo $file | sed -e 's/\.meta/\.tgz/'`" # otherwise package info functions can fail
- # Just delete packages with different arch, version or build number
- if [ "`package_version $candidate`" != "$PACKAGE_VERSION" ] || \
- [ "`package_arch $candidate`" != "$PACKAGE_ARCH" ] || \
- [ "`package_build $candidate`" != "$PACKAGE_BUILD" ]; then
- svn_del $file
- fi
- done
+ PACKAGE_VERSION="`package_version $PKG_NAME`"
+ PACKAGE_ARCH="`package_arch $PKG_NAME`"
+ PACKAGE_BUILD="`package_build $PKG_NAME`"
- for file in `find $MAKEPKG_REPOS -name "$PACKAGE.slack-required"`; do
- if [ $MOVE_SLACK_REQUIRED -eq $off ]; then
- svn_del $file
- elif [ ! -z "$SLACK_REQUIRED" ] && [ "$NEW_REPOS/$PACKAGE.slack-required" != "$file" ]; then
- svn_del $file
- fi
- done
+ # Using -mindepth 2 so it doesn't delete the new package
+ for file in `find . -mindepth 2 -name "$PACKAGE-*-*-*.tgz" -o -name "$PACKAGE-*-*-*.meta"`; do
+ candidate="`echo $file | sed -e 's/\.meta/\.tgz/'`" # otherwise package info functions can fail
+ # Just delete packages with different arch, version or build number
+ if [ "`package_version $candidate`" != "$PACKAGE_VERSION" ] || \
+ [ "`package_arch $candidate`" != "$PACKAGE_ARCH" ] || \
+ [ "`package_build $candidate`" != "$PACKAGE_BUILD" ]; then
+ svn_del $file
+ fi
+ done
- cd $cwd
+ for file in `find $MAKEPKG_REPOS -name "$PACKAGE.slack-required"`; do
+ if [ $MOVE_SLACK_REQUIRED -eq $off ]; then
+ svn_del $file
+ elif [ ! -z "$SLACK_REQUIRED" ] && [ "$NEW_REPOS/$PACKAGE.slack-required" != "$file" ]; then
+ svn_del $file
+ fi
+ done
+
+ )
else
# Using -mindepth 2 so it doesn't delete the new package
@@ -594,11 +595,11 @@ if [ $MOVE_BIN_PACKAGE -eq $on ]; then
mv $MAKEPKG_REPOS/$PKG_NAME $NEW_REPOS/
if [ -d "$NEW_REPOS/.svn" ]; then
- cwd="`pwd`"
- cd $NEW_REPOS
- chown_svn $MAKEPKG_REPOS && chgrp_svn $MAKEPKG_REPOS
- svn_add $PKG_NAME
- cd $cwd
+ (
+ cd $NEW_REPOS
+ chown_svn $MAKEPKG_REPOS && chgrp_svn $MAKEPKG_REPOS
+ svn_add $PKG_NAME
+ )
fi
# Move package's slack-required to binary repository