diff options
Diffstat (limited to 'trunk')
-rw-r--r-- | trunk/lib/common.sh | 58 | ||||
-rw-r--r-- | trunk/src/createpkg | 72 | ||||
-rwxr-xr-x | trunk/src/mkbuild | 81 |
3 files changed, 167 insertions, 44 deletions
diff --git a/trunk/lib/common.sh b/trunk/lib/common.sh index 22ac924..d1f16c6 100644 --- a/trunk/lib/common.sh +++ b/trunk/lib/common.sh @@ -949,6 +949,64 @@ function check_and_create_svn_repo { } +function repository_import { + + # import a folder into a subversion repository + # usage: repository_import <folder> <repository> + + local folder="$1" oldfolder + local repository="$2" repository_type repository_path + + if [ ! -d "$folder" ] || [ -z "$repository" ]; then + EXIT_CODE="1" + return $EXIT_CODE + fi + + if ! check_svn_repo $repository; then + echo "Invalid repository $repository, aborting." + EXIT_CODE="1" + return $EXIT_CODE + fi + + if ! echo $repository | grep -q ":"; then + repository="file://$repository" + fi + + mkdir -p $folder + + if [ -d "$folder/.svn" ]; then + echo "Packages folder $folder seens to be already under revision control, aborting." + EXIT_CODE="1" + return $EXIT_CODE + fi + + check_and_create_svn_repo $repository + if [ "$?" != "0" ]; then + EXIT_CODE="1" + return $EXIT_CODE + fi + + repository_path="`echo $repository | cut -d : -f 2`" + if [ -d "$repository_path" ]; then + chown_svn $repository_path && chgrp_svn $repository_path + fi + + echo "Importing files from $folder into $repository..." + su_svn import $folder $repository -m "initial import" + if [ "$?" == "0" ]; then + echo "Making $folder a working copy of $repository..." + oldfolder="$(mktemp -d $(echo $folder | sed -e 's/\/*$//g').XXXXXX)" + echo "Backing up old $folder at $oldfolder..." + mv $folder $oldfolder + chown_svn `dirname $folder` && chgrp_svn `dirname $folder` + su_svn checkout $repository $folder + else + EXIT_CODE="1" + return $EXIT_CODE + fi + +} + # ----------------------------------------------- # update jail functions # ----------------------------------------------- diff --git a/trunk/src/createpkg b/trunk/src/createpkg index a02c8c8..0a67648 100644 --- a/trunk/src/createpkg +++ b/trunk/src/createpkg @@ -272,7 +272,7 @@ function repository_checkout { if [ -d "$PACKAGES_DIR" ]; then oldfolder="$(mktemp -d $(echo $PACKAGES_DIR | sed -e 's/\/*$//g').XXXXXX)" - echo "Moving old $PACKAGES_DIR to $oldfolder..." + echo "Backing up old $folder at $oldfolder..." mv $PACKAGES_DIR $oldfolder fi @@ -327,58 +327,21 @@ function repository_status { } -function repository_import { +function binary_repository_import { # import packages into a subversion repository - # usage: repository_import [repository] + # usage: binary_repository_import [repository] - local repository="$1" repository_type repository_path packages_dir + local repository="$1" folder if [ -z "$repository" ]; then repository="file:////var/svn/packages" fi - if ! check_svn_repo $repository; then - echo "Invalid repository $repository, aborting." - EXIT_CODE="1" - return $EXIT_CODE - fi - - if ! echo $repository | grep -q ":"; then - repository="file://$repository" - fi - - repository_path="`echo $repository | cut -d : -f 2`" - # eval again so it doesn't include repository style information - packages_dir="`eval_parameter PACKAGES_DIR /var/simplepkg/repos`" - mkdir -p $packages_dir + folder="`eval_parameter PACKAGES_DIR /var/simplepkg/repos`" - if [ -d "$packages_dir/.svn" ]; then - echo "Packages folder $packages_dir seens to be already under revision control, aborting." - EXIT_CODE="1" - return $EXIT_CODE - fi - - check_and_create_svn_repo $repository - if [ "$?" != "0" ]; then - EXIT_CODE="1" - return $EXIT_CODE - fi - - chown_svn $repository_path && chgrp_svn $repository_path - - echo "Importing packages from $packages_dir into $repository..." - 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 - chown_svn `dirname $packages_dir` && chgrp_svn `dirname $packages_dir` - su_svn checkout $repository $packages_dir - else - EXIT_CODE="1" - return $EXIT_CODE - fi + repository_import $folder $repository } @@ -519,6 +482,27 @@ function update_metadata { } +function list_packages { + + # TODO + true + +} + +function delete_packages { + + # TODO + true + +} + +function sign_package { + + # TODO + true + +} + #--------------------------------------------------- # Starting createpkg #--------------------------------------------------- @@ -638,7 +622,7 @@ case $1 in ;; '--import') shift - repository_import $* + binary_repository_import $* exit $EXIT_CODE ;; '--checkout') diff --git a/trunk/src/mkbuild b/trunk/src/mkbuild index c348038..00d6ac2 100755 --- a/trunk/src/mkbuild +++ b/trunk/src/mkbuild @@ -78,6 +78,12 @@ ${red}DESCRIPTION${normal} commit .mkbuild in svn mkbuild tree ${red}-ca${normal}, ${red}--commit-all${normal} commit SlackBuild and .mkbuild files in svn tree + ${red}-im${normal}, ${red}--import-mkbuilds${normal} + import mkbuild repository in a svn tree + ${red}-is${normal}, ${red}--import-slackbuilds${normal} + import SlackBuild repository in a svn tree + ${red}-ia${normal}, ${red}-i${normal}, ${red}--import-all${normal}, ${red}--import${normal} + import mkbuild and SlackBuild repositories in a svn tree ${red}-h${normal}, ${red}--help${normal} this help mesage ${red}-n${normal}, ${red}--new${normal} ${green}<mkbuild_name>${normal} @@ -171,6 +177,24 @@ function set_parameters { MKBUILD_NAME="${2//.mkbuild}.mkbuild" break # we need to break otherwise commit log message is evalued ;; + '-is'|'--import-slackbuilds') + # Commit SlackBuild file + ACTION="import_slackbuilds" + MKBUILD_NAME="${2//.mkbuild}.mkbuild" + break # we need to break otherwise specific arguments are evalued + ;; + '-im'|'--import-mkbuilds') + # import mkbuild file + ACTION="import_mkbuilds" + MKBUILD_NAME="${2//.mkbuild}.mkbuild" + break # we need to break otherwise specific arguments are evalued + ;; + '-ia'|'-i'|'--import-all'|'--import') + # Commit SlackBuild and mkbuild file + ACTION="import_all" + MKBUILD_NAME="${2//.mkbuild}.mkbuild" + break # we need to break otherwise specific arguments are evalued + ;; '-um'|'--update-manifest') ACTION="update_manifest" MKBUILD_NAME="${2//.mkbuild}.mkbuild" @@ -692,6 +716,36 @@ function submit_cleanup { } +function import_mkbuilds { + + # import mkbuilds into a subversion repository + # usage: repository_import [repository] + + local repository="$1" + + if [ -z "$repository" ]; then + repository="file:////var/svn/mkbuilds" + fi + + repository_import $MKBUILDS_DIR $repository + +} + +function import_slackbuilds { + + # import SlackBuilds into a subversion repository + # usage: repository_import [repository] + + local repository="$1" + + if [ -z "$repository" ]; then + repository="file:////var/svn/slackbuilds" + fi + + repository_import $SLACKBUILDS_DIR $repository + +} + # ---------------------------------------------------------------- # general functions # ---------------------------------------------------------------- @@ -1398,6 +1452,20 @@ function edit_mkbuild { } +function delete_mkbuilds { + + # TODO + true + +} + +function delete_slackbuilds { + + # TODO + true + +} + # ---------------------------------------------------------------- #============================= @@ -1470,6 +1538,19 @@ if [ ! -z "$MKBUILD_NAME" ]; then commit_changes $SLACKBUILDS_DIR $MKBUILD_BASENAME: $* commit_changes $MKBUILDS_DIR $MKBUILD_BASENAME: $* ;; + 'import_slackbuilds') + shift + import_slackbuilds $* + ;; + 'import_mkbuilds') + shift + import_mkbuilds $* + ;; + 'import_all') + shift + import_mkbuilds $* + import_slackbuilds $* + ;; 'new') create_mkbuild ;; |