aboutsummaryrefslogtreecommitdiff
path: root/trunk/src/createpkg
diff options
context:
space:
mode:
Diffstat (limited to 'trunk/src/createpkg')
-rw-r--r--trunk/src/createpkg98
1 files changed, 51 insertions, 47 deletions
diff --git a/trunk/src/createpkg b/trunk/src/createpkg
index 18e5aaf..579f2c8 100644
--- a/trunk/src/createpkg
+++ b/trunk/src/createpkg
@@ -296,11 +296,11 @@ function repository_checkout {
svn="$PACKAGES_SVN"
fi
- if valid_svn_repo $svn; then
+ if valid_svn_repo $svn; then
svn checkout $svn $PACKAGES_DIR
chown_svn $PACKAGES_DIR && chgrp_svn $PACKAGES_DIR
if [ "$svn" != "$PACKAGES_SVN" ]; then
- echo "Using svn repository different from the one pointed at $CONF."
+ echo "Using svn repository different from the one pointed at $CONF."
fi
else
echo "Invalid repository $repository, aborting."
@@ -611,52 +611,52 @@ function create_package {
# Synchronize repository
[ $SYNC -eq $yes ] && sync_svn_repo $SLACKBUILDS_DIR $SLACKBUILDS_SVN
-
+
# Update keyring
update_keyring $SLACKBUILDS_DIR/GPG-KEY
-
+
# Get SlackBuild script
BUILD_SCRIPT="`find_slackbuild $PACKAGE`"
-
+
# Check SlackBuild script found
if [ -z "$BUILD_SCRIPT" ]; then
handle_error $ERROR_CREATEPKG_SLACKBUILD_NOTFOUND $PACKAGE
fi
-
+
# Select one SlackBuild
if [ "`echo $BUILD_SCRIPT | wc -w`" -gt 1 ]; then
AUX="$PS3"
PS3="Choice: "
LIST=`echo $BUILD_SCRIPT | sed 's/ /\n/g' | sed -r 's/.*\/(.*)\.SlackBuild$/\1/'`" EXIT"
-
+
select PACKAGE in `echo $LIST`; do
break
done
-
+
if [ "$PACKAGE" = "EXIT" ]; then
eecho $error "error: no package selected"
return 1
fi
-
+
# Select only one SlackBuild in BUILD_SCRIPT
BUILD_SCRIPT=`echo $BUILD_SCRIPT | sed 's/ /\n/g' | grep "/$PACKAGE.SlackBuild"`
PS3="$AUX"
else
PACKAGE=`basename $BUILD_SCRIPT .SlackBuild`
fi
-
+
# Get dirname and script name from slackbuild
SCRIPT_BASE="`dirname $BUILD_SCRIPT`"
SCRIPT_NAME="`basename $BUILD_SCRIPT`"
eecho $messag "$BASENAME: found script $PACKAGE.SlackBuild, now checking for dependencies"
-
+
# Sets the package's slack-required
if [ -f "$SCRIPT_BASE/$PACKAGE.slack-required" ]; then
SLACK_REQUIRED="$SCRIPT_BASE/$PACKAGE.slack-required"
elif [ -f "$SCRIPT_BASE/slack-required" ]; then
SLACK_REQUIRED="$SCRIPT_BASE/slack-required"
fi
-
+
if [ ! -z "$SLACK_REQUIRED" -a $NO_DEPS -ne $on ]; then
# This routine checks for dependencies in package's slack-required
(
@@ -671,17 +671,17 @@ function create_package {
done
)
[ $? -ne 0 ] && handle_error $error $ERROR_CREATEPKG_DEPENDENCY
-
+
eecho $messag "$BASENAME: done checking for $PACKAGE dependencies"
else
eecho $messag "$BASENAME: no unmet dependencies for $PACKAGE"
fi
-
+
eecho $messag "$BASENAME: processing $SCRIPT_NAME"
-
+
# Change to script base directory
cd $SCRIPT_BASE
-
+
# Use fakeroot if needed and available
if [ "`whoami`" != "root" ]; then
FAKEROOT="`which fakeroot`"
@@ -718,7 +718,7 @@ function create_package {
return 1
fi
fi
-
+
# Run SlackBuild script
[ $DEBUG -eq $off ] && SHELL_FLAG="+x" || SHELL_FLAG="-x"
(
@@ -733,27 +733,27 @@ function create_package {
SLACKBUILD_PATH="/" \
INTERACT=no $FAKEROOT sh $SHELL_FLAG ./$SCRIPT_NAME
)
-
+
# Check if package was built
handle_error $? $PACKAGE
-
+
# Fix source folder user
if [ ! -z "$SOURCE_DIR_USER" ]; then
chown -R $SOURCE_DIR_USER $SOURCE_DIR
fi
-
+
# Fix source folder group
if [ ! -z "$SOURCE_DIR_GROUP" ]; then
chgrp -R $SOURCE_DIR_GROUP $SOURCE_DIR
fi
-
+
# Get package name, arch, version and build number
PKG_NAME="`ls -1 -c $PACKAGES_DIR/$PACKAGE-*-*-*.tgz | head -n 1 | xargs basename`"
PACKAGE_NAME="`package_name $PKG_NAME`"
PACKAGE_VERSION="`package_version $PKG_NAME`"
PACKAGE_ARCH="`package_arch $PKG_NAME`"
PACKAGE_BUILD="`package_build $PKG_NAME`"
-
+
# Update package author
if [ ! -z "$CREATEPKG_AUTHOR" ]; then
AUTHOR="`echo $PACKAGE_BUILD | sed -e 's/^[0-9]*//'`"
@@ -768,14 +768,14 @@ function create_package {
echo "New package name is $PKG_NAME."
fi
fi
-
+
# Sign package
if [ $SIGN_PACKAGES -eq $on ]; then
-
+
echo "Signing package..."
-
+
get_sign_user
-
+
if [ ! -z "$SIGN_PACKAGES_USER" ] && [ "`whoami`" != "$SIGN_PACKAGES_USER" ]; then
tmp_sign_folder="`mktemp -d $TMP/createpkg_sign.XXXXXX`"
chown $SIGN_PACKAGES_USER $tmp_sign_folder
@@ -788,9 +788,9 @@ function create_package {
cp $tmp_sign_folder/$PKG_NAME.asc $PACKAGES_DIR/$PKG_NAME.asc
rm -rf $tmp_sign_folder
fi
-
+
fi
-
+
# Select repository directory
if [ $MOVE_BIN_PACKAGE -eq $on ]; then
SUBFOLDER="$( echo ${SCRIPT_BASE#$SLACKBUILDS_DIR/} )"
@@ -799,24 +799,24 @@ function create_package {
SUBFOLDER="."
NEW_REPOS=$PACKAGES_DIR
fi
-
+
# Update information from remote repository
repository_update $PACKAGES_DIR
-
+
# Create the repository folders
create_repo_folder $PACKAGES_DIR
-
+
# Remove old packages from repository tree
remove_old_package_data $PACKAGES_DIR
-
+
# Move package to SlackBuilds-like tree
- if [ $MOVE_BIN_PACKAGE -eq $on ]; then
-
+ if [ $MOVE_BIN_PACKAGE -eq $on ]; then
+
mv $PACKAGES_DIR/$PKG_NAME $NEW_REPOS/
if [ -e "$PACKAGES_DIR/$PKG_NAME.asc" ]; then
mv $PACKAGES_DIR/$PKG_NAME.asc $NEW_REPOS/
fi
-
+
if svn_folder $NEW_REPOS; then
(
cd $NEW_REPOS
@@ -825,23 +825,23 @@ function create_package {
svn_add $PKG_NAME.asc
)
fi
-
+
# Move package's slack-required to binary repository
if [ $MOVE_SLACK_REQUIRED -eq $on ]; then
if [ ! -z "$SLACK_REQUIRED" ]; then
svn_copy $SLACK_REQUIRED $NEW_REPOS/$PACKAGE.slack-required
fi
fi
-
+
fi
-
+
# Update repository metadata
update_metadata $PACKAGES_DIR
-
+
# General cleanup
echo Cleaning up the repository...
svn_remove_empty_folders $PACKAGES_DIR
-
+
# Update noarch repository
if [ $PACKAGES_REPOS_NOARCH -eq $on ] && [ "`package_arch $PKG_NAME`" == "noarch" ]; then
repository_update $NOARCH_DIR
@@ -855,18 +855,18 @@ function create_package {
update_metadata $NOARCH_DIR
svn_remove_empty_folders $NOARCH_DIR
fi
-
+
# Install package
if [ "$INSTALL" -eq $on ]; then
upgradepkg --install-new $NEW_REPOS/$PKG_NAME
fi
-
+
echo "Package saved at $NEW_REPOS/$PKG_NAME"
-
+
if [ $PACKAGES_REPOS_NOARCH -eq $on ] && [ "`package_arch $PKG_NAME`" == "noarch" ]; then
echo "Aditional copy saved at $NOARCH_DIR/$SUBFOLDER/$PKG_NAME"
fi
-
+
return $EXIT_CODE
}
@@ -965,9 +965,13 @@ case $1 in
list_slackbuilds
else
LIST=`find_slackbuild $2`
- for i in $LIST; do
- echo $i | sed 's/.*\/\([^\/]\+\)\.[Ss]lack[Bb]uild$/ \1/'
- done
+ if [ -z $LIST ]; then
+ EXIT_CODE=1
+ else
+ for i in $LIST; do
+ echo $i #| sed 's/.*\/\([^\/]\+\)\.[Ss]lack[Bb]uild$/ \1/'
+ done
+ fi
fi
exit $EXIT_CODE
;;