aboutsummaryrefslogtreecommitdiff
path: root/trunk
diff options
context:
space:
mode:
authorrudson <rudson@04377dda-e619-0410-9926-eae83683ac58>2007-02-18 23:17:30 +0000
committerrudson <rudson@04377dda-e619-0410-9926-eae83683ac58>2007-02-18 23:17:30 +0000
commitae1ecd24619fda20217113b277f83822296a616d (patch)
treea90a099e54a17075c25011f638d2498bc9c41d01 /trunk
parent6df8c81465374eaa4e07ce9580bb095dca04be7c (diff)
downloadsimplepkg-ae1ecd24619fda20217113b277f83822296a616d.tar.gz
simplepkg-ae1ecd24619fda20217113b277f83822296a616d.tar.bz2
mkslackbuild: release 0.9.2
git-svn-id: svn+slack://slack.fluxo.info/var/svn/simplepkg@189 04377dda-e619-0410-9926-eae83683ac58
Diffstat (limited to 'trunk')
-rwxr-xr-xtrunk/utils/mkslackbuild163
1 files changed, 138 insertions, 25 deletions
diff --git a/trunk/utils/mkslackbuild b/trunk/utils/mkslackbuild
index daefef0..effe00e 100755
--- a/trunk/utils/mkslackbuild
+++ b/trunk/utils/mkslackbuild
@@ -9,7 +9,7 @@
# Slackbuilds são scripts utilizados no Slackware para gerar
# pacotes tgz.
#
-# Version 0.9.1
+# Version 0.9.2
#
#--------------------------------------------------------------------
# Functions
@@ -17,7 +17,16 @@
# Show ./configure --help
function config_help()
{
- dialog --backtitle "mkSlackBuild $PROG_VERSION [$MK_PKGNAME]" --title " Check ./configure --help " --textbox $CONFIG_HELP 20 75
+ view_file "Check ./configure --help" $CONFIG_HELP
+}
+
+# Show file
+# INPUT: $1 string textbox
+# $2 file
+function view_file()
+{
+ [ $# -ne 2 ] && return 1
+ dialog --backtitle "mkSlackBuild $PROG_VERSION [$MK_PKGNAME]" --title " $1 " --textbox $2 20 75
}
# Exit function
@@ -33,8 +42,11 @@ function mk_exit()
# Clear all temp files
function clean_all()
{
+ [ -s $DEPENDENCY_LIST ] && cp $DEPENDENCY_LIST $BASEDIR/slack-required
+
rm $AUX_TMP 2>/dev/null
rm $SLACKDESC_TMP 2>/dev/null
+ rm $DEPENDENCY_LIST 2>/dev/null
if [ ! -z $MK_PKGNAME ]; then
rm $BASEDIR/*_$MK_PKGNAME.mkbuild 2>/dev/null
[ -e /tmp/$MK_PKGNAME ] && rm -rf /tmp/$MK_PKGNAME
@@ -118,6 +130,8 @@ function unpkg_source()
tar xvf $MK_SOURCE -C /tmp/$MK_PKGNAME/ 1>/dev/null
[ $? -ne 0 ] && mk_exit 1
MK_TMPSRC="/tmp/$MK_PKGNAME/`ls /tmp/$MK_PKGNAME/`"
+
+ DOC_FILES=`find $MK_TMPSRC -type f -maxdepth 1 -name "[A-Z]*" | sed 's/.*\/\(.*\)$/\1/'`
}
# Download source
@@ -213,31 +227,32 @@ function edit_configure()
local ANS0=1
while [ $ANS0 -eq 1 ]; do
- local ANS="0"
- while [ $ANS -ne 4 ]; do
- ANS=`dialog --stdout --backtitle "mkSlackBuild $PROG_VERSION [$MK_PKGNAME]" \
+ local ANS1="7"
+ while [ $ANS1 -ne 0 ]; do
+ ANS1=`dialog --stdout --backtitle "mkSlackBuild $PROG_VERSION [$MK_PKGNAME]" \
--menu "Select one option" 0 0 0 \
1 "View ./configure help" \
- 2 "PREFIX=$MK_PREFIX" \
- 3 "OPTIONS=$MK_OPTIONS" \
- 4 "Continue"`
+ 2 "View documentations" \
+ 3 "PREFIX=$MK_PREFIX" \
+ 4 "OPTIONS=$MK_OPTIONS" \
+ 0 "Continue"`
[ $? -ne 0 ] && mk_exit
- case $ANS in
+ case $ANS1 in
'1')
config_help
;;
'2')
- MK_PREFIX=`dialog --stdout --backtitle "mkSlackBuild $PROG_VERSION [$MK_PKGNAME]" --inputbox "Enter with prefix for install $MK_PKGNAME" 8 60 "$MK_PREFIX"`
+ view_docs
;;
'3')
- MK_OPTIONS=`dialog --stdout --backtitle "mkSlackBuild $PROG_VERSION [$MK_PKGNAME]" --inputbox "Enter with configure options for compile $MK_PKGNAME" 8 60 "$MK_OPTIONS"`
+ MK_PREFIX=`dialog --stdout --backtitle "mkSlackBuild $PROG_VERSION [$MK_PKGNAME]" --inputbox "Enter with prefix for install $MK_PKGNAME" 8 60 "$MK_PREFIX"`
;;
'4')
- echo "Continue..."
+ MK_OPTIONS=`dialog --stdout --backtitle "mkSlackBuild $PROG_VERSION [$MK_PKGNAME]" --inputbox "Enter with configure options for compile $MK_PKGNAME" 8 60 "$MK_OPTIONS"`
;;
*)
- ANS=4
+ ANS1=0
;;
esac
done
@@ -260,6 +275,24 @@ function edit_configure()
done
}
+# Show Documentations files
+function view_docs()
+{
+ local MENU=""
+ local SELECT=""
+
+ for i in $DOC_FILES; do
+ MENU="$MENU \"$i\" \"\" "
+ done
+
+ ANS2=0
+ while [ $ANS2 -eq 0 ]; do
+ SELECT=`eval "dialog --stdout --backtitle \"mkSlackBuild $PROG_VERSION [$MK_PKGNAME]\" --title \" Documentations files \" --menu \"Select doc-file below:\" 20 45 13 $MENU"`
+ ANS2=$?
+ [ $ANS2 -eq 0 ] && view_file "File: $SELECT" $MK_TMPSRC/$SELECT
+ done
+}
+
# Edit documentations files
function edit_docfiles()
{
@@ -284,7 +317,7 @@ function edit_docfiles()
# Edit compiler architecture
function edit_arch()
{
- MK_ARCH=`dialog --stdout --backtitle "mkSlackBuild documentation files below:" --inputbox "Set an architecture to compiler:" $MK_ARCH`
+ MK_ARCH=`dialog --stdout --backtitle "mkSlackBuild documentation files below:" --inputbox "Set an architecture to compiler:" 8 45 $MK_ARCH`
}
#--------------------------------------------------------------------
@@ -362,6 +395,17 @@ function make_file_sections()
MAXSECTION=$INDEX
}
+function get_source_dialog()
+{
+ dialog --stdout --backtitle "mkSlackBuild $PROG_VERSION [$MK_PKGNAME]" \
+ --yesno " Download $MK_SRCNAME? " 5 50
+ if [ $? -eq 0 ]; then
+ download_url
+ else
+ select_source
+ fi
+}
+
#--------------------------------------------------------------------
# Main functions
#--------------------------------------------------------------------
@@ -381,12 +425,25 @@ function create_slackbuild()
edit_arch
# Get source file
- dialog --stdout --backtitle "mkSlackBuild $PROG_VERSION [$MK_PKGNAME]" \
- --yesno " Download $MK_SRCNAME? " 5 50
- if [ $? -eq 0 ]; then
- download_url
+ if [ ! -e $MK_SOURCEDIR/$MK_SRCNAME ]; then
+ get_source_dialog
else
- select_source
+ MK_SOURCE=$MK_SOURCEDIR/$MK_SRCNAME
+ if [ "$MK_EXTENSION" = gz ]; then
+ if ( bzip2 -t $MK_SOURCE ); then
+ echo "Ok"
+ else
+ rm $MK_SOURCE
+ get_source_dialog
+ fi
+ elif [ "$MK_EXTENSION" = bz2 ]; then
+ if ( gzip -t $MK_SOURCE ); then
+ echo "Ok"
+ else
+ rm $MK_SOURCE
+ get_source_dialog
+ fi
+ fi
fi
# Uncompress source
@@ -436,12 +493,38 @@ function open_mkslackbuild()
# Create files sections
make_file_sections $MKSLACKBUILD
+ [ -e $BASEDIR/slack-required ] && ( cp $BASEDIR/slack-required $DEPENDENCY_LIST )
+
# Main-Menu
- edit_menu
+ #edit_menu
else
dialog --backtitle "mkSlackBuild $PROG_VERSION [$MK_PKGNAME]" \
--msgbox "$MKSLACKBUILD most be a file" 0 0
fi
+
+ # Get source file
+ if [ ! -e $MK_SOURCEDIR/$MK_SRCNAME ]; then
+ get_source_dialog
+ else
+ MK_SOURCE=$MK_SOURCEDIR/$MK_SRCNAME
+ if [ "$MK_EXTENSION" = gz ]; then
+ if ( bzip2 -t $MK_SOURCE ); then
+ echo "Ok"
+ else
+ rm $MK_SOURCE
+ get_source_dialog
+ fi
+ elif [ "$MK_EXTENSION" = bz2 ]; then
+ if ( gzip -t $MK_SOURCE ); then
+ echo "Ok"
+ else
+ rm $MK_SOURCE
+ get_source_dialog
+ fi
+ fi
+ fi
+
+ unpkg_source
}
# Save mkSlackbuild
@@ -449,8 +532,6 @@ function save_mkslackbuild()
{
dialog --backtitle "mkSlackBuild $PROG_VERSION [$MK_PKGNAME]" --infobox "mkSlackBuild save in $MKSLACKBUILD" 5 30
-# MKSLACKBUILD=$BASEDIR/$MK_PKGNAME.mkslackbuild
-
rm $MKSLACKBUILD 2>/dev/null
echo '#!/bin/bash' > $MKSLACKBUILD
echo -e "# mkSlackBuild version $MK_VERSION\n" >> $MKSLACKBUILD
@@ -472,6 +553,8 @@ function save_mkslackbuild()
echo "</${SECTION_NAME[i]}> ${SECTION_FLAG[i]}" >> $MKSLACKBUILD
echo "" >> $MKSLACKBUILD
done
+
+ [ -s $DEPENDENCY_LIST ] && cp $DEPENDENCY_LIST $BASEDIR/slack-required
}
# Edit Menu
@@ -508,19 +591,37 @@ function edit_menu()
done
}
+# Dependency list edit
+function edit_dependency()
+{
+ if [ ! -s $DEPENDENCY_LIST ]; then
+ echo -e "# Dependency list to $MK_PKGNAME\n# \n# dependency [condition] [version]]\n" > $DEPENDENCY_LIST
+ fi
+
+ $MK_EDITOR $DEPENDENCY_LIST
+}
+
+# Test SlackBuild script
+function exec_script()
+{
+ return 0
+}
#
#--------------------------------------------------------------------
# Start Program
#--------------------------------------------------------------------
#
-set +x # turn off debug
-PROG_VERSION=0.9.1
+# turn off debug
+##set +x
+# Start variables
+PROG_VERSION=0.9.2
LANG=us
BASEDIR=`pwd`
AUX_TMP=`mktemp -p /tmp/ aux_tmp.XXXXXX`
SLACKDESC_TMP=`mktemp -p /tmp/ slackdesc_tmp.XXXXXX`
SLACKDESC_LEN=77
+DEPENDENCY_LIST=`mktemp -p /tmp/ slack-required.XXXXXX`
if [ -e ~/.generic.mkSlackBuild ]; then
SB_MODEL=~/.generic.mkSlackBuild
elif [ -e /etc/simplepkg/generic.mkSlackBuild ]; then
@@ -560,7 +661,7 @@ if [ "$MK_AUTHOR" = "[[AUTHOR NAME]]" ]; then
edit_author
fi
-ANS0=7
+ANS0=11
while [ $ANS0 -ne 0 ]; do
if [ -z $MK_PKGNAME ]; then
ANS0=`dialog --stdout --backtitle "mkSlackBuild $PROG_VERSION [$MK_PKGNAME]" \
@@ -577,6 +678,9 @@ while [ $ANS0 -ne 0 ]; do
"3" "Save MkSlackBuild" \
"4" "Make Slackbuild" \
"5" "Edit setions menu" \
+ "6" "Edit dependency list" \
+ "7" "Test SlackBuild script" \
+ "8" "View doc-files" \
"0" "Exit"`
EXIT_STATUS=$?
fi
@@ -601,6 +705,15 @@ while [ $ANS0 -ne 0 ]; do
5)
edit_menu
;;
+ 6)
+ edit_dependency
+ ;;
+ 7)
+ exec_script
+ ;;
+ 8)
+ view_docs
+ ;;
*)
true
;;