python-db/python-db.spec

Tue, 22 Mar 2011 19:33:14 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Tue, 22 Mar 2011 19:33:14 +0100
changeset 313
fc0449ec63bb
child 314
1f760a8355e2
permissions
-rw-r--r--

Import package vendor original specs for necessary manipulations.

michael@313 1 ##
michael@313 2 ## python-db.spec -- OpenPKG RPM Package Specification
michael@313 3 ## Copyright (c) 2000-2010 OpenPKG Foundation e.V. <http://openpkg.net/>
michael@313 4 ##
michael@313 5 ## Permission to use, copy, modify, and distribute this software for
michael@313 6 ## any purpose with or without fee is hereby granted, provided that
michael@313 7 ## the above copyright notice and this permission notice appear in all
michael@313 8 ## copies.
michael@313 9 ##
michael@313 10 ## THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
michael@313 11 ## WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
michael@313 12 ## MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
michael@313 13 ## IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR
michael@313 14 ## CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
michael@313 15 ## SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
michael@313 16 ## LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
michael@313 17 ## USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
michael@313 18 ## ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
michael@313 19 ## OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
michael@313 20 ## OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
michael@313 21 ## SUCH DAMAGE.
michael@313 22 ##
michael@313 23
michael@313 24 # FIXME: rse: Oracle module was blindly packaged
michael@313 25
michael@313 26 # package version
michael@313 27 %define V_python 2.5
michael@313 28 %define V_pysqlite_major 2.4
michael@313 29 %define V_pysqlite 2.4.1
michael@313 30 %define V_psycopg2 2.0.14
michael@313 31 %define V_mysql_python 1.2.3c1
michael@313 32 %define V_cx_oracle 5.0.3
michael@313 33 %define V_sqlobject 0.12.4
michael@313 34
michael@313 35 # package information
michael@313 36 Name: python-db
michael@313 37 Summary: Python DB-API 2.0 Modules
michael@313 38 URL: http://www.python.org/
michael@313 39 Vendor: Python Community
michael@313 40 Packager: OpenPKG Foundation e.V.
michael@313 41 Distribution: OpenPKG Community
michael@313 42 Class: EVAL
michael@313 43 Group: Language
michael@313 44 License: GPL
michael@313 45 Version: %{V_python}
michael@313 46 Release: 20100506
michael@313 47
michael@313 48 # package options
michael@313 49 %option with_sqlite yes
michael@313 50 %option with_pgsql no
michael@313 51 %option with_mysql no
michael@313 52 %option with_oracle no
michael@313 53
michael@313 54 # list of sources
michael@313 55 Source0: http://initd.org/pub/software/pysqlite/releases/%{V_pysqlite_major}/%{V_pysqlite}/pysqlite-%{V_pysqlite}.tar.gz
michael@313 56 Source1: http://initd.org/pub/software/psycopg/psycopg2-%{V_psycopg2}.tar.gz
michael@313 57 Source2: http://switch.dl.sourceforge.net/mysql-python/MySQL-python-%{V_mysql_python}.tar.gz
michael@313 58 Source3: http://switch.dl.sourceforge.net/cx-oracle/cx_Oracle-%{V_cx_oracle}.tar.gz
michael@313 59 Source4: http://pypi.python.org/packages/source/S/SQLObject/SQLObject-%{V_sqlobject}.tar.gz
michael@313 60 Patch0: python-db.patch
michael@313 61
michael@313 62 # build information
michael@313 63 BuildPreReq: OpenPKG, openpkg >= 20100101, python >= %{V_python}
michael@313 64 PreReq: OpenPKG, openpkg >= 20100101, python >= %{V_python}
michael@313 65 BuildPreReq: python-setup
michael@313 66 %if "%{with_sqlite}" == "yes"
michael@313 67 BuildPreReq: sqlite
michael@313 68 PreReq: sqlite
michael@313 69 %endif
michael@313 70 %if "%{with_pgsql}" == "yes"
michael@313 71 BuildPreReq: postgresql
michael@313 72 PreReq: postgresql
michael@313 73 %endif
michael@313 74 %if "%{with_mysql}" == "yes"
michael@313 75 BuildPreReq: mysql
michael@313 76 PreReq: mysql
michael@313 77 %endif
michael@313 78 %if "%{with_oracle}" == "yes"
michael@313 79 BuildPreReq: oracle
michael@313 80 PreReq: oracle
michael@313 81 %endif
michael@313 82
michael@313 83 %description
michael@313 84 This packages provides Python DB-API 2.0 compliant bindings to
michael@313 85 various RDBMS. It currently supports SQLite, PostgreSQL, MySQL and
michael@313 86 Oracle.
michael@313 87
michael@313 88 %track
michael@313 89 prog python-db:pysqlite = {
michael@313 90 version = %{V_pysqlite}
michael@313 91 url = http://initd.org/pub/software/pysqlite/releases/
michael@313 92 regex = (\d+\.\d+)/
michael@313 93 url = http://initd.org/pub/software/pysqlite/releases/__NEWVER1__/
michael@313 94 regex = (\d+\.\d+\.\d+)/
michael@313 95 url = http://initd.org/pub/software/pysqlite/releases/__NEWVER1__/__NEWVER2__/
michael@313 96 regex = pysqlite-(__VER__)\.tar\.gz
michael@313 97 }
michael@313 98 prog python-db:psycopg2 = {
michael@313 99 version = %{V_psycopg2}
michael@313 100 url = http://initd.org/pub/software/psycopg/
michael@313 101 regex = psycopg2-(__VER__)\.tar\.gz
michael@313 102 }
michael@313 103 prog python-db:mysql-python = {
michael@313 104 version = %{V_mysql_python}
michael@313 105 url = http://sourceforge.net/projects/mysql-python/files/
michael@313 106 regex = MySQL-python-(__VER__)\.tar\.gz
michael@313 107 }
michael@313 108 prog python-db:cx_oracle = {
michael@313 109 version = %{V_cx_oracle}
michael@313 110 url = http://sourceforge.net/projects/cx-oracle/files/
michael@313 111 regex = cx_Oracle-(__VER__)\.tar\.gz
michael@313 112 }
michael@313 113 prog python-db:sqlobject = {
michael@313 114 version = %{V_sqlobject}
michael@313 115 url = http://pypi.python.org/pypi/SQLObject
michael@313 116 regex = pypi/SQLObject/(__VER__)
michael@313 117 }
michael@313 118
michael@313 119 %prep
michael@313 120 %setup -q -c
michael@313 121 %setup -q -T -D -a 1
michael@313 122 %setup -q -T -D -a 2
michael@313 123 %setup -q -T -D -a 3
michael@313 124 %setup -q -T -D -a 4
michael@313 125 %patch -p0
michael@313 126
michael@313 127 %build
michael@313 128 %if "%{with_sqlite}" == "yes"
michael@313 129 ( cd pysqlite-%{V_pysqlite}
michael@313 130 %{l_shtool} subst \
michael@313 131 -e 's;^\([ »··]*include_dirs = \[\)\([^\]]*\).*$;\1"%{l_prefix}/include"\2;' \
michael@313 132 -e 's;^\([ »··]*library_dirs = \[\)\([^\]]*\).*$;\1"%{l_prefix}/lib"\2;' \
michael@313 133 setup.py
michael@313 134 %{l_prefix}/bin/python setup.py build
michael@313 135 ) || exit $?
michael@313 136 %endif
michael@313 137 %if "%{with_pgsql}" == "yes"
michael@313 138 ( cd psycopg2-%{V_psycopg2}
michael@313 139 %{l_prefix}/bin/python setup.py build
michael@313 140 ) || exit $?
michael@313 141 %endif
michael@313 142 %if "%{with_mysql}" == "yes"
michael@313 143 ( cd MySQL-python-%{V_mysql_python}
michael@313 144 %{l_prefix}/bin/python setup.py build
michael@313 145 ) || exit $?
michael@313 146 %endif
michael@313 147 %if "%{with_oracle}" == "yes"
michael@313 148 ( cd cx_Oracle-%{V_cx_oracle}
michael@313 149 %{l_shtool} subst \
michael@313 150 -e 's;^\(PYTHON=\).*$;\1 %{l_prefix}/bin/python;' \
michael@313 151 Makefile
michael@313 152 ORACLE_HOME="`%{l_rc} --query oracle_home`"
michael@313 153 export ORACLE_HOME
michael@313 154 %{l_prefix}/bin/python setup.py build
michael@313 155 ) || exit $?
michael@313 156 %endif
michael@313 157 ( cd SQLObject-%{V_sqlobject}
michael@313 158 %{l_prefix}/bin/python setup.py build
michael@313 159 ) || exit $?
michael@313 160
michael@313 161 %install
michael@313 162 %{l_shtool} mkdir -f -p -m 755 \
michael@313 163 $RPM_BUILD_ROOT%{l_prefix}
michael@313 164 %if "%{with_sqlite}" == "yes"
michael@313 165 ( cd pysqlite-%{V_pysqlite}
michael@313 166 %{l_prefix}/bin/python setup.py install \
michael@313 167 --skip-build \
michael@313 168 --root=$RPM_BUILD_ROOT \
michael@313 169 --prefix=%{l_prefix}
michael@313 170 rm -rf $RPM_BUILD_ROOT%{l_prefix}/pysqlite2-doc
michael@313 171 ) || exit $?
michael@313 172 %endif
michael@313 173 %if "%{with_pgsql}" == "yes"
michael@313 174 ( cd psycopg2-%{V_psycopg2}
michael@313 175 %{l_prefix}/bin/python setup.py install \
michael@313 176 --skip-build \
michael@313 177 --root=$RPM_BUILD_ROOT \
michael@313 178 --prefix=%{l_prefix}
michael@313 179 ) || exit $?
michael@313 180 %endif
michael@313 181 %if "%{with_mysql}" == "yes"
michael@313 182 ( cd MySQL-python-%{V_mysql_python}
michael@313 183 %{l_prefix}/bin/python setup.py install \
michael@313 184 --skip-build \
michael@313 185 --root=$RPM_BUILD_ROOT \
michael@313 186 --prefix=%{l_prefix}
michael@313 187 ) || exit $?
michael@313 188 %endif
michael@313 189 %if "%{with_oracle}" == "yes"
michael@313 190 ( cd cx_Oracle-%{V_cx_oracle}
michael@313 191 ORACLE_HOME="`%{l_rc} --query oracle_home`"
michael@313 192 export ORACLE_HOME
michael@313 193 %{l_prefix}/bin/python setup.py install \
michael@313 194 --skip-build \
michael@313 195 --root=$RPM_BUILD_ROOT \
michael@313 196 --prefix=%{l_prefix}
michael@313 197 ) || exit $?
michael@313 198 %endif
michael@313 199 ( cd SQLObject-%{V_sqlobject}
michael@313 200 %{l_prefix}/bin/python setup.py install \
michael@313 201 --skip-build \
michael@313 202 --root=$RPM_BUILD_ROOT \
michael@313 203 --prefix=%{l_prefix}
michael@313 204 ) || exit $?
michael@313 205 %{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT %{l_files_std}
michael@313 206
michael@313 207 %files -f files
michael@313 208
michael@313 209 %clean
michael@313 210

mercurial