is used to update the whole set of packages, and assuming that download location for all of them. patch creation reworked using an awk file - needs improvements. git-svn-id: svn://svn.opensde.net/opensde/opensde/trunk@20674 10447126-35f2-4685-b0cf-6dd780d3921fmisl/sde-wrapper
@ -0,0 +1,36 @@ |
|||
# --- SDE-COPYRIGHT-NOTE-BEGIN --- |
|||
# This copyright note is auto-generated by ./scripts/Create-CopyPatch. |
|||
# |
|||
# Filename: lib/sde-package/package-update.awk |
|||
# Copyright (C) 2007 The OpenSDE Project |
|||
# |
|||
# 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 --- |
|||
|
|||
{ |
|||
if ( $0 ~ /^\[V\]/ ) { |
|||
oldver = $2; |
|||
gsub( /\./, "\\.", oldver ) |
|||
$2 = ver |
|||
} |
|||
else if ( $0 ~ /^\[D\]/ && $3 ~ ".*" oldver ".*" ) { |
|||
filename = $3; |
|||
gsub( oldver, ver, filename ); |
|||
if ( filename != $3 ) { |
|||
$2 = 0; |
|||
$3 = filename; |
|||
if ( location == "" ) |
|||
gsub( oldver, ver, $4 ); |
|||
else |
|||
$4 = location; |
|||
} |
|||
} |
|||
|
|||
|
|||
print $0; |
|||
} |
|||
@ -1,91 +0,0 @@ |
|||
#!/bin/bash |
|||
# |
|||
# --- SDE-COPYRIGHT-NOTE-BEGIN --- |
|||
# This copyright note is auto-generated by ./scripts/Create-CopyPatch. |
|||
# |
|||
# Filename: lib/sde-package/patch-update.sh |
|||
# Copyright (C) 2006 The OpenSDE Project |
|||
# Copyright (C) 2004 - 2006 The T2 SDE Project |
|||
# |
|||
# 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 --- |
|||
|
|||
pkg="$1" ; shift |
|||
ver="$1" ; shift |
|||
|
|||
if [ -z "$ver" ]; then |
|||
ver=${pkg/*-/} |
|||
pkg=${pkg%-$ver} |
|||
fi |
|||
|
|||
if [ -z "$pkg" -o -z "$ver" ]; then |
|||
echo "Usage: $0 pkg ver" |
|||
echo " or: $0 pkg-ver" |
|||
exit |
|||
fi |
|||
|
|||
pkg=`echo $pkg | tr A-Z a-z` |
|||
|
|||
echo "[ $pkg ]" >&2 |
|||
pkgdir=`echo package/*/$pkg` |
|||
|
|||
if [ ! -d "$pkgdir" ] ; then |
|||
echo "Can't find package for '$x'!" >&2 |
|||
else |
|||
oldver="`egrep "^\[(V|VER|VERSION)\] " $pkgdir/$pkg.desc | |
|||
tr '\t' ' ' | tr -s ' ' | cut -f2 -d' '`" |
|||
tmpfile=`mktemp` ; tmpfile2=`mktemp` |
|||
echo "Update patch for $pkg ($pkgdir): $oldver -> $ver" |
|||
|
|||
# [V] |
|||
expression="-e 's,^\[\(V\|VER\|VERSION\)\].*,[\1] $ver,'" |
|||
# file at [D] |
|||
expression="$expression -e '/^\[\(D\|DOWN\|DOWNLOAD\)\]/ s,${oldver//./\\.},$ver,g;'" |
|||
|
|||
# detect download location structure |
|||
sed -n -e 's,^\[\(D\|DOWN\|DOWNLOAD\)\].*[ \t]\([^ \t]*\)[ \t]*$,\2,p' $pkgdir/$pkg.desc > $tmpfile |
|||
|
|||
if grep -q "/$oldver/$" $tmpfile; then |
|||
# $ver -> /$ver/ |
|||
oldver="${oldver//./\\.}" |
|||
expression="$expression -e '/^\[\(D\|DOWN\|DOWNLOAD\)\]/ s,/$oldver/[ \t]*\$,/$ver/,g;'" |
|||
elif [ "$oldver" != "${oldver//-/}" ] && grep -q "/${oldver//-/}/\$" $tmpfile; then |
|||
# $ver-$extra -> /$ver/ |
|||
oldver="${oldver%%-*}"; oldver="${oldver//./\\.}" |
|||
ver="${ver%%-*}" |
|||
expression="$expression -e '/^\[\(D\|DOWN\|DOWNLOAD\)\]/ s,/$oldver/[ \t]*\$,/$ver/,g;'" |
|||
else |
|||
# $ver.$extra -> /$ver/ |
|||
oldver="${oldver%%-*}" |
|||
ver="${ver%%-*}" |
|||
|
|||
oldauxver= |
|||
auxver= |
|||
pattern="[^\.]*" |
|||
while [ "${oldver#$oldauxver}" ]; do |
|||
eval $( echo "$oldver $ver" | sed -e "s,\($pattern\).* \($pattern\).*,oldauxver=\1 auxver=\2," ) |
|||
if grep -q "/$oldauxver/\$" $tmpfile; then |
|||
oldver="${oldauxver%%-*}"; oldauxver="${oldauxver//./\\.}" |
|||
ver="${auxver%%-*}" |
|||
expression="$expression -e '/^\[\(D\|DOWN\|DOWNLOAD\)\]/ s,/$oldver/[ \t]*\$,/$ver/,g;'" |
|||
break |
|||
fi |
|||
pattern="$pattern\.\?[^\.]*" |
|||
done |
|||
fi |
|||
|
|||
# checksum at [D] |
|||
expression="$expression -e 's,^\[\(D\|DOWN\|DOWNLOAD\)\] [0-9]\+,[\1] 0,'" |
|||
|
|||
eval "sed $expression $pkgdir/$pkg.desc" > $tmpfile |
|||
diff -u ./$pkgdir/$pkg.desc $tmpfile | tee $tmpfile2 |
|||
[ -s $tmpfile2 ] || echo "Patch for '$x' is empty!" >&2 |
|||
rm -f $tmpfile $tmpfile2 |
|||
fi |
|||
echo |
|||
|
|||
@ -1,83 +0,0 @@ |
|||
#!/bin/bash |
|||
# --- SDE-COPYRIGHT-NOTE-BEGIN --- |
|||
# This copyright note is auto-generated by ./scripts/Create-CopyPatch. |
|||
# |
|||
# Filename: lib/sde-package/update.sh |
|||
# Copyright (C) 2006 The OpenSDE Project |
|||
# Copyright (C) 2004 - 2006 The T2 SDE Project |
|||
# |
|||
# 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 --- |
|||
|
|||
# Extract packagename and version number from the script arguments. |
|||
pkg="$1" ; shift |
|||
ver="$1" ; shift |
|||
|
|||
# The script also supports the package name and version separated by a '-' |
|||
# dash. In this case they have to be separated from each other. |
|||
if [ -z "$ver" ]; then |
|||
ver=${pkg/*-/} |
|||
pkg=${pkg%-$ver} |
|||
fi |
|||
|
|||
# Check if both package name and version have been extracted from the |
|||
# commandline arguments. If not the script was called with invalid |
|||
# arguments, show the usage. |
|||
if [ -z "$pkg" -o -z "$ver" -o $pkg == $ver ]; then |
|||
echo "Usage: $0 pkg ver" |
|||
echo " or: $0 pkg-ver" |
|||
echo "" |
|||
echo "Updating a package to a new versions." |
|||
echo "" |
|||
echo " pkg Packagename to be updated" |
|||
echo " ver New version number for the package" |
|||
echo " ver=refresh makes it just add checksums" |
|||
echo "" |
|||
echo "For detailed information on how to update packages" |
|||
echo "to new versions, please have a look at the online" |
|||
echo "T2 documentaion." |
|||
exit |
|||
fi |
|||
|
|||
# Make sure any diff files from previous runs are removed. |
|||
rm -f $$.diff |
|||
|
|||
# Only package names in lowercase are supported. As an additional |
|||
# service any package names supplied in capitols will be converted |
|||
# to lowercase. |
|||
pkg=`echo $pkg | tr A-Z a-z` |
|||
|
|||
# Of course we can only update packages we know about. |
|||
if [ -d package/*/$pkg ]; then |
|||
if [ "$ver" != "refresh" ]; then |
|||
# The package exists so now update the package descriptor |
|||
# for the given package to the new version. Luckily we have |
|||
# a script for that too :-) |
|||
$SDEROOT/lib/sde-package/patch-update.sh $pkg $ver | tee $$.diff |
|||
patch -p1 < $$.diff |
|||
rm -f $$.diff |
|||
fi |
|||
|
|||
# Step 2: Use the modified package descriptor to download |
|||
# the package. Again, nothing more that calling an existing |
|||
# script. |
|||
./scripts/Download $pkg |
|||
|
|||
# Third and final step is updating the checksum for the |
|||
# new download. |
|||
$SDEROOT/lib/sde-package/patch-cksum.sh $pkg | patch -p0 |
|||
else |
|||
# Oeps, the given package name does not exist. |
|||
echo "ERROR: package $pkg doesn't exist" |
|||
# As an extra service for the user a list possibilities is |
|||
# presented with packages closely matching the given package |
|||
# name. |
|||
pkg=`echo "$pkg" | tr '\-_.' '***'` |
|||
echo `echo package/*/*$pkg*/ | tr ' ' '\n' | grep -v '*' | cut -d'/' -f3` |
|||
fi |
|||
|
|||