Bug 979378

Summary: Upgrade problem from dpkg* < 1.16 to dpkg* >= 1.16
Product: [Fedora] Fedora Reporter: Oron Peled <oron>
Component: dpkgAssignee: Andrew Colin Kissa <andrew>
Status: CLOSED ERRATA QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 18CC: andrew, sergio, vanmeeuwen+fedora
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: dpkg-1.16.10-6.fc18 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2013-07-16 01:50:02 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
Patch to .spec file for fixing dpkg upgrade from <= 1.15 to >= 1.16
none
This move dpkg-buildflags and dpkg-mergechangelogs form dpkg to dpkg-dev
none
remove multiple ownership of some manual pages
none
move dpkg.cfg from /etc to /etc/dpkg
none
fix some pkgdatadir, pkgconfdir file locations
none
move "dpkg-dev.mo" files to dpkg-perl
none
minor fix to dpkg-perl ownerships
none
add patched /etc/logrotate.d/dpkg
none
cleanup spec: s/$RPM_BUILD_ROOT/%{buildroot}/g
none
added some new %doc and debian/copyright
none
minor rpmlint cleanups none

Description Oron Peled 2013-06-28 11:19:25 UTC
Steps to Reproduce (f18):
1. Install dpkg-devel.noarch (1.15*)
2. Try to install dpkg-dev (1.16*)

Actual results:

Yum/dnf check transaction, and RPM fails with conflicting files

Expected results:
1. dpkg-dev pulls dpkg-perl
2. dpkg-devel.noarch removed
3. If dpkg < 1.15 is present, it is upgraded to dpkg >= 1.16*

Additional info:
* Prepared and tested updated spec.
    SPEC URL: http://oron.fedorapeople.org/deb-package/dpkg.spec
* The .spec changes are commented and with description in %changelog
* Although the primary fix is for f18, I think its important to fix on all releases (e.g: it may fail people who try to upgrade f18 -> f19, etc.)

Comment 1 Oron Peled 2013-06-28 11:24:24 UTC
An irritating technicality:
 * There's no "version-not-equal" relation in dependencies.
 * So I "emulated" this with two "foo < version" and "foo > version" relations.
 * Any problems with this? (aside from aesthetics)

Comment 2 Oron Peled 2013-06-28 11:47:43 UTC
Re-tested the failure in different scenario:
 * Prepared test with dpkg-devel.noarch (<= 1.15*) installed
   - Which pulls dpkg (<= 1.15*)

 * Then "dnf update":
   - Pulls new dpkg-devel.<ARCH> as an update (interesting...)
   - Upgrade OK
   - Of course it doesn't know new dpkg-devel.<ARCH> is completely
     different from old dpkg-devel.noarch, but it's harmless for now.

 * Then try to "dnf install dh-make" (new one 0.61-1.fc18):
   - Pulls new dpkg-dev (1.16.10-4.fc18).
   - Which pulls new dpkg-perl.
   - Which fails because the following two files belong to old (<= 1.15*) dpkg:
        /usr/share/perl5/vendor_perl/Dpkg.pm
        /usr/share/perl5/vendor_perl/Dpkg/Gettext.pm

So passing through intermediate upgrade to dpkg-devel=1.16.10-4.fc18
solve some of the problems (dpkg-dev conflict with old dpkg-devel),
but not all -- there's still a conflict of dpkg-perl with old dpkg.

Comment 3 Sergio Basto 2013-06-28 14:39:30 UTC
Hi, give us the diff of the spec , to analyze please

Comment 4 Oron Peled 2013-06-28 21:22:34 UTC
Created attachment 766737 [details]
Patch to .spec file for fixing dpkg upgrade from <= 1.15 to >= 1.16

Comment 5 Sergio Basto 2013-06-29 01:48:44 UTC
+# Obsolete the old dpkg-devel.noarch (replaced by dpkg-dev)
+Obsoletes: dpkg-devel < 1.16

this one, ok !

>> - Which pulls new dpkg-perl. 
and fails because conflicts with old dpkg 
So dpkg-perl needs also Obsoletes dpkg < 1.16 
or even better 

I Drop Requirement dpkg of dpkg-perl (seems to me correct at the time ...) 
but that requirement solve this situation, so what do you think ?
 
dpkg-perl requires dpkg = %{version}-%{release}

instead 
+# We don't depend on dpkg, but we don't allow different version of it
+Conflicts: dpkg < %{version}-%{release}
+Conflicts: dpkg > %{version}-%{release}
+# We don't depend on dpkg-devel, but we don't allow different version of it
+Conflicts: dpkg-devel < %{version}-%{release}
+Conflicts: dpkg-devel > %{version}-%{release}

Comment 6 Oron Peled 2013-06-29 16:57:58 UTC
I've started looking deeper at the dependency relationships
and decided I'll compare a bit more the Debian/Fedora packages.

Here are some preliminary findings:
* Should be moved from dpkg to dpkg-dev:
  - dpkg-mergechangelogs and its man-pages
  - dpkg-buildflags and its man-pages

* /etc/dpkg.cfg should be in /etc/dpkg/dpkg.cfg

* There is a bunch of man pages owned both by dpkg and dpkg-dev
  (in many languages):
        dpkg-architecture.1.gz
        dpkg-buildflags.1.gz
        dpkg-buildpackage.1.gz
        dpkg-checkbuilddeps.1.gz
        dpkg-distaddfile.1.gz
        dpkg-genchanges.1.gz
        dpkg-gencontrol.1.gz
        dpkg-gensymbols.1.gz
        dpkg-mergechangelogs.1.gz
        dpkg-name.1.gz
        dpkg-parsechangelog.1.gz
        dpkg-scanpackages.1.gz
        dpkg-scansources.1.gz
        dpkg-shlibdeps.1.gz
        dpkg-source.1.gz
        dpkg-vendor.1.gz

* The dpkg-dev.mo translation files:
  - For some unknown reason, Debian maintain them in libdpkg-perl
  - In Fedora we assigned them to dpkg-dev
  - Although our assignment look more logical, this affect package dependencies.
  - As an example /usr/libexec/dpkg/parsechangelog/debian calls
    textdomain("dpkg-dev"). In Debian, both belog to libdpkg-perl.
    In Fedora, the files are in two separate packages.

This is for now. Later, I'll try to send patches for some of these problems.

Comment 7 Sergio Basto 2013-06-29 17:12:33 UTC
(In reply to Oron Peled from comment #6)
> I've started looking deeper at the dependency relationships
> and decided I'll compare a bit more the Debian/Fedora packages.
> 
> Here are some preliminary findings:
> * Should be moved from dpkg to dpkg-dev:
>   - dpkg-mergechangelogs and its man-pages
>   - dpkg-buildflags and its man-pages

no problem I will do it right now ,

> 
> * /etc/dpkg.cfg should be in /etc/dpkg/dpkg.cfg

hum ok, see it later 
 
> * There is a bunch of man pages owned both by dpkg and dpkg-dev
>   (in many languages):
>         dpkg-architecture.1.gz
>         dpkg-buildflags.1.gz
>         dpkg-buildpackage.1.gz
>         dpkg-checkbuilddeps.1.gz
>         dpkg-distaddfile.1.gz
>         dpkg-genchanges.1.gz
>         dpkg-gencontrol.1.gz
>         dpkg-gensymbols.1.gz
>         dpkg-mergechangelogs.1.gz
>         dpkg-name.1.gz
>         dpkg-parsechangelog.1.gz
>         dpkg-scanpackages.1.gz
>         dpkg-scansources.1.gz
>         dpkg-shlibdeps.1.gz
>         dpkg-source.1.gz
>         dpkg-vendor.1.gz
> 

this is obvious bug in spec 

grep dpkg-architecture dpkg.spec 
%{_mandir}/man1/dpkg-architecture.1.gz
%{_mandir}/*/man1/dpkg-architecture.1.gz
%{_bindir}/dpkg-architecture
%{_mandir}/man1/dpkg-architecture.1.gz
%{_mandir}/*/man1/dpkg-architecture.1.gz

man are duplicated , and should be just in correspondent  package , I will commit the fix right now in master.

Comment 8 Oron Peled 2013-06-29 17:22:52 UTC
Created attachment 766926 [details]
This move dpkg-buildflags and dpkg-mergechangelogs form dpkg to dpkg-dev

* Move binaries and their man-pages from dpkg to dpkg-dev

Comment 9 Oron Peled 2013-06-29 17:24:10 UTC
Created attachment 766927 [details]
remove multiple ownership of some manual pages

* These all belong to dpkg-dev. So remove them from dpkg

Comment 11 Oron Peled 2013-06-29 18:38:25 UTC
Created attachment 766929 [details]
move dpkg.cfg from /etc to /etc/dpkg

Looking at upstream code -- all configuration files are under /etc/dpkg:
 * In lib/dpkg/options.c (line 197):
       m_asprintf(&file, "%s/%s.cfg", CONFIGDIR, prog);
 * The CONFIGDIR is passed from Makefile.am:
       -DCONFIGDIR=\"$(pkgconfdir)\"
 * In Makefile.am pkgconfdir is set:
       pkgconfdir = $(sysconfdir)/@PACKAGE@

Comment 12 Oron Peled 2013-06-29 18:42:46 UTC
Created attachment 766930 [details]
fix some pkgdatadir, pkgconfdir file locations

* Define pkgdatadir for consistency (just like upstream name in Makefile.am)
* Added missing shlibs.{default,override} (from debian/dpkg-dev.install)
* Move %{pkgdatadir}/abitable from dpkg-dev to dpkg (from debian/dpkg.install)
* Grab all %{pkgdatadir}/*.mk into dpkg-dev (from debian/dpkg-dev.install)

Comment 13 Oron Peled 2013-06-29 18:43:51 UTC
* Thanks for the quick update.
* Attached two more patches.
* If you have time now, we can continue this on IRC (#fedora-devel [oron])

Comment 14 Sergio Basto 2013-06-29 18:57:34 UTC
(In reply to Oron Peled from comment #13)
> * If you have time now, we can continue this on IRC (#fedora-devel [oron])

Thanks , Now I going out, now , sorry .

what do you think ?  

about : dpkg-perl requires dpkg = %{version}-%{release} , 
instead 
+# We don't depend on dpkg, but we don't allow different version of it
+Conflicts: dpkg < %{version}-%{release}
+Conflicts: dpkg > %{version}-%{release}
+# We don't depend on dpkg-devel, but we don't allow different version of it
+Conflicts: dpkg-devel < %{version}-%{release}
+Conflicts: dpkg-devel > %{version}-%{release}

seems to me more clean .

Comment 15 Oron Peled 2013-06-29 19:04:09 UTC
Created attachment 766936 [details]
move "dpkg-dev.mo" files to dpkg-perl

* In upstream they also belong to libdpkg-perl and not dpkg-dev
* In dpkg-perl, they are used by /usr/libexec/dpkg/parsechangelog/debian:
        textdomain("dpkg-dev");

Comment 16 Oron Peled 2013-06-29 19:14:49 UTC
Created attachment 766937 [details]
minor fix to dpkg-perl ownerships

* Some directories were not owned (e.g: /usr/share/perl5/.../Dpkg/Compression)
* Use wildcards as in upstream debian/libdpkg-perl.install, so we don't
  have similar bugs in the future.

Comment 17 Oron Peled 2013-06-29 20:34:09 UTC
(In reply to Sergio from comment #14)

* I first wanted to make sure we have equivalent packages to Debian's
  (in terms of contained files). Otherwise, it's hard to compare dependencies.

* Checking now (after applying the patches in comment #15 and #16):
  - Upstream libdpkg-perl "Depends" on dpkg (specific version range)

  - Also, I've found specific perl modules that call dpkg commands:
    /usr/share/perl5/vendor_perl/Dpkg/Arch.pm run "dpkg --print-architecture"
    /usr/share/perl5/vendor_perl/Dpkg/Path.pm run "dpkg-query"
    /usr/share/perl5/vendor_perl/Dpkg/Source/Package.pm run "dpkg-source"

  - So not having "Requires: dpkg" for dpkg-perl was our mistake
    in the first place.

  - I also agree that we can have stricter version requirements than upstream.

  - So let's do what you suggested and add to dpkg-perl:
            Requires: dpkg = %{version}-%{release}

  - Since "dpkg-dev" already requires "dpkg-perl = %{version}-%{release},
    that means we don't need my first set of "Conflicts" (dpkg <> ...)
    Because dpkg-dev pulls same version of dpkg-perl and that will
    pull same version of dpkg.

* If you can review and commit:
  - First, my comment #15 and comment #16 (less conflicts for my git private
    branch).
  - Than your proposed "Requires:" for dpkg-perl
  - I'll re-sync and we can do final checks what to do with the other
    suggested Conflicts (dpkg-devel <> ...)

Comment 18 Sergio Basto 2013-06-30 00:34:22 UTC
all 4 patches pushed more # Obsolete the old dpkg-devel.noarch (replaced by dpkg-dev) Obsoletes: dpkg-devel < 1.16
more add to dpkg-perl: Requires: dpkg = %{version}-%{release}

http://pkgs.fedoraproject.org/cgit/dpkg.git/patch/?id=6d0630eecf685c5fb9eb786ac48c0a10cc358ad3

Comment 19 Fedora Update System 2013-06-30 00:50:23 UTC
dpkg-1.16.10-5.fc19 has been submitted as an update for Fedora 19.
https://admin.fedoraproject.org/updates/dpkg-1.16.10-5.fc19

Comment 20 Fedora Update System 2013-06-30 01:07:11 UTC
dpkg-1.16.10-5.fc18 has been submitted as an update for Fedora 18.
https://admin.fedoraproject.org/updates/dpkg-1.16.10-5.fc18

Comment 21 Oron Peled 2013-06-30 07:54:59 UTC
Created attachment 766996 [details]
add patched /etc/logrotate.d/dpkg

Comment 22 Oron Peled 2013-06-30 07:58:31 UTC
Created attachment 766997 [details]
cleanup spec: s/$RPM_BUILD_ROOT/%{buildroot}/g

There was mixed use of $RPM_BUILD_ROOT and %{rpmbuild}

Comment 23 Oron Peled 2013-06-30 07:59:26 UTC
Created attachment 766998 [details]
added some new %doc and debian/copyright

* debian/copyright is up-to-date and include more info than old COPYING file
* Added other, missing docs

Comment 24 Oron Peled 2013-06-30 08:00:10 UTC
Created attachment 766999 [details]
minor rpmlint cleanups

Comment 25 Oron Peled 2013-06-30 08:07:15 UTC
(In reply to comment #19 and #20 -- bodhi updates)

* Oops, you are quick. I thought you'll just commit to git and we'll
  have a final round of cleanups before pushing to bodhi.

* Your version looks OK, but:
  - Maybe you want to push the last fixes before you push the new package.
    The logrotate may be important. (comments #21, #22, #23, #24)
  - If not, the fixes can wait in git for some other opportunity.

Comment 26 Sergio Basto 2013-06-30 23:13:44 UTC
(In reply to Oron Peled from comment #25)
> (In reply to comment #19 and #20 -- bodhi updates)
> 
> * Oops, you are quick. I thought you'll just commit to git and we'll
>   have a final round of cleanups before pushing to bodhi.
> 
> * Your version looks OK, but:
>   - Maybe you want to push the last fixes before you push the new package.
>     The logrotate may be important. (comments #21, #22, #23, #24)
>   - If not, the fixes can wait in git for some other opportunity.

Hi, Thanks for the patches, I will include yours last 4 patches (all) , in git . Should I bump a release or we have more things to fix ?

Comment 27 Fedora Update System 2013-07-01 01:39:21 UTC
Package dpkg-1.16.10-5.fc18:
* should fix your issue,
* was pushed to the Fedora 18 testing repository,
* should be available at your local mirror within two days.
Update it with:
# su -c 'yum update --enablerepo=updates-testing dpkg-1.16.10-5.fc18'
as soon as you are able to.
Please go to the following url:
https://admin.fedoraproject.org/updates/FEDORA-2013-11999/dpkg-1.16.10-5.fc18
then log in and leave karma (feedback).

Comment 28 Fedora Update System 2013-07-01 03:36:20 UTC
dpkg-1.16.10-6.fc19 has been submitted as an update for Fedora 19.
https://admin.fedoraproject.org/updates/dpkg-1.16.10-6.fc19

Comment 29 Fedora Update System 2013-07-01 03:47:21 UTC
dpkg-1.16.10-6.fc18 has been submitted as an update for Fedora 18.
https://admin.fedoraproject.org/updates/dpkg-1.16.10-6.fc18

Comment 30 Oron Peled 2013-07-01 07:02:10 UTC
Tested 1.16.10-6 (both f18 and f19) -- all well.

Comment 31 Fedora Update System 2013-07-16 01:50:02 UTC
dpkg-1.16.10-6.fc19 has been pushed to the Fedora 19 stable repository.  If problems still persist, please make note of it in this bug report.

Comment 32 Fedora Update System 2013-07-16 01:51:45 UTC
dpkg-1.16.10-6.fc18 has been pushed to the Fedora 18 stable repository.  If problems still persist, please make note of it in this bug report.