diff options
author | rhatto <rhatto@04377dda-e619-0410-9926-eae83683ac58> | 2009-03-06 00:44:42 +0000 |
---|---|---|
committer | rhatto <rhatto@04377dda-e619-0410-9926-eae83683ac58> | 2009-03-06 00:44:42 +0000 |
commit | f0973107ef56fb8e9ca9f1bf9a8921bdc55fd35f (patch) | |
tree | 7c7181fdb2c34ddff45068ea2ad9d337c13c67f0 | |
parent | f85d43884e072c71178d08b8aeef35d2bd70d931 (diff) | |
download | simplepkg-f0973107ef56fb8e9ca9f1bf9a8921bdc55fd35f.tar.gz simplepkg-f0973107ef56fb8e9ca9f1bf9a8921bdc55fd35f.tar.bz2 |
attempting to fix #40 and #84
git-svn-id: svn+slack://slack.fluxo.info/var/svn/simplepkg@794 04377dda-e619-0410-9926-eae83683ac58
-rw-r--r-- | trunk/mkbuild/generic.mkSlackBuild | 4 | ||||
-rw-r--r-- | trunk/mkbuild/kde4.mkSlackBuild | 4 | ||||
-rw-r--r-- | trunk/mkbuild/perl.mkSlackBuild | 4 | ||||
-rw-r--r-- | trunk/src/createpkg | 129 |
4 files changed, 130 insertions, 11 deletions
diff --git a/trunk/mkbuild/generic.mkSlackBuild b/trunk/mkbuild/generic.mkSlackBuild index 7b31e5c..56af369 100644 --- a/trunk/mkbuild/generic.mkSlackBuild +++ b/trunk/mkbuild/generic.mkSlackBuild @@ -51,6 +51,7 @@ SRC_DIR=${SRC_DIR:=$CWD}/$PKG_NAME TMP=${TMP:=/tmp} PKG=${PKG:=$TMP/package-$PKG_NAME} REPOS=${REPOS:=$TMP} +SLACKBUILD_PATH=${SLACKBUILD_PATH:="[[SLACKBUILD PATH]]"} PREFIX=${PREFIX:=[[PREFIX]]} PKG_WORK="$TMP/$SRC_NAME" CONF_OPTIONS=${CONF_OPTIONS:="[[OTHER CONFIGURE ARGS]]"} @@ -514,7 +515,8 @@ fi <build_package> off # Build the package cd "$PKG" -makepkg -l y -c n "$REPOS/$PKG_NAME-$PKG_VERSION-$ARCH-$BUILD.tgz" || exit $ERROR_MKPKG +mkdir -p $REPOS/$SLACKBUILD_PATH +$MAKEPKG -l y -c n "$REPOS/$SLACKBUILD_PATH/$PKG_NAME-$PKG_VERSION-$ARCH-$BUILD.tgz" || exit $ERROR_MKPKG </build_package> <clean_builds> off diff --git a/trunk/mkbuild/kde4.mkSlackBuild b/trunk/mkbuild/kde4.mkSlackBuild index 867dcd4..1203317 100644 --- a/trunk/mkbuild/kde4.mkSlackBuild +++ b/trunk/mkbuild/kde4.mkSlackBuild @@ -50,6 +50,7 @@ SRC_DIR=${SRC_DIR:=$CWD}/$PKG_NAME TMP=${TMP:=/tmp} PKG=${PKG:=$TMP/package-$PKG_NAME} REPOS=${REPOS:=$TMP} +SLACKBUILD_PATH=${SLACKBUILD_PATH:="[[SLACKBUILD PATH]]"} PREFIX=${PREFIX:=[[PREFIX]]} PKG_WORK="$TMP/$SRC_NAME" CONF_OPTIONS=${CONF_OPTIONS:="[[OTHER CONFIGURE ARGS]]"} @@ -508,7 +509,8 @@ fi <build_package> off # Build the package cd "$PKG" -makepkg -l y -c n "$REPOS/$PKG_NAME-$PKG_VERSION-$ARCH-$BUILD.tgz" || exit $ERROR_MKPKG +mkdir -p $REPOS/$SLACKBUILD_PATH +$MAKEPKG -l y -c n "$REPOS/$SLACKBUILD_PATH/$PKG_NAME-$PKG_VERSION-$ARCH-$BUILD.tgz" || exit $ERROR_MKPKG </build_package> <clean_builds> off diff --git a/trunk/mkbuild/perl.mkSlackBuild b/trunk/mkbuild/perl.mkSlackBuild index 8b78f02..a2ccb7e 100644 --- a/trunk/mkbuild/perl.mkSlackBuild +++ b/trunk/mkbuild/perl.mkSlackBuild @@ -52,6 +52,7 @@ SRC_DIR=${SRC_DIR:=$CWD}/$PKG_NAME TMP=${TMP:=/tmp} PKG=${PKG:=$TMP/package-$PKG_NAME} REPOS=${REPOS:=$TMP} +SLACKBUILD_PATH=${SLACKBUILD_PATH:="[[SLACKBUILD PATH]]"} PREFIX=${PREFIX:=[[PREFIX]]} PKG_WORK="$TMP/$SRC_NAME" CONF_OPTIONS=${CONF_OPTIONS:="[[OTHER CONFIGURE ARGS]]"} @@ -431,7 +432,8 @@ fi <build_package> off # Build the package cd "$PKG" -makepkg -l y -c n "$REPOS/$PKG_NAME-$PKG_VERSION-$ARCH-$BUILD.tgz" || exit $ERROR_MKPKG +mkdir -p $REPOS/$SLACKBUILD_PATH +$MAKEPKG -l y -c n "$REPOS/$SLACKBUILD_PATH/$PKG_NAME-$PKG_VERSION-$ARCH-$BUILD.tgz" || exit $ERROR_MKPKG </build_package> <clean_builds> off 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 $* |