Subject: still TEST -e in pkgsrc
To: None <tech-pkg@netbsd.org>
From: Georg Schwarz <geos@epost.de>
List: tech-pkg
Date: 07/10/2004 21:11:02
There are still a number of occurrences of TEST -e  in pkgsrc. Please
let me propose the following changes:


*** pkgsrc/mk/buildlink2/fake-la.orig   Sat Jul 10 15:34:14 2004
--- pkgsrc/mk/buildlink2/fake-la        Sat Jul 10 15:49:21 2004
***************
*** 52,58 ****
                libbase=3D`${ECHO} $libname | ${SED} -e "s/\.a$//"`
                ltlib=3D"$realdir/$libbase.la"
                # If there's already a libtool .la file, use it.
!               if ${TEST} -e "$ltlib" ; then
                        current=3D`${SED} -n -e'/^current=3D[[:digit:]]/{
s/^current=3D//; p; };' "$ltlib"`
                        rev=3D`${SED} -n -e'/^revision=3D[[:digit:]]/{
s/^revision=3D//; p; };' "$ltlib"`
                        current=3D$(($current + 0))
--- 52,58 ----
                libbase=3D`${ECHO} $libname | ${SED} -e "s/\.a$//"`
                ltlib=3D"$realdir/$libbase.la"
                # If there's already a libtool .la file, use it.
!               if ${TEST} -f "$ltlib" ; then
                        current=3D`${SED} -n -e'/^current=3D[[:digit:]]/{
s/^current=3D//; p; };' "$ltlib"`
                        rev=3D`${SED} -n -e'/^revision=3D[[:digit:]]/{
s/^revision=3D//; p; };' "$ltlib"`
                        current=3D$(($current + 0))
***************
*** 100,106 ****
 =20
  for file in $dlname $library_names $old_library
  do
!       if ! [ -e $realdir/$file ]
        then
                removal_pattern=3D"$removal_pattern -e
s,$file\([^.0-9]\),\1,g"
        fi
--- 100,106 ----
 =20
  for file in $dlname $library_names $old_library
  do
!       if ! [ -f $realdir/$file ]
        then
                removal_pattern=3D"$removal_pattern -e
s,$file\([^.0-9]\),\1,g"
        fi


*** pkgsrc/mk/install/install.orig      Sat Jul 10 15:34:52 2004
--- pkgsrc/mk/install/install   Sat Jul 10 15:46:07 2004
***************
*** 117,123 ****
                                print;
\
                        }'
\
                `
!               if [ -d $sysconfdir -a ! -e ${PKG_SYSCONFDIR} ]; then
                        ${MKDIR} -p `${DIRNAME} ${PKG_SYSCONFDIR}`
                        ${LN} -sf $sysconfdir ${PKG_SYSCONFDIR}
                fi
--- 117,123 ----
                                print;
\
                        }'
\
                `
!               if [ -d $sysconfdir -a ! -d ${PKG_SYSCONFDIR} ]; then
                        ${MKDIR} -p `${DIRNAME} ${PKG_SYSCONFDIR}`
                        ${LN} -sf $sysconfdir ${PKG_SYSCONFDIR}
                fi
***************
*** 241,253 ****
                                msgadd ""
                        fi
                        msgadd "#${file} (m=3D@CONF_FILES_MODE@)"
!               elif [ -e "${file}" ]; then
                        if [ ! "${file}" -ef "${samplefile}" ]; then
                                ${ECHO} "       ${file} already exists,
example file is"
                                ${ECHO} "           ${samplefile}"
                        fi
                else
!                       if [ -e "${samplefile}" ]; then
                                ${ECHO} "       ${file}"
                                ${CP} "${samplefile}" "${file}"
                                ${CHMOD} @CONF_FILES_MODE@ "${file}"
--- 241,253 ----
                                msgadd ""
                        fi
                        msgadd "#${file} (m=3D@CONF_FILES_MODE@)"
!               elif [ -f "${file}" ]; then
                        if [ ! "${file}" -ef "${samplefile}" ]; then
                                ${ECHO} "       ${file} already exists,
example file is"
                                ${ECHO} "           ${samplefile}"
                        fi
                else
!                       if [ -f "${samplefile}" ]; then
                                ${ECHO} "       ${file}"
                                ${CP} "${samplefile}" "${file}"
                                ${CHMOD} @CONF_FILES_MODE@ "${file}"
***************
*** 267,279 ****
                                msgadd ""
                        fi
                        msgadd "#${file} (m=3D@SUPPORT_FILES_MODE@)"
!               elif [ -e "${file}" ]; then
                        if [ ! "${file}" -ef "${samplefile}" ]; then
                                ${ECHO} "       ${file} already exists,
example file is"
                                ${ECHO} "           ${samplefile}"
                        fi
                else
!                       if [ -e "${samplefile}" ]; then
                                ${ECHO} "       ${file}"
                                ${CP} "${samplefile}" "${file}"
                                ${CHMOD} @SUPPORT_FILES_MODE@ "${file}"
--- 267,279 ----
                                msgadd ""
                        fi
                        msgadd "#${file} (m=3D@SUPPORT_FILES_MODE@)"
!               elif [ -f "${file}" ]; then
                        if [ ! "${file}" -ef "${samplefile}" ]; then
                                ${ECHO} "       ${file} already exists,
example file is"
                                ${ECHO} "           ${samplefile}"
                        fi
                else
!                       if [ -f "${samplefile}" ]; then
                                ${ECHO} "       ${file}"
                                ${CP} "${samplefile}" "${file}"
                                ${CHMOD} @SUPPORT_FILES_MODE@ "${file}"
***************
*** 294,306 ****
                                msgadd ""
                        fi
                        msgadd "#${file} (o=3D${owner}, g=3D${group},
m=3D${mode})"
!               elif [ -e ${file} ]; then
                        if [ ! "${file}" -ef "${samplefile}" ]; then
                                ${ECHO} "       ${file} already exists,
example file is"
                                ${ECHO} "           ${samplefile}"
                        fi
                else
!                       if [ -e "${samplefile}" ]; then
                                ${ECHO} "       ${file}"
                                ${CP} "${samplefile}" "${file}"
                                ${CHOWN} "${owner}" "${file}"
--- 294,306 ----
                                msgadd ""
                        fi
                        msgadd "#${file} (o=3D${owner}, g=3D${group},
m=3D${mode})"
!               elif [ -f ${file} ]; then
                        if [ ! "${file}" -ef "${samplefile}" ]; then
                                ${ECHO} "       ${file} already exists,
example file is"
                                ${ECHO} "           ${samplefile}"
                        fi
                else
!                       if [ -f "${samplefile}" ]; then
                                ${ECHO} "       ${file}"
                                ${CP} "${samplefile}" "${file}"
                                ${CHOWN} "${owner}" "${file}"
***************
*** 323,335 ****
                                msgadd ""
                        fi
                        msgadd "#${file} (m=3D@RCD_SCRIPTS_MODE@)"
!               elif [ -e "${file}" ]; then
                        if [ ! "${file}" -ef "${samplefile}" ]; then
                                ${ECHO} "       ${file} already exists,
example file is"
                                ${ECHO} "           ${samplefile}"
                        fi
                else
!                       if [ -e "${samplefile}" ]; then
                                ${ECHO} "       ${file}"
                                ${CP} "${samplefile}" "${file}"
                                ${CHMOD} @RCD_SCRIPTS_MODE@ "${file}"
--- 323,335 ----
                                msgadd ""
                        fi
                        msgadd "#${file} (m=3D@RCD_SCRIPTS_MODE@)"
!               elif [ -f "${file}" ]; then
                        if [ ! "${file}" -ef "${samplefile}" ]; then
                                ${ECHO} "       ${file} already exists,
example file is"
                                ${ECHO} "           ${samplefile}"
                        fi
                else
!                       if [ -f "${samplefile}" ]; then
                                ${ECHO} "       ${file}"
                                ${CP} "${samplefile}" "${file}"
                                ${CHMOD} @RCD_SCRIPTS_MODE@ "${file}"


*** pkgsrc/mk/install/deinstall.orig    Sat Jul 10 15:35:00 2004
--- pkgsrc/mk/install/deinstall Sat Jul 10 15:46:55 2004
***************
*** 111,117 ****
                        shift; shift
 =20
                        if [ ! "${file}" -ef "${samplefile}" -a
\
!                            -e "${file}" -a -e "${samplefile}" ]; then
                                if ${CMP} -s "${file}" "${samplefile}";
then
                                        ${RM} -f "${file}"
                                fi
--- 111,117 ----
                        shift; shift
 =20
                        if [ ! "${file}" -ef "${samplefile}" -a
\
!                            -f "${file}" -a -f "${samplefile}" ]; then
                                if ${CMP} -s "${file}" "${samplefile}";
then
                                        ${RM} -f "${file}"
                                fi
***************
*** 127,133 ****
                samplefile=3D"$1"; file=3D"$2"
                shift; shift
 =20
!               if [ -e "${file}" ]; then
                        modified_files=3D"${modified_files} \"${file}\""
                fi
        done
--- 127,133 ----
                samplefile=3D"$1"; file=3D"$2"
                shift; shift
 =20
!               if [ -f "${file}" ]; then
                        modified_files=3D"${modified_files} \"${file}\""
                fi
        done


Another issue is that some pkgsrc sripts contain TEST -ef (to test for
hardlinks). Some shells=B4 test does not support that. I am not sure what
to do about that.


Some of the following patchsets also contain TEST -e:

pkgsrc/audio/abcde
pkgsrc/audio/cdparanoia
pkgsrc/audio/kdemultimedia2
pkgsrc/ham/dpbox
pkgsrc/lang/sather
pkgsrc/misc/heyu
pkgsrc/misc/pdmenu
pkgsrc/misc/vfu
pkgsrc/sysutils/xentools12
pkgsrc/www/asp2php
pkgsrc/www/gtkasp2php
pkgsrc/www/ap-jserv


as do
=20
pkgsrc/audio/rio/files/find-lpt-port
pkgsrc/comms/conserver/files/conserver.sh
pkgsrc/comms/minicom/scripts/create-dev-link
pkgsrc/emulators/*/INSTALL
pkgsrc/graphics/fxtv/Makefile
pkgsrc/net/ja-samba/INSTALL
pkgsrc/net/samba/INSTALL
pkgsrc/net/samba2/INSTALL
pkgsrc/pkgtools/pkg_install/files/view/linkfarm.sh.in
pkgsrc/www/opera6/files/opera.sh
pkgsrc/www/wwwoffle/INSTALL
pkgsrc/www/opera7/files/opera.sh
pkgsrc/textproc/nbsed/files/TEST/sed.test

(some of them are most likely for NetBSD only, so it does not matter)

Could someone please change this? Thanks. (should I better pr-send
this?)


--=20
Georg Schwarz    http://home.pages.de/~schwarz/
 geos@epost.de     +49 177 8811442