From 43a158579d6c32f069fbc287a55227552276f808 Mon Sep 17 00:00:00 2001 From: James Meyer Date: Sun, 19 Sep 2010 02:09:36 +0000 Subject: update build_all and mp account for .xz and multiple pkg pkgbuild Signed-off-by: James Meyer --- build_tools/bin/mp | 127 ++++++++++++++++++++++++++------------ build_tools/bin/update_db_repo.sh | 2 +- 2 files changed, 90 insertions(+), 39 deletions(-) diff --git a/build_tools/bin/mp b/build_tools/bin/mp index 523b7a3..9ff97f9 100755 --- a/build_tools/bin/mp +++ b/build_tools/bin/mp @@ -16,28 +16,61 @@ then else PFIX="-testing" fi + ALL_OFF="$(tput sgr0)" + BOLD="$(tput bold)" + BLUE="${BOLD}$(tput setaf 4)" + GREEN="${BOLD}$(tput setaf 2)" + RED="${BOLD}$(tput setaf 1)" + YELLOW="${BOLD}$(tput setaf 3)" + +plain() { + local mesg=$1; shift + printf "${BOLD} ${mesg}${ALL_OFF}\n" "$@" >&2 +} + +msg() { + local mesg=$1; shift + printf "${GREEN}==>${ALL_OFF}${BOLD} ${mesg}${ALL_OFF}\n" "$@" >&2 +} + +msg() { + local mesg=$1; shift + printf "${BLUE} ->${ALL_OFF}${BOLD} ${mesg}${ALL_OFF}\n" "$@" >&2 +} + +warning() { + local mesg=$1; shift + printf "${YELLOW}==> $(gettext "WARNING:")${ALL_OFF}${BOLD} ${mesg}${ALL_OFF}\n" "$@" >&2 +} + +error() { + local mesg=$1; shift + printf "${RED}==> $(gettext "ERROR:")${ALL_OFF}${BOLD} ${mesg}${ALL_OFF}\n" "$@" >&2 +} + function bump { - echo x$cmdline | grep -q \\-b + msg x$cmdline | grep -q \\-b if [ $? = 0 ] then - cmdline=`echo $cmdline|sed -e "s/-b//g"` + cmdline=`msg $cmdline|sed -e "s/-b//g"` i="PKGBUILD" #getting pkgrel number after = package_pkgrel=`cat $i | grep pkgrel= | cut -d'=' -f 2` #extract number before dot in pkgrel - beforedot=`echo $package_pkgrel | cut -n -d'.' -f 1` + beforedot=`msg $package_pkgrel | cut -n -d'.' -f 1` #add 1 to pkgrel new_pkgrel=$[$beforedot+1] #write it back to PKGBUILD sed -i "s:pkgrel=${package_pkgrel}:pkgrel=${new_pkgrel}:g" $i - echo "bumped $pkgname release from $package_pkgrel to $new_pkgrel" + msg "bumped $pkgname release from $package_pkgrel to $new_pkgrel" . PKGBUILD fi - TOTALPKG="$pkgname"-"$pkgver"-"$pkgrel"-"$CARCH".pkg.tar.gz + #defined below +# TOTALPKG="$pkgname"-"$pkgver"-"$pkgrel"-"$CARCH".pkg.tar.gz SRCPKG="$pkgname"-"$pkgver"-"$pkgrel".src.tar.gz } @@ -47,20 +80,20 @@ function bump { function find_repo { dirname=`dirname $mydir` - echo $dirname|grep -q "extra" + msg $dirname|grep -q "extra" if [ $? = 0 ] then REPO=extra${PFIX} else REPO=core${PFIX} fi - echo $dirname|grep -q "chroot-devel" + msg $dirname|grep -q "chroot-devel" if [ $? = 0 ] then REPO=chroot-devel fi - echo $dirname|grep -q "mv-core" + msg $dirname|grep -q "mv-core" if [ $? = 0 ] then REPO=mv-core @@ -81,35 +114,50 @@ function find_repo { function update-repo { cd $DOCROOT - echo - echo "DOCROOT=$DOCROOT" - echo - #remove old package from local copy - DELPKG="$pkgname"-"$pkgver"-*-"$CARCH".pkg.tar.gz - #echo $DOCROOT - #echo $DELPKG - echo "Removing old packages from $CARCH/$REPO:" - rm -fvI $DELPKG - #copy in new package - echo - echo "Updating $CARCH/$REPO with $TOTALPKG" - cp -f $PKGDEST/$TOTALPKG . - repo-add $DOCROOT/$REPO.db.tar.gz $DOCROOT/$TOTALPKG + msg + msg "DOCROOT=$DOCROOT" + msg + for i in ${pkgname[@]} + do + msg $i + TOTALPKG="$i"-"$pkgver"-"$pkgrel"-"$CARCH".pkg.tar.gz + if [ ! -e $PKGDEST/$TOTALPKG ] + then + TOTALPKG="$i"-"$pkgver"-"$pkgrel"-"$CARCH".pkg.tar.xz + fi + if [ ! -e $PKGDEST/$TOTALPKG ] + then + msg $PKGDEST/$TOTALPKG + msg "Couldn't find the new package" + exit 0 + fi + + #remove old package from local copy + DELPKG="$i"-"$pkgver"-*-"$CARCH".pkg.tar.*z + rm -fvI $DELPKG + #copy in new package + msg "############################################" + msg "Updating $CARCH/$REPO with $TOTALPKG" + cp -f $PKGDEST/$TOTALPKG . + repo-add $DOCROOT/$REPO.db.tar.gz $DOCROOT/$TOTALPKG + msg "############################################" + done cd - } function update-src-pkg { - DELPKG="$pkgname"-"$pkgver"-*.src.tar.gz - echo "Removing old src pkg" + msg "---------------------------------SRC-------------------------" + DELPKG="$pkgname"-"$pkgver"-*.src.tar.*z + msg "Removing old src pkg" if [ ! -d $PKGHOME/$REPO/$SRCPKG ] then - echo "Creating src_pkg directory" + msg "Creating src_pkg directory" mkdir -p $SRCPKGHOME/$REPO fi rm -vf $SRCPKGHOME/$REPO/$DELPKG - echo "copying src_pkg to $SRCPKGHOME/$REPO" + msg "copying src_pkg to $SRCPKGHOME/$REPO" cp -f $PKGHOME/$SRCPKG $SRCPKGHOME/$REPO } @@ -127,19 +175,19 @@ function dup_check { out=`pacman -Sl $i$PFIX|cut -d" " -f2 |grep ^pkgname$` if [ $? = 0 ] then - echo "#######################################" - echo "$pkgname already exists in $i$PFIX" - echo " "$out - echo + msg "#######################################" + msg "$pkgname already exists in $i$PFIX" + msg " "$out + msg - echo x$cmdline|grep -q \\-f + msg x$cmdline|grep -q \\-f if [ $? = 0 ] then - echo "Force detected, making pkg anyhow" - echo "#######################################" + msg "Force detected, making pkg anyhow" + msg "#######################################" return else - echo "#######################################" + msg "#######################################" exit 2 fi fi @@ -149,16 +197,19 @@ function dup_check { } #MAIN PROGRAM - find_repo dup_check bump -echo "---------------" makepkg --asroot $cmdline || exit 1 -echo "---------updating database ----------" +msg "=============FINSHED CREATING PKG==================" +if [ $arch = "any" ] +then + CARCH="any" +fi +msg "---------updating database ----------" update-repo #&& pacman -Sy -echo "----------creating source package---------" +msg "----------creating source package---------" makepkg -f --holdver --asroot --source --skipinteg && update-src-pkg diff --git a/build_tools/bin/update_db_repo.sh b/build_tools/bin/update_db_repo.sh index b95ab7c..3cc221e 100755 --- a/build_tools/bin/update_db_repo.sh +++ b/build_tools/bin/update_db_repo.sh @@ -19,5 +19,5 @@ echo " --------------------------" pwd #forcefully remove the old db to start clean rm -f $REPO.db.tar.gz - repo-add -q $REPO.db.tar.gz *.pkg.tar.gz + repo-add -q $REPO.db.tar.gz *.pkg.tar.* cd - -- cgit v0.12