Bug 1303117 - hy_package_get_requires should return also "Requires(pre)"
Summary: hy_package_get_requires should return also "Requires(pre)"
Keywords:
Status: CLOSED RAWHIDE
Alias: None
Product: Fedora
Classification: Fedora
Component: hawkey
Version: 24
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: rpm-software-management
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2016-01-29 15:31 UTC by Harald Hoyer
Modified: 2017-03-02 09:58 UTC (History)
7 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2017-03-02 09:58:10 UTC


Attachments (Terms of Use)

Description Harald Hoyer 2016-01-29 15:31:16 UTC
$ 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 15:31:46 UTC
Basically it's missing "Requires(pre)"

Comment 2 Michal Domonkos 2016-02-01 13:28:53 UTC
We should definitely fix this.

Comment 3 Harald Hoyer 2016-02-02 16:19:58 UTC
(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 16:49:39 UTC
(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 17:03:04 UTC
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 17:11:29 UTC
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 17:12:03 UTC
(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 14:24:29 UTC
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 14:21:52 UTC
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 18:07:21 UTC
ping???

Comment 11 Michal Luscon 2016-04-26 08:48:43 UTC
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 12:21:17 UTC
(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 09:25:03 UTC
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 09:58:10 UTC
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.