Description of problem: Let's implement a new function rlAssertBinaryOrigin() which would be used for checking that given binary is provided by one of given packages. The function should support the following syntax: rlAssertBinaryOrigin binary [package [package...]] If no package would be provided on the command line environment variable PACKAGES would be used to get the list of rpms which should own the binary file. The implementation itself should be roughly as this: rlRun "rpm -q $PACKAGES | grep $(rpm -qf $(which $PYTHON))" This new functionality will be useful when testing binaries packaged in Software Collections [1] to make sure the binary under test is what is actually expected to be tested. [1] http://docs.fedoraproject.org/en-US/Fedora_Draft_Documentation/0.1/html/Software_Collections_Guide/index.html
Please, make sure this works with alternatives as well.
Created attachment 697868 [details] proposed patch the patch solves also BZ#772622
Created attachment 699387 [details] tests for the new functionality
Created attachment 699498 [details] proposed patch
Created attachment 699499 [details] tests for the new functionality
Fixed rlAssertBinaryOrigin so it returns the actual status code
Created attachment 700562 [details] proposed patch Merged the src and test patches, only binary is mandatory argument for rlAssertBinaryOrigin
Tested patch from the comment #7 applied on beakerlib-1.6-1.el6eso.noarch: Works both for "normal" and alternatives handled binaries. If not package name is supplied, the content of the PACKAGES environment variable is used. The documentation needs a little fix, Martin has been already notified.
Created attachment 702794 [details] proposed patch Documentation fixes
Both the functionality and the documentation is good from my POV.
This has not been yet committed to the git repo, moving to ASSIGNED. https://fedorahosted.org/beakerlib/wiki/CodingStyle#BugzillaStates Petr, could you have a look at this? It's blocking parametrization.
I've looked briefly through the sources, it looks generally fine. I'm just not sure about the following line: BINARY=$(ls -l $(which $CMD) | awk '{ print $NF }') What about using readlink here instead? Last thing: It's probably better to use rlLogInfo/rlLogError when reporting additional information rather than simply: echo "$CMD: command not found".
(In reply to comment #10) > Both the functionality and the documentation is good from my POV. Taking back the 'functionality' part. It *doesn't* work when there are more levels of symlimks. E.g. /usr/bin/XXX -> /etc/alternatives/XXX-provider -> /etc/alternatives/XXX-provider-internal -> /usr/share/provider/bin/XXX In that scenario the proposed patch doesn't find the final destination and tries to assert a symlink - which fails. Is there any reason why readlink command cannot be used? It would work correctly that way.
Created attachment 704988 [details] proposed patch * using readlink * minor fixes
Thanks for the patch, Martin. Pushed to git: http://git.fedorahosted.org/cgit/beakerlib.git/commit/?id=f4163cb
beakerlib-1.7-1.fc19 has been submitted as an update for Fedora 19. https://admin.fedoraproject.org/updates/beakerlib-1.7-1.fc19
Package beakerlib-1.7-1.fc19: * should fix your issue, * was pushed to the Fedora 19 testing repository, * should be available at your local mirror within two days. Update it with: # su -c 'yum update --enablerepo=updates-testing beakerlib-1.7-1.fc19' as soon as you are able to. Please go to the following url: https://admin.fedoraproject.org/updates/FEDORA-2013-7067/beakerlib-1.7-1.fc19 then log in and leave karma (feedback).
beakerlib-1.7-1.fc19 has been pushed to the Fedora 19 stable repository. If problems still persist, please make note of it in this bug report.