aboutsummaryrefslogtreecommitdiff
path: root/trunk/src/createpkg
diff options
context:
space:
mode:
Diffstat (limited to 'trunk/src/createpkg')
-rw-r--r--trunk/src/createpkg129
1 files changed, 121 insertions, 8 deletions
diff --git a/trunk/src/createpkg b/trunk/src/createpkg
index c83b673..5ac4ac2 100644
--- a/trunk/src/createpkg
+++ b/trunk/src/createpkg
@@ -49,6 +49,12 @@ ${red}DESCRIPTION${normal}
show description and dependences of the program
${red}-l${normal}, ${red}--list${normal}
list all the SlackBuilds
+ ${red}--list-packages ${green}[repository]${normal}
+ list all packages in binary repositories
+ ${red}--sign${green}<package_name>${normal}
+ sign a binary package
+ ${red}--remove${green}<package_name>${normal}
+ remove a binary package
${red}--sync${normal}
synchronize SlackBuilds repository
${red}--update${normal}
@@ -468,6 +474,7 @@ function update_metadata {
cd $makepkg_repos
+ get_sign_user
repo_gpg_key $makepkg_repos
gen_meta $SUBFOLDER/$PKG_NAME
gen_filelist
@@ -494,22 +501,109 @@ function update_metadata {
function list_packages {
- # TODO
- true
+ # list packages in repositories
+ # usage: list_packages [repository_list]
+
+ local repository repositories="$*"
+
+ if [ -z "$repositories" ]; then
+ repositories="$PACKAGES_DIR $NOARCH_DIR"
+ fi
+
+ for repository in $repositories; do
+ echo "Packages from $repository..."
+ find $repository -name '*.tgz'
+ done
}
-function delete_packages {
+function remove_package {
+
+ # delete a package from repositories
+ # usage: remove_packages <package> [repository_list]
+
+ local package="$1" repository repositories="$2"
+
+ if [ -z "$package" ]; then
+ return 1
+ fi
+
+ if [ -z "$repositories" ]; then
+ repositories="$PACKAGES_DIR $NOARCH_DIR"
+ fi
+
+ for repository in $repositories; do
+
+ (
- # TODO
- true
+ cd $repository
+
+ for file in `find . -name "$package-*-*-*.tgz" -o -name "$package-*-*-*.meta" -o -name "$package-*-*-*.tgz.asc"`; do
+ svn_del $file
+ if [ -e "CHECKSUMS.md5" ] && echo $file | grep -q -e ".tgz$"; then
+ # remove md5 information
+ sed -i "/ \.*\/*$(regexp_slash $file)$/d" CHECKSUMS.md5
+ cat CHECKSUMS.md5 | gzip -9 -c - > CHECKSUMS.md5.gz
+ fi
+ done
+
+ for file in `find $repository -name "$package.slack-required"`; do
+ svn_del $file
+ done
+
+ )
+
+ update_metadata $repository
+ done
}
function sign_package {
- # TODO
- true
+ # sign a package from repositories
+ # usage: sign_package <package> [repository_list]
+
+ local package="$1" repository repositories="$2"
+
+ if [ -z "$package" ]; then
+ return 1
+ fi
+
+ if [ -z "$repositories" ]; then
+ repositories="$PACKAGES_DIR $NOARCH_DIR"
+ fi
+
+ for repository in $repositories; do
+
+ (
+
+ cd $repository
+
+ for file in `find . -name "$package-*-*-*.tgz"`; do
+
+ 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
+ su $SIGN_PACKAGES_USER -c "gpg $GPG_AGENT_OPTION --armor -sb -u $SIGN_KEYID -o $tmp_sign_folder/`basename $file`.asc $repository/$file"
+ cp $tmp_sign_folder/`basename $file`.asc $repository/$file.asc
+ rm -rf $tmp_sign_folder
+ else
+ tmp_sign_folder="`mktemp -d $TMP/createpkg_sign.XXXXXX`"
+ gpg $GPG_AGENT_OPTION --armor -sb -u $SIGN_KEYID -o $tmp_sign_folder/`basename $file`.asc $repository/$file
+ cp $tmp_sign_folder/`basename $file`.asc $repository/$file.asc
+ rm -rf $tmp_sign_folder
+ fi
+
+ done
+
+ )
+
+ update_metadata $repository
+ done
}
@@ -636,6 +730,7 @@ function create_package {
COLOR=${COLOR:=$COLOR_MODE} \
REPOS=${REPOS:=$PACKAGES_DIR} \
CLEANUP=${CLEANUP:=$CREATEPKG_CLEANUP} \
+ SLACKBUILD_PATH="" \
INTERACT=no $FAKEROOT sh $SHELL_FLAG ./$SCRIPT_NAME
)
@@ -688,7 +783,10 @@ function create_package {
cp $tmp_sign_folder/$PKG_NAME.asc $PACKAGES_DIR/$PKG_NAME.asc
rm -rf $tmp_sign_folder
else
- gpg $GPG_AGENT_OPTION --armor -sb -u $SIGN_KEYID $PACKAGES_DIR/$PKG_NAME
+ tmp_sign_folder="`mktemp -d $TMP/createpkg_sign.XXXXXX`"
+ gpg $GPG_AGENT_OPTION --armor -sb -u $SIGN_KEYID -o $tmp_sign_folder/$PKG_NAME.asc $PACKAGES_DIR/$PKG_NAME
+ cp $tmp_sign_folder/$PKG_NAME.asc $PACKAGES_DIR/$PKG_NAME.asc
+ rm -rf $tmp_sign_folder
fi
fi
@@ -947,6 +1045,21 @@ case $1 in
fi
exit $EXIT_CODE
;;
+ '--list-packages')
+ shift
+ list_packages $*
+ exit $EXIT_CODE
+ ;;
+ '--sign')
+ shift
+ sign_package $*
+ exit $EXIT_CODE
+ ;;
+ '--remove')
+ shift
+ remove_package $*
+ exit $EXIT_CODE
+ ;;
*)
if [ "${1:0:1}" != "-" ]; then
build_queue $*