aboutsummaryrefslogtreecommitdiff
path: root/trunk
diff options
context:
space:
mode:
authorrhatto <rhatto@04377dda-e619-0410-9926-eae83683ac58>2008-11-28 17:22:06 +0000
committerrhatto <rhatto@04377dda-e619-0410-9926-eae83683ac58>2008-11-28 17:22:06 +0000
commitf8fd450c9b9561c29bfdba24bb87a9cc55fc889e (patch)
treefeea5ca231dc9f2a571a67591b893bb5388378f7 /trunk
parent990e65cdfd4539143968b4e85d7badd2ef42c2ec (diff)
downloadsimplepkg-f8fd450c9b9561c29bfdba24bb87a9cc55fc889e.tar.gz
simplepkg-f8fd450c9b9561c29bfdba24bb87a9cc55fc889e.tar.bz2
cleanup
git-svn-id: svn+slack://slack.fluxo.info/var/svn/simplepkg@601 04377dda-e619-0410-9926-eae83683ac58
Diffstat (limited to 'trunk')
-rw-r--r--trunk/conf/simplepkg.conf4
-rw-r--r--trunk/doc/CHANGELOG2
-rw-r--r--trunk/lib/common.sh12
-rw-r--r--trunk/src/createpkg242
4 files changed, 162 insertions, 98 deletions
diff --git a/trunk/conf/simplepkg.conf b/trunk/conf/simplepkg.conf
index 6011cd8..b50372c 100644
--- a/trunk/conf/simplepkg.conf
+++ b/trunk/conf/simplepkg.conf
@@ -52,6 +52,10 @@ MAKEPKG_REPOS="/var/simplepkg/repos"
# if you know what are you doing.
MAKEPKG_REPOS_STYLE="distro/distro-version"
+# Se this to "yes" if you want createpkg to put noarch packages also in
+# a noarch/ folder.
+MAKEPKG_REPOS_NOARCH="off"
+
# 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.
diff --git a/trunk/doc/CHANGELOG b/trunk/doc/CHANGELOG
index c3a5e3f..496b764 100644
--- a/trunk/doc/CHANGELOG
+++ b/trunk/doc/CHANGELOG
@@ -38,7 +38,7 @@ simplepkg changelog
- subversion integration
- minor changes
- new config parameters MAKEPKG_REPOS_STYLE, MOVE_SLACK_REQUIRED, MKBUILDS_SVN_USER,
- MAKEPKG_SVN_USER, MAKEPKG_SVN_GROUP, MKBUILDS_SVN_GROUP
+ MAKEPKG_SVN_USER, MAKEPKG_SVN_GROUP, MKBUILDS_SVN_GROUP, MAKEPKG_REPOS_NOARCH
- cleaner -s option output
- lspkg: fix on package search routine
- jail-commit: using unified diff
diff --git a/trunk/lib/common.sh b/trunk/lib/common.sh
index 83eec65..a49257a 100644
--- a/trunk/lib/common.sh
+++ b/trunk/lib/common.sh
@@ -513,7 +513,11 @@ function svn_check {
folder="`dirname $1`"
file="`basename $1`"
- if [ -d "$folder/.svn" ]; then
+ if [ -d "$folder/$file/.svn" ]; then
+
+ return 0
+
+ elif [ -d "$folder/.svn" ]; then
(
cd $folder
@@ -838,7 +842,7 @@ function gen_packages_txt {
if [ "$1" == "." ]; then
echo "Created new PACKAGES.TXT and PACKAGES.TXT.gz"
else
- echo "Created new $1/PACKAGES.TXT and $1/PACKAGES.TXT.gz"
+ echo "Created new $1/PACKAGES.TXT and $1/PACKAGES.TXT.gz for $folder"
fi
fi
@@ -871,7 +875,7 @@ function gen_md5_checksums {
if [ "$1" == "." ]; then
echo "Created new CHECKSUMS.md5 and CHECKSUMS.md5.gz"
else
- echo "Created new $1/CHECKSUMS.md5 and $1/CHECKSUMS.md5.gz"
+ echo "Created new $1/CHECKSUMS.md5 and $1/CHECKSUMS.md5.gz for $folder"
fi
fi
@@ -905,7 +909,7 @@ function update_md5_checksum {
cat CHECKSUMS.md5 | gzip -9 -c - > CHECKSUMS.md5.gz
- echo "Updated CHECKSUMS.md5"
+ echo "Updated CHECKSUMS.md5 at $folder"
svn_add CHECKSUMS.md5
svn_add CHECKSUMS.md5.gz
diff --git a/trunk/src/createpkg b/trunk/src/createpkg
index a11a101..9ce645a 100644
--- a/trunk/src/createpkg
+++ b/trunk/src/createpkg
@@ -254,6 +254,8 @@ function load_parameters {
# Load Createpkg parameters
MAKEPKG_REPOS="`eval_parameter MAKEPKG_REPOS /var/simplepkg/repos`"
MAKEPKG_REPOS_STYLE="`eval_parameter MAKEPKG_REPOS_STYLE none`"
+ MAKEPKG_REPOS_NOARCH="`eval_parameter MAKEPKG_REPOS_NOARCH $off`"
+ NOARCH_REPOS="`eval_parameter MAKEPKG_REPOS /var/simplepkg/repos`/noarch"
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`"
@@ -313,6 +315,131 @@ function commit_changes {
}
+function create_repo_folder {
+
+ # Create repository directory
+ # usage: create_repo_folder <repository_folder>
+
+ folder="$1"
+
+ if [ ! -e $new_repos ]; then
+ if [ -d "$folder/.svn" ] && ! svn_check $folder/$SUBFOLDER; then
+ (
+ cd $folder
+ chown_svn $folder && chgrp_svn $folder
+ svn_mkdir $SUBFOLDER
+ )
+ else
+ mkdir -p $folder/$SUBFOLDER
+ fi
+ fi
+
+}
+
+function remove_old_package_data {
+
+ # Remove old packages from repository tree
+ # usage: remove_old_package_data <repository_folder>
+
+ if [ -z "$2" ]; then
+ return 1
+ fi
+
+ makepkg_repos="$1"
+
+ # Remove old PACKAGEs from repository tree
+ if [ $REMOVE_OLD_PACKAGE -eq $on ]; then
+
+ # first remove entries from CHECKSUMS.md5
+ if [ -f "$makepkg_repos/CHECKSUMS.md5" ]; then
+ sed -i "/$PACKAGE-.*-.*-.*.*$/d" $makepkg_repos/CHECKSUMS.md5
+ fi
+
+ # then remove entries from patches/CHECKSUMS.md5
+ if [ -f "$makepkg_repos/patches/CHECKSUMS.md5" ]; then
+ sed -i "/$PACKAGE-.*-.*-.*.*$/d" $makepkg_repos/patches/CHECKSUMS.md5
+ fi
+
+ # Using subversion
+ if [ -d "$makepkg_repos/.svn" ]; then
+
+ (
+
+ cd $makepkg_repos
+
+ PACKAGE_VERSION="`package_version $PKG_NAME`"
+ PACKAGE_ARCH="`package_arch $PKG_NAME`"
+ PACKAGE_BUILD="`package_build $PKG_NAME`"
+
+ # Using -mindepth 2 so it doesn't delete the new PACKAGE
+ for file in `find . -mindepth 2 -name "$PACKAGE-*-*-*.tgz" -o -name "$PACKAGE-*-*-*.meta"`; do
+ candidate="`echo $file | sed -e 's/\.meta/\.tgz/'`" # otherwise PACKAGE info functions can fail
+ # Just delete PACKAGEs with different arch, version or build number
+ if [ "`package_version $candidate`" != "$PACKAGE_VERSION" ] || \
+ [ "`package_arch $candidate`" != "$PACKAGE_ARCH" ] || \
+ [ "`package_build $candidate`" != "$PACKAGE_BUILD" ]; then
+ svn_del $file
+ fi
+ done
+
+ for file in `find $makepkg_repos -name "$PACKAGE.slack-required"`; do
+ if [ $MOVE_SLACK_REQUIRED -eq $off ]; then
+ svn_del $file
+ elif [ ! -z "$SLACK_REQUIRED" ] && [ "$repository_folder/$SUBFOLDER/$PACKAGE.slack-required" != "$file" ]; then
+ svn_del $file
+ fi
+ done
+
+ )
+
+ else
+ # Using -mindepth 2 so it doesn't delete the new PACKAGE
+ find $makepkg_repos -mindepth 2 -name "$PACKAGE-*-*-*.tgz" -o -name "$PACKAGE-*-*-*.meta" -exec rm {} 2>/dev/null \;
+ find $makepkg_repos -name "$PACKAGE.slack-required" -exec rm {} 2>/dev/null \;
+ fi
+ fi
+
+}
+
+function update_metadata {
+
+ # Update repository metadata
+ # usage: update_metadata <repository_folder>
+
+ if [ ! -d "$1" ]; then
+ return 1
+ fi
+
+ makepkg_repos="$1"
+
+ (
+
+ cd $makepkg_repos
+
+ gen_meta $SUBFOLDER/$PKG_NAME
+ gen_filelist
+ gen_patches_filelist patches
+ update_md5_checksum $makepkg_repos $SUBFOLDER/$PKG_NAME
+
+ # update md5 file from patches/ folder if needed
+ if [ -d "patches/" ]; then
+
+ found_patch="no"
+
+ for file in `find patches/ -name "$PACKAGE-*-*-*.tgz"`; do
+ found_patch="yes"
+ update_md5_checksum $makepkg_repos/patches patches/$SUBFOLDER/$PKG_NAME
+ done
+
+ if [ "$found_patch" == "yes" ]; then
+ gen_patches_filelist patches/
+ fi
+ fi
+
+ )
+
+}
+
#---------------------------------------------------
# Starting createpkg
#---------------------------------------------------
@@ -522,73 +649,19 @@ handle_error $? $PACKAGE
PKG_NAME="`ls -1 -c $MAKEPKG_REPOS/$PACKAGE-*-*-*.tgz | head -n 1 | xargs basename`"
# Select repository directory
-[ $MOVE_BIN_PACKAGE -eq $on ] && NEW_REPOS=$MAKEPKG_REPOS/$( echo ${SCRIPT_BASE#$SLACKBUILDS_DIR/} ) || NEW_REPOS=$MAKEPKG_REPOS
-
-# Create repository directory
-if [ ! -e $NEW_REPOS ]; then
- if [ -d "$MAKEPKG_REPOS/.svn" ] && ! svn_check $NEW_REPOS; then
- (
- cd $MAKEPKG_REPOS
- chown_svn $MAKEPKG_REPOS && chgrp_svn $MAKEPKG_REPOS
- svn_mkdir $( echo ${SCRIPT_BASE#$SLACKBUILDS_DIR/} )
- )
- else
- mkdir -p $NEW_REPOS
- fi
+if [ $MOVE_BIN_PACKAGE -eq $on ]; then
+ SUBFOLDER="$( echo ${SCRIPT_BASE#$SLACKBUILDS_DIR/} )"
+ NEW_REPOS=$MAKEPKG_REPOS/$SUBFOLDER
+else
+ SUBFOLDER="."
+ NEW_REPOS=$MAKEPKG_REPOS
fi
-# Remove old packages from repository tree
-if [ $REMOVE_OLD_PACKAGE -eq $on ]; then
-
- # first remove entries from CHECKSUMS.md5
- if [ -f "$MAKEPKG_REPOS/CHECKSUMS.md5" ]; then
- sed -i "/$PACKAGE-.*-.*-.*.*$/d" $MAKEPKG_REPOS/CHECKSUMS.md5
- fi
-
- # then remove entries from patches/CHECKSUMS.md5
- if [ -f "$MAKEPKG_REPOS/patches/CHECKSUMS.md5" ]; then
- sed -i "/$PACKAGE-.*-.*-.*.*$/d" $MAKEPKG_REPOS/patches/CHECKSUMS.md5
- fi
-
- # Using subversion
- if [ -d "$MAKEPKG_REPOS/.svn" ]; then
-
- (
-
- cd $MAKEPKG_REPOS
-
- PACKAGE_VERSION="`package_version $PKG_NAME`"
- PACKAGE_ARCH="`package_arch $PKG_NAME`"
- PACKAGE_BUILD="`package_build $PKG_NAME`"
-
- # Using -mindepth 2 so it doesn't delete the new package
- for file in `find . -mindepth 2 -name "$PACKAGE-*-*-*.tgz" -o -name "$PACKAGE-*-*-*.meta"`; do
- candidate="`echo $file | sed -e 's/\.meta/\.tgz/'`" # otherwise package info functions can fail
- # Just delete packages with different arch, version or build number
- if [ "`package_version $candidate`" != "$PACKAGE_VERSION" ] || \
- [ "`package_arch $candidate`" != "$PACKAGE_ARCH" ] || \
- [ "`package_build $candidate`" != "$PACKAGE_BUILD" ]; then
- svn_del $file
- fi
- done
-
- for file in `find $MAKEPKG_REPOS -name "$PACKAGE.slack-required"`; do
- if [ $MOVE_SLACK_REQUIRED -eq $off ]; then
- svn_del $file
- elif [ ! -z "$SLACK_REQUIRED" ] && [ "$NEW_REPOS/$PACKAGE.slack-required" != "$file" ]; then
- svn_del $file
- fi
- done
-
- )
-
- else
- # Using -mindepth 2 so it doesn't delete the new package
- find $MAKEPKG_REPOS -mindepth 2 -name "$PACKAGE-*-*-*.tgz" -o -name "$PACKAGE-*-*-*.meta" -exec rm {} 2>/dev/null \;
- find $MAKEPKG_REPOS -name "$PACKAGE.slack-required" -exec rm {} 2>/dev/null \;
- fi
-fi
+# Create the repository folders
+create_repo_folder $MAKEPKG_REPOS
+# Remove old packages from repository tree
+remove_old_package_data $MAKEPKG_REPOS
# Move package to SlackBuilds-like tree
if [ $MOVE_BIN_PACKAGE -eq $on ]; then
@@ -611,40 +684,23 @@ if [ $MOVE_BIN_PACKAGE -eq $on ]; then
fi
-# Update repository FILELIST.TXT, ...
-(
-
- cd $MAKEPKG_REPOS
-
- SUBFOLDER="`echo $NEW_REPOS | sed -e "s/^$(regexp_slash $MAKEPKG_REPOS/)//"`"
- gen_meta $SUBFOLDER/$PKG_NAME
-
- gen_filelist
- gen_patches_filelist patches
- update_md5_checksum $MAKEPKG_REPOS $SUBFOLDER/$PKG_NAME
-
- # update md5 file from patches/ folder if needed
- if [ -d "patches/" ]; then
-
- found_patch="no"
-
- for file in `find patches/ -name "$PACKAGE-*-*-*.tgz"`; do
- found_patch="yes"
- SUBFOLDER="`echo $NEW_REPOS | sed -e "s/^$(regexp_slash $MAKEPKG_REPOS/patches/)//"`"
- update_md5_checksum $MAKEPKG_REPOS/patches $SUBFOLDER/$PKG_NAME
- done
-
- if [ "$found_patch" == "yes" ]; then
- gen_patches_filelist patches/
- fi
- fi
-
-)
+# Update repository metadata
+update_metadata $MAKEPKG_REPOS
# General cleanup
echo Cleaning up the repository...
svn_remove_empty_folders $MAKEPKG_REPOS
+# Update noarch repository
+if [ "$MAKEPKG_REPOS_NOARCH" -eq $on ] && [ "`package_arch $PKG_NAME`" == "noarch" ]; then
+ echo Copying package to noarch repository...
+ create_repo_folder $NOARCH_REPOS
+ remove_old_package_data $NOARCH_REPOS
+ svn_copy $NEW_REPOS/$PACKAGE* $NOARCH_REPOS/$SUBFOLDER/
+ update_metadata $NOARCH_REPOS
+ svn_remove_empty_folders $NOARCH_REPOS
+fi
+
# Install package
if [ "$INSTALL" -eq $on ]; then
upgradepkg --install-new $NEW_REPOS/$PKG_NAME