From 9f1ccebf513095fe6768929bcef64acc0224178b Mon Sep 17 00:00:00 2001 From: Robin Gloster Date: Mon, 5 Mar 2018 17:27:39 +0100 Subject: [PATCH] postgis_2_3: remove 2.4 supports all packaged postgresql versions --- pkgs/development/libraries/postgis/2.3.nix | 102 ------------------ .../libraries/postgis/pg_db_postgis_enable.sh | 38 ------- .../pg_db_postgis_fix_or_load_sql_dump.sh | 52 --------- pkgs/top-level/all-packages.nix | 1 - 4 files changed, 193 deletions(-) delete mode 100644 pkgs/development/libraries/postgis/2.3.nix delete mode 100644 pkgs/development/libraries/postgis/pg_db_postgis_enable.sh delete mode 100644 pkgs/development/libraries/postgis/pg_db_postgis_fix_or_load_sql_dump.sh diff --git a/pkgs/development/libraries/postgis/2.3.nix b/pkgs/development/libraries/postgis/2.3.nix deleted file mode 100644 index 8e6218a0d561..000000000000 --- a/pkgs/development/libraries/postgis/2.3.nix +++ /dev/null @@ -1,102 +0,0 @@ -{ fetchurl -, stdenv -, perl -, libxml2 -, postgresql -, geos -, proj -, flex -, gdal -, json_c -, pkgconfig -, file -}: - - /* - - ### NixOS - usage: - ================== - - services.postgresql.extraPlugins = [ (pkgs.postgis.override { postgresql = pkgs.postgresql95; }) ]; - - - ### important Postgis implementation details: - ============================================= - - Postgis provides a shared library implementing many operations. They are - exposed to the Postgres SQL interpreter by special SQL queries eg: - - CREATE FUNCTION [...] - AS '[..]liblwgeom', 'lwhistogram2d_in' LANGUAGE 'C' IMMUTABLE STRICT; -- WITH (isstrict); - - where liblwgeom is the shared library. - Postgis < 1.5 used absolute paths, in NixOS $libdir is always used. - - Thus if you want to use postgresql dumps which were created by non NixOS - systems you have to adopt the library path. - - - ### TODO: - ========= - the bin commands to have gtk gui: - */ - - -let - version = "2.3.1"; - sha256 = "0xd21h2k6x3i1b3z6pgm3pmkfpxm6irxd5wbx68acjndjgd6p3ac"; -in stdenv.mkDerivation rec { - name = "postgis-${version}"; - - src = fetchurl { - url = "http://download.osgeo.org/postgis/source/postgis-${builtins.toString version}.tar.gz"; - inherit sha256; - }; - - # don't pass these vars to the builder - removeAttrs = ["sql_comments" "sql_srcs"]; - - # create aliases for all commands adding version information - postInstall = '' - sql_srcs=$(for sql in ${builtins.toString sql_srcs}; do echo -n "$(find $out -iname "$sql") "; done ) - - for prog in $out/bin/*; do # */ - ln -s $prog $prog-${version} - done - - cp -r doc $out - ''; - - buildInputs = [ libxml2 postgresql geos proj perl gdal json_c pkgconfig ]; - - sql_comments = "postgis_comments.sql"; - - sql_srcs = ["postgis.sql" "spatial_ref_sys.sql"]; - - # postgis config directory assumes /include /lib from the same root for json-c library - NIX_LDFLAGS = "-L${stdenv.lib.getLib json_c}/lib"; - - dontDisableStatic = true; - preConfigure = '' - sed -i 's@/usr/bin/file@${file}/bin/file@' configure - configureFlags="--datadir=$out/share --datarootdir=$out/share --bindir=$out/bin --with-gdalconfig=${gdal}/bin/gdal-config --with-jsondir=${json_c.dev}" - makeFlags="PERL=${perl}/bin/perl datadir=$out/share pkglibdir=$out/lib bindir=$out/bin" - ''; - postConfigure = '' - sed -i "s|@mkdir -p \$(DESTDIR)\$(PGSQL_BINDIR)||g ; - s|\$(DESTDIR)\$(PGSQL_BINDIR)|$prefix/bin|g - " \ - "raster/loader/Makefile"; - sed -i "s|\$(DESTDIR)\$(PGSQL_BINDIR)|$prefix/bin|g - " \ - "raster/scripts/python/Makefile"; - ''; - - meta = with stdenv.lib; { - description = "Geographic Objects for PostgreSQL"; - homepage = http://postgis.refractions.net; - license = licenses.gpl2; - maintainers = [ maintainers.marcweber ]; - platforms = platforms.linux; - }; -} diff --git a/pkgs/development/libraries/postgis/pg_db_postgis_enable.sh b/pkgs/development/libraries/postgis/pg_db_postgis_enable.sh deleted file mode 100644 index c7652e20d9f3..000000000000 --- a/pkgs/development/libraries/postgis/pg_db_postgis_enable.sh +++ /dev/null @@ -1,38 +0,0 @@ -#!/bin/sh -sql_files=(@sql_srcs@) -sql_comments=@sql_comments@ - -do_help(){ echo "$0 [--comments] db_name1 [db_name2 ..]"; } - -for arg in "$@"; do - case "$arg" in - -h|--help) - do_help; exit 0 - ;; - --comments) - LOAD_COMMENTS=1 - ;; - *) - dbs=(${dbs[@]} "$arg") - ;; - esac -done - -PSQL(){ - echo ">> loading $1" - psql -d "$db" -f $1 -} - -for db in ${dbs[@]}; do - createlang plpgsql "$db" - - # mandatory - for sql in $sql_files; do - PSQL $sql - done - - # optionally load some comments - if [ -n "$LOAD_COMMENTS" ]; then - PSQL $sql_comments - fi -done diff --git a/pkgs/development/libraries/postgis/pg_db_postgis_fix_or_load_sql_dump.sh b/pkgs/development/libraries/postgis/pg_db_postgis_fix_or_load_sql_dump.sh deleted file mode 100644 index 6a98c5d24ca8..000000000000 --- a/pkgs/development/libraries/postgis/pg_db_postgis_fix_or_load_sql_dump.sh +++ /dev/null @@ -1,52 +0,0 @@ -#!/bin/sh -libName=@libName@ - -# this is a quick and dirty implementation - -do_help(){ - echo "$0 --str str in-file|- [out|-|psql:db]"; - echo "in: - = STDIN or filename"; - echo "out: - = STDIN or filename or psql:database_name" - echo " psql:database_name will load the dump into the database" - echo " if out is omitted in is used for out (same file)" - echo "--str: different replacement string. Eg for Ubuntu use: '/usr/lib/postgresql/8.3/lib/liblwgeom'"; - echo "WARNING: A postgis dump is not meant to be distributed - it still may be useful :)" -} - -if [ -z "$1" -o "$1" = --help -o "$1" = -h ]; then - do_help; exit 1 -fi - -tostr='$libdir/'"$libName" -if [ "$1" == "--str" ]; then - to="$2"; shift 2 -fi - -i=$1 -o="${2:-$1}" - -cmd_in(){ - case "$i" in - -) cat;; - *) cat "$i";; - esac -} - -cmd_out(){ - case "$o" in - -) cat;; # stdout - psql:*) psql "${o:5}";; # pipe into psql - *) - t=`mktemp`; cat > "$t"; mv "$t" "$o" - ;; - esac -} - -cmd_replace(){ - contents=`cat` - # get wrong library path: - fromstr=$(echo "$contents" | head -n 50 | sed -n "s/.*AS '\([^']*\)'.*/\1/p" | head -n 1) - echo "$contents" | sed "s@AS '$fromstr@AS '$tostr@g" -} - -cmd_in | cmd_replace | cmd_out diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index f54b163c1305..28bb42acfe9f 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -10890,7 +10890,6 @@ with pkgs; }; postgis = callPackage ../development/libraries/postgis { }; - postgis_2_3 = callPackage ../development/libraries/postgis/2.3.nix { }; protobuf = callPackage ../development/libraries/protobuf/3.4.nix { };