From 52a6b2792631217e5e7a96a5bd1577e320b2cdcf Mon Sep 17 00:00:00 2001 From: rhatto Date: Mon, 22 Dec 2008 19:27:00 +0000 Subject: attempting to fix #46 git-svn-id: svn+slack://slack.fluxo.info/var/svn/simplepkg@705 04377dda-e619-0410-9926-eae83683ac58 --- trunk/src/mkbuild | 82 +++++++++++++++++++++++++++++++++++++++++-------------- 1 file changed, 61 insertions(+), 21 deletions(-) (limited to 'trunk/src/mkbuild') 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 '/^#>>/,/< + # get integrity file metadata + # usage: file_metainfo - 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\"" -- cgit v1.2.3