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

View File

@ -521,4 +521,9 @@ let inherit (builtins) head tail trace; in
ensureDir $(toPythonPath $out)
export PYTHONPATH=$PYTHONPATH''${PYTHONPATH:+:}$(toPythonPath $out)
'') ["minInit" "addInputs" "defEnsureDir"];
fetchUrlFromSrcInfo = srcInfo: fetchurl {
url = srcInfo.url;
sha256 = srcInfo.hash;
};
}) // args

View File

@ -1,26 +1,20 @@
a :
let
fetchurl = a.fetchurl;
s = import ./src-info-for-default.nix;
version = a.lib.attrByPath ["version"] s.version a;
s = import ./src-for-default.nix;
buildInputs = with a; [
];
in
rec {
src = fetchurl {
url = s.url;
sha256 = s.hash;
};
src = a.fetchUrlFromSrcInfo s;
inherit (s) name;
inherit buildInputs;
configureFlags = [];
/* doConfigure should be removed if not needed */
phaseNames = ["doConfigure" "doMakeInstall"];
name = "${abort "Specify name"}-" + version;
meta = {
description = "${abort "Specify description"}";
maintainers = [

View File

@ -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

View File

@ -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@'

View File

@ -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

View File

@ -0,0 +1,25 @@
a :
let
s = import ./src-for-default.nix;
buildInputs = with a; [
zlib
];
in
rec {
src = a.fetchUrlFromSrcInfo s;
inherit (s) name;
inherit buildInputs;
configureFlags = [];
/* doConfigure should be removed if not needed */
phaseNames = ["doConfigure" "doMakeInstall"];
goSrcDir = "cd GeoIP-*/";
meta = {
description = "Geolocation API";
maintainers = [
a.lib.maintainers.raskin
];
};
}

View File

@ -0,0 +1,8 @@
rec {
advertisedUrl="http://geolite.maxmind.com/download/geoip/api/c/GeoIP-1.4.6.tar.gz";
version = "1.4.6";
url="http://geolite.maxmind.com/download/geoip/api/c/GeoIP-1.4.6.tar.gz";
hash = "1i4ixj6ha62qqzsn23qg428cv1zjj2ip7kmas62xgivvgm02kd0n";
name = "geoip-1.4.6";
}

View File

@ -0,0 +1,6 @@
{
downloadPage = "http://geolite.maxmind.com/download/geoip/api/c/";
sourceRegexp = "GeoIP-[0-9.]+[.]tar[.]gz";
choiceCommand = "tail -1";
baseName = "geoip";
}

View File

@ -0,0 +1,30 @@
a :
let
s = import ./src-for-default.nix;
buildInputs = with a; [
zlib libpng freetype gd which libxml2
geoip
];
in
rec {
src = a.fetchUrlFromSrcInfo s;
inherit (s) name;
inherit buildInputs;
configureFlags = [];
/* doConfigure should be removed if not needed */
phaseNames = ["doConfigure" "doMakeInstall" "doLinks"];
doLinks = a.fullDepEntry (''
ln -s shared_en.xsl $out/share/webdruid/classic/shared.xsl
'') ["minInit"];
meta = {
description = "A web log analyzer";
maintainers = [
a.lib.maintainers.raskin
];
platforms = a.lib.platforms.all;
};
}

View File

@ -0,0 +1,8 @@
rec {
advertisedUrl="http://downloads.sourceforge.net/webdruid/files/webdruid/0.6.0-alpha5/webdruid-0.6.0-alpha5.tar.gz";
version = "0.6.0-alpha5";
url="http://downloads.sourceforge.net/webdruid/files/webdruid/${version}/webdruid-${version}.tar.gz";
hash = "1aiqffccayvf02snl9la62zqb1674cp4rv19af6xyxgvw4334hw0";
name = "webdruid-0.6.0-alpha5";
}

View File

@ -0,0 +1,7 @@
{
downloadPage = "http://sourceforge.net/projects/webdruid/files/";
choiceCommand = ''head -1 | sed -re "$skipRedirectSF"'';
versionExtractorSedScript = ''$extractReleaseSF'';
versionReferenceCreator = ''s@$version@\''${version}@g'';
baseName = "webdruid";
}

View File

@ -1516,6 +1516,11 @@ let
inherit (gtkLibs) glib;
};
webdruid = builderDefsPackage ../tools/admin/webdruid {
inherit zlib libpng freetype gd which
libxml2 geoip;
};
wget = import ../tools/networking/wget {
inherit fetchurl stdenv gettext openssl;
};
@ -3097,6 +3102,10 @@ let
inherit (gtkLibs) pango glib gtk;
};
geoip = builderDefsPackage ../development/libraries/geoip {
inherit zlib;
};
geos = import ../development/libraries/geos {
inherit fetchurl fetchsvn stdenv autoconf
automake libtool swig which lib composableDerivation python ruby;