diff options
-rw-r--r-- | trunk/src/createpkg | 40 | ||||
-rwxr-xr-x | trunk/src/mkbuild | 45 |
2 files changed, 77 insertions, 8 deletions
diff --git a/trunk/src/createpkg b/trunk/src/createpkg index 52116d9..c2d3c32 100644 --- a/trunk/src/createpkg +++ b/trunk/src/createpkg @@ -59,6 +59,8 @@ ${red}DESCRIPTION${normal} check binary packages' svn repository status ${red}--import${normal} import packages into a svn repository + ${red}--checkout${normal} + checkout binary packages from a svn repository ${red}--update-keyring${normal} update GPG-KEY from binary repositories ${red}-h${normal}, ${red}--help${normal} @@ -294,19 +296,33 @@ function load_parameters { function repository_checkout { - local svn + # checkout a binary repository + # usage: repository_checkout [repository-adress] + + local svn oldfolder if [ -d "$PACKAGES_DIR" ]; then - mv $PACKAGES_DIR $PACKAGES_DIR.old + oldfolder="$(mktemp -d $(echo $PACKAGES_DIR | sed -e 's/\/*$//g').XXXXXX)" + echo "Moving old $PACKAGES_DIR to $oldfolder..." + mv $PACKAGES_DIR $oldfolder fi if [ -z "$1" ]; then svn="$1" else - svn="$SLACKBUILDS_SVN" + svn="$PACKAGES_SVN" fi - svn checkout $svn $PACKAGES_DIR + if check_svn_repo $svn; then + svn checkout $svn $PACKAGES_DIR + chown_svn $PACKAGES_DIR && chgrp_svn $PACKAGES_DIR + if [ "$svn" != "$PACKAGES_SVN" ]; then + echo "Using svn repository different from the one pointed at $CONF." + fi + else + echo "Invalid repository $repository, aborting." + EXIT_CODE="1" + fi } @@ -354,6 +370,7 @@ function repository_import { fi if ! check_svn_repo $repository; then + echo "Invalid repository $repository, aborting." EXIT_CODE="1" return $EXIT_CODE fi @@ -379,6 +396,7 @@ function repository_import { echo "Creating subversion repository $repository..." mkdir -p `dirname $repository_path` svnadmin create $repository_path --fs-type fsfs + chown_svn $repository_path && chgrp_svn $repository_path if [ "$?" != "0" ]; then EXIT_CODE="1" return $EXIT_CODE @@ -386,11 +404,12 @@ function repository_import { fi echo "Importing packages from $packages_dir into $repository..." - svn import $packages_dir $repository -m "importing binary packages" + su_svn import $packages_dir $repository -m "importing binary packages" if [ "$?" == "0" ]; then echo "Making $packages_dir a working copy of $repository..." rm -rf $packages_dir - svn checkout $repository $packages_dir + chown_svn `dirname $packages_dir` && chgrp_svn `dirname $packages_dir` + su_svn checkout $repository $packages_dir else EXIT_CODE="1" return $EXIT_CODE @@ -648,13 +667,18 @@ case $1 in fi exit $EXIT_CODE ;; + '--status') + repository_status + exit $EXIT_CODE + ;; '--import') shift repository_import $* exit $EXIT_CODE ;; - '--status') - repository_status + '--checkout') + shift + repository_checkout $* exit $EXIT_CODE ;; '--update-keyring') diff --git a/trunk/src/mkbuild b/trunk/src/mkbuild index 3a3a9be..63ab779 100755 --- a/trunk/src/mkbuild +++ b/trunk/src/mkbuild @@ -1356,6 +1356,11 @@ function search_mkbuild { # find a given mkbuild # usage: search_mkbuild [-i] + if [ "$MKBUILD_NAME" == ".mkbuild" ]; then + list_mkbuilds + return + fi + if [ "$1" == "-i" ]; then # case insensitive mode find $MKBUILDS_DIR -iname $MKBUILD_NAME @@ -1365,6 +1370,46 @@ function search_mkbuild { } +function list_mkbuilds { + + # List all available mkbuilds + cd $MKBUILDS_DIR + echo "Sarava mkbuilds list" + # level 1 + for i in *; do + if [ -d $i ]; then + echo -e " $i: " + ( + cd $i + # level 2 + for j in *; do + if [ -d $j ]; then + eecho $commun " $j" + ( + cd $j + BUILD="`ls *.mkbuild 2>/dev/null`" + if [ "$BUILD" != "" ]; then + # level 3 + for k in $BUILD; do + eecho $messag " $k" + done + else + BUILD="" + fi + for k in *; do + if [ -d $k ]; then + eecho $messag " $k.mkbuild" + fi + done + ) + fi + done + ) + fi + done + +} + function edit_mkbuild { # edit a mkbuild |