Sometimes there are some requirements in Makefile which are not checked later in the code. Such a check may sometimes save time while investigating issues. I often add requirements to the Makefile and usually forget to update the code too. The I currently use for this looks as follows: for REQ in $(grep '"Requires:' Makefile | sed -e 's/.*Requires: *\(.*\)".*/\1/' | tr '\n' ' '); do out=$(rpm -q "$REQ" | grep -v 'not installed' || which "$REQ" 2> /dev/null ) if [[ $? -eq 0 ]]; then [[ "$out" =~ ^/ ]] && out="$out from package $(rpm -qf $out)" rlLog "requirement $REQ covered by $out" else rlDie "requirement $REQ not satisfied" fi done I can imagine to add another option to rlAssertRpm, like --makefile which would do the job. Also I propose to include this to the option --all and the current --all implementation itself put into separate option, like --env. Option --all would be then combination of both. What do you think guys? Feel free to CC other people.
Remember that requires in Makefile is a superset of "requires on rhel5" + "requires on rhel6" etc. So in case requirements differ between rhel5 and rhel6 you would be getting errors in the test.
What Karel said. I'd like to be able to check all requires without having to enumerate them twice (and do that in harness, not in test). But it's AFAIK not possible with Makefile reqs implementation as it is now. Maybe if/when we start defining requirements per test environment. AFAIK that's what RHSCL folks call dynamic requirements?
Well, that's something I did not consider. I usually do not face these issues. If this is implemented it should be definitely done other way. As my routine actually does not check rpms but requirements in general it should be called rlAssertRequirements or so. Ok, your arguments are better than mine so I'll keep current model by putting it directly into test code. Thanks for comments.
Still, I think that having that information would be useful. Just not to have it as an test Assert (if we cannot distinguish what is really needed). What about filing a RFE for beaker to store those package versions in a separate test log? It would be easier to access and more precise that mining this info from an install log.
What about non-assertish version of this functionality? = based on rlCheckRpm instead of rlAssertRpm? function rlCheckMakefileRequires{ rlLogInfo "checking all Makefile requires" for each package from Makefile's Requires{ all+ rlCheckRpm package && found++ } rlLog "found %d out of %d makefile requires" % (found,all) }
Sure, non-arrest one can be easily done. I just do not use existing function as I want to be compatible with requirements specified by path to binary and as I do some checks similar to those in rlCheckRpm I think it is not necessary to do them again. So if you find such a function useful I can change my code so it does only rlLog and set exit code accordingly. I would use it in rlRun or so.
(In reply to Dalibor Pospíšil from comment #6) > as I want to be compatible with requirements specified by path to binary and Ah, right, didn't think about this. So this function would have to work with everything Makefile's Requires support and people use in tests: * package names * paths to binaries * virtual provides (e.g. perl(Some-module)) Basically the 'yum provides' inputs.
Be sure to use 'yum provides --disablerepo=\*', otherwise it would be terribly slow.
hmm, according to this: https://bugzilla.redhat.com/show_bug.cgi?id=952635#c5 any Makefile 'Requires' that is not a package name won't work.
According to my test it is not true, see https://bugzilla.redhat.com/show_bug.cgi?id=952635#c10. I have tried path to binary which works. We could check also other provides strings.
fixed by https://git.fedorahosted.org/cgit/beakerlib.git/commit/?id=be1ab4ba0aabb1a6f7da5412f9cab226d30837ca
Made it more flexible by https://git.fedorahosted.org/cgit/beakerlib.git/commit/?id=0798489230e33b71401a3a1c4f5ff8d926b61d3a
beakerlib-1.9-1.fc20 has been submitted as an update for Fedora 20. https://admin.fedoraproject.org/updates/beakerlib-1.9-1.fc20
Package beakerlib-1.9-1.fc20: * should fix your issue, * was pushed to the Fedora 20 testing repository, * should be available at your local mirror within two days. Update it with: # su -c 'yum update --enablerepo=updates-testing beakerlib-1.9-1.fc20' as soon as you are able to. Please go to the following url: https://admin.fedoraproject.org/updates/FEDORA-2014-7442/beakerlib-1.9-1.fc20 then log in and leave karma (feedback).
beakerlib-1.9-2.fc20 has been submitted as an update for Fedora 20. https://admin.fedoraproject.org/updates/beakerlib-1.9-2.fc20
Please consider the package fixing this bug available in Fedora stable repos once bz1116308 is closed and RHEL stable repos once bz1116317 is closed. Fixed in: beakerlib-1.9-2.fc19 beakerlib-1.9-2.fc20 beakerlib-1.9-2.fc21 beakerlib-1.9-3.el5 beakerlib-1.9-2.el6 beakerlib-1.9-2.el7
beakerlib-1.9-3.fc20 has been submitted as an update for Fedora 20. https://admin.fedoraproject.org/updates/beakerlib-1.9-3.fc20
beakerlib-1.9-3.fc20 has been pushed to the Fedora 20 stable repository. If problems still persist, please make note of it in this bug report.