]> gitweb.fluxo.info Git - simplepkg.git/commitdiff
adding user and group support for svn management
authorrhatto <rhatto@04377dda-e619-0410-9926-eae83683ac58>
Thu, 27 Nov 2008 22:23:38 +0000 (22:23 +0000)
committerrhatto <rhatto@04377dda-e619-0410-9926-eae83683ac58>
Thu, 27 Nov 2008 22:23:38 +0000 (22:23 +0000)
git-svn-id: svn+slack://slack.fluxo.info/var/svn/simplepkg@561 04377dda-e619-0410-9926-eae83683ac58

trunk/conf/simplepkg.conf
trunk/doc/CHANGELOG
trunk/lib/common.sh
trunk/src/createpkg
trunk/src/mkbuild

index 077fc94b1b99429ff09a35578aec2945d2c2f2e7..6011cd8e0c6bada6f39d5ece10f6b95938073884 100644 (file)
@@ -1,7 +1,15 @@
+#---------------------------------------------------------------------
+# Default simplepkg configuration.
+# File: /etc/simplepkg/default/simplepkg.conf
 #
-# /etc/simplepkg/default/simplepkg.conf
-#
+# This file contains the default behaviour of simplepkg scripts.
+# Please do not edit this file. Use /etc/simplepkg/simplepkg.conf
+# instead for overriding the default configuration.
+#---------------------------------------------------------------------
 
+#---------------------------------------------------------------------
+#                        GENERAL SECTION
+#---------------------------------------------------------------------
 # Default architecture: set this option if you dont want simplepkg
 # to use the value from /etc/slackware-version
 # DEFAULT_ARCH="i386"
 # Temporary folder
 TMP="/tmp"
 
-# Where jails are placed
-JAIL_ROOT="/vservers"
+#---------------------------------------------------------------------
+#                     MKBUILD AND CREATEPKG SECTION
+#---------------------------------------------------------------------
 
-# Wheter mkjail should add new jails in the jail list;
-# to enable it, set to "1" or "yes"
-ADD_TO_JAIL_LIST="1"
+# Set SlackBuilds default directory for scripts
+SLACKBUILDS_DIR="/var/simplepkg/slackbuilds"
+
+# Set default directory for mkbuilds
+MKBUILDS_DIR="/var/simplepkg/mkbuilds"
+
+# Set SlackBuilds svn default repository
+SLACKBUILDS_SVN="http://slack.sarava.org/slackbuilds"
+
+# Set mkbuilds svn default repository
+MKBUILDS_SVN="http://slack.sarava.org/mkbuilds"
+
+# Set binaries default repository directory
+MAKEPKG_REPOS="/var/simplepkg/repos"
+
+# Set the binaries default repository nested folder, useful if you manage
+# packages from different distribution versions and architectures in the
+# same parent folder.
+#
+# You can use any string here and also de special parameters none, distro,
+# arch and version. You can also mix more than one parameter, like
+# "distro-version".
+#
+# Default value is "distro/distro-version" and you should change this just
+# if you know what are you doing.
+MAKEPKG_REPOS_STYLE="distro/distro-version"
+
+# If your binary repository is under svn and you plan to manage it with an
+# user different than root, then set this parameter with the username
+# owning the repository working copy.
+MAKEPKG_SVN_USER=""
+
+# Same as the previous option, but for svn repository group.
+MAKEPKG_SVN_GROUP=""
+
+# If your mkbuild and slackbuild repositories is under svn and you plan to
+# manage it with an user different than root, then set this parameter with the
+# username owning the repository working copy.
+MKBUILDS_SVN_USER=""
+
+# Same as the previous option, but for svn repository group.
+MKBUILDS_SVN_GROUP=""
+
+# Set sources default directory
+SOURCE_DIR="/var/simplepkg/sources"
+
+# Set color style
+# possible values are: color,gray, none
+COLOR_MODE="none"
+
+# Createpkg architecture
+CREATE_ARCH="i486"
+
+# Remove build files
+CREATE_CLEANUP="yes"
+
+# Remove old packages from repository tree by createpkg
+REMOVE_OLD_PACKAGE="off"
+
+# Move package to SlackBuilds-like tree
+MOVE_BIN_PACKAGE="on"
+
+# Move package's slack-required to binary repository
+MOVE_SLACK_REQUIRED="on"
+
+#---------------------------------------------------------------------
+#                        SIMPLARET SECTION
+#---------------------------------------------------------------------
 
 # Whether mkjail should clean the package cache before installation
 # to enable it, set to "1" or "yes"
@@ -107,6 +181,10 @@ CONSIDER_ALL_PACKAGES_AS_PATCHES="0"
 # stored in the same tree.
 STORE_ROOT_PATCHES_ON_PATCHES_DIR="0"
 
+#---------------------------------------------------------------------
+#                         TEMPLATEPKG SECTION
+#---------------------------------------------------------------------
+
 # Set to yes if your templates will be placed in a subversion repository
 # This just work if TEMPLATE_STORAGE_STYLE is set to own-folder (default)
 TEMPLATES_UNDER_SVN="no"
@@ -127,55 +205,12 @@ TEMPLATE_FOLDER="/etc/simplepkg/templates"
 TEMPLATE_STORAGE_STYLE="own-folder"
 
 #---------------------------------------------------------------------
-#                     MKBUILD AND CREATEPKG SECTION
+#                        MKJAIL SECTION
 #---------------------------------------------------------------------
-# Set SlackBuilds default directory from scripts
-SLACKBUILDS_DIR="/var/simplepkg/slackbuilds"
-
-# Set mkbuild default directory from parameters files
-MKBUILDS_DIR="/var/simplepkg/mkbuilds"
-
-# Set SlackBuilds svn default repository
-SLACKBUILDS_SVN="http://slack.sarava.org/slackbuilds"
-
-# Set mkbuilds svn default repository
-MKBUILDS_SVN="http://slack.sarava.org/mkbuilds"
-
-# Set binaries default repository directory
-MAKEPKG_REPOS="/var/simplepkg/repos"
-
-# Set the binaries default repository nested folder, useful if you manage
-# packages from different distribution versions and architectures in the
-# same parent folder.
-#
-# You can use any string here and also de special parameters none, distro,
-# arch and version. You can also mix more than one parameter, like
-# "distro-version".
-#
-# Default value is "distro/distro-version" and you should change this just
-# if you know what are you doing.
-MAKEPKG_REPOS_STYLE="distro/distro-version"
-
-# Set sources default directory
-SOURCE_DIR="/var/simplepkg/sources"
-
-# Set color style
-# possible values are: color,gray, none
-COLOR_MODE="none"
-
-# Createpkg architecture
-CREATE_ARCH="i486"
-
-# Remove build files
-CREATE_CLEANUP="yes"
-
-# Remove old packages from repository tree by createpkg
-REMOVE_OLD_PACKAGE="off"
 
-# Move package to SlackBuilds-like tree
-MOVE_BIN_PACKAGE="on"
-
-# Move package's slack-required to binary repository
-MOVE_SLACK_REQUIRED="on"
+# Where jails are placed
+JAIL_ROOT="/vservers"
 
-#---------------------------------------------------------------------
+# Wheter mkjail should add new jails in the jail list;
+# to enable it, set to "1" or "yes"
+ADD_TO_JAIL_LIST="1"
index 593a0e2070139fdb98addb4cf2b98106a71a94c4..657ae799deffc67c2a6842c04ddb968ca8291d92 100644 (file)
@@ -7,7 +7,7 @@ simplepkg changelog
     - common.sh:
       - other minor changes
       - repository metainformationg is now added at svn control if applicable
-      - new functions su_svn, regexp_slash, default_distro and svn_add
+      - new functions su_svn, chown_svn, chgrp_svn, regexp_slash, default_distro and svn_add
       - new config parameter "TMP" 
       - renamed function use_svn to templates_under_svn
     - simplaret: simplaret_search_and_process_patch do not donwload a package with the same
@@ -33,7 +33,8 @@ simplepkg changelog
       - new options --status, --update and --commit to manage subversion repository
       - subversion integration
       - minor changes
-      - new config parameters MAKEPKG_REPOS_STYLE and MOVE_SLACK_REQUIRED
+      - new config parameters MAKEPKG_REPOS_STYLE, MOVE_SLACK_REQUIRED, MKBUILDS_SVN_USER,
+        MAKEPKG_SVN_USER, MAKEPKG_SVN_GROUP, MKBUILDS_SVN_GROUP
       - cleaner -s option output
     - lspkg: fix on package search routine
     - jail-commit: using unified diff
index 79a7a0dc6bda19566dc32568cecef7b5a9a79ebc..21cf9be777d064a54945b6afcd5739abd1376e36 100644 (file)
@@ -826,8 +826,8 @@ function gen_meta {
   SIZE=$( expr `gunzip -l $1 | tail -n 1 | awk '{print $1}'` / 1024 )
   USIZE=$( expr `gunzip -l $1 | tail -n 1 | awk '{print $2}'` / 1024 )
   REQUIRED=$(tar xzfO $1 install/slack-required 2>/dev/null | grep -v -e "^#" | xargs -r -iZ echo -n "Z," | sed -e "s/,$//")
-  CONFLICTS=$(tar xzfO $1 install/slack-conflicts 2>/dev/null | xargs -r -iZ echo -n "Z," | sed -e "s/,$//")
-  SUGGESTS=$(tar xzfO $1 install/slack-suggests 2>/dev/null | xargs -r )
+  CONFLICTS=$(tar xzfO $1 install/slack-conflicts 2>/dev/null | grep -v -e "^#" | xargs -r -iZ echo -n "Z," | sed -e "s/,$//")
+  SUGGESTS=$(tar xzfO $1 install/slack-suggests 2>/dev/null | grep -v -e "^#" | xargs -r )
   METAFILE=${NAME%tgz}meta
 
   echo "PACKAGE NAME:  $NAME" > $LOCATION/$METAFILE
@@ -1092,3 +1092,21 @@ function su_svn {
   fi
 
 }
+
+function chown_svn {
+
+  # set svn folder ownership
+  if [ ! -z "$SVN_USER" ] && [ ! -z "$1" ]; then
+    chown -R $SVN_USER $1
+  fi
+
+}
+
+function chgrp_svn {
+
+  # set svn folder group
+  if [ ! -z "$SVN_GROUP" ] && [ ! -z "$1" ]; then
+    chgrp -R $SVN_GROUP $1
+  fi
+
+}
index e465e58f986216a12873c8612c5325f371b88c15..fe52d4f852ad3be4f5866c66cf5fed46ebc9cf7b 100644 (file)
@@ -257,6 +257,8 @@ function load_parameters {
   SOURCE_DIR="`eval_parameter SOURCE_DIR /var/simplepkg/sources`"
   SLACKBUILDS_DIR="`eval_parameter SLACKBUILDS_DIR /var/simplepkg/slackbuilds`"
   SLACKBUILDS_SVN="`eval_parameter SLACKBUILDS_SVN http://slack.sarava.org/slackbuilds`"
+  SVN_USER="`eval_parameter MAKEPKG_SVN_USER`"
+  SVN_GROUP="`eval_parameter MAKEPKG_SVN_GROUP`"
 
   COLOR_MODE="`eval_parameter COLOR_MODE none`"
   CREATE_ARCH="`eval_parameter CREATE_ARCH $(default_arch)`"
@@ -272,7 +274,8 @@ function repository_update {
 
   if [ -d "$MAKEPKG_REPOS/.svn" ]; then
     cwd="`pwd`"
-    cd $MAKEPKG_REPOS && svn update
+    chown_svn $MAKEPKG_REPOS && chgrp_svn $MAKEPKG_REPOS
+    cd $MAKEPKG_REPOS && su_svn update
     cd $cwd
   fi
 
@@ -284,7 +287,7 @@ function repository_status {
 
   if [ -d "$MAKEPKG_REPOS/.svn" ]; then
     cwd="`pwd`"
-    cd $MAKEPKG_REPOS && svn status
+    cd $MAKEPKG_REPOS && su_svn status
     cd $cwd
   fi
 
@@ -296,11 +299,12 @@ function commit_changes {
 
   if [ -d "$MAKEPKG_REPOS/.svn" ]; then
     cwd="`pwd`"
+    chown_svn $MAKEPKG_REPOS && chgrp_svn $MAKEPKG_REPOS
     cd $MAKEPKG_REPOS
     if [ ! -z "$1" ]; then
-      svn commit -m $*
+      su_svn commit -m $*
     else
-      svn commit
+      su_svn commit
     fi
     cd $cwd
   fi
@@ -526,7 +530,8 @@ if [ ! -e $NEW_REPOS ]; then
   if [ -d "$MAKEPKG_REPOS/.svn" ] && ! svn_check $NEW_REPOS; then
     cwd="`pwd`"
     cd $MAKEPKG_REPOS
-    svn add $( echo ${SCRIPT_BASE#$SLACKBUILDS_DIR/} )
+    chown_svn $MAKEPKG_REPOS && chgrp_svn $MAKEPKG_REPOS
+    su_svn add $( echo ${SCRIPT_BASE#$SLACKBUILDS_DIR/} )
     cd $cwd
   fi
 fi
@@ -561,7 +566,8 @@ if [ $REMOVE_OLD_PACKAGE -eq $on ]; then
         if [ "`package_version $file`" != "$PACKAGE_VERSION" ] || \
            [ "`package_arch $file`" != "$PACKAGE_ARCH" ] || \
            [ "`package_build $file`" != "$PACKAGE_BUILD" ]; then
-          svn del --force $file
+           chown_svn $MAKEPKG_REPOS && chgrp_svn $MAKEPKG_REPOS
+           su_svn del --force $file
         fi
       else
         rm $file
@@ -570,10 +576,11 @@ if [ $REMOVE_OLD_PACKAGE -eq $on ]; then
 
     for file in `find $MAKEPKG_REPOS -name "$PACKAGE.slack-required"`; do
       if svn_check $file; then
+        chown_svn $MAKEPKG_REPOS && chgrp_svn $MAKEPKG_REPOS
         if [ $MOVE_SLACK_REQUIRED -eq $off ]; then
-          svn del --force $file
+          su_svn del --force $file
         elif [ ! -z "$SLACK_REQUIRED" ] && [ "$NEW_REPOS/$PACKAGE.slack-required" != "$file" ]; then
-          svn del --force $file
+          su_svn del --force $file
         fi
       else
         rm $file
@@ -596,7 +603,8 @@ if [ $MOVE_BIN_PACKAGE -eq $on ]; then
   if [ -d "$NEW_REPOS/.svn" ]; then
     cwd="`pwd`"
     cd $NEW_REPOS
-    svn add $PKG_NAME
+    chown_svn $MAKEPKG_REPOS && chgrp_svn $MAKEPKG_REPOS
+    su_svn add $PKG_NAME
     cd $cwd
   fi
 
@@ -607,7 +615,8 @@ if [ $MOVE_BIN_PACKAGE -eq $on ]; then
       if [ -d "$NEW_REPOS/.svn" ] && ! svn_check $NEW_REPOS/$PACKAGE.slack-required; then
         cwd="`pwd`"
         cd $NEW_REPOS
-        svn add $PACKAGE.slack-required
+        chown_svn $MAKEPKG_REPOS && chgrp_svn $MAKEPKG_REPOS
+        su_svn add $PACKAGE.slack-required
         cd $cwd
       fi
     fi
index 40a0e272862f423c714049088466211821b2823b..efc3adcdb6de5b854edf3f4ddceb411cad41db27 100755 (executable)
@@ -613,7 +613,9 @@ function svn_mkdir {
   DIR=""
   for i in $DIR_LIST; do
     DIR=$DIR/$i
-    [ ! -e ${DIR:1} ] && svn mkdir ${DIR:1}
+    if [ ! -e ${DIR:1} ]; then
+      su_svn mkdir ${DIR:1}
+    fi
   done
 
 }
@@ -630,7 +632,8 @@ function svn_add {
   else
     cp $WORK/$1 $2/
     # add file to svn tree
-    svn add $2/$1
+    chown_svn $2/$1 && chgrp_svn $2/$1
+    su_svn add $2/$1
   fi
 
 }
@@ -690,6 +693,8 @@ function load_parameters {
 
   SLACKBUILDS_SVN="`eval_parameter SLACKBUILDS_DIR http://slack.sarava.org/slackbuilds`"
   MKBUILDS_SVN="`eval_parameter MKBUILDS_SVN http://slack.sarava.org/mkbuilds`"
+  SVN_USER="`eval_parameter MKBUILDS_SVN_USER`"
+  SVN_GROUP="`eval_parameter MKBUILDS_SVN_GROUP`"
 
   COLOR_MODE="`eval_parameter COLOR_MODE none`"