Browse Source

Moved pkgchksum() code into lib/sde-package/pkgchksum.sh

karasz/new-early
Alejandro Mery 16 years ago
parent
commit
44ff33a202
2 changed files with 43 additions and 20 deletions
  1. +3
    -20
      lib/functions.in
  2. +40
    -0
      lib/sde-package/pkgchksum.sh

+ 3
- 20
lib/functions.in

@ -657,31 +657,14 @@ pkggetdir() {
esac
}
# This function generates the T2 package checksum of $confdir.
# The checksum includes the filenames and content (except of the .cache),
# including subdirs but without whitespaces and comments and some tag lines
# that are not vital for rebuilds during update checks.
#
# pkgchksum package-name | full-patch
# pkgchksum package-name
#
pkgchksum() {
(
# expand to full patch if only a package name was specified
[[ $1 == */* ]] || set $base/package/*/$1/
cd $1
# find all files (without hidden (e.g. .svn) files)
find . ! -path '*/.*' ! -name '*.cache' -print -exec cat \{\} \; \
2>/dev/null |
# strip some unimportant stuff (e.g. comments, whitespaces, ...)
sed \
-e '/^[ ]*#.*/d' \
-e '/^\[COPY\]/d' \
-e '/^\[CV-*\]/d' \
-e '/^\[[T,I,U,A,M,L,S,C]\]/d' \
-e 's/[\t ]*//g' \
-e '/^ *$/d' |
md5sum | cut -d ' ' -f 1
[[ $1 == */* ]] || set $base/package/*/$1/
sh "$base/lib/sde-package/pkgchksum.sh" "$1"
)
}

+ 40
- 0
lib/sde-package/pkgchksum.sh

@ -0,0 +1,40 @@
#!/bin/sh
# --- SDE-COPYRIGHT-NOTE-BEGIN ---
# This copyright note is auto-generated by ./scripts/Create-CopyPatch.
#
# Filename: lib/sde-package/pkgchksum.sh
# Copyright (C) 2006 - 2008 The OpenSDE Project
# Copyright (C) 2004 - 2006 The T2 SDE Project
# Copyright (C) 1998 - 2003 Clifford Wolf
#
# More information can be found in the files COPYING and README.
#
# 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; version 2 of the License. A copy of the
# GNU General Public License can be found in the file COPYING.
# --- SDE-COPYRIGHT-NOTE-END ---
# This routine generates the package checksum of a $confdir.
# The checksum includes the filenames and content (except of the .cache),
# including subdirs but without whitespaces and comments and some tag lines
# that are not vital for rebuilds during update checks.
if [ -d "$1" ]; then
cd "$1"
# find all files (without hidden (e.g. .svn) files)
find . ! -path '*/.*' ! -name '*.cache' -print -exec cat \{\} \; \
2>/dev/null |
# strip some unimportant stuff (e.g. comments, whitespaces, ...)
sed \
-e '/^[ ]*#.*/d' \
-e '/^\[COPY\]/d' \
-e '/^\[CV-*\]/d' \
-e '/^\[[T,I,U,A,M,L,S,C]\]/d' \
-e 's/[\t ]*//g' \
-e '/^ *$/d' |
md5sum | cut -d ' ' -f 1
else
exit 1
fi

Loading…
Cancel
Save