Adding WebDruid log analyzer. In the same time, reworking source autoupdate system a bit

svn path=/nixpkgs/trunk/; revision=16859
This commit is contained in:
Michael Raskin
2009-08-26 11:13:36 +00:00
parent e8931adcf3
commit fbea8a558a
12 changed files with 142 additions and 19 deletions
@@ -12,6 +12,7 @@ Attributes:
src-info-for-file.nix:
downloadPage
baseName (default = unnamed-package)
sourceRegexp (default = '.*[.]tar[.].*')
choiceCommand (default = 'head -1')
versionExtractorSedScript (default = 's/.*-([0-9.]+)[.].*/\1/')
@@ -24,3 +25,4 @@ advertisedUrl (its match is the check for update presence)
url
hash
version
name
@@ -0,0 +1,6 @@
# sed scripts
#http://sourceforge.net/projects/webdruid/files/webdruid/0.6.0-alpha5/webdruid-0.6.0-alpha5.tar.gz/download
#http://downloads.sourceforge.net/webdruid/files/webdruid/0.6.0-alpha5/webdruid-0.6.0-alpha5.tar.gz
skipRedirectSF='s@^http://sourceforge.net/projects/@http://downloads.sourceforge.net/@; s@/download$@@'
extractReleaseSF='s@.*/([^/]+)/[^/]+@\1@'
@@ -1,13 +1,18 @@
#! /bin/sh
set -x
own_dir="$(cd "$(dirname "$0")"; sh -c pwd)"
source "$own_dir/snippets.sh"
main_file="$1"
main_dir="$(cd "$(dirname "$main_file")" ; sh -c pwd)"
file_name="$(basename "$main_file")"
defs_file="$main_dir"/src-info-for-"$file_name"
src_file="$main_dir"/src-for-"$file_name"
new_src_file="$main_dir"/updated-src-for-"$file_name"
# OK, [vcs] revert is always possible
new_src_file="$main_dir"/src-for-"$file_name"
forcedUrl="$2"
@@ -23,8 +28,12 @@ getAttr () {
if [ -z "$forcedUrl" ] ; then
freshUrl="$("$own_dir"/urls-from-page.sh "$(getAttr downloadPage)" |
egrep "$(getAttr sourceRegexp '.*[.]tar[.].*')" |
sh -c "$(getAttr choiceCommand 'head -1')")"
eval "egrep \"$(getAttr sourceRegexp '.*[.]tar[.].*')\"" |
eval "$(getAttr choiceCommand 'head -1')")"
if ! egrep ':' freshUrl ; then
freshUrl="$(dirname "$(getAttr downloadPage).")/$freshUrl"
fi
echo "Found download link: $freshUrl" >&2
else
@@ -37,21 +46,35 @@ if [ x"$freshUrl" = x"$(cat "$src_defs_dir"/advertisedUrl)" ]; then
fi
version="$(echo "$freshUrl" |
sed -re "$(getAttr versionExtractorSedScript \
's/.*-([0-9.]+)[.].*/\1/')")"
eval "sed -re \"$(getAttr versionExtractorSedScript \
's/.*-([0-9.]+)[.].*/\1/')\"")"
mirrorUrl="$(echo "$freshUrl" |
sed -r -e "$(getAttr versionReferenceCreator \
's/-([0-9.]+)[.]/-${version}./')" |
sed -r -e "$(getAttr mirrorSedScript)")"
eval "sed -r -e \"$(getAttr versionReferenceCreator \
's/-([0-9.]+)[.]/-${version}./')\"" |
eval "sed -r -e \"$(getAttr mirrorSedScript)\"")"
hash=$(nix-prefetch-url "$freshUrl")
baseName="$(getAttr baseName 'unnamed-package')"
name="$baseName-$version"
advertisedUrl="$freshUrl"
url="$mirrorUrl"
extraAssignments=""
for i in $(getAttr extraVars ''); do
eval "$(getAttr "eval_$i" 'i=""')"
extraAssignments="$extraAssignments $i=\"$(eval echo \"\$$i\")\";"
done
cat << EOF > "$new_src_file"
rec {
advertisedUrl="$freshUrl";
advertisedUrl="$advertisedUrl";
version = "$version";
url="$mirrorUrl";
url="$url";
hash = "$hash";
name = "$name";
$extraAssignments
}
EOF