python-db/python-db.spec

Tue, 29 Mar 2011 20:04:34 +0200

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Tue, 29 Mar 2011 20:04:34 +0200
changeset 334
4a34d7a82eab
parent 313
fc0449ec63bb
permissions
-rw-r--r--

Rework package yet again, correcting and introducing new buildconf logic:
Conditionally disable bootstrap stage comparison correctly, correct
english grammar, better find system as(1) and ld(1), indotruce detailed
optimization option messages, more completely guess cpu types, allow
profiled bootstrapping without a preinstalled GCC because many other
compilers have long since implemented 64-bit arithmetic, instruct make
to build sequentially (not in sparallel) when building a profiled
bootstrap as GCC online documents recommend, and generally improve
comment blocks.

The single most important correction in this changeset relates to the
GCC changed optimization policy since at least GCC 4.5, in which -march
is always passed and not always correctly guessed. In the case of this
package, allowing GCC to guess the architecture leads to wild build
errors at various subcomponents (zlib, libgcc, libiberty...) and
bootstrap stages. It seems quite platform specific, and the safest
approach to correcting this seems to be explicitly always specifying the
-march argument when bootstrapping GCC. Because the best choice 'native'
is not available when bootstrapping using a foreign (non GCC) compiler,
a guess is made according to rpmmacros l_platform in that case.

It is questionable as to whether these recent optimization changes
on the part of GCC or this package are compatible with each other,
or if either are complete or correct at all. At least applying these
corrections allows this package to build again in most cases test.

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

mercurial