]> gitweb.fluxo.info Git - simplepkg.git/commitdiff
adding createpkg --import
authorrhatto <rhatto@04377dda-e619-0410-9926-eae83683ac58>
Fri, 16 Jan 2009 17:21:07 +0000 (17:21 +0000)
committerrhatto <rhatto@04377dda-e619-0410-9926-eae83683ac58>
Fri, 16 Jan 2009 17:21:07 +0000 (17:21 +0000)
git-svn-id: svn+slack://slack.fluxo.info/var/svn/simplepkg@747 04377dda-e619-0410-9926-eae83683ac58

trunk/src/createpkg

index a46417d2918b2f1b083306daf84122bc96769e7d..93cc5ce42c775c5fb42d64fc1ba41579a944e537 100644 (file)
@@ -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