#1 Provide python- and python2- obsoletes from the python3- subpackages
Closed 2 years ago by churchyard. Opened 2 years ago by torsava.
rpms/ torsava/python-psycopg2 master  into  master

file modified
+35 -5

@@ -1,9 +1,16 @@ 

  %if 0%{?fedora}

- %bcond_without python2

- %bcond_without python3

+   %bcond_without python2

+   %bcond_without python3

  %else

- %bcond_with    python2

- %bcond_without python3

+   %if 0%{?rhel} > 7

+     # Disable python2 build

+     %bcond_with    python2

+     %bcond_without python3

+   %else

+     # Disable python3 build

+     %bcond_without python2

+     %bcond_with    python3

+   %endif

  %endif

  

  

@@ -30,7 +37,7 @@ 

  Summary:	%{sum}

  Name:		python-%{srcname}

  Version:	2.7.4

- Release:	1%{?dist}

+ Release:	2%{?dist}

  # The exceptions allow linking to OpenSSL and PostgreSQL's libpq

  License:	LGPLv3+ with exceptions

  Group:		Applications/Databases

@@ -87,6 +94,12 @@ 

  Summary: %{sum} 3

  %{?python_provide:%python_provide python3-%{srcname}}

  

+ %if %{without python2}

+ # Provide a clean upgrade path when the python2 package is removed

+ Obsoletes:      python-%{srcname} < %{version}-%{release}

+ Obsoletes:      python2-%{srcname} < %{version}-%{release}

+ %endif # without python2

+ 

  %description  -n python3-psycopg2

  %{desc}

  

@@ -94,6 +107,13 @@ 

  %package -n python3-%{srcname}-tests

  Summary: A testsuite for %sum 2

  Requires: python3-%srcname = %version-%release

+ %{?python_provide:%python_provide python3-%{srcname}-tests}

+ 

+ %if %{without python2}

+ # Provide a clean upgrade path when the python2 package is removed

+ Obsoletes:      python-%{srcname}-tests < %{version}-%{release}

+ Obsoletes:      python2-%{srcname}-tests < %{version}-%{release}

+ %endif # without python2

  

  %description -n python3-%{srcname}-tests

  %desc

@@ -104,6 +124,13 @@ 

  Summary: A PostgreSQL database adapter for Python 3 (debug build)

  # Require base python 3 package, as we're sharing .py/.pyc files:

  Requires:	python3-psycopg2 = %{version}-%{release}

+ %{?python_provide:%python_provide python3-%{srcname}-debug}

+ 

+ %if %{without python2}

+ # Provide a clean upgrade path when the python2 package is removed

+ Obsoletes:      python-%{srcname}-debug < %{version}-%{release}

+ Obsoletes:      python2-%{srcname}-debug < %{version}-%{release}

+ %endif # without python2

  

  %description -n python3-%{srcname}-debug

  This is a build of the psycopg PostgreSQL database adapter for the debug

@@ -252,6 +279,9 @@ 

  

  

  %changelog

+ * Fri Mar 16 2018 Tomas Orsava <torsava@redhat.com> - 2.7.4-2

+ - Provide python- and python2- obsoletes from the python3- subpackages

+ 

  * Mon Feb 12 2018 Pavel Raiskup <praiskup@redhat.com> - 2.7.4-1

  - rebase to latest upstream release, per release notes:

    http://initd.org/psycopg/articles/2018/02/08/psycopg-274-released/

no initial comment

Is this per guidelines? I don't think pyhton3-foo obsoletes python2-foo actually.

It is per this guideline: https://fedoraproject.org/wiki/Packaging:Guidelines#Renaming.2FReplacing_Existing_Packages ("If a package supersedes/replaces an existing package without being a sufficiently compatible replacement as defined above, use only the Obsoletes: line from the above example.") i.e. the python3 package is not providing python2-%{srcname} yet it obsoletes it to provide a clean upgrade path. this is common when removing packages, we even have fedora-obsolete-packages package that just obsoletes things nothing else can obsolete.

Can we safely assume that nobody will ever need (and thus provide) python2-psycopg2 package? Say epel8?

Nope. But such package can have release 10001 (or larger epoch if the version needs to be lower) to beat this.

Right. EPOCH would be the answer, thanks.

Hmm,

If a package supersedes/replaces an existing package without being a sufficiently compatible replacement as defined above, use only the Obsoletes: line from the above example.

Still, python3-foo doesn't supersede nor replace python2-foo, so I don't think this applies.
Could we somehow bake this into Python guidelines first, please?

I don't think so. We discussed putting these Obsoletes into an if-not-rhel block, but decided against polluting Fedora spec files. If you'd be more comfortable with it, I'll amend the PR.

rebased onto d83c64d

2 years ago

Pull-Request has been closed by churchyard

2 years ago