From 44ff33a2029ba668603197cf3c345b68185c2354 Mon Sep 17 00:00:00 2001 From: Alejandro Mery Date: Sat, 16 Aug 2008 22:42:11 +0000 Subject: [PATCH] Moved pkgchksum() code into lib/sde-package/pkgchksum.sh --- lib/functions.in | 23 +++------------------ lib/sde-package/pkgchksum.sh | 40 ++++++++++++++++++++++++++++++++++++ 2 files changed, 43 insertions(+), 20 deletions(-) create mode 100644 lib/sde-package/pkgchksum.sh diff --git a/lib/functions.in b/lib/functions.in index 74c2725..9ef4a1d 100644 --- a/lib/functions.in +++ b/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" ) } diff --git a/lib/sde-package/pkgchksum.sh b/lib/sde-package/pkgchksum.sh new file mode 100644 index 0000000..824bc71 --- /dev/null +++ b/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