]> gitweb.fluxo.info Git - simplepkg.git/commitdiff
attempting to fix #46
authorrhatto <rhatto@04377dda-e619-0410-9926-eae83683ac58>
Mon, 22 Dec 2008 19:27:00 +0000 (19:27 +0000)
committerrhatto <rhatto@04377dda-e619-0410-9926-eae83683ac58>
Mon, 22 Dec 2008 19:27:00 +0000 (19:27 +0000)
git-svn-id: svn+slack://slack.fluxo.info/var/svn/simplepkg@705 04377dda-e619-0410-9926-eae83683ac58

trunk/Makefile
trunk/doc/CHANGELOG
trunk/src/mkbuild
trunk/utils/repos [moved from trunk/src/repos with 100% similarity]

index 6cc561fc9c7a674e44e6deefa484d945955b50dc..ed65bf882388da8e9154135f0cfce950350c6be1 100644 (file)
@@ -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
index 1ae2a847f83c240e121d85e91f25086cd793f172..de955e9386fa658d7aa3c3ca75f81d6bc75bec63 100644 (file)
@@ -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"
index 6e4e8de2c32a221edc337b0eaaa18614acdd3e9a..a6dc9474072f8cd73cdd50df7d3ac34bd84021dc 100755 (executable)
@@ -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\""
similarity index 100%
rename from trunk/src/repos
rename to trunk/utils/repos