Bug 202375 - ports-mgmt/portlint: warn about not using option helpers
Summary: ports-mgmt/portlint: warn about not using option helpers
Status: Open
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Only Me
Assignee: Joe Marcus Clarke
URL:
Keywords: feature, needs-patch
Depends on:
Blocks:
 
Reported: 2015-08-16 23:09 UTC by Jan Beich
Modified: 2017-12-31 14:34 UTC (History)
1 user (show)

See Also:
bugzilla: maintainer-feedback? (marcus)


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Jan Beich freebsd_committer 2015-08-16 23:09:32 UTC
To make ports' Makefiles easier to read and review portlint should warn about conditionals that can be eliminated with option helpers. At least for new ports.

For example,

  $ cd net/ocserv
  $ portlint -C
  WARN: Makefile: [49]: USES is defined with `+='. Consider using option helper FOO_USES instead.
  WARN: Makefile: [50]: LIB_DEPENDS is defined with `+='. Consider using option helper FOO_LIB_DEPENDS instead.
  WARN: Makefile: [52]: CONFIGURE_ARGS is defined with `+='. Consider using option helpers instead: FOO_CONFIGURE_ENABLE, FOO_CONFIGURE_WITH or FOO_CONFIGURE_ON.
  WARN: Makefile: [68]: PORT_OPTIONS found within *-install target. Consider using target option helper pre-install-FOO-on or post-install-FOO-on instead.
  WARN: Makefile: [73]: PORT_OPTIONS found within *-install target. Consider using target option helper pre-install-FOO-on or post-install-FOO-on instead.
Comment 1 Joe Marcus Clarke freebsd_committer 2015-10-25 16:53:59 UTC
Are you asking for literal examples below?  Meaning that if something is spotted with a += assignment, I should recommend FOO_* helpers?  That is doable, but being able to detect the specific option would be difficult.
Comment 2 Jan Beich freebsd_committer 2015-10-25 18:41:47 UTC
Anything with "/^\.[[:space:]]*if.*PORT_OPTIONS/,/^\.[[:space:]]*endif/" awk/sed range can potentially be converted. If they aren't enough sometimes one can write custom helpers e.g.,

# From multimedia/openh264
DEBUG_BUILD_DEPENDS_OFF=        ${DEBUG_BUILD_DEPENDS_OFF_${ARCH}}
DEBUG_BUILD_DEPENDS_OFF_amd64=  nasm:${PORTSDIR}/devel/nasm
DEBUG_BUILD_DEPENDS_OFF_i386=   nasm:${PORTSDIR}/devel/nasm

Contrary to comment 0 no need to emphasize on patterns like += to avoid a lot of false positives from other conditionals, shared files or slave ports.
Comment 3 w.schwarzenfeld freebsd_triage 2017-12-31 14:34:33 UTC
Forgotten to close?