Permalink
Browse files

Support PGXN.

The requirement of PGXN support is, to let users do

 $ pgxn install madlib

to install extension files in postgres install directory.  After that,
users can CREATE EXTENSION in SQL.

The way pgxn client works is download the zip file, unpack it, enter
the directory, configure if any, make install.  To be compatible with
this, we create a Makefile in the top directory when configured, and
let "make install" be "make -C build extension-install".  This becomes
a little surprising behavior to the normal usage out of PGXN, so
the configure creates such Makefile only if the packager indicates,
by creating META.json file in the top directory.  This is automated
with deploy/PGXN/pgxn.sh, which clones an arbitrary git repository and
m4 META.json_in into the cloned directory, then zip it.

We still need to work on the automation of META.json, but for now
we will package as stands and learn how to do it later.

MADLIB-334
  • Loading branch information...
1 parent c2ac230 commit 14a00f288119cb52fa699d52f118bbc3e1346963 @haradh1 haradh1 committed May 9, 2012
Showing with 83 additions and 0 deletions.
  1. +22 −0 configure
  2. +37 −0 deploy/PGXN/META.json_in
  3. +1 −0 deploy/PGXN/dist.ver
  4. +23 −0 deploy/PGXN/package.sh
View
22 configure
@@ -17,3 +17,25 @@ mkdir -p build
cd build
rm -f CMakeCache.txt
cmake "$@" ..
+
+# Create top-directory Makefile
+cd ..
+
+cat <<MAKEFILE >Makefile
+
+all %:
+ \$(MAKE) -C build \$@
+clean:
+ rm -f Makefile
+ rm -rf build
+MAKEFILE
+
+if [ -e META.json ]; then
+ cat <<MAKEFILE >>Makefile
+install: extension-install
+# keep a tab to do nothing for install
+
+extension-install:
+ \$(MAKE) -C build \$@
+MAKEFILE
+fi
View
37 deploy/PGXN/META.json_in
@@ -0,0 +1,37 @@
+{
+ "name": "madlib",
+ "abstract": "An open-source in-detabase analytics library",
+ "description": "An open-source in-database analytics library",
+ "version": "PGXN_VERSION",
+ "maintainer": "MADlib development team",
+ "license": "bsd",
+ "provides": {
+ "madlib": {
+ "file": "madlib--0.3.0.sql"
+ "docfile": "ReadMe.txt",
+ "version": "0.3.0"
+ }
+ },
+ "resources": {
+ "homepage": "http://madlib.net/",
+ "bugtracker": {
+ "web": "http://jira.madlib.net/"
+ },
+ "repository": {
+ "url": "https://github.com/madlib/madlib.git"
+ "web": "https://github.com/madlib/madlib",
+ "type": "git"
+ }
+ },
+ "release_status": "testing",
+ "tags": [
+ "machine learning",
+ "analytics"
+ ],
+
+
+ "meta-spec": {
+ "version": "1.0.0",
+ "url": "http://pgxn.org/meta/spec.txt"
+ }
+}
View
1 deploy/PGXN/dist.ver
@@ -0,0 +1 @@
+0.3.0alpha1
View
23 deploy/PGXN/package.sh
@@ -0,0 +1,23 @@
+#!/bin/sh
+
+GIT_URL=$1
+
+if [ -z $GIT_URL ]; then
+ echo "$0 GIT_URL"
+ exit;
+fi
+
+# This is the version string for the distribution
+TEMPDIR=`mktemp -d -t madlib`
+ORIG=`pwd`
+PGXNDIR=`dirname $0`
+PGXNDIR=`(cd $PGXNDIR; pwd)`
+VERSION=`cat $PGXNDIR/dist.ver`
+cd $TEMPDIR
+
+git clone $GIT_URL madlib-$VERSION
+
+m4 -DPGXN_VERSION=$VERSION $PGXNDIR/META.json_in > madlib-$VERSION/META.json
+zip -x "madlib-$VERSION/.git/*" -r $ORIG/madlib.zip ./madlib-$VERSION
+rm -rf madlib-$VERSION
+

0 comments on commit 14a00f2

Please sign in to comment.