Mon, 28 Jan 2013 17:37:18 +0100
Correct socket error reporting improvement with IPv6 portable code,
after helpful recommendation by Saúl Ibarra Corretgé on OSips devlist.
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 | # package version |
michael@314 | 25 | %define V_python 2.7 |
michael@314 | 26 | %define V_pysqlite 2.6.3 |
michael@314 | 27 | %define V_psycopg2 2.4 |
michael@314 | 28 | %define V_psycopg_maj 2-4 |
michael@314 | 29 | %define V_mysql_python 1.2.3 |
michael@314 | 30 | %define V_cx_oracle 5.1 |
michael@314 | 31 | %define V_sqlobject 0.15.1 |
michael@313 | 32 | |
michael@313 | 33 | # package information |
michael@313 | 34 | Name: python-db |
michael@313 | 35 | Summary: Python DB-API 2.0 Modules |
michael@313 | 36 | URL: http://www.python.org/ |
michael@313 | 37 | Vendor: Python Community |
michael@313 | 38 | Packager: OpenPKG Foundation e.V. |
michael@313 | 39 | Distribution: OpenPKG Community |
michael@313 | 40 | Class: EVAL |
michael@313 | 41 | Group: Language |
michael@313 | 42 | License: GPL |
michael@313 | 43 | Version: %{V_python} |
michael@314 | 44 | Release: 20110322 |
michael@313 | 45 | |
michael@313 | 46 | # package options |
michael@313 | 47 | %option with_sqlite yes |
michael@313 | 48 | %option with_pgsql no |
michael@313 | 49 | %option with_mysql no |
michael@313 | 50 | %option with_oracle no |
michael@313 | 51 | |
michael@313 | 52 | # list of sources |
michael@314 | 53 | Source0: http://pysqlite.googlecode.com/files/pysqlite-%{V_pysqlite}.tar.gz |
michael@314 | 54 | Source1: http://www.psycopg.org/psycopg/tarballs/PSYCOPG-%{V_psycopg_maj}/psycopg2-%{V_psycopg2}.tar.gz |
michael@313 | 55 | Source2: http://switch.dl.sourceforge.net/mysql-python/MySQL-python-%{V_mysql_python}.tar.gz |
michael@313 | 56 | Source3: http://switch.dl.sourceforge.net/cx-oracle/cx_Oracle-%{V_cx_oracle}.tar.gz |
michael@313 | 57 | Source4: http://pypi.python.org/packages/source/S/SQLObject/SQLObject-%{V_sqlobject}.tar.gz |
michael@313 | 58 | Patch0: python-db.patch |
michael@313 | 59 | |
michael@313 | 60 | # build information |
michael@314 | 61 | Prefix: %{l_prefix} |
michael@314 | 62 | BuildRoot: %{l_buildroot} |
michael@314 | 63 | BuildPreReq: OpenPKG, openpkg >= 20060823, python >= %{V_python} |
michael@314 | 64 | PreReq: OpenPKG, openpkg >= 20060823, 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@314 | 82 | AutoReq: no |
michael@314 | 83 | AutoReqProv: no |
michael@313 | 84 | |
michael@313 | 85 | %description |
michael@313 | 86 | This packages provides Python DB-API 2.0 compliant bindings to |
michael@313 | 87 | various RDBMS. It currently supports SQLite, PostgreSQL, MySQL and |
michael@313 | 88 | Oracle. |
michael@313 | 89 | |
michael@313 | 90 | %track |
michael@313 | 91 | prog python-db:pysqlite = { |
michael@313 | 92 | version = %{V_pysqlite} |
michael@313 | 93 | url = http://initd.org/pub/software/pysqlite/releases/ |
michael@313 | 94 | regex = (\d+\.\d+)/ |
michael@313 | 95 | url = http://initd.org/pub/software/pysqlite/releases/__NEWVER1__/ |
michael@313 | 96 | regex = (\d+\.\d+\.\d+)/ |
michael@313 | 97 | url = http://initd.org/pub/software/pysqlite/releases/__NEWVER1__/__NEWVER2__/ |
michael@313 | 98 | regex = pysqlite-(__VER__)\.tar\.gz |
michael@313 | 99 | } |
michael@313 | 100 | prog python-db:psycopg2 = { |
michael@313 | 101 | version = %{V_psycopg2} |
michael@313 | 102 | url = http://initd.org/pub/software/psycopg/ |
michael@313 | 103 | regex = psycopg2-(__VER__)\.tar\.gz |
michael@313 | 104 | } |
michael@313 | 105 | prog python-db:mysql-python = { |
michael@313 | 106 | version = %{V_mysql_python} |
michael@313 | 107 | url = http://sourceforge.net/projects/mysql-python/files/ |
michael@313 | 108 | regex = MySQL-python-(__VER__)\.tar\.gz |
michael@313 | 109 | } |
michael@313 | 110 | prog python-db:cx_oracle = { |
michael@313 | 111 | version = %{V_cx_oracle} |
michael@313 | 112 | url = http://sourceforge.net/projects/cx-oracle/files/ |
michael@313 | 113 | regex = cx_Oracle-(__VER__)\.tar\.gz |
michael@313 | 114 | } |
michael@313 | 115 | prog python-db:sqlobject = { |
michael@313 | 116 | version = %{V_sqlobject} |
michael@313 | 117 | url = http://pypi.python.org/pypi/SQLObject |
michael@313 | 118 | regex = pypi/SQLObject/(__VER__) |
michael@313 | 119 | } |
michael@313 | 120 | |
michael@313 | 121 | %prep |
michael@313 | 122 | %setup -q -c |
michael@313 | 123 | %setup -q -T -D -a 1 |
michael@313 | 124 | %setup -q -T -D -a 2 |
michael@313 | 125 | %setup -q -T -D -a 3 |
michael@313 | 126 | %setup -q -T -D -a 4 |
michael@313 | 127 | %patch -p0 |
michael@313 | 128 | |
michael@313 | 129 | %build |
michael@313 | 130 | %if "%{with_sqlite}" == "yes" |
michael@313 | 131 | ( cd pysqlite-%{V_pysqlite} |
michael@313 | 132 | %{l_shtool} subst \ |
michael@313 | 133 | -e 's;^\([ »··]*include_dirs = \[\)\([^\]]*\).*$;\1"%{l_prefix}/include"\2;' \ |
michael@313 | 134 | -e 's;^\([ »··]*library_dirs = \[\)\([^\]]*\).*$;\1"%{l_prefix}/lib"\2;' \ |
michael@313 | 135 | setup.py |
michael@313 | 136 | %{l_prefix}/bin/python setup.py build |
michael@313 | 137 | ) || exit $? |
michael@313 | 138 | %endif |
michael@313 | 139 | %if "%{with_pgsql}" == "yes" |
michael@313 | 140 | ( cd psycopg2-%{V_psycopg2} |
michael@313 | 141 | %{l_prefix}/bin/python setup.py build |
michael@313 | 142 | ) || exit $? |
michael@313 | 143 | %endif |
michael@313 | 144 | %if "%{with_mysql}" == "yes" |
michael@313 | 145 | ( cd MySQL-python-%{V_mysql_python} |
michael@313 | 146 | %{l_prefix}/bin/python setup.py build |
michael@313 | 147 | ) || exit $? |
michael@313 | 148 | %endif |
michael@313 | 149 | %if "%{with_oracle}" == "yes" |
michael@313 | 150 | ( cd cx_Oracle-%{V_cx_oracle} |
michael@313 | 151 | %{l_shtool} subst \ |
michael@313 | 152 | -e 's;^\(PYTHON=\).*$;\1 %{l_prefix}/bin/python;' \ |
michael@313 | 153 | Makefile |
michael@313 | 154 | ORACLE_HOME="`%{l_rc} --query oracle_home`" |
michael@313 | 155 | export ORACLE_HOME |
michael@313 | 156 | %{l_prefix}/bin/python setup.py build |
michael@313 | 157 | ) || exit $? |
michael@313 | 158 | %endif |
michael@313 | 159 | ( cd SQLObject-%{V_sqlobject} |
michael@313 | 160 | %{l_prefix}/bin/python setup.py build |
michael@313 | 161 | ) || exit $? |
michael@313 | 162 | |
michael@313 | 163 | %install |
michael@314 | 164 | rm -rf $RPM_BUILD_ROOT |
michael@313 | 165 | %{l_shtool} mkdir -f -p -m 755 \ |
michael@313 | 166 | $RPM_BUILD_ROOT%{l_prefix} |
michael@313 | 167 | %if "%{with_sqlite}" == "yes" |
michael@313 | 168 | ( cd pysqlite-%{V_pysqlite} |
michael@313 | 169 | %{l_prefix}/bin/python setup.py install \ |
michael@313 | 170 | --skip-build \ |
michael@313 | 171 | --root=$RPM_BUILD_ROOT \ |
michael@313 | 172 | --prefix=%{l_prefix} |
michael@313 | 173 | rm -rf $RPM_BUILD_ROOT%{l_prefix}/pysqlite2-doc |
michael@313 | 174 | ) || exit $? |
michael@313 | 175 | %endif |
michael@313 | 176 | %if "%{with_pgsql}" == "yes" |
michael@313 | 177 | ( cd psycopg2-%{V_psycopg2} |
michael@313 | 178 | %{l_prefix}/bin/python setup.py install \ |
michael@313 | 179 | --skip-build \ |
michael@313 | 180 | --root=$RPM_BUILD_ROOT \ |
michael@313 | 181 | --prefix=%{l_prefix} |
michael@313 | 182 | ) || exit $? |
michael@313 | 183 | %endif |
michael@313 | 184 | %if "%{with_mysql}" == "yes" |
michael@313 | 185 | ( cd MySQL-python-%{V_mysql_python} |
michael@313 | 186 | %{l_prefix}/bin/python setup.py install \ |
michael@313 | 187 | --skip-build \ |
michael@313 | 188 | --root=$RPM_BUILD_ROOT \ |
michael@313 | 189 | --prefix=%{l_prefix} |
michael@313 | 190 | ) || exit $? |
michael@313 | 191 | %endif |
michael@313 | 192 | %if "%{with_oracle}" == "yes" |
michael@313 | 193 | ( cd cx_Oracle-%{V_cx_oracle} |
michael@313 | 194 | ORACLE_HOME="`%{l_rc} --query oracle_home`" |
michael@313 | 195 | export ORACLE_HOME |
michael@313 | 196 | %{l_prefix}/bin/python setup.py install \ |
michael@313 | 197 | --skip-build \ |
michael@313 | 198 | --root=$RPM_BUILD_ROOT \ |
michael@313 | 199 | --prefix=%{l_prefix} |
michael@313 | 200 | ) || exit $? |
michael@313 | 201 | %endif |
michael@313 | 202 | ( cd SQLObject-%{V_sqlobject} |
michael@313 | 203 | %{l_prefix}/bin/python setup.py install \ |
michael@313 | 204 | --skip-build \ |
michael@313 | 205 | --root=$RPM_BUILD_ROOT \ |
michael@313 | 206 | --prefix=%{l_prefix} |
michael@313 | 207 | ) || exit $? |
michael@313 | 208 | %{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT %{l_files_std} |
michael@313 | 209 | |
michael@313 | 210 | %files -f files |
michael@313 | 211 | |
michael@313 | 212 | %clean |
michael@314 | 213 | rm -rf $RPM_BUILD_ROOT |
michael@313 | 214 |