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/Makefile | 1 - trunk/doc/CHANGELOG | 1 + trunk/src/mkbuild | 82 +++++++++++++++++++++++++++++++++++++------------- trunk/src/repos | 87 ----------------------------------------------------- trunk/utils/repos | 87 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 5 files changed, 149 insertions(+), 109 deletions(-) delete mode 100755 trunk/src/repos create mode 100755 trunk/utils/repos (limited to 'trunk') diff --git a/trunk/Makefile b/trunk/Makefile index 6cc561f..ed65bf8 100644 --- a/trunk/Makefile +++ b/trunk/Makefile @@ -28,7 +28,6 @@ install_lib: install_bin: $(INSTALL) -D --mode=0755 src/simplaret $(DESTDIR)/$(PREFIX)/bin/simplaret - $(INSTALL) -D --mode=0755 src/repos $(DESTDIR)/$(PREFIX)/bin/repos $(INSTALL) -D --mode=0755 src/lspkg $(DESTDIR)/$(PREFIX)/bin/lspkg $(INSTALL) -D --mode=0755 src/mkbuild $(DESTDIR)/$(PREFIX)/bin/mkbuild $(INSTALL) -D --mode=0755 src/mkpatch $(DESTDIR)/$(PREFIX)/bin/mkpatch diff --git a/trunk/doc/CHANGELOG b/trunk/doc/CHANGELOG index 1ae2a84..de955e9 100644 --- a/trunk/doc/CHANGELOG +++ b/trunk/doc/CHANGELOG @@ -4,6 +4,7 @@ simplepkg changelog 0.6pre31 ======== + - repos script moved to utils/ folder - new "compact" template storage format - common.sh: - default arch when its not present at /etc/slackware-version is now assumed to be "i486" 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\"" diff --git a/trunk/src/repos b/trunk/src/repos deleted file mode 100755 index e4a17ee..0000000 --- a/trunk/src/repos +++ /dev/null @@ -1,87 +0,0 @@ -#!/bin/bash -# -# repos script got from -# http://software.jaos.org/BUILD/slapt-get/FAQ.html#slgFAQ17 -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or -# any later version. -# -# Changes by rhatto at riseup.net to fit http://slack.sarava.org needs -# - -BASENAME="`basename $0`" -REPOS_CONF="/etc/simplepkg/repos.conf" -COMMON="/usr/libexec/simplepkg/common.sh" - -if [ -f "$COMMON" ]; then - source $COMMON -else - echo "error: file $COMMON found, check your $BASENAME installation" - exit 1 -fi - -function usage { - - echo "`basename $0` [pkg [file]|all|new|svnmeta|PACKAGESTXT|FILELIST|MD5]" - -} - -function do_all { - - for pkg in `find . -type f -name '*.tgz' -print`; do - gen_meta $pkg - done - $0 PACKAGESTXT - $0 FILELIST - $0 MD5 - -} - -# --------------------------------- -# main -# --------------------------------- - -case "$1" in - pkg) - if [ -n "$2" ]; then - gen_meta $2 - else - usage - fi - ;; - all) - do_all - ;; - new) - for pkg in `find . -type f -name '*.tgz' -print`; do - if [ ! -f ${pkg%tgz}meta ]; then - gen_meta $pkg - fi - done - ;; - svnmeta) - svn_add_meta - ;; - PACKAGESTXT) - gen_packages_txt . - gen_packages_txt patches - ;; - FILELIST) - gen_filelist - gen_patches_filelist patches - ;; - MD5) - gen_md5_checksums . - gen_md5_checksums patches - ;; - usage) - usage - ;; - *) - do_all - svn_add_meta - ;; -esac - diff --git a/trunk/utils/repos b/trunk/utils/repos new file mode 100755 index 0000000..e4a17ee --- /dev/null +++ b/trunk/utils/repos @@ -0,0 +1,87 @@ +#!/bin/bash +# +# repos script got from +# http://software.jaos.org/BUILD/slapt-get/FAQ.html#slgFAQ17 +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# any later version. +# +# Changes by rhatto at riseup.net to fit http://slack.sarava.org needs +# + +BASENAME="`basename $0`" +REPOS_CONF="/etc/simplepkg/repos.conf" +COMMON="/usr/libexec/simplepkg/common.sh" + +if [ -f "$COMMON" ]; then + source $COMMON +else + echo "error: file $COMMON found, check your $BASENAME installation" + exit 1 +fi + +function usage { + + echo "`basename $0` [pkg [file]|all|new|svnmeta|PACKAGESTXT|FILELIST|MD5]" + +} + +function do_all { + + for pkg in `find . -type f -name '*.tgz' -print`; do + gen_meta $pkg + done + $0 PACKAGESTXT + $0 FILELIST + $0 MD5 + +} + +# --------------------------------- +# main +# --------------------------------- + +case "$1" in + pkg) + if [ -n "$2" ]; then + gen_meta $2 + else + usage + fi + ;; + all) + do_all + ;; + new) + for pkg in `find . -type f -name '*.tgz' -print`; do + if [ ! -f ${pkg%tgz}meta ]; then + gen_meta $pkg + fi + done + ;; + svnmeta) + svn_add_meta + ;; + PACKAGESTXT) + gen_packages_txt . + gen_packages_txt patches + ;; + FILELIST) + gen_filelist + gen_patches_filelist patches + ;; + MD5) + gen_md5_checksums . + gen_md5_checksums patches + ;; + usage) + usage + ;; + *) + do_all + svn_add_meta + ;; +esac + -- cgit v1.2.3