diff options
| -rw-r--r-- | trunk/src/createpkg | 60 | 
1 files changed, 59 insertions, 1 deletions
diff --git a/trunk/src/createpkg b/trunk/src/createpkg index a46417d..93cc5ce 100644 --- a/trunk/src/createpkg +++ b/trunk/src/createpkg @@ -43,7 +43,7 @@ ${red}DESCRIPTION${normal}                  does not solve dependences              ${red}-d${normal}, ${red}--debug${normal} ${green}<program>${normal}                  enable SlackBuild debug (sh -x ...) -            ${red}-s${normal}, ${red}--search${normal} ${green}S<program${normal}> +            ${red}-s${normal}, ${red}--search${normal} ${green}<program${normal}>                  search for a ${green}<program>${normal}              ${red}-f${normal}, ${red}--info${normal} ${green}<program>${normal}                  show description and dependences of the program @@ -57,6 +57,8 @@ ${red}DESCRIPTION${normal}                  commit changes to binary packages' repository              ${red}--status${normal}                  check binary packages' svn repository status +            ${red}--import${normal} +                import packages into a svn repository              ${red}--update-keyring${normal}                  update GPG-KEY from binary repositories              ${red}-h${normal}, ${red}--help${normal} @@ -340,6 +342,57 @@ function repository_status {  } +function repository_import { + +  # import packages into a subversion repository +  # usage: repository_import [repository] + +  local repository="$1" repository_type repository_path packages_dir + +  if [ -z "$repository" ]; then +    repository="file:////var/svn/packages" +  fi + +  if ! check_svn_repo $repository; then +    EXIT_CODE="1" +    return $EXIT_CODE +  fi + +  repository_type="`echo $repository | cut -d : -f 1`" +  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 + +  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 + +  if [ "$repository_type" == "file" ] && [ ! -d "$repository_path" ]; then +    echo "Creating subversion repository $repository..." +    svnadmin create $repository --fs-type fsfs +    if [ "$?" != "0" ]; then +      EXIT_CODE="1" +      return $EXIT_CODE +    fi +  fi + +  echo "Importing packages from $packages_dir into $repository..." +  svn --import $packages_dir $repository +  if [ "$?" == "0" ]; then +    echo "Making $packages_dir a working copy of $repository..." +    rm -rf $packages_dir +    svn checkout $repository $packages_dir +  else +    EXIT_CODE="1" +    return $EXIT_CODE +  fi + +} +  function create_repo_folder {    # Create repository directory @@ -590,6 +643,11 @@ case $1 in      fi      exit $EXIT_CODE    ;; +  '--import') +    shift +    repository_import $* +    exit $EXIT_CODE +  ;;    '--status')      repository_status      exit $EXIT_CODE  | 
