Bug 1083597 - [RFE] create rlCheckMakefileRequires
Summary: [RFE] create rlCheckMakefileRequires
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Fedora
Classification: Fedora
Component: beakerlib
Version: 20
Hardware: Unspecified
OS: Unspecified
low
medium
Target Milestone: ---
Assignee: Dalibor Pospíšil
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard: Release
Depends On:
Blocks: Fedora-beakerlib-1.9-3 1116317
TreeView+ depends on / blocked
 
Reported: 2014-04-02 14:27 UTC by Dalibor Pospíšil
Modified: 2014-07-30 06:58 UTC (History)
5 users (show)

Fixed In Version: beakerlib-1.9-3.fc20
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2014-07-30 06:58:11 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)

Description Dalibor Pospíšil 2014-04-02 14:27:50 UTC
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.

Comment 1 Karel Srot 2014-04-02 14:47:50 UTC
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.

Comment 2 Ales Zelinka 2014-04-02 16:21:11 UTC
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?

Comment 3 Dalibor Pospíšil 2014-04-03 14:47:06 UTC
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.

Comment 4 Karel Srot 2014-04-04 04:50:20 UTC
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.

Comment 5 Ales Zelinka 2014-04-04 11:18:50 UTC
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)
}

Comment 6 Dalibor Pospíšil 2014-04-04 12:26:24 UTC
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.

Comment 7 Ales Zelinka 2014-04-04 12:33:26 UTC
(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.

Comment 8 Karel Srot 2014-04-04 12:39:32 UTC
Be sure to use 'yum provides --disablerepo=\*', otherwise it would be terribly slow.

Comment 9 Ales Zelinka 2014-04-14 11:19:55 UTC
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.

Comment 10 Dalibor Pospíšil 2014-04-17 07:56:44 UTC
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.

Comment 13 Fedora Update System 2014-06-17 13:43:07 UTC
beakerlib-1.9-1.fc20 has been submitted as an update for Fedora 20.
https://admin.fedoraproject.org/updates/beakerlib-1.9-1.fc20

Comment 14 Fedora Update System 2014-06-17 23:30:34 UTC
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).

Comment 15 Fedora Update System 2014-07-02 08:02:49 UTC
beakerlib-1.9-2.fc20 has been submitted as an update for Fedora 20.
https://admin.fedoraproject.org/updates/beakerlib-1.9-2.fc20

Comment 16 Dalibor Pospíšil 2014-07-04 08:51:01 UTC
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

Comment 17 Fedora Update System 2014-07-17 13:16:32 UTC
beakerlib-1.9-3.fc20 has been submitted as an update for Fedora 20.
https://admin.fedoraproject.org/updates/beakerlib-1.9-3.fc20

Comment 18 Fedora Update System 2014-07-30 06:58:11 UTC
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.


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