Note: This is a public test instance of Red Hat Bugzilla. The data contained within is a snapshot of the live data so any changes you make will not be reflected in the production Bugzilla. Email is disabled so feel free to test any aspect of the site that you want. File any problems you find or give feedback at bugzilla.redhat.com.
Bug 903068 - packages in spacewalk are allways for "apt-get upgrade"
Summary: packages in spacewalk are allways for "apt-get upgrade"
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: Spacewalk
Classification: Community
Component: Server
Version: 1.7
Hardware: All
OS: Linux
unspecified
low
Target Milestone: ---
Assignee: Michael Mráka
QA Contact: Red Hat Satellite QA List
URL:
Whiteboard:
: 903066 (view as bug list)
Depends On:
Blocks: space22
TreeView+ depends on / blocked
 
Reported: 2013-01-23 04:44 UTC by Peter Hudec
Modified: 2014-07-17 08:41 UTC (History)
2 users (show)

Fixed In Version: spacewalk-schema-2.2.23-1 spacewalk-java-2.2.38-1 spacewalk-backend-2.2.16-1
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2014-07-17 08:41:10 UTC
Embargoed:


Attachments (Terms of Use)
quick patch which solved the problem for me (1.64 KB, text/plain)
2013-01-23 04:48 UTC, Peter Hudec
no flags Details
possible fix for bug 903068 (6.26 KB, patch)
2014-03-31 07:37 UTC, Carsten Menzel
no flags Details | Diff
patch with dedicated tables (29.85 KB, patch)
2014-04-02 05:31 UTC, Carsten Menzel
no flags Details | Diff
patch with dedicated tables (29.86 KB, patch)
2014-04-02 05:37 UTC, Carsten Menzel
no flags Details | Diff

Description Peter Hudec 2013-01-23 04:44:08 UTC
For packages in spacewalk debian based repo the linux clients allways show that are to upgrade, even if the same versoin is allready installed.

https://www.redhat.com/archives/spacewalk-list/2013-January/msg00112.html

TEJB1139H5XEAS info # apt-get upgrade -s
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages will be upgraded:
  pss-foxim strace worthless
3 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
Inst pss-foxim [2.1] (2.1 spacewalk.fopss.sk [all])
Conf pss-foxim (2.1 spacewalk.fopss.sk [all])
Inst strace [4.5.20-2.3ubuntu1] (4.5.20-2.3ubuntu1 spacewalk.fopss.sk [i386])
Inst worthless [1.0-2] (1.0-2 spacewalk.fopss.sk [all])
Conf strace (4.5.20-2.3ubuntu1 spacewalk.fopss.sk [i386])
Conf worthless (1.0-2 spacewalk.fopss.sk [all])

Comment 1 Peter Hudec 2013-01-23 04:47:17 UTC
The problem is in wrong generated Packages for debian repo.

See https://www.redhat.com/archives/spacewalk-list/2013-January/msg00115.html

I solved this problem with the pach proided in the 

https://www.redhat.com/archives/spacewalk-list/2013-January/msg00117.html

Comment 2 Peter Hudec 2013-01-23 04:48:18 UTC
Created attachment 685650 [details]
quick patch which solved the problem for me

Comment 3 Jan Pazdziora 2013-01-25 12:34:41 UTC
*** Bug 903066 has been marked as a duplicate of this bug. ***

Comment 4 Carsten Menzel 2014-03-25 12:36:19 UTC
I just made the same experience with Debian Wheezy.

I found out, that in addition to the Installed-Size attribute in the Packages file, also the order of the packages in the "Depends:" attribute of a package in the Packages file is important.
If the order is different to the information stored in /var/lib/dpkg/status, APT thinks, that the installed package and the package in Spacewalk are different.

Comment 5 Carsten Menzel 2014-03-31 07:37:17 UTC
Created attachment 880583 [details]
possible fix for bug 903068

I analyzed the problem in detail and found out, that beside the "Installed-Size:" and the "Depends:" attribute, also the other dependency attributes are essential for APT, when they were present in the originally installed package.
In detail, the following attributes must be parsed and added to the Packages file, if they are present in a package:

- Recommends:
- Suggests:
- Breaks:
- Pre-Depends:

For this, I uploaded a patch for the SPACEWALK-2.1 branch. This patch also includes the fix from Peter Hudec for the Installed-Size attribute.

The patch is a bit ugly, because it uses the rhnpackageenhances table for the "Breaks" dependencies and the rhnpackagesupplements table for the "Pre-Depends" dependencies.
For the final solution, there should be specific tables for these two attributes (e.g. rhnpackagebreaks and rhnpackagepredepends).

The order of the packages in the dependency lists is stored together with the name in the rhnpackagecapability table as a suffix (_<index number>).
This suffix is removed and parsed, when the "Packages" file is generated by the DebPackageWriter module.

Comment 6 Šimon Lukašík 2014-03-31 17:10:16 UTC
Hello Carsten, thank You for your patch.

You are right that this is a bit ugly. My only problem is that once upstream accepts this patch, it will be hard to bring up the final solution (as you call it). Because of automated upgrades from existing installation.

Would you be willing to contribute a patch using a separate tables? Thanks!

Comment 7 Carsten Menzel 2014-04-02 05:31:07 UTC
Created attachment 881636 [details]
patch with dedicated tables

Hello Simon,
I reworked my patch to use dedicated tables for the "Breaks:" and "Pre-Depends" dependencies of Debian packages (rhnpackagebreaks and rhnpackagepredepends).
For the other dependencies (suggests, recommends), the existing tables can be used (rhnpackagesuggests, rhnpackagerecommends, etc.)

The patch includes the SQL scripts for the creation of the tables and the corresponding triggers (Oracle and PostgreSQL).
For the schema upgrade, I did not create a sql file. But I think, this can be easily be created by the upstream maintainer.
As I do not know, how the .sql files are included in the installation routines, I also did not incorporate this in my patch.

I tested it yesterday with our Spacewalk installation and both the import of .deb and .rpm packages and the writing of the repository information are working as expected. Also the new tables are used as planned.

Regards,
Carsten

Comment 8 Carsten Menzel 2014-04-02 05:37:11 UTC
Created attachment 881637 [details]
patch with dedicated tables

Fixed typo in part for /backend/server/importlib/headerSource.py:

old:
if tag in ['recommends', 'supplements', 'break', 'predepends'] and not(hash['flags'] & (1 << 27)):

new:
if tag in ['recommends', 'supplements', 'breaks', 'predepends'] and not(hash['flags'] & (1 << 27)):


Sorry. I first saw it, when i checked the diff on the Bugzilla diff view.

Regards,
Carsten

Comment 9 Michael Mráka 2014-04-04 10:02:06 UTC
Hi Carsten,

Thank you for the patch. I've reviewed it, added schema upgrade scripts and committed to spacewalk master.

commit 19f3618824a2f14b50f090365f0d1be066bfb8c5
    903068 - update scripts for schema
commit 9d536bd25a2555775529db0445745619740a1c37
    903068 - fixed oracle source checksums
commit cae505f2c2cb2a63529dac9abaa1b7276e826a8b
    903068 - fixed debian repo generation
    - missing Installed-Size attribute
    - the order of the packages in the "Depends:" attribute of a package in the Packages file is important
    - added missing Recommends:, Suggests:, Breaks:, Pre-Depends:

Comment 10 Milan Zázrivec 2014-07-17 08:41:10 UTC
Spacewalk 2.2 has been released:

    https://fedorahosted.org/spacewalk/wiki/ReleaseNotes22


Note You need to log in before you can comment on or make changes to this bug.