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}>
# Use: set_parameters $@
# where $@ are the parameters input
#
- # Parameters analyze
+ # Parameter evaluation
ACTION="build"
while [ "$1" ]; do
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:`
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
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
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
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
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
}
# 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
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
[ -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\""