Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make pylint and jsl optional #502

Closed
wants to merge 1 commit into from
Closed

Conversation

tiran
Copy link
Member

@tiran tiran commented Feb 24, 2017

./configure no longer fails when pylint or jsl are not available. The
make targets for pylint and jsl are no longer defined without the tools.

Rational:
pylint and jsl are not required to build FreeIPA. Both are useful
developer tools. It's more user friendly to make both components
optionally with default config arguments. There is no reason to
fail building on a build system without development tools.

It's still possible to enforce dependency checks with --with-jslint and
--enable-pylint.

https://fedorahosted.org/freeipa/ticket/6604

Signed-off-by: Christian Heimes cheimes@redhat.com

@tkrizek
Copy link
Contributor

tkrizek commented Mar 1, 2017

Please clean up the confgure.ac and update freeipa.spec file as well.

configure.ac:375:       AS_HELP_STRING([--disable-pylint],
freeipa.spec.in:16:    %global enable_pylint_option --disable-pylint
freeipa.spec.in:17:    %global without_jslint_option --without-jslint

@tkrizek tkrizek self-assigned this Mar 1, 2017
@tiran
Copy link
Member Author

tiran commented Mar 1, 2017

good catch, @tomaskrizek

@lslebodn
Copy link
Contributor

lslebodn commented Mar 1, 2017

May I know why the default was changed without design discussion?

IIRC pscacek intentionally enabled it by default. Much better approach would be to print hint at configure time detection that it is optional and can be disabled.

Code wise; the change is too complicated (too many nested if condition ...)
which does not improve readability of configure.ac

Copy link
Contributor

@lslebodn lslebodn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code wise; the change is too complicated (too many nested if condition ...)
which does not improve readability of configure.ac

@tiran
Copy link
Member Author

tiran commented Mar 1, 2017

Please see ticket for reasoning.

My solution is the best thing, I could come up with in short time. It's not worth the trouble to burn a lot of time on it. It's write-once code. You are welcome to provide a better solution. I know your autoconf Fu is stronger than mine.

@lslebodn
Copy link
Contributor

lslebodn commented Mar 1, 2017

Writing hint together with error is the simplest solution. And still remind developers to install pylint/jslint.

e.g.

diff --git a/configure.ac b/configure.ac
index af41f5e3a..c02dd1fe4 100644
--- a/configure.ac
+++ b/configure.ac
@@ -384,7 +384,10 @@ if test x$PYLINT != xno; then
     AC_MSG_CHECKING([for Pylint])
     $PYTHON -m pylint --version > /dev/null
     if test "$?" != "0"; then
-        AC_MSG_ERROR([cannot find pylint for $PYTHON])
+        AC_MSG_ERROR([cannot find pylint for $PYTHON
+This feature is optional and aimed for developers. You can skip this check
+wich configure time option --disable-pylint
+        ])
     else
         AC_MSG_RESULT([yes])
     fi

@lslebodn
Copy link
Contributor

lslebodn commented Mar 1, 2017

Please add explanation to the thumb down

@lslebodn
Copy link
Contributor

lslebodn commented Mar 1, 2017

It was explained on IRC

< cheimes> lslebodn: Your proposal is missing the point of the ticket. It doesn't not simplify
building, but rather improves error messages. The whole point of the ticket is a more
pleasant experience for outsiders that are not FreeIPA core contributors.

But there is main problem with this PR. The design document expected these option enabled by default.
http://www.freeipa.org/page/V4/Build_system_refactoring

This is a reason why I mentioned to log just a hint for optional *lint dependencies.

And ticket https://pagure.io/freeipa/issue/6604 says that options were made optional a moth ago

master:

  • 5c18fea CONFIGURE: Fix detection of pylint
  • 3f91469 CONFIGURE: Update help message for jslint
  • b82d285 SPEC: Fix build in mock

@tkrizek
Copy link
Contributor

tkrizek commented Mar 1, 2017

@lslebodn We don't want to have linters enabled by default when you run ./configure without options. But you're right we should update the wiki pages to mention the new defaults.

@tkrizek tkrizek added the ack Pull Request approved, can be merged label Mar 1, 2017
@lslebodn
Copy link
Contributor

lslebodn commented Mar 1, 2017

But you're right we should update the wiki pages to mention the new defaults.
Such change require broader discussion.

e.g. I know that @rcritten had strong opinion about pylint usage in past.

@tiran
Copy link
Member Author

tiran commented Mar 1, 2017

@tomaskrizek good point, I added a TODO item to the ticket, https://pagure.io/freeipa/issue/6604#comment-415669

@tkrizek
Copy link
Contributor

tkrizek commented Mar 1, 2017

Wiki page updated (along with `--without-ipatests`` option from #364).

@lslebodn Ok, let's keep the PR open for a couple days to see if there's any disagreement. I don't see this as a drastic change that should be widely discussed, but feel free to bring up the topic on freeipa-devel if you disagree.

@MartinBasti
Copy link
Contributor

Since we have gating here each PR is checked by linters, commits are checked before pushed, that was reason why linters are optional now in build.

@pvoborni
Copy link
Member

pvoborni commented Mar 1, 2017

+1 Reasoning for not skipping linters was that reviewer or patch author can forget to run those. This problem was solved by travis checks.

@lslebodn
Copy link
Contributor

lslebodn commented Mar 1, 2017 via email

@HonzaCholasta
Copy link
Contributor

I tend to agree with @lslebodn, but I don't have a strong opinion on this. I noticed a couple of issues though:

  • --without-jslint does not seem to work correctly:

    $ ./configure --without-jslint
    ...
                        IPA Server 4.4.90.dev201703020634+git3a29b47
                        ========================
    ...
            jslint:                   /usr/bin/jsl
    ...
    
  • In freeipa.spec.in, when with_lint is not defined, lint should be disabled, so --disable-pylint and --without-jslint should be passed to %configure.

@lslebodn
Copy link
Contributor

lslebodn commented Mar 2, 2017 via email

@stlaz
Copy link
Contributor

stlaz commented Mar 2, 2017

There's an ongoing discussion about the acceptance of the patch. Removing the ACK label until the acceptance is agreed on. Please, @lslebodn or @tomaskrizek, add the label back once that is done. However, please, try to cut the discussion short and make the decision in the least comments possible.

@stlaz stlaz removed the ack Pull Request approved, can be merged label Mar 2, 2017
@tkrizek
Copy link
Contributor

tkrizek commented Mar 2, 2017

Since --without-jslint was removed, there's actually no way to explicitly turn off jsl (it will always be autodetected). I tried to set --with-jslint=no, but that didn't do the trick.

Pylint can be disabled with --enable-pylint=no, however.

I suggest the following:

  • when --with-jslint=no, turn off jsl,
  • pass --with-jslint=no --enable-pylint=no to %configure in freeipa.spec.in when with_lint is not defined.

@tiran
Copy link
Member Author

tiran commented Mar 2, 2017

@tomaskrizek autoconf is a bit magic. --without-jslint is still there. The line AC_ARG_WITH([jslint], ...) provides --with-jslint and --without-jslint. But there was a bug in my check logic.

I pushed another fix that fixed a bug in my logic and replaces some complicated checks with a straight-forward AS_CASE block.

freeipa.spec.in Outdated
@@ -11,10 +11,7 @@
# lint is not executed during rpmbuild
# %%global with_lint 1
%if 0%{?with_lint}
%global enable_pylint_option --enable-pylint
%else
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As @HonzaCholasta mentioned, if with_lint is not defined, linting should be disabled.

@tiran
Copy link
Member Author

tiran commented Mar 2, 2017

Which audience is our primary concern here?

  1. Should default settings be tailored towards downstream packager?
  2. Or should defaults settings be user-friendly for upstream and external users?

I'm for upstream first.

Packaging is pretty much automated and scripted. A packager can easily adjust a script for a new version. There also just a handful of distributions (Fedora/RHEL/CentOS, Debian/Ubuntu, SuSE, Gentoo).

@tkrizek
Copy link
Contributor

tkrizek commented Mar 3, 2017

@tiran Needs rebase.

@lslebodn
Copy link
Contributor

lslebodn commented Mar 3, 2017 via email

@tkrizek tkrizek removed the ack Pull Request approved, can be merged label Mar 3, 2017
@tiran tiran force-pushed the optional_linters branch 2 times, most recently from 12e21b6 to fe062ff Compare March 14, 2017 16:54
@tiran
Copy link
Member Author

tiran commented Mar 14, 2017

The PR got three +1 / heart and not -1. I propose to get it merged for 4.5 today.

./configure no longer fails when pylint or jsl are not available. The
make targets for pylint and jsl are no longer defined without the tools.

Rational:
pylint and jsl are not required to build FreeIPA. Both are useful
developer tools. It's more user friendly to make both components
optionally with default config arguments. There is no reason to
fail building on a build system without development tools.

It's still possible to enforce dependency checks with --with-jslint and
--enable-pylint.

https://fedorahosted.org/freeipa/ticket/6604

Signed-off-by: Christian Heimes <cheimes@redhat.com>
@lslebodn
Copy link
Contributor

lslebodn commented Mar 14, 2017 via email

@tiran
Copy link
Member Author

tiran commented Mar 14, 2017

#502 (comment)

two thumbs up, one heart, no thumbs down

@HonzaCholasta
Copy link
Contributor

This PR makes packaging IPA 4.5 on RHEL 7 easier for me, so thumbs up from me.

@tiran
Copy link
Member Author

tiran commented Mar 15, 2017

PR #593 addresses @lslebodn concerns and provides a superior solution for local pre-commit checking.

@tkrizek tkrizek added the ack Pull Request approved, can be merged label Mar 15, 2017
@lslebodn
Copy link
Contributor

lslebodn commented Mar 15, 2017

PR #593 is not related to default yes; It is about something else.

Current version does not fix concerns; because default should be yes as it was discussed in https://www.redhat.com/archives/freeipa-devel/2017-March/msg00371.html

I looks like upstream discussion is useless. And nobody cares about other distributions then fedora/rhel which can parse recommendation form upstream spec file.

I am really disappointed from such upstream unfriendly approach.

@lslebodn
Copy link
Contributor

lslebodn commented Mar 15, 2017

This PR makes packaging IPA 4.5 on RHEL 7 easier for me, so thumbs up from me.

I understand it is more convenient to have less extra configure options in rhel;
But it was discussed on upstream mailing list and better error messages would give such hints to everyone. https://www.redhat.com/archives/freeipa-devel/2017-March/msg00308.html

@HonzaCholasta it would be good if you add comment also to upstream discussion; if you prefer autodetection. It would be good if result of discussion is the same as pushed patch.
https://www.redhat.com/archives/freeipa-devel/2017-March/msg00371.html

Current version will not persuade other distributions(debian; openSUSE) to run pylint as part of build.

@lslebodn
Copy link
Contributor

lslebodn commented Mar 15, 2017 via email

@HonzaCholasta
Copy link
Contributor

@lslebodn, nobody said that this has to be the last lint build related patch ever, we can change the behavior later, even on top of this PR. I would rather push this now and continue the discussion / submit additional PRs after 4.5 is released.

@lslebodn
Copy link
Contributor

lslebodn commented Mar 15, 2017 via email

@HonzaCholasta
Copy link
Contributor

4.5.1 will be an official release too.

@pvoborni
Copy link
Member

There was no result in the upstream discussion. My personal opinion is that one way or the other can work. They are for different use cases. I tend to prefer the "be easier for developer" approach. That said, preferred method for downstreams needs to be documented ideally in BUILD.txt.

In any case spending so much time discussing so minor change is a waste of time. I'd push it.

@tiran
Copy link
Member Author

tiran commented Mar 15, 2017

@pvoborni For the use case "easy for developers" the make lint target is not sufficient. It tests only a small subset and doesn't check Python 3 issues. PR #593 provides a better alternative for a pre-commit patch check that takes care of linting on Python 2 and 3 plus additional checks.

@lslebodn
Copy link
Contributor

lslebodn commented Mar 15, 2017 via email

@HonzaCholasta
Copy link
Contributor

master:

  • f1f6350 Make pylint and jsl optional

@HonzaCholasta HonzaCholasta added the pushed Pull Request has already been pushed label Mar 15, 2017
@tiran tiran deleted the optional_linters branch March 15, 2017 12:38
@pvoborni
Copy link
Member

If it improves messages then I assume so provided that in won't be controversial in other aspects.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ack Pull Request approved, can be merged pushed Pull Request has already been pushed
Projects
None yet
7 participants