Bug 177006

Summary: [PATCH] lang/perl5.12, lang/perl5.14, lang/perl5.16: Don't write to make.conf unless necessary
Product: Ports & Packages Reporter: Craig Leres <leres>
Component: Individual Port(s)Assignee: freebsd-perl (Nobody) <perl>
Status: Closed FIXED    
Severity: Affects Only Me CC: leres
Priority: Normal    
Version: Latest   
Hardware: Any   
OS: Any   
Attachments:
Description Flags
patch.txt none

Description Craig Leres freebsd_committer freebsd_triage 2013-03-15 23:10:00 UTC
	Reinstalling perl results in a USE_PERL line being appended
	to /etc/make.conf even when the identical definition is
	already present and in effect.

Fix: Only update when necessary; apply the attached patch to
	files/use.perl in lang/perl5.12, lang/perl5.14 and
	lang/perl5.16.
How-To-Repeat: 	deinstall/install perl and notice make.conf has been changed:

	# co -p /etc/make.conf | diff -u - /etc/make.conf
	/etc/RCS/make.conf,v  -->  standard output
	revision 1.48
	--- -   2013-03-15 15:54:26.831481426 -0700
	+++ /etc/make.conf      2013-03-15 15:54:14.000000000 -0700
	@@ -79,3 +79,5 @@
	 PYTHON_VERSION=python2.7
	 PERL_VERSION=5.16.2
	 WITH_BDB_VER=48
	+# added by use.perl 2013-03-15 15:54:14
	+PERL_VERSION=5.16.2
Comment 1 Edwin Groothuis freebsd_committer freebsd_triage 2013-03-15 23:10:08 UTC
Responsible Changed
From-To: freebsd-ports-bugs->skv

Over to maintainer (via the GNATS Auto Assign Tool)
Comment 2 azverev 2013-04-22 07:23:58 UTC
Hello Craig.

Cleaning make.conf must occurs on deinstall and called from here:

do_cleanup_make_conf()
{
        echo -n "Cleaning up ${MAKE_CONF}..."
        if [ -f ${MAKE_CONF} ] ; then
                /bin/cp -p ${MAKE_CONF} ${MAKE_CONF}.new
                /usr/bin/awk 's=3D0;
                        /^#.*use.perl/ { s=3D1; mode=3D1 }
                        /^#/ { s=3D1; if (mode !=3D 1) { mode=3D0 } }
                        /.*PERL.*=3D/ { s=3D1; if (mode =3D=3D 1) { =
mode=3D2 } }
                        /^$/ { s=3D1; if (mode !=3D 2) { mode =3D 0 } }
                        { if (s !=3D 1) { mode =3D 0 } if (mode =3D=3D =
0) print
}' ${MAKE_CONF} >${MAKE_CONF}.new
                /bin/mv ${MAKE_CONF} ${MAKE_CONF}.bak
                /bin/mv ${MAKE_CONF}.new ${MAKE_CONF}
        fi
        echo " Done."
}
Comment 3 Eitan Adler freebsd_committer freebsd_triage 2013-04-22 17:14:05 UTC
Responsible Changed
From-To: skv->freebsd-ports-bugs

skv's ports bit has been taken in for safekeeping
Comment 4 Edwin Groothuis freebsd_committer freebsd_triage 2013-06-17 02:11:03 UTC
Responsible Changed
From-To: freebsd-ports-bugs->perl

Over to maintainer (via the GNATS Auto Assign Tool)
Comment 5 Alex Kozlov freebsd_committer freebsd_triage 2013-09-27 18:08:00 UTC
State Changed
From-To: open->closed

Thanks for your work, but looks like PR is obsolete after r327989 (perl 
doesn't write to /etc/make.conf anymore).