Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 15 May 2013 17:24:22 +0200
From:      Gyrd Thane Lange <gyrd-se@thanelange.no>
To:        Gyrd Thane Lange <gyrd-se@thanelange.no>
Cc:        Marco Steinbach <coco@executive-computing.de>, Baptiste Daroussin <bapt@FreeBSD.org>, FreeBSD Mailing List <freebsd-ports@freebsd.org>, Chris Rees <utisoft@gmail.com>
Subject:   Re: OPTIONSng: Overide options in /var/db/ports/*/options ?
Message-ID:  <5193A8A6.2000108@thanelange.no>
In-Reply-To: <20130317212713.326fc93d@parvati.thanelange.no>
References:  <5145B415.80303@executive-computing.de> <5145C9DC.6010300@infracaninophile.co.uk> <5145E47D.4050201@executive-computing.de> <CADLo8399uthkGDPGQv8aV8hdOuBzcsczcdx1tv5KoWAQmCjVFA@mail.gmail.com> <51460B2C.6080500@executive-computing.de> <20130317184927.GF72627@ithaqua.etoilebsd.net> <20130317212713.326fc93d@parvati.thanelange.no>

next in thread | previous in thread | raw e-mail | index | archive | help
This is a multi-part message in MIME format.

--Boundary_(ID_isg6SnZki9FxcShUbsppSw)
Content-type: text/plain; charset=ISO-8859-1
Content-transfer-encoding: 7BIT

Hi all, its been a while but I have prepared a patch.

On 17.03.2013 21:27, Gyrd Thane Lange wrote:

[Snipped away most of the discussion about whether
/var/db/ports/*/options or make.conf should have the final word, and
mechanisms for forcing one or the other.]

> I would rather have a mechanism where the port dialogue is brought up
> automatically if there is a conflict between the settings in make.conf
> and those stored in */options. The dialogue should then present the
> stored settings, with the make.conf settings applied latest.

(Forget about raising the dialogue and resolving conflicts
automatically. I found a better way.)

> This way my settings in make.conf will no longer be silently ignored.

Rather than forcing either of make.conf or /var/db/ports/*/options to
thrumph the other I have instead settled on a conflict reporting
mechanism that will prevent the port system from silently ignoring my
wishes and allow me to manually resolve the conflicts before building.

The gist of the attached patch is:

1) Go through the options in make.conf and command line (in priority
order) and build two lists:
  - a list of all options that MUST be set
  - a list of all options that MUST NOT be set

2) Compare with current options and build lists where options do not
match users MUST [NOT] preferences.

3) Act on any conflict
Currently I've only implemented a simple way of setting IGNORE with a
list of conflicting options when the following make variable is set.

OPTIONS_CONFLICT_ACTION=fail

If the variable is not set then no action will be taken (making this
feature non-obtrusive to users unless they activate it.) In the future
we may implement other actions: perhaps to automatically bring up the
configuration dialogue.

Note about (1). I see that _[UN]SET_FORCE options have been implemented
after I prepared this patch. This may easily be added to the patch if
required. I have not needed it yet.

This patch is complementary to all the other preference logic, since it
doesn't actually change any options but only report on them.

Best regards,
Gyrd ^_^


--Boundary_(ID_isg6SnZki9FxcShUbsppSw)
Content-type: text/plain; charset=windows-1252; name=mk_options_conflict.diff
Content-transfer-encoding: 7BIT
Content-disposition: attachment; filename=mk_options_conflict.diff

Index: Mk/bsd.options.mk
===================================================================
--- Mk/bsd.options.mk	(revision 317733)
+++ Mk/bsd.options.mk	(working copy)
@@ -315,6 +315,88 @@
 .undef _SORTED_OPTIONS
 .endif
 
+### 2013-04-19, GTL, check for conflicts
+# Build list of users express preference
+# Maintain two lists:
+#   a) A positive list of all options that MUST be set
+#   b) A negative list of all options that MUST NOT be set
+# Priority: (first listed is least important)
+#   1) Global
+#   2) Uniquename
+#   3) with_/without_ (from make.conf)
+#   4) command line
+
+# Global options...
+_OPTIONS_MUST_SET=	${OPTIONS_SET}
+_OPTIONS_MUST_UNSET=	${OPTIONS_UNSET}
+
+# Port specific options...
+.for opt in ${${UNIQUENAME}_SET}
+_OPTIONS_MUST_SET+=	${opt}
+_OPTIONS_MUST_UNSET:=	${_OPTIONS_MUST_UNSET:N${opt}}
+.endfor
+.for opt in ${${UNIQUENAME}_UNSET}
+_OPTIONS_MUST_SET:=	${_OPTIONS_MUST_SET:N${opt}}
+_OPTIONS_MUST_UNSET+=	${opt}
+.endfor
+
+# WITH and WITHOUT found in make.conf or reloaded from old optionsfile
+# Actually, we only want to heed settings from make.conf (not the optionsfile),
+# but I don't know how to tell them apart.
+#.for opt in ${ALL_OPTIONS}
+#.  if defined(WITH_${opt})
+#_OPTIONS_MUST_SET+=	${opt}
+#_OPTIONS_MUST_UNSET:=	${_OPTIONS_MUST_UNSET:N${opt}}
+#.  endif
+#.  if defined(WITHOUT_${opt})
+#_OPTIONS_MUST_SET:=	${_OPTIONS_MUST_SET:N${opt}}
+#_OPTIONS_MUST_UNSET+=	${opt}
+#.  endif
+#.endfor
+
+# Command line...
+.for opt in ${WITH}
+_OPTIONS_MUST_SET+=	${opt}
+_OPTIONS_MUST_UNSET:=	${_OPTIONS_MUST_UNSET:N${opt}}
+.endfor
+.for opt in ${WITHOUT}
+_OPTIONS_MUST_SET:=	${_OPTIONS_MUST_SET:N${opt}}
+_OPTIONS_MUST_UNSET+=	${opt}
+.endfor
+
+# Prettify...
+_OPTIONS_MUST_SET:=	${_OPTIONS_MUST_SET:O:u}
+_OPTIONS_MUST_UNSET:=	${_OPTIONS_MUST_UNSET:O:u}
+
+# report where current options does match users preferences
+.for opt in ${ALL_OPTIONS}
+.  if empty(PORT_OPTIONS:M${opt})
+.    if ${_OPTIONS_MUST_SET:M${opt}}
+_OPTIONS_CONFLICT_SET+=		${opt}
+.    endif
+.  else
+.    if ${_OPTIONS_MUST_UNSET:M${opt}}
+_OPTIONS_CONFLICT_UNSET+=	${opt}
+.    endif
+.  endif
+.endfor
+.undef opt
+.if !empty(OPTIONS_CONFLICT_ACTION:Mfail)
+.  if defined(_OPTIONS_CONFLICT_SET)
+.    if defined(_OPTIONS_CONFLICT_UNSET)
+eol_marker=.
+.    endif
+# Complain about options that should have been set
+IGNORE+=	Option ${_OPTIONS_CONFLICT_SET} unexpectedly unset${eol_marker}
+.  endif
+.  if defined(_OPTIONS_CONFLICT_UNSET)
+# Complain about options that should not have been set
+IGNORE+=	Option ${_OPTIONS_CONFLICT_UNSET} unexpectedly set
+.  endif
+.endif
+### End of conflicts check
+
+
 ### to be removed once old OPTIONS disappear
 .for opt in ${ALL_OPTIONS}
 .if empty(PORT_OPTIONS:M${opt})

--Boundary_(ID_isg6SnZki9FxcShUbsppSw)--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?5193A8A6.2000108>