From owner-svn-ports-all@FreeBSD.ORG Mon Oct 14 16:22:35 2013 Return-Path: Delivered-To: svn-ports-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id A40537A7; Mon, 14 Oct 2013 16:22:35 +0000 (UTC) (envelope-from ak@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 8FD732471; Mon, 14 Oct 2013 16:22:35 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r9EGMZSF006599; Mon, 14 Oct 2013 16:22:35 GMT (envelope-from ak@svn.freebsd.org) Received: (from ak@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r9EGMYV6006595; Mon, 14 Oct 2013 16:22:34 GMT (envelope-from ak@svn.freebsd.org) Message-Id: <201310141622.r9EGMYV6006595@svn.freebsd.org> From: Alex Kozlov Date: Mon, 14 Oct 2013 16:22:34 +0000 (UTC) To: ports-committers@freebsd.org, svn-ports-all@freebsd.org, svn-ports-head@freebsd.org Subject: svn commit: r330335 - in head/lang: perl5.12/files perl5.14/files perl5.16/files perl5.18/files X-SVN-Group: ports-head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-ports-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the ports tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 14 Oct 2013 16:22:35 -0000 Author: ak Date: Mon Oct 14 16:22:34 2013 New Revision: 330335 URL: http://svnweb.freebsd.org/changeset/ports/330335 Log: - Simplify and modernize use.perl Approved by: perl (az, mat) Modified: head/lang/perl5.12/files/use.perl head/lang/perl5.14/files/use.perl head/lang/perl5.16/files/use.perl head/lang/perl5.18/files/use.perl Modified: head/lang/perl5.12/files/use.perl ============================================================================== --- head/lang/perl5.12/files/use.perl Mon Oct 14 16:10:52 2013 (r330334) +++ head/lang/perl5.12/files/use.perl Mon Oct 14 16:22:34 2013 (r330335) @@ -2,64 +2,31 @@ # $FreeBSD$ -this=`echo -n $0 | /usr/bin/sed -e 's!^.*/!!'` +LINK_USRBIN="%%LINK_USRBIN%%" +: ${OSVERSION:=`/sbin/sysctl -n kern.osreldate`}; +PERL_ARCH="%%PERL_ARCH%%" PERL_VERSION="%%PERL_VERSION%%" PERL_VER="%%PERL_VER%%" -PERL5_SIGNATURE=%%PERL5_SIGNATURE%% -banner=`date +"%F %T"` -banner="# added by use.perl $banner" -if [ -z "${OSVERSION}" ]; then - if [ -f /sbin/sysctl -a -x /sbin/sysctl ] ; then - osreldate=`/sbin/sysctl -n kern.osreldate` - else - osreldate=`/usr/sbin/sysctl -n kern.osreldate` - fi -else - osreldate=${OSVERSION} -fi - -if [ "$2" = "POST-INSTALL" ] ; then - need_remove_links=%%LINK_USRBIN%% - need_create_links=%%LINK_USRBIN%% - need_remove_perl5_signature=yes - need_create_perl5_signature=yes - need_post_install=yes - if [ "${osreldate}" -lt 900022 ]; then - need_cleanup_manpath=yes - need_spam_manpath=yes - fi -elif [ "$2" = "POST-DEINSTALL" ] ; then - need_remove_links=%%LINK_USRBIN%% - need_remove_perl5_signature=yes - if [ "${osreldate}" -lt 900022 ]; then - need_cleanup_manpath=yes - fi -else - exit 0; -fi - -special_link_list=" - perl - perl5" +PERL5_SIGNATURE="%%PERL5_SIGNATURE%%" +banner="# added by use.perl $(/bin/date +'%F %T')" +special_link_list="perl perl5" do_remove_links() { echo "Removing stale symlinks from /usr/bin..." - for binary in $special_link_list - do - if [ -L "/usr/bin/$binary" ] ; then - echo " Removing /usr/bin/$binary" - /bin/rm -f "/usr/bin/$binary" + for binary in ${special_link_list} ; do + if [ -L "/usr/bin/${binary}" ] ; then + echo " Removing /usr/bin/${binary}" + /bin/rm -f "/usr/bin/${binary}" else - echo " Skipping /usr/bin/$binary" + echo " Skipping /usr/bin/${binary}" fi done bins=`/bin/ls /usr/bin/*perl*5.* ${PKG_PREFIX}/bin/*perl*5.* 2>/dev/null` - for binary in $bins - do - if [ -L "$binary" ] ; then - echo " Removing $binary installed by an older perl port" - /bin/rm -f "$binary" + for binary in ${bins} ; do + if [ -L "${binary}" ] ; then + echo " Removing ${binary} installed by an older perl port" + /bin/rm -f "${binary}" fi done echo "Done." @@ -68,20 +35,18 @@ do_remove_links() do_create_links() { echo "Creating various symlinks in /usr/bin..." - for binary in $special_link_list - do - if [ -f "/usr/bin/$binary" ] ; then - echo " Backing up /usr/bin/$binary as /usr/bin/$binary.freebsd" - /bin/mv -f "/usr/bin/$binary" "/usr/bin/$binary.freebsd" + for binary in ${special_link_list} ; do + if [ -f "/usr/bin/${binary}" ] ; then + echo " Backing up /usr/bin/${binary} as /usr/bin/${binary}.freebsd" + /bin/mv -f "/usr/bin/${binary}" "/usr/bin/${binary}.freebsd" fi - bin=`echo $binary | /usr/bin/sed -e 's!perl5!perl!'` - if [ -e "/usr/bin/$binary" ] ; then - echo " *** /usr/bin/$binary is still there, which should not happen" - elif [ -e "$PKG_PREFIX/bin/${bin}%%PERL_VERSION%%" ] ; then - echo " Symlinking $PKG_PREFIX/bin/${bin}%%PERL_VERSION%% to /usr/bin/$binary" - /bin/ln -sf "$PKG_PREFIX/bin/${bin}%%PERL_VERSION%%" "/usr/bin/$binary" + if [ -e "/usr/bin/${binary}" ] ; then + echo " *** /usr/bin/${binary} is still there, which should not happen" + elif [ -e "${PKG_PREFIX}/bin/perl${PERL_VERSION}" ] ; then + echo " Symlinking ${PKG_PREFIX}/bin/perl${PERL_VERSION} to /usr/bin/${binary}" + /bin/ln -sf "${PKG_PREFIX}/bin/perl${PERL_VERSION}" "/usr/bin/${binary}" else - echo " *** $PKG_PREFIX/bin/${bin}%%PERL_VERSION%% is not there, a symlink won't do any good" + echo " *** ${PKG_PREFIX}/bin/perl${PERL_VERSION} is not there, a symlink won't do any good" fi done echo "Done." @@ -90,18 +55,16 @@ do_create_links() do_post_install() { INCLUDEDIR=/usr/include - install -d ${PKG_PREFIX}/lib/perl5/site_perl/%%PERL_VER%%/%%PERL_ARCH%%/auto - install -d ${PKG_PREFIX}/lib/perl5/site_perl/%%PERL_VER%%/auto - install -d ${PKG_PREFIX}/lib/perl5/%%PERL_VER%%/man/man3 + install -d ${PKG_PREFIX}/lib/perl5/site_perl/${PERL_VER}/${PERL_ARCH}/auto + install -d ${PKG_PREFIX}/lib/perl5/site_perl/${PERL_VER}/auto + install -d ${PKG_PREFIX}/lib/perl5/${PERL_VER}/man/man3 cd ${INCLUDEDIR} && ${PKG_PREFIX}/bin/h2ph *.h machine/*.h sys/*.h >/dev/null } do_remove_perl5_signature() { echo -n "Removing ${PERL5_SIGNATURE}..." - if [ -f ${PERL5_SIGNATURE} ] ; then - /bin/rm ${PERL5_SIGNATURE} - fi + [ -f "${PERL5_SIGNATURE}" ] && /bin/rm "${PERL5_SIGNATURE}" echo " Done." } @@ -125,9 +88,9 @@ do_cleanup_manpath() do_create_perl5_signature() { echo -n "Creating ${PERL5_SIGNATURE}..." - echo "$banner" >>${PERL5_SIGNATURE} - echo "# Do not modify PERL_VERSION here, instead use DEFAULT_VERSIONS= perl5=${PERL_VER}" >>${PERL5_SIGNATURE} - echo "PERL_VERSION=%%PERL_VERSION%%" >>${PERL5_SIGNATURE} + echo "${banner}" >>"${PERL5_SIGNATURE}" + echo "# Do not modify PERL_VERSION here, instead use DEFAULT_VERSIONS= perl5=${PERL_VER}" >>"${PERL5_SIGNATURE}" + echo "PERL_VERSION=${PERL_VERSION}" >>"${PERL5_SIGNATURE}" echo " Done." } @@ -135,19 +98,30 @@ do_spam_manpath() { if [ -f /etc/manpath.config ] ; then echo -n "Spamming /etc/manpath.config..." - echo "$banner" >>/etc/manpath.config - echo "OPTIONAL_MANPATH ${PKG_PREFIX}/lib/perl5/%%PERL_VER%%/man" >>/etc/manpath.config - echo "OPTIONAL_MANPATH ${PKG_PREFIX}/lib/perl5/%%PERL_VER%%/perl/man" >>/etc/manpath.config + echo "${banner}" >>/etc/manpath.config + echo "OPTIONAL_MANPATH ${PKG_PREFIX}/lib/perl5/${PERL_VER}/man" >>/etc/manpath.config + echo "OPTIONAL_MANPATH ${PKG_PREFIX}/lib/perl5/${PERL_VER}/perl/man" >>/etc/manpath.config echo " Done." fi } -[ "$need_remove_links" = "yes" ] && do_remove_links -[ "$need_create_links" = "yes" ] && do_create_links -[ "$need_post_install" = "yes" ] && do_post_install -[ "$need_remove_perl5_signature" = "yes" ] && do_remove_perl5_signature -[ "$need_create_perl5_signature" = "yes" ] && do_create_perl5_signature -[ "$need_cleanup_manpath" = "yes" ] && do_cleanup_manpath -[ "$need_spam_manpath" = "yes" ] && do_spam_manpath + +if [ "$2" = "POST-INSTALL" ] ; then + do_remove_perl5_signature + do_create_perl5_signature + do_post_install + if [ ${LINK_USRBIN} = yes ] ; then + do_remove_links + do_create_links + fi + if [ "${OSVERSION}" -lt 900022 ] ; then + do_cleanup_manpath + do_spam_manpath + fi +elif [ "$2" = "POST-DEINSTALL" ] ; then + do_remove_perl5_signature + [ ${LINK_USRBIN} = yes ] && do_remove_links + [ "${OSVERSION}" -lt 900022 ] && do_cleanup_manpath +fi exit 0 Modified: head/lang/perl5.14/files/use.perl ============================================================================== --- head/lang/perl5.14/files/use.perl Mon Oct 14 16:10:52 2013 (r330334) +++ head/lang/perl5.14/files/use.perl Mon Oct 14 16:22:34 2013 (r330335) @@ -2,64 +2,31 @@ # $FreeBSD$ -this=`echo -n $0 | /usr/bin/sed -e 's!^.*/!!'` +LINK_USRBIN="%%LINK_USRBIN%%" +: ${OSVERSION:=`/sbin/sysctl -n kern.osreldate`}; +PERL_ARCH="%%PERL_ARCH%%" PERL_VERSION="%%PERL_VERSION%%" PERL_VER="%%PERL_VER%%" -PERL5_SIGNATURE=%%PERL5_SIGNATURE%% -banner=`date +"%F %T"` -banner="# added by use.perl $banner" -if [ -z "${OSVERSION}" ]; then - if [ -f /sbin/sysctl -a -x /sbin/sysctl ] ; then - osreldate=`/sbin/sysctl -n kern.osreldate` - else - osreldate=`/usr/sbin/sysctl -n kern.osreldate` - fi -else - osreldate=${OSVERSION} -fi - -if [ "$2" = "POST-INSTALL" ] ; then - need_remove_links=%%LINK_USRBIN%% - need_create_links=%%LINK_USRBIN%% - need_remove_perl5_signature=yes - need_create_perl5_signature=yes - need_post_install=yes - if [ "${osreldate}" -lt 900022 ]; then - need_cleanup_manpath=yes - need_spam_manpath=yes - fi -elif [ "$2" = "POST-DEINSTALL" ] ; then - need_remove_links=%%LINK_USRBIN%% - need_remove_perl5_signature=yes - if [ "${osreldate}" -lt 900022 ]; then - need_cleanup_manpath=yes - fi -else - exit 0; -fi - -special_link_list=" - perl - perl5" +PERL5_SIGNATURE="%%PERL5_SIGNATURE%%" +banner="# added by use.perl $(/bin/date +'%F %T')" +special_link_list="perl perl5" do_remove_links() { echo "Removing stale symlinks from /usr/bin..." - for binary in $special_link_list - do - if [ -L "/usr/bin/$binary" ] ; then - echo " Removing /usr/bin/$binary" - /bin/rm -f "/usr/bin/$binary" + for binary in ${special_link_list} ; do + if [ -L "/usr/bin/${binary}" ] ; then + echo " Removing /usr/bin/${binary}" + /bin/rm -f "/usr/bin/${binary}" else - echo " Skipping /usr/bin/$binary" + echo " Skipping /usr/bin/${binary}" fi done bins=`/bin/ls /usr/bin/*perl*5.* ${PKG_PREFIX}/bin/*perl*5.* 2>/dev/null` - for binary in $bins - do - if [ -L "$binary" ] ; then - echo " Removing $binary installed by an older perl port" - /bin/rm -f "$binary" + for binary in ${bins} ; do + if [ -L "${binary}" ] ; then + echo " Removing ${binary} installed by an older perl port" + /bin/rm -f "${binary}" fi done echo "Done." @@ -68,20 +35,18 @@ do_remove_links() do_create_links() { echo "Creating various symlinks in /usr/bin..." - for binary in $special_link_list - do - if [ -f "/usr/bin/$binary" ] ; then - echo " Backing up /usr/bin/$binary as /usr/bin/$binary.freebsd" - /bin/mv -f "/usr/bin/$binary" "/usr/bin/$binary.freebsd" + for binary in ${special_link_list} ; do + if [ -f "/usr/bin/${binary}" ] ; then + echo " Backing up /usr/bin/${binary} as /usr/bin/${binary}.freebsd" + /bin/mv -f "/usr/bin/${binary}" "/usr/bin/${binary}.freebsd" fi - bin=`echo $binary | /usr/bin/sed -e 's!perl5!perl!'` - if [ -e "/usr/bin/$binary" ] ; then - echo " *** /usr/bin/$binary is still there, which should not happen" - elif [ -e "$PKG_PREFIX/bin/${bin}%%PERL_VERSION%%" ] ; then - echo " Symlinking $PKG_PREFIX/bin/${bin}%%PERL_VERSION%% to /usr/bin/$binary" - /bin/ln -sf "$PKG_PREFIX/bin/${bin}%%PERL_VERSION%%" "/usr/bin/$binary" + if [ -e "/usr/bin/${binary}" ] ; then + echo " *** /usr/bin/${binary} is still there, which should not happen" + elif [ -e "${PKG_PREFIX}/bin/perl${PERL_VERSION}" ] ; then + echo " Symlinking ${PKG_PREFIX}/bin/perl${PERL_VERSION} to /usr/bin/${binary}" + /bin/ln -sf "${PKG_PREFIX}/bin/perl${PERL_VERSION}" "/usr/bin/${binary}" else - echo " *** $PKG_PREFIX/bin/${bin}%%PERL_VERSION%% is not there, a symlink won't do any good" + echo " *** ${PKG_PREFIX}/bin/perl${PERL_VERSION} is not there, a symlink won't do any good" fi done echo "Done." @@ -90,18 +55,16 @@ do_create_links() do_post_install() { INCLUDEDIR=/usr/include - install -d ${PKG_PREFIX}/lib/perl5/site_perl/%%PERL_VER%%/%%PERL_ARCH%%/auto - install -d ${PKG_PREFIX}/lib/perl5/site_perl/%%PERL_VER%%/auto - install -d ${PKG_PREFIX}/lib/perl5/%%PERL_VER%%/man/man3 + install -d ${PKG_PREFIX}/lib/perl5/site_perl/${PERL_VER}/${PERL_ARCH}/auto + install -d ${PKG_PREFIX}/lib/perl5/site_perl/${PERL_VER}/auto + install -d ${PKG_PREFIX}/lib/perl5/${PERL_VER}/man/man3 cd ${INCLUDEDIR} && ${PKG_PREFIX}/bin/h2ph *.h machine/*.h sys/*.h >/dev/null } do_remove_perl5_signature() { echo -n "Removing ${PERL5_SIGNATURE}..." - if [ -f ${PERL5_SIGNATURE} ] ; then - /bin/rm ${PERL5_SIGNATURE} - fi + [ -f "${PERL5_SIGNATURE}" ] && /bin/rm "${PERL5_SIGNATURE}" echo " Done." } @@ -125,9 +88,9 @@ do_cleanup_manpath() do_create_perl5_signature() { echo -n "Creating ${PERL5_SIGNATURE}..." - echo "$banner" >>${PERL5_SIGNATURE} - echo "# Do not modify PERL_VERSION here, instead use DEFAULT_VERSIONS= perl5=${PERL_VER}" >>${PERL5_SIGNATURE} - echo "PERL_VERSION=%%PERL_VERSION%%" >>${PERL5_SIGNATURE} + echo "${banner}" >>"${PERL5_SIGNATURE}" + echo "# Do not modify PERL_VERSION here, instead use DEFAULT_VERSIONS= perl5=${PERL_VER}" >>"${PERL5_SIGNATURE}" + echo "PERL_VERSION=${PERL_VERSION}" >>"${PERL5_SIGNATURE}" echo " Done." } @@ -135,19 +98,30 @@ do_spam_manpath() { if [ -f /etc/manpath.config ] ; then echo -n "Spamming /etc/manpath.config..." - echo "$banner" >>/etc/manpath.config - echo "OPTIONAL_MANPATH ${PKG_PREFIX}/lib/perl5/%%PERL_VER%%/man" >>/etc/manpath.config - echo "OPTIONAL_MANPATH ${PKG_PREFIX}/lib/perl5/%%PERL_VER%%/perl/man" >>/etc/manpath.config + echo "${banner}" >>/etc/manpath.config + echo "OPTIONAL_MANPATH ${PKG_PREFIX}/lib/perl5/${PERL_VER}/man" >>/etc/manpath.config + echo "OPTIONAL_MANPATH ${PKG_PREFIX}/lib/perl5/${PERL_VER}/perl/man" >>/etc/manpath.config echo " Done." fi } -[ "$need_remove_links" = "yes" ] && do_remove_links -[ "$need_create_links" = "yes" ] && do_create_links -[ "$need_post_install" = "yes" ] && do_post_install -[ "$need_remove_perl5_signature" = "yes" ] && do_remove_perl5_signature -[ "$need_create_perl5_signature" = "yes" ] && do_create_perl5_signature -[ "$need_cleanup_manpath" = "yes" ] && do_cleanup_manpath -[ "$need_spam_manpath" = "yes" ] && do_spam_manpath + +if [ "$2" = "POST-INSTALL" ] ; then + do_remove_perl5_signature + do_create_perl5_signature + do_post_install + if [ ${LINK_USRBIN} = yes ] ; then + do_remove_links + do_create_links + fi + if [ "${OSVERSION}" -lt 900022 ] ; then + do_cleanup_manpath + do_spam_manpath + fi +elif [ "$2" = "POST-DEINSTALL" ] ; then + do_remove_perl5_signature + [ ${LINK_USRBIN} = yes ] && do_remove_links + [ "${OSVERSION}" -lt 900022 ] && do_cleanup_manpath +fi exit 0 Modified: head/lang/perl5.16/files/use.perl ============================================================================== --- head/lang/perl5.16/files/use.perl Mon Oct 14 16:10:52 2013 (r330334) +++ head/lang/perl5.16/files/use.perl Mon Oct 14 16:22:34 2013 (r330335) @@ -2,64 +2,31 @@ # $FreeBSD$ -this=`echo -n $0 | /usr/bin/sed -e 's!^.*/!!'` +LINK_USRBIN="%%LINK_USRBIN%%" +: ${OSVERSION:=`/sbin/sysctl -n kern.osreldate`}; +PERL_ARCH="%%PERL_ARCH%%" PERL_VERSION="%%PERL_VERSION%%" PERL_VER="%%PERL_VER%%" -PERL5_SIGNATURE=%%PERL5_SIGNATURE%% -banner=`date +"%F %T"` -banner="# added by use.perl $banner" -if [ -z "${OSVERSION}" ]; then - if [ -f /sbin/sysctl -a -x /sbin/sysctl ] ; then - osreldate=`/sbin/sysctl -n kern.osreldate` - else - osreldate=`/usr/sbin/sysctl -n kern.osreldate` - fi -else - osreldate=${OSVERSION} -fi - -if [ "$2" = "POST-INSTALL" ] ; then - need_remove_links=%%LINK_USRBIN%% - need_create_links=%%LINK_USRBIN%% - need_remove_perl5_signature=yes - need_create_perl5_signature=yes - need_post_install=yes - if [ "${osreldate}" -lt 900022 ]; then - need_cleanup_manpath=yes - need_spam_manpath=yes - fi -elif [ "$2" = "POST-DEINSTALL" ] ; then - need_remove_links=%%LINK_USRBIN%% - need_remove_perl5_signature=yes - if [ "${osreldate}" -lt 900022 ]; then - need_cleanup_manpath=yes - fi -else - exit 0; -fi - -special_link_list=" - perl - perl5" +PERL5_SIGNATURE="%%PERL5_SIGNATURE%%" +banner="# added by use.perl $(/bin/date +'%F %T')" +special_link_list="perl perl5" do_remove_links() { echo "Removing stale symlinks from /usr/bin..." - for binary in $special_link_list - do - if [ -L "/usr/bin/$binary" ] ; then - echo " Removing /usr/bin/$binary" - /bin/rm -f "/usr/bin/$binary" + for binary in ${special_link_list} ; do + if [ -L "/usr/bin/${binary}" ] ; then + echo " Removing /usr/bin/${binary}" + /bin/rm -f "/usr/bin/${binary}" else - echo " Skipping /usr/bin/$binary" + echo " Skipping /usr/bin/${binary}" fi done bins=`/bin/ls /usr/bin/*perl*5.* ${PKG_PREFIX}/bin/*perl*5.* 2>/dev/null` - for binary in $bins - do - if [ -L "$binary" ] ; then - echo " Removing $binary installed by an older perl port" - /bin/rm -f "$binary" + for binary in ${bins} ; do + if [ -L "${binary}" ] ; then + echo " Removing ${binary} installed by an older perl port" + /bin/rm -f "${binary}" fi done echo "Done." @@ -68,20 +35,18 @@ do_remove_links() do_create_links() { echo "Creating various symlinks in /usr/bin..." - for binary in $special_link_list - do - if [ -f "/usr/bin/$binary" ] ; then - echo " Backing up /usr/bin/$binary as /usr/bin/$binary.freebsd" - /bin/mv -f "/usr/bin/$binary" "/usr/bin/$binary.freebsd" + for binary in ${special_link_list} ; do + if [ -f "/usr/bin/${binary}" ] ; then + echo " Backing up /usr/bin/${binary} as /usr/bin/${binary}.freebsd" + /bin/mv -f "/usr/bin/${binary}" "/usr/bin/${binary}.freebsd" fi - bin=`echo $binary | /usr/bin/sed -e 's!perl5!perl!'` - if [ -e "/usr/bin/$binary" ] ; then - echo " *** /usr/bin/$binary is still there, which should not happen" - elif [ -e "$PKG_PREFIX/bin/${bin}%%PERL_VERSION%%" ] ; then - echo " Symlinking $PKG_PREFIX/bin/${bin}%%PERL_VERSION%% to /usr/bin/$binary" - /bin/ln -sf "$PKG_PREFIX/bin/${bin}%%PERL_VERSION%%" "/usr/bin/$binary" + if [ -e "/usr/bin/${binary}" ] ; then + echo " *** /usr/bin/${binary} is still there, which should not happen" + elif [ -e "${PKG_PREFIX}/bin/perl${PERL_VERSION}" ] ; then + echo " Symlinking ${PKG_PREFIX}/bin/perl${PERL_VERSION} to /usr/bin/${binary}" + /bin/ln -sf "${PKG_PREFIX}/bin/perl${PERL_VERSION}" "/usr/bin/${binary}" else - echo " *** $PKG_PREFIX/bin/${bin}%%PERL_VERSION%% is not there, a symlink won't do any good" + echo " *** ${PKG_PREFIX}/bin/perl${PERL_VERSION} is not there, a symlink won't do any good" fi done echo "Done." @@ -90,18 +55,16 @@ do_create_links() do_post_install() { INCLUDEDIR=/usr/include - install -d ${PKG_PREFIX}/lib/perl5/site_perl/%%PERL_VER%%/%%PERL_ARCH%%/auto - install -d ${PKG_PREFIX}/lib/perl5/site_perl/%%PERL_VER%%/auto - install -d ${PKG_PREFIX}/lib/perl5/%%PERL_VER%%/man/man3 + install -d ${PKG_PREFIX}/lib/perl5/site_perl/${PERL_VER}/${PERL_ARCH}/auto + install -d ${PKG_PREFIX}/lib/perl5/site_perl/${PERL_VER}/auto + install -d ${PKG_PREFIX}/lib/perl5/${PERL_VER}/man/man3 cd ${INCLUDEDIR} && ${PKG_PREFIX}/bin/h2ph *.h machine/*.h sys/*.h >/dev/null } do_remove_perl5_signature() { echo -n "Removing ${PERL5_SIGNATURE}..." - if [ -f ${PERL5_SIGNATURE} ] ; then - /bin/rm ${PERL5_SIGNATURE} - fi + [ -f "${PERL5_SIGNATURE}" ] && /bin/rm "${PERL5_SIGNATURE}" echo " Done." } @@ -125,9 +88,9 @@ do_cleanup_manpath() do_create_perl5_signature() { echo -n "Creating ${PERL5_SIGNATURE}..." - echo "$banner" >>${PERL5_SIGNATURE} - echo "# Do not modify PERL_VERSION here, instead use DEFAULT_VERSIONS= perl5=${PERL_VER}" >>${PERL5_SIGNATURE} - echo "PERL_VERSION=%%PERL_VERSION%%" >>${PERL5_SIGNATURE} + echo "${banner}" >>"${PERL5_SIGNATURE}" + echo "# Do not modify PERL_VERSION here, instead use DEFAULT_VERSIONS= perl5=${PERL_VER}" >>"${PERL5_SIGNATURE}" + echo "PERL_VERSION=${PERL_VERSION}" >>"${PERL5_SIGNATURE}" echo " Done." } @@ -135,19 +98,30 @@ do_spam_manpath() { if [ -f /etc/manpath.config ] ; then echo -n "Spamming /etc/manpath.config..." - echo "$banner" >>/etc/manpath.config - echo "OPTIONAL_MANPATH ${PKG_PREFIX}/lib/perl5/%%PERL_VER%%/man" >>/etc/manpath.config - echo "OPTIONAL_MANPATH ${PKG_PREFIX}/lib/perl5/%%PERL_VER%%/perl/man" >>/etc/manpath.config + echo "${banner}" >>/etc/manpath.config + echo "OPTIONAL_MANPATH ${PKG_PREFIX}/lib/perl5/${PERL_VER}/man" >>/etc/manpath.config + echo "OPTIONAL_MANPATH ${PKG_PREFIX}/lib/perl5/${PERL_VER}/perl/man" >>/etc/manpath.config echo " Done." fi } -[ "$need_remove_links" = "yes" ] && do_remove_links -[ "$need_create_links" = "yes" ] && do_create_links -[ "$need_post_install" = "yes" ] && do_post_install -[ "$need_remove_perl5_signature" = "yes" ] && do_remove_perl5_signature -[ "$need_create_perl5_signature" = "yes" ] && do_create_perl5_signature -[ "$need_cleanup_manpath" = "yes" ] && do_cleanup_manpath -[ "$need_spam_manpath" = "yes" ] && do_spam_manpath + +if [ "$2" = "POST-INSTALL" ] ; then + do_remove_perl5_signature + do_create_perl5_signature + do_post_install + if [ ${LINK_USRBIN} = yes ] ; then + do_remove_links + do_create_links + fi + if [ "${OSVERSION}" -lt 900022 ] ; then + do_cleanup_manpath + do_spam_manpath + fi +elif [ "$2" = "POST-DEINSTALL" ] ; then + do_remove_perl5_signature + [ ${LINK_USRBIN} = yes ] && do_remove_links + [ "${OSVERSION}" -lt 900022 ] && do_cleanup_manpath +fi exit 0 Modified: head/lang/perl5.18/files/use.perl ============================================================================== --- head/lang/perl5.18/files/use.perl Mon Oct 14 16:10:52 2013 (r330334) +++ head/lang/perl5.18/files/use.perl Mon Oct 14 16:22:34 2013 (r330335) @@ -2,64 +2,31 @@ # $FreeBSD$ -this=`echo -n $0 | /usr/bin/sed -e 's!^.*/!!'` +LINK_USRBIN="%%LINK_USRBIN%%" +: ${OSVERSION:=`/sbin/sysctl -n kern.osreldate`}; +PERL_ARCH="%%PERL_ARCH%%" PERL_VERSION="%%PERL_VERSION%%" PERL_VER="%%PERL_VER%%" -PERL5_SIGNATURE=%%PERL5_SIGNATURE%% -banner=`date +"%F %T"` -banner="# added by use.perl $banner" -if [ -z "${OSVERSION}" ]; then - if [ -f /sbin/sysctl -a -x /sbin/sysctl ] ; then - osreldate=`/sbin/sysctl -n kern.osreldate` - else - osreldate=`/usr/sbin/sysctl -n kern.osreldate` - fi -else - osreldate=${OSVERSION} -fi - -if [ "$2" = "POST-INSTALL" ] ; then - need_remove_links=%%LINK_USRBIN%% - need_create_links=%%LINK_USRBIN%% - need_remove_perl5_signature=yes - need_create_perl5_signature=yes - need_post_install=yes - if [ "${osreldate}" -lt 900022 ]; then - need_cleanup_manpath=yes - need_spam_manpath=yes - fi -elif [ "$2" = "POST-DEINSTALL" ] ; then - need_remove_links=%%LINK_USRBIN%% - need_remove_perl5_signature=yes - if [ "${osreldate}" -lt 900022 ]; then - need_cleanup_manpath=yes - fi -else - exit 0; -fi - -special_link_list=" - perl - perl5" +PERL5_SIGNATURE="%%PERL5_SIGNATURE%%" +banner="# added by use.perl $(/bin/date +'%F %T')" +special_link_list="perl perl5" do_remove_links() { echo "Removing stale symlinks from /usr/bin..." - for binary in $special_link_list - do - if [ -L "/usr/bin/$binary" ] ; then - echo " Removing /usr/bin/$binary" - /bin/rm -f "/usr/bin/$binary" + for binary in ${special_link_list} ; do + if [ -L "/usr/bin/${binary}" ] ; then + echo " Removing /usr/bin/${binary}" + /bin/rm -f "/usr/bin/${binary}" else - echo " Skipping /usr/bin/$binary" + echo " Skipping /usr/bin/${binary}" fi done bins=`/bin/ls /usr/bin/*perl*5.* ${PKG_PREFIX}/bin/*perl*5.* 2>/dev/null` - for binary in $bins - do - if [ -L "$binary" ] ; then - echo " Removing $binary installed by an older perl port" - /bin/rm -f "$binary" + for binary in ${bins} ; do + if [ -L "${binary}" ] ; then + echo " Removing ${binary} installed by an older perl port" + /bin/rm -f "${binary}" fi done echo "Done." @@ -68,20 +35,18 @@ do_remove_links() do_create_links() { echo "Creating various symlinks in /usr/bin..." - for binary in $special_link_list - do - if [ -f "/usr/bin/$binary" ] ; then - echo " Backing up /usr/bin/$binary as /usr/bin/$binary.freebsd" - /bin/mv -f "/usr/bin/$binary" "/usr/bin/$binary.freebsd" + for binary in ${special_link_list} ; do + if [ -f "/usr/bin/${binary}" ] ; then + echo " Backing up /usr/bin/${binary} as /usr/bin/${binary}.freebsd" + /bin/mv -f "/usr/bin/${binary}" "/usr/bin/${binary}.freebsd" fi - bin=`echo $binary | /usr/bin/sed -e 's!perl5!perl!'` - if [ -e "/usr/bin/$binary" ] ; then - echo " *** /usr/bin/$binary is still there, which should not happen" - elif [ -e "$PKG_PREFIX/bin/${bin}%%PERL_VERSION%%" ] ; then - echo " Symlinking $PKG_PREFIX/bin/${bin}%%PERL_VERSION%% to /usr/bin/$binary" - /bin/ln -sf "$PKG_PREFIX/bin/${bin}%%PERL_VERSION%%" "/usr/bin/$binary" + if [ -e "/usr/bin/${binary}" ] ; then + echo " *** /usr/bin/${binary} is still there, which should not happen" + elif [ -e "${PKG_PREFIX}/bin/perl${PERL_VERSION}" ] ; then + echo " Symlinking ${PKG_PREFIX}/bin/perl${PERL_VERSION} to /usr/bin/${binary}" + /bin/ln -sf "${PKG_PREFIX}/bin/perl${PERL_VERSION}" "/usr/bin/${binary}" else - echo " *** $PKG_PREFIX/bin/${bin}%%PERL_VERSION%% is not there, a symlink won't do any good" + echo " *** ${PKG_PREFIX}/bin/perl${PERL_VERSION} is not there, a symlink won't do any good" fi done echo "Done." @@ -90,18 +55,16 @@ do_create_links() do_post_install() { INCLUDEDIR=/usr/include - install -d ${PKG_PREFIX}/lib/perl5/site_perl/%%PERL_VER%%/%%PERL_ARCH%%/auto - install -d ${PKG_PREFIX}/lib/perl5/site_perl/%%PERL_VER%%/auto - install -d ${PKG_PREFIX}/lib/perl5/%%PERL_VER%%/man/man3 + install -d ${PKG_PREFIX}/lib/perl5/site_perl/${PERL_VER}/${PERL_ARCH}/auto + install -d ${PKG_PREFIX}/lib/perl5/site_perl/${PERL_VER}/auto + install -d ${PKG_PREFIX}/lib/perl5/${PERL_VER}/man/man3 cd ${INCLUDEDIR} && ${PKG_PREFIX}/bin/h2ph *.h machine/*.h sys/*.h >/dev/null } do_remove_perl5_signature() { echo -n "Removing ${PERL5_SIGNATURE}..." - if [ -f ${PERL5_SIGNATURE} ] ; then - /bin/rm ${PERL5_SIGNATURE} - fi + [ -f "${PERL5_SIGNATURE}" ] && /bin/rm "${PERL5_SIGNATURE}" echo " Done." } @@ -125,9 +88,9 @@ do_cleanup_manpath() do_create_perl5_signature() { echo -n "Creating ${PERL5_SIGNATURE}..." - echo "$banner" >>${PERL5_SIGNATURE} - echo "# Do not modify PERL_VERSION here, instead use DEFAULT_VERSIONS= perl5=${PERL_VER}" >>${PERL5_SIGNATURE} - echo "PERL_VERSION=%%PERL_VERSION%%" >>${PERL5_SIGNATURE} + echo "${banner}" >>"${PERL5_SIGNATURE}" + echo "# Do not modify PERL_VERSION here, instead use DEFAULT_VERSIONS= perl5=${PERL_VER}" >>"${PERL5_SIGNATURE}" + echo "PERL_VERSION=${PERL_VERSION}" >>"${PERL5_SIGNATURE}" echo " Done." } @@ -135,19 +98,30 @@ do_spam_manpath() { if [ -f /etc/manpath.config ] ; then echo -n "Spamming /etc/manpath.config..." - echo "$banner" >>/etc/manpath.config - echo "OPTIONAL_MANPATH ${PKG_PREFIX}/lib/perl5/%%PERL_VER%%/man" >>/etc/manpath.config - echo "OPTIONAL_MANPATH ${PKG_PREFIX}/lib/perl5/%%PERL_VER%%/perl/man" >>/etc/manpath.config + echo "${banner}" >>/etc/manpath.config + echo "OPTIONAL_MANPATH ${PKG_PREFIX}/lib/perl5/${PERL_VER}/man" >>/etc/manpath.config + echo "OPTIONAL_MANPATH ${PKG_PREFIX}/lib/perl5/${PERL_VER}/perl/man" >>/etc/manpath.config echo " Done." fi } -[ "$need_remove_links" = "yes" ] && do_remove_links -[ "$need_create_links" = "yes" ] && do_create_links -[ "$need_post_install" = "yes" ] && do_post_install -[ "$need_remove_perl5_signature" = "yes" ] && do_remove_perl5_signature -[ "$need_create_perl5_signature" = "yes" ] && do_create_perl5_signature -[ "$need_cleanup_manpath" = "yes" ] && do_cleanup_manpath -[ "$need_spam_manpath" = "yes" ] && do_spam_manpath + +if [ "$2" = "POST-INSTALL" ] ; then + do_remove_perl5_signature + do_create_perl5_signature + do_post_install + if [ ${LINK_USRBIN} = yes ] ; then + do_remove_links + do_create_links + fi + if [ "${OSVERSION}" -lt 900022 ] ; then + do_cleanup_manpath + do_spam_manpath + fi +elif [ "$2" = "POST-DEINSTALL" ] ; then + do_remove_perl5_signature + [ ${LINK_USRBIN} = yes ] && do_remove_links + [ "${OSVERSION}" -lt 900022 ] && do_cleanup_manpath +fi exit 0