aboutsummaryrefslogtreecommitdiff
path: root/trunk/src/mkbuild
diff options
context:
space:
mode:
authorrhatto <rhatto@04377dda-e619-0410-9926-eae83683ac58>2008-12-22 19:27:00 +0000
committerrhatto <rhatto@04377dda-e619-0410-9926-eae83683ac58>2008-12-22 19:27:00 +0000
commit52a6b2792631217e5e7a96a5bd1577e320b2cdcf (patch)
treea75b9a6ccb558c3dc1c1321de74df7aece7ff81d /trunk/src/mkbuild
parenta8a8c9c4225963cd7ad8749a5dd52ca8489f595a (diff)
downloadsimplepkg-52a6b2792631217e5e7a96a5bd1577e320b2cdcf.tar.gz
simplepkg-52a6b2792631217e5e7a96a5bd1577e320b2cdcf.tar.bz2
attempting to fix #46
git-svn-id: svn+slack://slack.fluxo.info/var/svn/simplepkg@705 04377dda-e619-0410-9926-eae83683ac58
Diffstat (limited to 'trunk/src/mkbuild')
-rwxr-xr-xtrunk/src/mkbuild82
1 files changed, 61 insertions, 21 deletions
diff --git a/trunk/src/mkbuild b/trunk/src/mkbuild
index 6e4e8de..a6dc947 100755
--- a/trunk/src/mkbuild
+++ b/trunk/src/mkbuild
@@ -109,8 +109,7 @@ ${red}AUTHOR${normal}
Written by ${blue}Rudson R. Alves${normal}
${red}AVAILABILITY${normal}
- by svn: ${yellow}svn checkout svn://slack.sarava.org/simplepkg${normal}
- this mkbuild is found in branches/0.6/
+ by svn: ${yellow}svn checkout http://slack.sarava.org/simplepkg${normal}
${red}REPORTING BUGS${normal}
Report bugs to <${blue}rudsonaalves[at]rra.etc.br${normal}>
@@ -129,7 +128,7 @@ function set_parameters {
# Use: set_parameters $@
# where $@ are the parameters input
#
- # Parameters analyze
+ # Parameter evaluation
ACTION="build"
while [ "$1" ]; do
@@ -401,7 +400,7 @@ function get_mkbuild_status {
function activate_sections {
- # Enable and desable sections
+ # Enable and disable sections
ACTIONS_LIST=`sed '/^#>>/,/<</ ! d; /^#/ d ' $MKBUILD_NAME | tr -d ' '`
for i in $ACTIONS_LIST; do
STATUS=`echo $i | cut -f1 -d:`
@@ -628,10 +627,12 @@ function submit_mkbuild {
svn_copy $WORK/$MKBUILD_NAME $MKBUILD_PATH
for i in `ls $WORK | grep -E -v '(SlackBuild|old|slack-required|.mkbuild$|.tmp$)\*{0,1}$'`; do
- if ! is_the_same $(dirname $MKBUILD_PATH) $WORK; then
- svn_copy $WORK/$i $MKBUILD_PATH
- else
- svn_add $WORK/$i
+ if [ "`basename $i`" != "$DIST_SRC_NAME" ]; then
+ if ! is_the_same $(dirname $MKBUILD_PATH) $WORK; then
+ svn_copy $WORK/$i $MKBUILD_PATH
+ else
+ svn_add $WORK/$i
+ fi
fi
done
@@ -655,7 +656,7 @@ function submit_cleanup {
if ! is_the_same $(dirname $MKBUILD_PATH) $WORK; then
(
cd $WORK
- rm -f *.old *.tmp *.SlackBuild slack-required
+ rm -f *.old *.tmp *.SlackBuild slack-required $DIST_SRC_NAME
)
fi
@@ -708,6 +709,7 @@ function decompress_find {
function load_parameters {
# Load Createpkg parameters
+ SOURCE_DIR="`eval_parameter SOURCE_DIR /var/simplepkg/sources`"
SLACKBUILDS_DIR="`eval_parameter SLACKBUILDS_DIR /var/simplepkg/slackbuilds`"
[ ! -d $SLACKBUILDS_DIR ] && mkdir -p $SLACKBUILDS_DIR
@@ -726,10 +728,11 @@ function load_parameters {
function file_metainfo {
- # get integrity file metainformation
- # usage: file_metainfo <file> <file_type>
+ # get integrity file metadata
+ # usage: file_metainfo <file> <file_type> <manifest_file>
- local size algo sum="" file="$1" file_type="`echo $2 | tr '[:lower:]' '[:upper:]'`"
+ local sum="" file="$1" file_type="`echo $2 | tr '[:lower:]' '[:upper:]'`"
+ local size algo candidate folders path manifest_file="$3"
if [ -d "$file" ]; then
return
@@ -740,15 +743,41 @@ function file_metainfo {
fi
if [ ! -e "$file" ]; then
- echo "$file_type `basename $file` " # end space is important
- return
+ if [ "$file_type" == "DIST" ]; then
+
+ folders="$WORK $TMP $SOURCE_DIR"
+ if ! is_the_same /tmp $TMP; then
+ folders="$folders /tmp"
+ fi
+
+ echo "Trying to find $(basename $file)) at $folders..."
+
+ for path in $folders; do
+ candidate="$(find $path -name $(basename $file))"
+ if [ ! -z "$candidate" ]; then
+ break
+ fi
+ done
+
+ if [ ! -z "$candidate" ]; then
+ echo "Using $(basename $file) found at $(dirname $candidate) to hash at the Manifest."
+ file="$candidate"
+ else
+ echo "$file_type `basename $file` " >> $manifest_file # end space is important
+ return 1
+ fi
+
+ else
+ echo "$file_type `basename $file` " >> $manifest_file # end space is important
+ return 1
+ fi
fi
for algo in md5 sha1 sha256 sha512 rmd160; do
sum="$sum `echo $algo | tr '[:lower:]' '[:upper:]'` `gethash $algo $file`"
done
- echo $file_type `basename $file` `file_size $file` $sum
+ echo $file_type `basename $file` `file_size $file` $sum >> $manifest_file
}
@@ -771,9 +800,16 @@ function update_manifest_info {
# Set temporary file
tmpfile="`mktemp $TMP/mkbuild_manifest.XXXXXX`"
- # Update metainfo
+ # Update metadata
sed -e "/^$file_type `basename $file` /d" `dirname $file`/Manifest > $tmpfile
- file_metainfo $file $file_type >> $tmpfile
+ file_metainfo $file $file_type $tmpfile
+
+ if [ "$?" != "0" ]; then
+ echo "Could not add hashes for $file on Manifest: file not found."
+ echo "Please do it with --update-manifest."
+ fi
+
+ # Save Manifest changes
sort $tmpfile > `dirname $file`/Manifest
rm -f $tmpfile
@@ -795,10 +831,10 @@ function update_manifest {
update_manifest_info $WORK/slack-required
fi
- # Add source code information
- DIST_SRC_NAME="`eval "echo $CONST_STRING"`" # we need this to strip some escape strings
- DIST_SRC_NAME="`eval "echo $DIST_SRC_NAME"`" # twice does the job
- update_manifest_info $DIST_SRC_NAME dist
+ # Add source code information if its not already there
+ if ! grep -q -e "^DIST $DIST_SRC_NAME " $WORK/Manifest; then
+ update_manifest_info $DIST_SRC_NAME dist
+ fi
# Update patches
for i in `find $WORK | grep -E '(.diff$|.diff.gz$|.diff.bz2$|.patch$|.patch.gz$|.patch.bz2$)\*{0,1}$'`; do
@@ -988,6 +1024,10 @@ if [ ! -z $MKBUILD_NAME ]; then
[ -z $SOURCE_NAME ] && SOURCE_NAME=`eval "echo $CONST_STRING"`
[ $VERBOSE -eq $on ] && echo "SOURCE_NAME=\"$SOURCE_NAME\""
+ # Eval source code name
+ DIST_SRC_NAME="`eval "echo $CONST_STRING"`" # we need this to strip some escape strings
+ DIST_SRC_NAME="`eval "echo $DIST_SRC_NAME"`" # twice does the job
+
# Documentations list
DOCFILES=`validate_parameter "$DOCFILES" "DOCUMENTATION FILES" "NEWS TODO README AUTHORS INSTALL ChangeLog MAINTAINERS COPYING LICENSE SIGNATURE readme.*"`
[ $VERBOSE -eq $on ] && echo "[[DOCUMENTATION FILES]]=\"$DOCFILES\""