From mad@madpilot.net  Fri Mar  9 10:40:53 2012
Return-Path: <mad@madpilot.net>
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id A49601065670
	for <FreeBSD-gnats-submit@freebsd.org>; Fri,  9 Mar 2012 10:40:53 +0000 (UTC)
	(envelope-from mad@madpilot.net)
Received: from megatron.madpilot.net (megatron.madpilot.net [88.149.173.206])
	by mx1.freebsd.org (Postfix) with ESMTP id 17BAF8FC13
	for <FreeBSD-gnats-submit@freebsd.org>; Fri,  9 Mar 2012 10:40:53 +0000 (UTC)
Received: from megatron.madpilot.net (localhost [127.0.0.1])
	by megatron.madpilot.net (Postfix) with ESMTP id 3V44qy1Wwxz1gP
	for <FreeBSD-gnats-submit@freebsd.org>; Fri,  9 Mar 2012 11:40:46 +0100 (CET)
Received: from megatron.madpilot.net ([127.0.0.1])
	by megatron.madpilot.net (megatron.madpilot.net [127.0.0.1]) (amavisd-new, port 10026)
	with ESMTP id SQHLIxavNDr0 for <FreeBSD-gnats-submit@freebsd.org>;
	Fri,  9 Mar 2012 11:40:43 +0100 (CET)
Received: by megatron.madpilot.net (Postfix, from userid 1000)
	id 3V44qv50ncz1gN; Fri,  9 Mar 2012 11:40:43 +0100 (CET)
Message-Id: <3V44qv50ncz1gN@megatron.madpilot.net>
Date: Fri,  9 Mar 2012 11:40:43 +0100 (CET)
From: Guido Falsi <mad@madpilot.net>
Reply-To: Guido Falsi <mad@madpilot.net>
To: FreeBSD-gnats-submit@freebsd.org
Cc:
Subject: [PATCH] bsd.database.mk does not honour WITH_PGSQL_VER anymore
X-Send-Pr-Version: 3.113
X-GNATS-Notify:

>Number:         165874
>Category:       ports
>Synopsis:       [PATCH] bsd.database.mk does not honour WITH_PGSQL_VER anymore
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    crees
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          change-request
>Submitter-Id:   current-users
>Arrival-Date:   Fri Mar 09 10:50:06 UTC 2012
>Closed-Date:    Sat Mar 10 23:54:16 UTC 2012
>Last-Modified:  Sun Mar 11 00:00:23 UTC 2012
>Originator:     Guido Falsi
>Release:        FreeBSD 9.0-STABLE amd64
>Organization:
none
>Environment:
System: FreeBSD megatron.madpilot.net 9.0-STABLE FreeBSD 9.0-STABLE #3 r232684: Thu Mar 8 11:40:10 CET 2012 root@megatron.madpilot.net:/usr/obj/usr/src/sys/MEGATRON amd64

>Description:

After the last commit to bsd.databse.mk on march 6th the WITH_PGSQL_VER
variable in make.conf is not being honoured anymore.

The new version of the file is forcing PGSQL_VER == 90, this happens
because the sequence of if-elif-elses always ends up in the fallback
else.

I tested this patch with the ports that were causing me problems,
and seems to fix it without any ill effects, but it needs to be
better reviewed before committing it.

>How-To-Repeat:

With recent ports tree(Mk/bsd.database.mk version >= 1.67) do:

# cd /usr/ports/databases/libdbi-drivers && make -DWITH_PGSQL_VER=91 -V PGSQL_VER
90

if more testing is needed performing the build will try to install
postgresql90-client, which is wrong with that variabler defined.

>Fix:

--- Mk/bsd.database.mk.orig	2012-03-09 10:55:59.000000000 +0100
+++ Mk/bsd.database.mk	2012-03-09 11:28:39.000000000 +0100
@@ -204,34 +204,34 @@
 .      endfor
 .    endif
 _WANT_PGSQL_VER?=	${WANT_PGSQL_VER}
+.  endif
 
-.    if defined(WITH_PGSQL_VER) && !empty(_WANT_PGSQL_VER)
-.      for version in ${_WANT_PGSQL_VER}
-.        if ${WITH_PGSQL_VER} == ${version} 
+.  if defined(WITH_PGSQL_VER) && !empty(_WANT_PGSQL_VER)
+.    for version in ${_WANT_PGSQL_VER}
+.      if ${WITH_PGSQL_VER} == ${version} 
 PGSQL_VER=	${WITH_PGSQL_VER}
-.        endif
-.      endfor
+.      endif
+.    endfor
 
 # Take highest allowed version, but take default if allowed
-.    elif !empty(_WANT_PGSQL_VER)
-.      for ver in ${_WANT_PGSQL_VER}
-.        if ${DEFAULT_PGSQL_VER} == ${ver}
+.  elif !empty(_WANT_PGSQL_VER)
+.    for ver in ${_WANT_PGSQL_VER}
+.      if ${DEFAULT_PGSQL_VER} == ${ver}
 PGSQL_VER=	${ver}
-.        else
+.      else
 _PGSQL_VER_HIGHEST=	${ver}
-.        endif
-.      endfor
+.      endif
+.    endfor
 PGSQL_VER?=	${_PGSQL_VER_HIGHEST}
-.    elif defined(WITH_PGSQL_VER)
+.  elif defined(WITH_PGSQL_VER)
 PGSQL_VER=	${WITH_PGSQL_VER}
 .  endif
-.  else
-.    if defined(_PGSQL_VER)
+
+.  if defined(_PGSQL_VER)
 PGSQL_VER=	${_PGSQL_VER}
-.    else
-PGSQL_VER=	${DEFAULT_PGSQL_VER}
-.    endif
-.  endif # WANT_PGSQL_VER
+.  else
+PGSQL_VER?=	${DEFAULT_PGSQL_VER}
+.  endif
 
 .      if empty(PGSQL_VER)
 IGNORE?=	cannot install: the port wants postgresql-client version ${WANT_PGSQL_VER} and you have set WITH_PGSQL_VER=${WITH_PGSQL_VER} in make.conf or have postgresql${WITH_PGSQL_VER}-client installed
>Release-Note:
>Audit-Trail:
Responsible-Changed-From-To: freebsd-ports-bugs->crees 
Responsible-Changed-By: crees 
Responsible-Changed-When: Sat Mar 10 22:42:46 UTC 2012 
Responsible-Changed-Why:  
My fault. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=165874 
State-Changed-From-To: open->analyzed 
State-Changed-By: crees 
State-Changed-When: Sat Mar 10 23:43:16 UTC 2012 
State-Changed-Why:  
Yes, sorry about that.  I've simplified the logic at 
http://people.freebsd.org/~crees/patches/165874.diff ; it now ensures 
that the installed version is in sync with WITH_, if WITH is unset and 
no installed version it sets WITH to default, then only deals with WITH. 
By the way, make -DWITH_PGSQL_VER=91 doesn't do what you think; it 
defines WITH_PGSQL_VER as empty.  You should use make WITH_PGSQL_VER=91 
:)  I'll commit this if my testing works fine 

http://www.freebsd.org/cgi/query-pr.cgi?pr=165874 
State-Changed-From-To: analyzed->closed 
State-Changed-By: crees 
State-Changed-When: Sat Mar 10 23:54:15 UTC 2012 
State-Changed-Why:  
Fixed.  Thanks for the heads-up. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=165874 

From: dfilter@FreeBSD.ORG (dfilter service)
To: bug-followup@FreeBSD.org
Cc:  
Subject: Re: ports/165874: commit references a PR
Date: Sat, 10 Mar 2012 23:56:27 +0000 (UTC)

 crees       2012-03-10 23:53:22 UTC
 
   FreeBSD ports repository
 
   Modified files:
     Mk                   bsd.database.mk 
   Log:
   Correct PGSQL_VER generation; was too complicated with many variables.
   
   For simplicity, WITH_PGSQL_VER is verified to be correct and then used as the "authoritative" value to compare with WANT_PGSQL_VER range.
   
   PR:             ports/165874
   Submitted by:   Guido Falsi <mad@madpilot.net> (based on)
   Reviewed by:    make index
   Feature safe:   yes
   
   Revision  Changes    Path
   1.69      +21 -33    ports/Mk/bsd.database.mk
 _______________________________________________
 cvs-all@freebsd.org mailing list
 http://lists.freebsd.org/mailman/listinfo/cvs-all
 To unsubscribe, send any mail to "cvs-all-unsubscribe@freebsd.org"
 
>Unformatted:
