From a9ac98e7bbebb5feef64079d715fd78ab925ce47 Mon Sep 17 00:00:00 2001 From: LtWorf Date: Tue, 9 Dec 2008 17:24:24 +0000 Subject: [PATCH] Deb postinstall generates optimized files git-svn-id: http://galileo.dmi.unict.it/svn/relational/trunk@71 014f5005-505e-4b48-8d0a-63407b615a7c --- CHANGELOG | 3 ++- Makefile | 29 ++++++++++++++++++++++------- relational.1 | 2 +- 3 files changed, 25 insertions(+), 9 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index 2980ce3..c04b6d8 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -49,4 +49,5 @@ 0.8 - Added __eq__ to relation object, will compare ignoring order. - New default relation's format is csv, as defined in RFC4180 -- Converted sample's relations to csv \ No newline at end of file +- Converted sample's relations to csv +- Deb postinstall generates optimized files diff --git a/Makefile b/Makefile index 035c524..f88046f 100644 --- a/Makefile +++ b/Makefile @@ -45,7 +45,7 @@ debian: echo "This program is under the GPLv3 license" >> data/usr/share/doc/relational/copyright cp CHANGELOG data/usr/share/doc/relational/changelog - echo "relational ("`./relational.py -v | cut -d. -f1`":"`./relational.py -v`") unstable; urgency=low" >> data/usr/share/doc/relational/changelog.Debian + echo "relational ("`./relational.py -v | cut -d. -f1`":"`./relational.py -v`+SVN`svn update | cut -d" " -f3 | tr -d "."`") unstable; urgency=low" >> data/usr/share/doc/relational/changelog.Debian echo "" >> data/usr/share/doc/relational/changelog.Debian echo " * Automatically generated package, see changelog.gz" >> data/usr/share/doc/relational/changelog.Debian echo "" >> data/usr/share/doc/relational/changelog.Debian @@ -77,10 +77,10 @@ debian: mkdir -p data/DEBIAN #package description echo "Package: relational" >> data/DEBIAN/control - echo "Version: "`./relational.py -v | cut -d. -f1`":"`./relational.py -v` >> data/DEBIAN/control + echo "Version: "`./relational.py -v | cut -d. -f1`":"`./relational.py -v`+SVN`svn update | cut -d" " -f3 | tr -d "."`>> data/DEBIAN/control echo "Architecture: all" >> data/DEBIAN/control echo "Maintainer: Salvo 'LtWorf' Tomaselli " >> data/DEBIAN/control - echo "Installed-Size: "`du -bs --apparent-size data/ | cut -f1` >> data/DEBIAN/control + echo "Installed-Size: "`du -s --apparent-size data/ | cut -f1` >> data/DEBIAN/control echo "Depends: python-qt4 (>= 4.0.1-5), python (>= 2.3)" >> data/DEBIAN/control echo "Recommends: libqt4-webkit (>= 4.4.3-1)" >> data/DEBIAN/control echo "Section: devel" >> data/DEBIAN/control @@ -89,8 +89,23 @@ debian: echo "Description: Python implementation of Relational algebra.">> data/DEBIAN/control echo " This program provides a GUI to execute relational algebra queries.">> data/DEBIAN/control echo " It is meant to be used for educational purposes.">> data/DEBIAN/control - su -c "chown -R root:root data/*; dpkg -b data/ relational.deb; rm -rf data/" - cp relational.deb relational_`./relational.py -v`.deb - rm -f relational.deb + + #Postinst to generate optimized files + echo "#!/usr/bin/python" > data/DEBIAN/postinst + echo "import py_compile" >> data/DEBIAN/postinst + echo "import os" >> data/DEBIAN/postinst + printf "for i in os.listdir(\"/usr/share/python-support/relational/\"):\n" >> data/DEBIAN/postinst + printf " if i.endswith(\".py\"):\n" >> data/DEBIAN/postinst + printf " py_compile.compile(\"/usr/share/python-support/relational/\"+i)\n" >> data/DEBIAN/postinst + + #Postrm file to remove optimized generated python files + echo "#!/bin/sh" > data/DEBIAN/postrm + echo "set -e" >> data/DEBIAN/postrm + echo "rm -rf /usr/share/python-support/relational/" >> data/DEBIAN/postrm + echo "exit 0" >> data/DEBIAN/postrm + + chmod 0755 data/DEBIAN/postrm data/DEBIAN/postinst - \ No newline at end of file + su -c "chown -R root:root data/*; dpkg -b data/ relational.deb; rm -rf data/" + cp relational.deb relational_`./relational.py -v`+SVN`svn update | cut -d" " -f3 | tr -d "."`.deb + rm -f relational.deb diff --git a/relational.1 b/relational.1 index dffec03..f95244a 100644 --- a/relational.1 +++ b/relational.1 @@ -1,6 +1,6 @@ .TH "Relational" "1" .SH "NAME" -relational \(em .Python implementation of Relational algebra. +relational \(em Python implementation of Relational algebra. .SH "SYNOPSIS" .PP \fBrelational\fR [\-v\fR\fP]