Browse files

some fixes, unstable. version bump not needed, i think

  • Loading branch information...
1 parent e4f1961 commit a0905615c1d9b867b63272dfb087efd4ca09a141 @badboy badboy committed Sep 2, 2009
Showing with 76 additions and 24 deletions.
  1. +76 −24 aur-repo
View
100 aur-repo
@@ -26,17 +26,18 @@ exp_path() {
# Functions
download() {
- if [ "$DOWNLOADER" = "wget" ]; then
- wget -q "${AURURL}/${PACKAGE}/${PACKAGE}.tar.gz" -O ".cache/${PACKAGE}.tar.gz"
- elif [ "$DOWNLOADER" = "curl" ]; then
- curl "${AURURL}/${PACKAGE}/${PACKAGE}.tar.gz" > ".cache/${PACKAGE}.tar.gz"
- else
- echo "no download program specified"
- exit 1
- fi
- if [ $? -ne 0 ]; then
- log "Can't download '${PACKAGE}.tar.gz'. Skipping this package..."
- fi
+ #if [ "$DOWNLOADER" = "wget" ]; then
+ # wget -q "${AURURL}/${PACKAGE}/${PACKAGE}.tar.gz" -O ".cache/${PACKAGE}.tar.gz"
+ #elif [ "$DOWNLOADER" = "curl" ]; then
+ # curl "${AURURL}/${PACKAGE}/${PACKAGE}.tar.gz" > ".cache/${PACKAGE}.tar.gz"
+ #else
+ # echo "no download program specified"
+ # exit 1
+ #fi
+ cp "/home/badboy/tmp/packages/${PACKAGE}.tar.gz" ".cache/${PACKAGE}.tar.gz"
+ #if [ $? -ne 0 ]; then
+ # log "Can't download '${PACKAGE}.tar.gz'. Skipping this package..."
+ #fi
}
get_pkgver() {
@@ -116,9 +117,41 @@ get_data() {
CARCH=`grep "^arch =" build/${PACKAGE}/pkg/.PKGINFO | cut -d "=" -f 2|cut -d " " -f 2`
}
+bump_version() {
+ local PKGBUILD="$REPOPATH/build/$PACKAGE/PKGBUILD"
+ if [ ! -f "$PKGBUILD" ]; then
+ echo "PKGBUILD not found"
+ exit 1
+ fi
+ local OLDREL=$(get_pkgrel $PKGBUILD)
+ local VER=$(get_pkgver $PKGBUILD)-$OLDREL
+ local INSTVER=$(pacman -Q $PACKAGE)
+ echo $OLDREL
+ echo $VER
+ echo $INSTVER
+ if [ $? -ne 0 ]; then
+ echo "$PACKAGE is not installed...no bump needed"
+ exit 1
+ fi
+ INSTVER=$(echo $INSTVER | awk '{print $2}')
+ local VERCMP=$(vercmp $INSTVER $VER)
+ if [ $VERCMP -eq 0 ]; then
+ echo "versions are equal! bumping pkgrel"
+ local NEWREL=$(echo $OLDREL | awk '{printf $1+1}')
+ log "Package '$PACKAGE': pkgrel bump ($OLDREL => $NEWREL)"
+ sed -i "s/^pkgrel=$OLDREL/pkgrel=$NEWREL/" $PKGBUILD
+ elif [ $VERCMP -lt 0 ]; then
+ log "Package '$PACKAGE': version changed ($INSTVER => $VER)"
+ else
+ echo "version lower/higher then installed. no pkgrel bump"
+ exit 1
+ fi
+}
+
show_help() {
cat << EOF
-Usage: $0 REPOPATH
+Usage: $(basename $0) [REPOPATH]
+ $(basename $0) -b <package> [REPOPATH]
Config file example:
@@ -136,11 +169,22 @@ Options:
EOF
}
+
+if [ "$1" = "-h" ]; then
+ show_help
+ exit 1
+fi
+
BUILD_ONE=0
-if [ "$1" = "-b" ] && [ -n "$2" ]; then
- PACKAGE=$2
- BUILD_ONE=1
- shift 2
+if [ "$1" = "-b" ]; then
+ if [ -n "$2" ]; then
+ PACKAGE=$2
+ BUILD_ONE=1
+ shift 2
+ else
+ show_help
+ exit 1
+ fi
fi
if [ -z "$1" ]; then
@@ -161,12 +205,26 @@ if [ $? -eq 1 ]; then
exit 1
fi
+if [ ! -d ".cache" ]; then
+ mkdir ".cache"
+fi
+
+if [ ! -d "build" ]; then
+ mkdir "build"
+fi
+
# Include the configuration
source repo.conf
if [ $BUILD_ONE -eq 1 ]; then
+ NO_DOWNLOAD=1
if [ ! -d "$REPOPATH/build/$PACKAGE" ]; then
+ NO_DOWNLOAD=0
download
+ cd ${REPOPATH}/.cache
+ tar -xf ${PACKAGE}.tar.gz
+ cp -r "${PACKAGE}" "${REPOPATH}/build/"
+ cd "${REPOPATH}"
fi
if [ ! -d "$REPOPATH/build/$PACKAGE" ]; then
@@ -175,6 +233,7 @@ if [ $BUILD_ONE -eq 1 ]; then
fi
REBUILD=1
+ #bump_version
build nodiff
get_data
repo-add $REPOPATH/$PERSREPO.db.tar.gz $PACKAGE-$pkgver-$CARCH.pkg.tar.gz
@@ -187,13 +246,6 @@ if [ ${#GET_FROM_AUR[@]} -eq 0 ]; then
exit 1
fi
-if [ ! -d ".cache" ]; then
- mkdir .cache
-fi
-
-if [ ! -d "build" ]; then
- mkdir "build"
-fi
# Download package, check option, build it and add it to repository
for ITEM in "${GET_FROM_AUR[@]}"; do
@@ -224,4 +276,4 @@ for ITEM in "${GET_FROM_AUR[@]}"; do
esac
done
-rm -rf .cache/*
+#rm -rf .cache/*

0 comments on commit a090561

Please sign in to comment.