Bug 1303117 - hy_package_get_requires should return also "Requires(pre)"
hy_package_get_requires should return also "Requires(pre)"
Status: CLOSED RAWHIDE
Product: Fedora
Classification: Fedora
Component: hawkey (Show other bugs)
24
Unspecified Unspecified
unspecified Severity unspecified
: ---
: ---
Assigned To: rpm-software-management
Fedora Extras Quality Assurance
: Triaged
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2016-01-29 10:31 EST by Harald Hoyer
Modified: 2017-03-02 04:58 EST (History)
7 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2017-03-02 04:58:10 EST
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Harald Hoyer 2016-01-29 10:31:16 EST
$ sudo dnf repoquery  --disablerepo=* --enablerepo=rawhide --requires kernel-core
/bin/sh
rpmlib(CompressedFileNames) <= 3.0.4-1
rpmlib(FileDigests) <= 4.6.0-1
rpmlib(PayloadFilesHavePrefix) <= 4.0-1
rpmlib(PayloadIsXz) <= 5.2-1
systemd >= 200

compared to:

$ repoquery  --disablerepo=* --enablerepo=rawhide --requires kernel-core

Yum-utils package has been deprecated, use dnf instead.
See 'man yum2dnf' for more information.


/bin/sh
dracut >= 027
fileutils
linux-firmware >= 20150904-56.git6ebf5d57
systemd >= 200
systemd >= 203-2
Comment 1 Harald Hoyer 2016-01-29 10:31:46 EST
Basically it's missing "Requires(pre)"
Comment 2 Michal Domonkos 2016-02-01 08:28:53 EST
We should definitely fix this.
Comment 3 Harald Hoyer 2016-02-02 11:19:58 EST
(In reply to Michal Domonkos from comment #2)
> We should definitely fix this.

Yes :) Do you have a quick fix in mind, so I can continue with my research?
Comment 4 Harald Hoyer 2016-02-17 11:49:39 EST
(In reply to Harald Hoyer from comment #3)
> (In reply to Michal Domonkos from comment #2)
> > We should definitely fix this.
> 
> Yes :) Do you have a quick fix in mind, so I can continue with my research?

ping?
Comment 5 Honza Silhan 2016-02-17 12:03:04 EST
we'll introduce a new repoquery option to list these requirements. It should be separated from the `--requires` as these are more like BuildRequires not necessary needed for package to run.

I am sorry but there is currently no quick fix but we have it on agenda.
Comment 6 Harald Hoyer 2016-02-17 12:11:29 EST
might be a hawkey problem

>>> import dnf
>>> b = dnf.Base()
>>> b.conf.cachedir = dnf.yum.misc.getCacheDir()
>>> b.fill_sack()
<dnf.sack.Sack object at 0x7f2a981b9940>
>>> b.add_remote_rpm("/home/harald/Downloads/kernel-core-4.5.0-0.rc4.git0.1.fc24.x86_64.rpm")
<hawkey.Package object id 4241, kernel-core-4.5.0-0.rc4.git0.1.fc24.x86_64, @commandline>
>>> pkgs = b.sack.query().available().run()
>>> [str(x) for x in pkgs[0].requires]
['/bin/sh', 'rpmlib(CompressedFileNames) <= 3.0.4-1', 'rpmlib(FileDigests) <= 4.6.0-1', 'rpmlib(PayloadFilesHavePrefix) <= 4.0-1', 'rpmlib(PayloadIsXz) <= 5.2-1']
>>> str(pkgs[0].name)
'kernel-core'


~$ rpm -qp --requires /home/harald/Downloads/kernel-core-4.5.0-0.rc4.git0.1.fc24.x86_64.rpm
/bin/sh
/bin/sh
/bin/sh
dracut >= 027
fileutils
linux-firmware >= 20150904-56.git6ebf5d57
rpmlib(CompressedFileNames) <= 3.0.4-1
rpmlib(FileDigests) <= 4.6.0-1
rpmlib(PayloadFilesHavePrefix) <= 4.0-1
rpmlib(PayloadIsXz) <= 5.2-1
systemd >= 200
systemd >= 203-2
Comment 7 Harald Hoyer 2016-02-17 12:12:03 EST
(In reply to Jan Silhan from comment #5)
> we'll introduce a new repoquery option to list these requirements. It should
> be separated from the `--requires` as these are more like BuildRequires not
> necessary needed for package to run.
> 
> I am sorry but there is currently no quick fix but we have it on agenda.

Huh? Requires(pre) is absolutely needed!!
Comment 8 Harald Hoyer 2016-02-18 09:24:29 EST
This makes it work for me

~/git/hawkey (master)$ git diff
diff --git a/src/package.c b/src/package.c
index 5c7a637..781d39b 100644
--- a/src/package.c
+++ b/src/package.c
@@ -26,6 +26,7 @@
 #include <solv/pool.h>
 #include <solv/repo.h>
 #include <solv/util.h>
+#include <solv/queue.h>
 
 // hawkey
 #include "advisory_internal.h"
@@ -65,9 +66,22 @@ reldeps_for(HyPackage pkg, Id type)
     Solvable *s = get_solvable(pkg);
     HyReldepList reldeplist;
     Queue q;
+    Id marker = -1;
+    int i;
 
+    if (type == SOLVABLE_REQUIRES)
+            marker = 0;
     queue_init(&q);
-    solvable_lookup_deparray(s, type, &q, -1);
+    solvable_lookup_deparray(s, type, &q, marker);
+    if (type == SOLVABLE_REQUIRES) {
+            for (i = 0; i < q.count; i++) {
+                    if (q.elements[i] == SOLVABLE_PREREQMARKER) {
+                            queue_delete(&q, i);
+                            break;
+                    }
+            }
+    }
+
     reldeplist = reldeplist_from_queue(pool, q);
Comment 9 Jan Kurik 2016-02-24 09:21:52 EST
This bug appears to have been reported against 'rawhide' during the Fedora 24 development cycle.
Changing version to '24'.

More information and reason for this action is here:
https://fedoraproject.org/wiki/Fedora_Program_Management/HouseKeeping/Fedora24#Rawhide_Rebase
Comment 10 Harald Hoyer 2016-03-10 13:07:21 EST
ping???
Comment 11 Michal Luscon 2016-04-26 04:48:43 EDT
Hi Harald,

we decided to implement a --requires-pre switch. PR is available at https://github.com/rpm-software-management/libhif/pull/95 .
Comment 12 Harald Hoyer 2016-05-03 08:21:17 EDT
(In reply to Michal Luscon from comment #11)
> Hi Harald,
> 
> we decided to implement a --requires-pre switch. PR is available at
> https://github.com/rpm-software-management/libhif/pull/95 .

Thanks!

Although, I don't need the patch anymore.
I thought, that Requires(pre) implies a normal Requires, which is apparently not the case.
Comment 13 Fedora Admin XMLRPC Client 2016-07-08 05:25:03 EDT
This package has changed ownership in the Fedora Package Database.  Reassigning to the new owner of this component.
Comment 14 Jaroslav Mracek 2017-03-02 04:58:10 EST
Released in libdnf-0.7.4 in fedora rawhide.

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