aboutsummaryrefslogtreecommitdiff
path: root/trunk/src/createpkg
diff options
context:
space:
mode:
Diffstat (limited to 'trunk/src/createpkg')
-rw-r--r--trunk/src/createpkg164
1 files changed, 142 insertions, 22 deletions
diff --git a/trunk/src/createpkg b/trunk/src/createpkg
index cf8e515..84fbb28 100644
--- a/trunk/src/createpkg
+++ b/trunk/src/createpkg
@@ -19,7 +19,7 @@
# /etc/simplepkg/slackbuildrc parameters:
#
# SLACKBUILDS_DIR="/folder/to/place/slackbuilds", defaults to /var/slackbuilds
-# SVN="svn://repository", defaults do svn://slack.sarava.org/slackbuilds
+# SVN="svn://repository", defaults do http://slack.sarava.org/slackbuilds
# SYNC="yes|no", whether to always update the repository
#
@@ -58,6 +58,12 @@ ${red}DESCRIPTION${normal}
list all the SlackBuilds
${red}--sync${normal}
synchronize SlackBuilds repository
+ ${red}--update${normal}
+ synchronize packages repository
+ ${red}--commit${normal} ${green}["message"]${normal}
+ commit changes to binary packages' repository
+ ${red}--status${normal}
+ check binary packages' svn repository status
${red}-h${normal}, ${red}--help${normal}
show this help
@@ -101,18 +107,28 @@ function build_all_slackbuild {
function check_config {
- # check the configuration
- TMP=${TMP:=/tmp};
+ # Check the configuration
+ TMP=${TMP:=/tmp}
+
if [ ! -z "$REPOS" ]; then
MAKEPKG_REPOS="$REPOS"
else
REPOS=$MAKEPKG_REPOS
fi
+
+ # Nested folders, if configured
+ if [ ! -z "$MAKEPKG_REPOS_STYLE" ]; then
+ MAKEPKG_REPOS_STYLE=$(echo $MAKEPKG_REPOS_STYLE | sed -e "s/none//g" -e "s/distro/`default_distro`/g" \
+ -e "s/arch/`default_arch`/g" -e "s/version/`default_version`/g")
+ MAKEPKG_REPOS="$MAKEPKG_REPOS/$MAKEPKG_REPOS_STYLE"
+ REPOS="$REPOS/$MAKEPKG_REPOS_STYLE"
+ fi
+
# Create $TMP and $REPOS if need
[ ! -e $TMP ] && mkdir -p $TMP
[ ! -e $MAKEPKG_REPOS ] && mkdir -p $MAKEPKG_REPOS
#
- SLACKBUILDS_DIR=${SLACKBUILDS_DIR:=/var/slackbuilds}
+ SLACKBUILDS_DIR=${SLACKBUILDS_DIR:=/var/simplepkg/slackbuilds}
#
SYNC=${SYNC:=$no}
SYNC=`convert_boolean $SYNC`
@@ -236,10 +252,11 @@ function list_builds {
function load_parameters {
# Load Createpkg parameters
- MAKEPKG_REPOS="`eval_parameter MAKEPKG_REPOS /var/simplaret/repos`"
- SOURCE_DIR="`eval_parameter SOURCE_DIR /var/simplaret/sources`"
- SLACKBUILDS_DIR="`eval_parameter SLACKBUILDS_DIR /var/simplaret/slackbuilds`"
- SLACKBUILDS_SVN="`eval_parameter SLACKBUILDS_SVN svn://slack.sarava.org/slackbuilds`"
+ MAKEPKG_REPOS="`eval_parameter MAKEPKG_REPOS /var/simplepkg/repos`"
+ MAKEPKG_REPOS_STYLE="`eval_parameter MAKEPKG_REPOS_STYLE none`"
+ 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`"
COLOR_MODE="`eval_parameter COLOR_MODE none`"
CREATE_ARCH="`eval_parameter CREATE_ARCH $(default_arch)`"
@@ -247,6 +264,48 @@ function load_parameters {
REMOVE_OLD_PACKAGE="`eval_boolean_parameter REMOVE_OLD_PACKAGE $off`"
MOVE_BIN_PACKAGE="`eval_boolean_parameter MOVE_BIN_PACKAGE $off`"
+ MOVE_SLACK_REQUIRED="`eval_boolean_parameter MOVE_SLACK_REQUIRED $off`"
+
+}
+
+function repository_update {
+
+ if [ -d "$MAKEPKG_REPOS/.svn" ]; then
+ cwd="`pwd`"
+ cd $MAKEPKG_REPOS && svn update
+ cd $cwd
+ fi
+
+ mk_exit 0
+
+}
+
+function repository_status {
+
+ if [ -d "$MAKEPKG_REPOS/.svn" ]; then
+ cwd="`pwd`"
+ cd $MAKEPKG_REPOS && svn status
+ cd $cwd
+ fi
+
+ mk_exit 0
+
+}
+
+function commit_changes {
+
+ if [ -d "$MAKEPKG_REPOS/.svn" ]; then
+ cwd="`pwd`"
+ cd $MAKEPKG_REPOS
+ if [ ! -z "$1" ]; then
+ svn commit -m $*
+ else
+ svn commit
+ fi
+ cd $cwd
+ fi
+
+ mk_exit 0
}
@@ -347,6 +406,19 @@ case $1 in
list_builds
exit $EXIT_CODE
;;
+ '--update')
+ repository_update
+ exit $EXIT_CODE
+ ;;
+ '--commit')
+ shift
+ commit_changes $*
+ exit $EXIT_CODE
+ ;;
+ '--status')
+ repository_status
+ exit $EXIT_CODE
+ ;;
*)
if [ "${1:0:1}" != "-" ]; then
PACKAGE="$1"
@@ -449,33 +521,81 @@ PKG_NAME="`ls -1 -c $MAKEPKG_REPOS/$PACKAGE-*-*-*.tgz | head -n 1 | xargs basena
[ $MOVE_BIN_PACKAGE -eq $on ] && NEW_REPOS=$MAKEPKG_REPOS/$( echo ${SCRIPT_BASE#$SLACKBUILDS_DIR/} ) || NEW_REPOS=$MAKEPKG_REPOS
# Create repository directory
-# TODO: subversion integration
-[ ! -e $NEW_REPOS ] && mkdir -p $NEW_REPOS 2>/dev/null
+if [ ! -e $NEW_REPOS ]; then
+ mkdir -p $NEW_REPOS || mkdir -p $NEW_REPOS
+ if [ -d "$MAKEPKG_REPOS/.svn" ] && ! svn_check $NEW_REPOS; then
+ cwd="`pwd`"
+ cd $MAKEPKG_REPOS
+ svn add $( echo ${SCRIPT_BASE#$SLACKBUILDS_DIR/} )
+ cd $cwd
+fi
# Remove old packages from repository tree
-# TODO: subversion integration
-[ $REMOVE_OLD_PACKAGE -eq $on ] && rm $NEW_REPOS/$PACKAGE-*-*-*.tgz 2>/dev/null
+if [ $REMOVE_OLD_PACKAGE -eq $on ]; then
+
+ # Using subversion
+ if [ -d "`basename $NEW_REPOS`/.svn" ]; then
+
+ cwd="`pwd`"
+ cd `basename $NEW_REPOS`
+
+ PACKAGE_VERSION="`package_version $PKG_NAME`"
+ PACKAGE_ARCH="`package_arch $PKG_NAME`"
+ PACKAGE_BUILD="`package_build $PKG_NAME`"
+
+ for file in `ls $PACKAGE-*-*-*.tgz`; do
+ if svn_check $file; then
+ # Just deleted packages with different arch, version or build number
+ if [ "`package_version $file`" != "$PACKAGE_VERSION" ] || \
+ [ "`package_arch $file`" != "$PACKAGE_ARCH" ] || \
+ [ "`package_build $file`" != "$PACKAGE_BUILD" ]; then
+ svn del --force $file
+ fi
+ fi
+ done
-# Move package and slack-required to SlackBuilds-like tree
-# TODO: subversion integration
-[ $MOVE_BIN_PACKAGE -eq $on ] && mv $MAKEPKG_REPOS/$PKG_NAME $NEW_REPOS/
-[ ! -z "$SLACK_REQUIRED" ] && cp $SLACK_REQUIRED $NEW_REPOS/$PACKAGE.slack-required
+ cd $cwd
+
+ else
+ rm $NEW_REPOS/$PACKAGE-*-*-*.tgz 2>/dev/null
+ fi
+fi
+
+# Move package to SlackBuilds-like tree
+if [ $MOVE_BIN_PACKAGE -eq $on ]; then
+ mv $MAKEPKG_REPOS/$PKG_NAME $NEW_REPOS/
+ if [ -d "`basename $NEW_REPOS`/.svn" ]; then
+ cwd="`pwd`"
+ cd `basename $NEW_REPOS`
+ svn add $PKG_NAME
+ cd $cwd
+ fi
+fi
+
+# Move package's slack-required to binary repository
+if [ $MOVE_SLACK_REQUIRED -eq $on ]; then
+ if [ ! -z "$SLACK_REQUIRED" ]; then
+ cp $SLACK_REQUIRED $NEW_REPOS/$PACKAGE.slack-required
+ if ! svn_check $NEW_REPOS/$PACKAGE.slack-required; then
+ cwd="`pwd`"
+ cd `basename $NEW_REPOS`
+ svn add $PACKAGE.slack-required
+ cd $cwd
+ fi
+ fi
+fi
# Install package
if [ "$INSTALL" -eq $on ]; then
- # as we dont have the full package file name, we'll
- # use the newer file name that matches our wildcard:
-
upgradepkg --install-new $NEW_REPOS/$PKG_NAME
fi
-# TODO: subversion integration
-# generate or update all metadata
-# svn commit
# Update repository FILELIST.TXT, ...
(
cd $MAKEPKG_REPOS
gen_filelist
+ gen_md5_checksums .
+ gen_patches_filelist patches
)
exit $EXIT_CODE