On 02/29/2016 07:27 PM, Lukas Slebodnik wrote:
On (29/02/16 18:54), Nikolai Kondrashov wrote:
> On 02/29/2016 06:31 PM, Lukas Slebodnik wrote:
>> The rest of the required packages CI will attempt to install itself, using
>> -the distribution's package manager invoked through sudo.
>> +the distribution's package manager invoked through sudo. We need to use
>> +yum-deprecated instead of yum on Fedora >= 22 due to bug in dnf BZ1215208.
>>
>> A sudo rule can be employed to selectively avoid password prompts on Red Hat
>> distros:
>>
>> <USER> ALL=(ALL:ALL) NOPASSWD: /usr/bin/yum --assumeyes install -- *
>> + <USER> ALL=(ALL:ALL) NOPASSWD: /usr/bin/yum-deprecated --assumeyes
install -- *
>
> It would be good to mention the different rule required on RHEL here (CI still
> invokes "yum" there). Otherwise the instructions would be wrong and
confusing.
>
It looks like I'm brainwashed today. I'm out of ideas for reasonable sentence.
Could you suggest something.
Sure, let's try this:
The rest of the required packages CI will attempt to install itself, using
the distribution's package manager invoked through sudo.
A sudo rule can be employed to selectively avoid password prompts on RHEL
distros:
<USER> ALL=(ALL:ALL) NOPASSWD: /usr/bin/yum --assumeyes install -- *
on Fedora distros:
# We need to use yum-deprecated on Fedora because of BZ1215208.
<USER> ALL=(ALL:ALL) NOPASSWD: /usr/bin/yum-deprecated --assumeyes install
-- *
> keeping the "if" branches consistent and somewhat
easier to interpret.
> However, if you and others are more comfortable reading and using regex(3)
> regexes, then it's fine.
>
>> + [ $# != 0 ] && sudo -p "$prompt" \
>> + yum-deprecated --assumeyes install -- "$@"
|&
>> + awk 'BEGIN {s=0}
>> + /^No package .* available.$/ {s=1}
>> + {print}
>> + END {exit s}'
>> + elif [[ "$DISTRO_BRANCH" == -redhat-* ]]; then
>> [ $# != 0 ] && sudo -p "$prompt" yum --assumeyes
install -- "$@" |&
>> # Pass input to output, fail if a missing package is reported
>> # TODO Remove and switch to DNF once
>
> I see that avoiding copy-pasting here would produce more complicated code, so
> it's perhaps OK. However, it would be good then to copy-paste the comment
> along with the TODO as well, and then perhaps add a note and a TODO regarding
> BZ1215208.
>
We will still need awk trick for old style yum on el{6,7}. Therefore
I moved TODO to the 1st branch.
Well, yeah, the bug is Fedora-specific, but we still need to have a reminder
to remove the hack on RHEL as well. It will get fixed eventually.
Nick