From e459c92573a0799b173c8e6edf531441e0f6d044 Mon Sep 17 00:00:00 2001 From: rhatto Date: Fri, 16 Jan 2009 17:21:07 +0000 Subject: adding createpkg --import git-svn-id: svn+slack://slack.fluxo.info/var/svn/simplepkg@747 04377dda-e619-0410-9926-eae83683ac58 --- trunk/src/createpkg | 60 ++++++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 59 insertions(+), 1 deletion(-) 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}${normal} enable SlackBuild debug (sh -x ...) - ${red}-s${normal}, ${red}--search${normal} ${green}S + ${red}-s${normal}, ${red}--search${normal} ${green} search for a ${green}${normal} ${red}-f${normal}, ${red}--info${normal} ${green}${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 -- cgit v1.2.3