]> gitweb.fluxo.info Git - slackbuilds.git/commitdiff
-ca bogosort bogosort: adding manifest
authorrhatto <rhatto@370017ae-e619-0410-ac65-c121f96126d4>
Wed, 24 Dec 2008 21:18:32 +0000 (21:18 +0000)
committerrhatto <rhatto@370017ae-e619-0410-ac65-c121f96126d4>
Wed, 24 Dec 2008 21:18:32 +0000 (21:18 +0000)
git-svn-id: svn+slack://slack.fluxo.info/var/svn/slackbuilds@2030 370017ae-e619-0410-ac65-c121f96126d4

app/text/bogosort/Manifest [new file with mode: 0644]
app/text/bogosort/bogosort.SlackBuild

diff --git a/app/text/bogosort/Manifest b/app/text/bogosort/Manifest
new file mode 100644 (file)
index 0000000..8883c69
--- /dev/null
@@ -0,0 +1,4 @@
+DIST bogosort_0.4.2.orig.tar.gz 161628 MD5 66a5804bff44a331c81938e03c32b003 SHA1 9549be745ed349c231e29fba7616db276d8a11a8 SHA256 bfd66ce866bb8935088873c52323a06997f627a209da1017491425d93e5510ef SHA512 2d2f7be36ec08aa78323cbdc5f1030297706c364d6fc82554065cf737295d11c90dd6061323f2732b63c70401d710b2018075bff6d1e6ab0078069b405ea62e9 RMD160 fa269a9a5b6de0ec21702d4e090819ffcc0d0511
+MKBUILD bogosort.mkbuild 3518 MD5 6d6c2ece44d0e1282eee88852e09b0b4 SHA1 6303dbe9cb17f293dbdd30eb384fa9d8bbcaa856 SHA256 490204a4d1862b624853f315579397e8b6d8dbe10d3c801eb51ae2d8754a1b70 SHA512 40098507b1e6b22a5e7db3b9cb314dd143125fdc51a0d39272d347d81910ecf3d4f76d53953657e31555484c23fa3ab4ad1518dea44f1d1d4b25c41dea4891f3 RMD160 c5e03bc24ae9a427f16e5204aa992e305285429e
+PATCH bogosort_0.4.2-2.diff.gz 27483 MD5 fd0d826e2f6b8f53b490c4c28f59fe40 SHA1 f013ea2da0e5f7e382dbaecc887f1bd3d25b8a87 SHA256 118cea036101901b7ef8ed47c9c0a35a33f46d88b1690c93d29540cc5ffd52d7 SHA512 9c091a1fb22e606665a495a5667ccf966fc5845a049d380bac5efbea701dbaec0ce2d45afe057cfefceaf19ee5e8612fc217ec2d705ae8c8c48c106d7f3fdac2 RMD160 815d2520bbc86aa8c7ea33d6dd1ef423a111340d
+SLACKBUILD bogosort.SlackBuild 8058 MD5 cf8dd8ba0867d2bb29765f6cdff94be2 SHA1 be8604bfebc853fda81a26370bdbd12a3d046796 SHA256 d04af11fd8f667994f604f1100483b619a24798f334a0d4aa3821cfaecba372d SHA512 d2124e3dee7e231625f0efefe64aea48e0ce04f409eb811ed6fff45bf411bb987d97283fec530d78103754f8365f916a87b2af6512b2103bb984f21a60bac5b6 RMD160 7177fe08726b88ada0f311afa9a3047b65c139b0
index 409e54ffd642c516497eec93bde656122cf8a6bc..df8c85d1bac4024ed5a2eb19b2e191a709e5c7ec 100755 (executable)
@@ -10,9 +10,9 @@
 #  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General
 #  Public License for more details.
 #
-#  You should have received a copy of the GNU General Public License along with
-#  this program; if not, write to the Free Software Foundation, Inc., 59 Temple
-#  Place - Suite 330, Boston, MA 02111-1307, USA
+#  You should have received a copy of the GNU General Public License along
+#  with this program; if not, write to the Free Software Foundation, Inc.,
+#  59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
 #
 # slackbuild for bogosort, by Silvio Rhatto
 # requires:  
@@ -57,6 +57,7 @@ elif [ "$ARCH" = "s390" ]; then
 elif [ "$ARCH" = "x86_64" ]; then
   SLKCFLAGS="-O2 -fPIC"
   LIBDIR="$PREFIX/lib64"
+  LDFLAGS="-L/lib64 -L/usr/lib64"
 fi
 
 # Set error codes (used by createpkg)
@@ -64,6 +65,7 @@ ERROR_WGET=31;      ERROR_MAKE=32;      ERROR_INSTALL=33
 ERROR_MD5=34;       ERROR_CONF=35;      ERROR_HELP=36
 ERROR_TAR=37;       ERROR_MKPKG=38;     ERROR_GPG=39
 ERROR_PATCH=40;     ERROR_VCS=41;       ERROR_MKDIR=42
+ERROR_MANIFEST=43;
 
 # Clean up any leftovers of previous builds
 rm -rf "$PKG_WORK" 2> /dev/null
@@ -83,30 +85,94 @@ if [ ! -s "$SRC_DIR/$SRC" ] || ! gunzip -t "$SRC_DIR/$SRC" 2> /dev/null; then
   wget "$URL" -O "$SRC_DIR/$SRC" || exit $ERROR_WGET
 fi
 
+# Download patches
+if echo http://ftp.debian.org/debian/pool/main/b/bogosort/bogosort_0.4.2-2.diff.gz | grep -q -v "PATCH URLS"; then
+  for patch_url in http://ftp.debian.org/debian/pool/main/b/bogosort/bogosort_0.4.2-2.diff.gz; do
+    patch="`basename $patch_url`"
+    if [ ! -s "$SRC_DIR/$patch" ]; then
+      wget "$patch_url" -O "$SRC_DIR/$patch" || exit $ERROR_WGET
+    fi
+  done
+fi
+
+# Check Manifest file
+if [ -e "$CWD/Manifest" ]; then
+
+  MANIFEST_LINES="`grep -E -v "^(MKBUILD|SLACKBUILD)" $CWD/Manifest | wc -l`"
+
+  for ((MANIFEST_COUNT=1; MANIFEST_COUNT <= $MANIFEST_LINES; MANIFEST_COUNT++)); do
+
+    MANIFEST_LINE="`grep -E -v "^(MKBUILD|SLACKBUILD)" $CWD/Manifest | head -n $MANIFEST_COUNT | tail -n 1`"
+    MANIFEST_FILE="`echo $MANIFEST_LINE | awk '{ print $2 }'`"
+    MANIFEST_FILE_TYPE="`echo $MANIFEST_LINE | awk '{ print $1 }'`"
+
+    if [ -e "$SRC_DIR/$MANIFEST_FILE" ]; then
+      MANIFEST_FILE="$SRC_DIR/$MANIFEST_FILE"
+    else
+      MANIFEST_FILE="`find $CWD -name $MANIFEST_FILE`"
+    fi
+
+    if [ ! -e "$MANIFEST_FILE" ] || [ -d "$MANIFEST_FILE" ]; then
+      continue
+    fi
+
+    echo "Checking Manifest for $MANIFEST_FILE_TYPE $MANIFEST_FILE integrity..."
+
+    SIZE_SRC="`wc -c $MANIFEST_FILE | awk '{ print $1 }'`"
+    SIZE_MANIFEST="`echo $MANIFEST_LINE | awk '{ print $3 }'`"
+
+    # Check source code size
+    if [ "$SIZE_SRC" != "$SIZE_MANIFEST" ]; then
+      echo "SIZE Manifest: $SIZE_MANIFEST; SIZE $SRC: $SIZE_SRC"
+      exit $ERROR_MANIFEST
+    else
+      echo "Size match."
+    fi
+
+    # Check source code integrity
+    for ALGO in md5 sha1 sha256 sha512 rmd160; do
+      if [ $ALGO = "rmd160" ]; then
+        ALGO_SRC="`openssl rmd160 $MANIFEST_FILE | awk '{ print $2 }'`"
+      else
+        ALGO_SRC="`"$ALGO"sum $MANIFEST_FILE | awk '{ print $1 }'`"
+      fi
+      ALGO="`echo $ALGO | tr '[:lower:]' '[:upper:]'`"
+      ALGO_MANIFEST=$(echo $MANIFEST_LINE | sed "s/.* $ALGO //" | awk '{ print $1 }')
+      if [ "$ALGO_SRC" != "$ALGO_MANIFEST" ]; then
+        echo "$ALGO Manifest: $ALGO_MANIFEST; $ALGO $SRC: $ALGO_SRC"
+        exit $ERROR_MANIFEST
+      else
+        echo "$ALGO match."
+      fi
+    done
+
+  done
+
+else
+  exit $ERROR_MANIFEST
+fi
+
 # Untar
 cd "$PKG_WORK"
 tar --no-same-owner --no-same-permissions -xvf "$SRC_DIR/$SRC" || exit $ERROR_TAR
-PKG_SRC="$PWD/`ls -l | awk '/^d/ { print $8 }'`"
+PKG_SRC="$PWD/`ls -l | awk '/^d/ { print $NF }'`"
 cd "$PKG_SRC"
 
 # Patch source
-patches="
+patches=" http://ftp.debian.org/debian/pool/main/b/bogosort/bogosort_0.4.2-2.diff.gz
          $PKG_NAME.diff $PKG_NAME-$PKG_VERSION.diff
          $PKG_NAME-$PKG_VERSION-$ARCH.diff $PKG_NAME-$ARCH.diff"
 for patch in $patches; do
+  patch="`basename $patch`"
   if [ -f "$CWD/$patch" ]; then
     patch -Np1 < "$CWD/$patch" || exit $ERROR_PATCH
   elif [ -f "$CWD/patches/$patch" ]; then
     patch -Np1 < "$CWD/patches/$patch" || exit $ERROR_PATCH
-  fi
-done
-
-if echo http://ftp.debian.org/debian/pool/main/b/bogosort/bogosort_0.4.2-2.diff.gz | grep -q -v "PATCH URLS"; then
-  for patch_url in http://ftp.debian.org/debian/pool/main/b/bogosort/bogosort_0.4.2-2.diff.gz; do
-    patch="`basename $patch_url`" 
-    if [ ! -s "$SRC_DIR/$patch" ]; then
-      wget "$patch_url" -O "$SRC_DIR/$patch" || exit $ERROR_WGET
-    fi
+  elif [ -f "$CWD/$patch.gz" ]; then
+    gzip -dc "$CWD/$patch.gz" | patch -Np1 || exit $ERROR_PATCH
+  elif [ -f "$CWD/patches/$patch.gz" ]; then
+    gzip -dc "$CWD/patches/$patch.gz" | patch -Np1 || exit $ERROR_PATCH
+  elif [ -f "$SRC_DIR/$patch" ]; then
     if [ "`basename $patch .gz`" != "$patch" ]; then
       gzip -dc $SRC_DIR/$patch | patch -Np1 || exit $ERROR_PATCH
     elif [ "`basename $patch .bz2`" != "$patch" ]; then
@@ -114,8 +180,8 @@ if echo http://ftp.debian.org/debian/pool/main/b/bogosort/bogosort_0.4.2-2.diff.
     else
       patch -Np1 < "$SRC_DIR/$patch" || exit $ERROR_PATCH
     fi
-  done
-fi
+  fi
+done
 
 # Configure
 CFLAGS="$SLKCFLAGS" \
@@ -150,9 +216,9 @@ done
 mkdir -p "$PKG/install" || exit $ERROR_MKDIR
 cat << EODESC > "$PKG/install/slack-desc"
 # HOW TO EDIT THIS FILE:
-# The "handy ruler" below makes it easier to edit a package description.  Line
+# The "handy ruler" below makes it easier to edit a package description. Line
 # up the first '|' above the ':' following the base package name, and the '|'
-# on the right side marks the last column you can put a character in.  You must
+# on the right side marks the last column you can put a character in. You must
 # make exactly 11 lines for the formatting to be correct.  It's also
 # customary to leave one space after the ':'.
 
@@ -175,6 +241,6 @@ cd "$PKG"
 makepkg -l y -c n "$REPOS/$PKG_NAME-$PKG_VERSION-$ARCH-$BUILD.tgz" || exit $ERROR_MKPKG
 
 # Delete source and build directories if requested
-if [ "$CLEANUP" == "yes" ]; then
+if [ "$CLEANUP" == "yes" ] || [ "$1" = "--cleanup" ]; then
   rm -rf "$PKG_WORK" "$PKG"
 fi