From d9f328ce4d62ffda48b271884561a7d7a97ade78 Mon Sep 17 00:00:00 2001 From: dim Date: Thu, 29 Nov 2007 21:30:25 +0000 Subject: [PATCH] debian packaging --- Makefile | 34 +++++++++++++++++++++++++++++-- debian/control | 15 +++++--------- debian/docs | 2 +- debian/pgloader.links | 2 -- debian/pgloader.manpages | 2 +- debian/pycompat | 2 +- debian/pyversions | 2 +- debian/rules | 11 +--------- examples/clob/clob.data | 2 +- examples/clob/clob.out | 2 +- examples/clob/clob.sql | 2 +- examples/cluttered/cluttered.data | 2 +- examples/cluttered/cluttered.sql | 2 +- examples/csv/csv.sql | 2 +- examples/errors/errors.data | 2 +- examples/errors/errors.sql | 2 +- examples/partial/partial.sql | 2 +- examples/reformat/reformat.sql | 2 +- examples/serial/serial.data | 2 +- examples/serial/serial.sql | 2 +- examples/simple/simple.data | 2 +- examples/simple/simple.sql | 2 +- examples/udc/udc.sql | 2 +- pgloader.py | 2 +- pgloader/options.py | 2 +- 25 files changed, 59 insertions(+), 45 deletions(-) delete mode 100644 debian/pgloader.links diff --git a/Makefile b/Makefile index 4825d03..36254c0 100644 --- a/Makefile +++ b/Makefile @@ -1,4 +1,10 @@ -DOCS = pgloader.1.txt +# $Id: Makefile,v 1.6 2007-11-29 21:30:22 dim Exp $ +# +# Makefile for debian packaging purpose, make install not intended to work. + +DOCS = pgloader.1.txt +CVSROOT = $(shell cat CVS/Root) +VERSION = $(shell ./pgloader.py --version | cut -d' ' -f3) # debian setting DESTDIR = @@ -11,8 +17,12 @@ examples = examples libs = $(wildcard pgloader/*.py) refm = $(wildcard reformat/*.py) +DEBDIR = /tmp/pgloader +EXPORT = $(DEBDIR)/export/pgloader +ORIG = $(DEBDIR)/export/pgloader_$(VERSION).orig.tar.gz + install: - install -m 755 $(pgloader) $(libdir) + install -m 755 $(pgloader) $(DESTDIR)/usr/bin/pgloader install -m 755 -d $(libdir)/pgloader install -m 755 -d $(libdir)/reformat @@ -28,3 +38,23 @@ pgloader.1.xml: $(DOCS) man: ${DOCS:.txt=.xml} xmlto man $< + +deb: + # working copy from where to make the .orig archive + rm -rf $(DEBDIR) + mkdir -p $(DEBDIR)/pgloader + mkdir -p $(EXPORT) + cp -a . $(EXPORT) + for n in "*~" "*.pyc"; do \ + find $(EXPORT) -name "$$n" -print0|xargs -0 rm -f; \ + done + find $(EXPORT) -type d -name CVS -print0|xargs -0 rm -rf + + # prepare the .orig without the debian/ packaging stuff + cp -a $(EXPORT) $(DEBDIR) + rm -rf $(DEBDIR)/pgloader/debian + (cd $(DEBDIR) && tar czf $(ORIG) pgloader) + + # build the debian package and copy them to .. + (cd $(EXPORT) && debuild) + cp -a $(DEBDIR)/export/pgloader_$(VERSION)* .. diff --git a/debian/control b/debian/control index a79b8a8..c01abee 100644 --- a/debian/control +++ b/debian/control @@ -9,13 +9,8 @@ Package: pgloader Architecture: all Depends: python (>=2.4.4), python-psycopg2 | python-psycopg (<< 1.1.21) Description: loads flat data files into PostgreSQL - pgloader imports data from a flat file and insert it into a database - table. It uses a flat file per database table, and you can configure as - many Sections as you want, each one associating a table name and a data - file. - . - Data are parsed and rewritten, then given to PostgreSQL COPY command. - Parsing is necessary for dealing with end of lines and eventual trailing - separator characters, and for column reordering: your flat data file may - not have the same column order as the databse table has. - + pgloader imports data from flat files and insert it into a database + table. You have to provide a configuration file containing sections, + which each defines how to load a table. CSV and text format are + supported, the latter being able to parse multi-line non-quoted with + trailing delimiter quite CSV input, such as given by Informix UNLOAD. diff --git a/debian/docs b/debian/docs index 2312955..5937f10 100644 --- a/debian/docs +++ b/debian/docs @@ -1 +1 @@ -pgloader.1 \ No newline at end of file +pgloader.1 diff --git a/debian/pgloader.links b/debian/pgloader.links deleted file mode 100644 index 202fef5..0000000 --- a/debian/pgloader.links +++ /dev/null @@ -1,2 +0,0 @@ -/usr/share/pgloader/pgloader.py /usr/bin/pgloader - diff --git a/debian/pgloader.manpages b/debian/pgloader.manpages index 2312955..5937f10 100644 --- a/debian/pgloader.manpages +++ b/debian/pgloader.manpages @@ -1 +1 @@ -pgloader.1 \ No newline at end of file +pgloader.1 diff --git a/debian/pycompat b/debian/pycompat index d8263ee..0cfbf08 100644 --- a/debian/pycompat +++ b/debian/pycompat @@ -1 +1 @@ -2 \ No newline at end of file +2 diff --git a/debian/pyversions b/debian/pyversions index cd06769..57a7586 100644 --- a/debian/pyversions +++ b/debian/pyversions @@ -1 +1 @@ -2.3- \ No newline at end of file +2.3- diff --git a/debian/rules b/debian/rules index 97a2035..7115fbd 100644 --- a/debian/rules +++ b/debian/rules @@ -29,25 +29,16 @@ configure-stamp: build: build-stamp + $(MAKE) man build-stamp: configure-stamp dh_testdir - - # Add here commands to compile the package. - #$(MAKE) - #docbook-to-man pgloader.1.sgml > pgloader.1 - $(MAKE) man - touch $@ clean: dh_testdir dh_testroot rm -f build-stamp configure-stamp - - # Add here commands to clean up after the build process. - -$(MAKE) clean - dh_clean install: build diff --git a/examples/clob/clob.data b/examples/clob/clob.data index ce2a1e8..880e9ab 100644 --- a/examples/clob/clob.data +++ b/examples/clob/clob.data @@ -4,4 +4,4 @@ 4|59,15,clob.out 5|6e,13,clob.out 6|81,6,clob.out -7|87,d,clob.out \ No newline at end of file +7|87,d,clob.out diff --git a/examples/clob/clob.out b/examples/clob/clob.out index d9a15de..93af061 100644 --- a/examples/clob/clob.out +++ b/examples/clob/clob.out @@ -1 +1 @@ -This is some clob dataTo be used on several data entryReferences to those are to be foundIn the clob.data fileThey refer to beginlengthand filename. \ No newline at end of file +This is some clob dataTo be used on several data entryReferences to those are to be foundIn the clob.data fileThey refer to beginlengthand filename. diff --git a/examples/clob/clob.sql b/examples/clob/clob.sql index d59fb26..1db377b 100644 --- a/examples/clob/clob.sql +++ b/examples/clob/clob.sql @@ -1,4 +1,4 @@ CREATE TABLE clob ( a integer primary key, b text -); \ No newline at end of file +); diff --git a/examples/cluttered/cluttered.data b/examples/cluttered/cluttered.data index 484374c..044efe2 100644 --- a/examples/cluttered/cluttered.data +++ b/examples/cluttered/cluttered.data @@ -13,4 +13,4 @@ escaping^just to test^ escaped value\ \ with empty line\ -embeded^last line^ \ No newline at end of file +embeded^last line^ diff --git a/examples/cluttered/cluttered.sql b/examples/cluttered/cluttered.sql index d327cf6..d8f7ff3 100644 --- a/examples/cluttered/cluttered.sql +++ b/examples/cluttered/cluttered.sql @@ -2,4 +2,4 @@ CREATE TABLE cluttered ( a integer primary key, b text, c text -); \ No newline at end of file +); diff --git a/examples/csv/csv.sql b/examples/csv/csv.sql index ed0c5f7..f9995bb 100644 --- a/examples/csv/csv.sql +++ b/examples/csv/csv.sql @@ -3,4 +3,4 @@ CREATE TABLE csv ( b bigint, c char(2), d text -); \ No newline at end of file +); diff --git a/examples/errors/errors.data b/examples/errors/errors.data index 33ca814..0432b98 100644 --- a/examples/errors/errors.data +++ b/examples/errors/errors.data @@ -4,4 +4,4 @@ 4|\ |2006-16-4| 5|some fifth row text|2006-5-12| 6|some sixth row text|2006-13-10| -7|some null date to play with|| \ No newline at end of file +7|some null date to play with|| diff --git a/examples/errors/errors.sql b/examples/errors/errors.sql index 8daead7..0d8e2ed 100644 --- a/examples/errors/errors.sql +++ b/examples/errors/errors.sql @@ -2,4 +2,4 @@ CREATE TABLE errors ( a integer primary key, b date, c text -); \ No newline at end of file +); diff --git a/examples/partial/partial.sql b/examples/partial/partial.sql index b58b0fa..21faaf7 100644 --- a/examples/partial/partial.sql +++ b/examples/partial/partial.sql @@ -4,4 +4,4 @@ CREATE TABLE partial ( c text, d text, e text -); \ No newline at end of file +); diff --git a/examples/reformat/reformat.sql b/examples/reformat/reformat.sql index 1277673..983d418 100644 --- a/examples/reformat/reformat.sql +++ b/examples/reformat/reformat.sql @@ -1,4 +1,4 @@ CREATE TABLE reformat ( id integer primary key, timestamp timestamp -); \ No newline at end of file +); diff --git a/examples/serial/serial.data b/examples/serial/serial.data index 43e3d5d..6428a73 100644 --- a/examples/serial/serial.data +++ b/examples/serial/serial.data @@ -4,4 +4,4 @@ some third row text;2006-10-12 \ ;2006-10-4 some fifth row text;2006-5-12 some sixth row text;2006-7-10 -some null date to play with; \ No newline at end of file +some null date to play with; diff --git a/examples/serial/serial.sql b/examples/serial/serial.sql index 916e00e..6fba76d 100644 --- a/examples/serial/serial.sql +++ b/examples/serial/serial.sql @@ -2,4 +2,4 @@ CREATE TABLE serial ( a serial primary key, b date, c text -); \ No newline at end of file +); diff --git a/examples/simple/simple.data b/examples/simple/simple.data index 5af4588..adfb1b1 100644 --- a/examples/simple/simple.data +++ b/examples/simple/simple.data @@ -4,4 +4,4 @@ 4|\ |2006-10-4| 5|some fifth row text|2006-5-12| 6|some sixth row text|10/7/6| -7|some null date to play with|| \ No newline at end of file +7|some null date to play with|| diff --git a/examples/simple/simple.sql b/examples/simple/simple.sql index 981bd68..762040b 100644 --- a/examples/simple/simple.sql +++ b/examples/simple/simple.sql @@ -2,4 +2,4 @@ CREATE TABLE simple ( a integer primary key, b date, c text -); \ No newline at end of file +); diff --git a/examples/udc/udc.sql b/examples/udc/udc.sql index 3558801..5ec8666 100644 --- a/examples/udc/udc.sql +++ b/examples/udc/udc.sql @@ -2,4 +2,4 @@ CREATE TABLE udc ( b integer primary key, c text, d integer -); \ No newline at end of file +); diff --git a/pgloader.py b/pgloader.py index 54bef13..0f7f535 100644 --- a/pgloader.py +++ b/pgloader.py @@ -108,7 +108,7 @@ def parse_options(): (opts, args) = parser.parse_args() if opts.version: - print "PgLoader version %s" % pgloader.options.PGLOADER_VERSION + print "PGLoader version %s" % pgloader.options.PGLOADER_VERSION sys.exit(0) # check existence en read ability of config file diff --git a/pgloader/options.py b/pgloader/options.py index 8ef7310..a410d3a 100644 --- a/pgloader/options.py +++ b/pgloader/options.py @@ -2,7 +2,7 @@ # # Some common options, for each module to get them -PGLOADER_VERSION = '2.2.5-devel' +PGLOADER_VERSION = '2.2.5~dev' INPUT_ENCODING = None PG_CLIENT_ENCODING = 'latin9'