aboutsummaryrefslogtreecommitdiff
path: root/src/createpkg
diff options
context:
space:
mode:
authorrudson <rudson@04377dda-e619-0410-9926-eae83683ac58>2007-01-06 13:38:31 +0000
committerrudson <rudson@04377dda-e619-0410-9926-eae83683ac58>2007-01-06 13:38:31 +0000
commit7101e90ad3188835308d4cf22ce7acf7ca9f7907 (patch)
treed89c9d0a59ded6cd556d87ac13d3186c203b5aa0 /src/createpkg
parentce77b525169bcc20d841d728571d47dc69ca6862 (diff)
downloadsimplepkg-7101e90ad3188835308d4cf22ce7acf7ca9f7907.tar.gz
simplepkg-7101e90ad3188835308d4cf22ce7acf7ca9f7907.tar.bz2
createpkg: habilitado o simplaret --install
git-svn-id: svn+slack://slack.fluxo.info/var/svn/simplepkg@82 04377dda-e619-0410-9926-eae83683ac58
Diffstat (limited to 'src/createpkg')
-rw-r--r--src/createpkg99
1 files changed, 46 insertions, 53 deletions
diff --git a/src/createpkg b/src/createpkg
index 8c4e7de..092c174 100644
--- a/src/createpkg
+++ b/src/createpkg
@@ -50,7 +50,7 @@ function error_codes {
# Createpkg error codes
ERROR_INSTPKG=200 # installpkg error
ERROR_DEPEN=201 # dependency error
-
+ SCRIPT_OR_PACKAGE_NOT_FOUND=202 # Script or package not found
}
function handle_error {
@@ -78,21 +78,37 @@ function handle_error {
3) echo -e "$CL_ALERT $BASENAME: could not update the repository $2 $CL_OFF" ;;
4) echo -e "$CL_ALERT $BASENAME: could not create folder $2 $CL_OFF" ;;
5) echo -e "$CL_ALERT $BASENAME: script not found for $2 $CL_OFF" ;;
- $ERROR_WGET) echo -e "$CL_ERROR $BASENAME: error downloading source/package for $2 $CL_OFF" ;;
- $ERROR_MAKE) echo -e "$CL_ERROR $BASENAME: error compiling $2 source code $CL_OFF" ;;
- $ERROR_INSTALL) echo -e "$CL_ERROR $BASENAME: error installing $2 $CL_OFF" ;;
- $ERROR_MD5) echo -e "$CL_ERROR $BASENAME: error on source code integrity check for $2 $CL_OFF" ;;
- $ERROR_CONF) echo -e "$CL_ERROR $BASENAME: error configuring the source code for $2 $CL_OFF" ;;
- $ERROR_HELP) exit 0 ;; # its supposed to never happen here :P
- $ERROR_TAR) echo -e "$CL_ERROR $BASENAME: error decompressing source code for $2 $CL_OFF" ;;
- $ERROR_MKPKG) echo -e "$CL_ERROR $BASENAME: error creating package $2 $CL_OFF" ;;
- $ERROR_GPG) echo -e "$CL_ERROR $BASENAME: error verifying GPG signature the source code for $2 $CL_OFF" ;;
- $ERROR_PATCH) echo -e "$CL_ERROR $BASENAME: error patching the source code for $2 $CL_OFF" ;;
- $ERROR_VCS) echo -e "$CL_ERROR $BASENAME: error downloading $2 source from version control system $CL_OFF" ;;
- $ERROR_MKDIR) echo -e "$CL_ERROR $BASENAME: make directory $2 error, aborting $CL_OFF" ;;
- $ERROR_INSTPKG) echo -e "$CL_ERROR $BASENAME: install package $2 error, aborting $CL_OFF" ;;
- $ERROR_DEPEN) echo -e "$CL_ERROR $BASENAME: dependency solve error, aborting $CL_OFF" ;;
- *) echo -e "$CL_ERROR $BASENAME: unknown error or user interrupt $CL_OFF" ;;
+ $ERROR_WGET)
+ echo -e "$CL_ERROR $BASENAME: error downloading source/package for $2 $CL_OFF" ;;
+ $ERROR_MAKE)
+ echo -e "$CL_ERROR $BASENAME: error compiling $2 source code $CL_OFF" ;;
+ $ERROR_INSTALL)
+ echo -e "$CL_ERROR $BASENAME: error installing $2 $CL_OFF" ;;
+ $ERROR_MD5)
+ echo -e "$CL_ERROR $BASENAME: error on source code integrity check for $2 $CL_OFF" ;;
+ $ERROR_CONF)
+ echo -e "$CL_ERROR $BASENAME: error configuring the source code for $2 $CL_OFF" ;;
+ $ERROR_HELP)
+ exit 0 ;; # its supposed to never happen here :P
+ $ERROR_TAR)
+ echo -e "$CL_ERROR $BASENAME: error decompressing source code for $2 $CL_OFF" ;;
+ $ERROR_MKPKG)
+ echo -e "$CL_ERROR $BASENAME: error creating package $2 $CL_OFF" ;;
+ $ERROR_GPG)
+ echo -e "$CL_ERROR $BASENAME: error verifying GPG signature the source code for $2 $CL_OFF" ;;
+ $ERROR_PATCH)
+ echo -e "$CL_ERROR $BASENAME: error patching the source code for $2 $CL_OFF" ;;
+ $ERROR_VCS)
+ echo -e "$CL_ERROR $BASENAME: error downloading $2 source from version control system $CL_OFF" ;;
+ $ERROR_MKDIR)
+ echo -e "$CL_ERROR $BASENAME: make directory $2 error, aborting $CL_OFF" ;;
+ $ERROR_INSTPKG)
+ echo -e "$CL_ERROR $BASENAME: install package $2 error, aborting $CL_OFF" ;;
+ $ERROR_DEPEN)
+ echo -e "$CL_ERROR $BASENAME: dependency solve error, aborting $CL_OFF" ;;
+ *) echo -e "$CL_ERROR $BASENAME: unknown error or user interrupt $CL_OFF" ;;
+ $SCRIPT_OR_PACKAGE_NOT_FOUND)
+ echo -e "$CL_ERROR $BASENAME: SlackBuild or package not found $CL_OFF" ;;
esac
exit $1
@@ -150,55 +166,32 @@ function solve_dep {
# TODO: Make check version procedures
if [ -z $INSTALLED ]; then
- createpkg_simplaret --slack_install $PACK # Install package from official Slackware tree
if [ $? -ne 0 ]; then
# Check package in SlackBuilds tree
echo -e "$CL_MENSG $BASENAME: processing $PACKAGE dependency $PACK $CL_OFF"
SYNC=no CREATEPKG_CHILD=$CREATEPKG_CHILD createpkg --install $PACK
+
# check if the package was built and installed
EXIT_CODE="$?"
- [ "$EXIT_CODE" != "0" ] && handle_error $EXIT_CODE
- fi
- fi
-
-}
-
-function createpkg_simplaret {
- local SLACK_MIRROR="http://slackware.cs.utah.edu/pub/slackware/slackware-$DEFAULT_VERSION"
-
- # Slackware FILELIST. ( put after 'source COMMON' command )
- SLACK_FILELIST="$STORAGE/$DEFAULT_ARCH/$DEFAULT_VERSION/FILELIST.TXT"
- # Verify parameters number
- [ $# -lt 1 ] && exit 32
+ if [ "$EXIT_CODE" == "5" ]; then
+ # exit code 5 == slackbuild not found
+ # try to use simplaret
+ ARCH=$ARCH simplaret --update
+ ARCH=$ARCH simplaret --install $PACK
+ EXIT_CODE="$?"
+ if [ "$EXIT_CODE" != "0" ]; then
+ handle_error $SCRIPT_OR_PACKAGE_NOT_FOUND
+ fi
- case $1 in
- '--slack_install')
- # Install package from Slackware mirror
- # Check package in Slackware tree
- local CANDIDATE=`eval "cat $SLACK_FILELIST | egrep '\/$2-[^-]+-[^-]+-[^-]\.tgz$'" | awk '{print $8}' | sort -r | head -n1`
- [ -z $CANDIDATE ] && return 31
- #
- local PACK=$CANDIDATE
- local PKG_NAME=`basename $PACK`
- local REPOS_DIR=$REPOS/slackware-$DEFAULT_VERSION/${PACK#./}
-
- # Make repository directory
- if [ ! -e $REPOS_DIR ]; then
- mkdir -p $REPOS_DIR || handle_error $ERROR_MKDIR $REPOS_DIR
+ elif [ "$EXIT_CODE" != "0" ]; then
+ handle_error $EXIT_CODE
fi
- # Download package from slackware mirror
- wget $SLACK_MIRROR/$PACK --directory-prefix=$REPOS_DIR/ || handle_error $ERROR_WGET $PACK
+ fi
+ fi
- # Install slackware package
- installpkg $REPOS_DIR/$PKG_NAME || handle_error $ERROR_INSTPKG $PKG_NAME
- ;;
- *)
- echo "None..."
- ;;
- esac
}
function check_repo {