From c406a95c53be1709ff514cf7bc6de9de5c057057 Mon Sep 17 00:00:00 2001 From: Florent Thoumie Date: Wed, 4 May 2011 22:33:13 +0000 Subject: [PATCH] Latest round of infrastructure changes. - bsd.port.mk: add INDEX_PORTS, to support INDEX creation for a subset of the ports tree [1] - bsd.port.mk: call target "install-rc-script" before "post-install" [2] - [patch] ports/Mk bsd.port.mk order if groups/users are created by package [3] - [bsd.port.mk] [patch] reaper of the dead: md5 has been in /sbin for a while [4] - [bsd.port.mk] [patch] remove support for pre 7.x systems (b.*.m) [5] - [patch] [bsd.port.mk] reaper of the dead: are three variable defintions needed [6] PR: ports/156575 [1], ports/139116 [2], ports/152498 [3], ports/155983 [4], ports/155510 [5], ports/156340 [6] Submitted by: Florent Thoumie [1], Sergey Skvortsov [2], Olli Hauer [3], Eitan Adler [4], Eitan Adler [5], Eitan Adler [6] --- Makefile | 8 +++-- Mk/bsd.commands.mk | 10 ------- Mk/bsd.gcc.mk | 8 ----- Mk/bsd.port.mk | 68 ++++++++++++++++++++++++++++++++++++------- Mk/bsd.port.subdir.mk | 5 ---- Mk/bsd.qt.mk | 4 --- 6 files changed, 63 insertions(+), 40 deletions(-) diff --git a/Makefile b/Makefile index 76061672c406..e6234de75349 100644 --- a/Makefile +++ b/Makefile @@ -101,6 +101,10 @@ INDEX_SHELL= /rescue/sh INDEX_SHELL= /bin/sh .endif +.if !defined(INDEX_PORTS) +INDEX_PORTS=. +.endif + ${INDEXDIR}/${INDEXFILE}: @${INDEX_ECHO_1ST} "Generating ${INDEXFILE} - please wait.."; \ if [ "${INDEX_PRISTINE}" != "" ]; then \ @@ -108,9 +112,9 @@ ${INDEXDIR}/${INDEXFILE}: fi; \ tmpdir=`/usr/bin/mktemp -d -t index` || exit 1; \ trap "rm -rf $${tmpdir}; exit 1" 1 2 3 5 10 13 15; \ - ( cd ${.CURDIR} && make -j${INDEX_JOBS} INDEX_TMPDIR=$${tmpdir} BUILDING_INDEX=1 \ + ( cd ${.CURDIR}; for i in ${INDEX_PORTS}; do (cd $${i} && make -j${INDEX_JOBS} INDEX_TMPDIR=$${tmpdir} BUILDING_INDEX=1 \ __MAKE_SHELL=${INDEX_SHELL} \ - ECHO_MSG="${INDEX_ECHO_MSG}" describe ) || \ + ECHO_MSG="${INDEX_ECHO_MSG}" describe); done ) || \ (rm -rf $${tmpdir} ; \ if [ "${INDEX_QUIET}" = "" ]; then \ echo; \ diff --git a/Mk/bsd.commands.mk b/Mk/bsd.commands.mk index b63df72508c6..79143e6f8fc8 100644 --- a/Mk/bsd.commands.mk +++ b/Mk/bsd.commands.mk @@ -102,18 +102,8 @@ XZ_CMD?= /usr/bin/xz ${XZ} XZ_CMD?= ${LOCALBASE}/bin/xz ${XZ} .endif -.if exists(/sbin/md5) MD5?= /sbin/md5 -.else -MD5?= md5 -.endif -.if exists(/sbin/sha256) SHA256?= /sbin/sha256 -.elif exists(${LOCALBASE}/sbin/sha256) -SHA256?= ${LOCALBASE}/sbin/sha256 -.else -SHA256?= NO -.endif # ECHO is defined in /usr/share/mk/sys.mk, which can either be "echo", # or "true" if the make flag -s is given. Use ECHO_CMD where you mean diff --git a/Mk/bsd.gcc.mk b/Mk/bsd.gcc.mk index 9e523b30b8b5..56f1b980cc2f 100644 --- a/Mk/bsd.gcc.mk +++ b/Mk/bsd.gcc.mk @@ -87,17 +87,9 @@ F77:= ${LOCALBASE}/intel_fc_80/bin/ifort # In some case we want to use g77 from lang/gcc34 (FreeBSD>=7) or f77 # (FreeBSD<=6). . elif ${USE_FORTRAN} == g77 -. if (${OSVERSION} > 700042) _USE_GCC:= 3.4 FC:= g77-34 F77:= g77-34 -. else -F77:= f77 -FC:= f77 -CC:= gcc -CXX:= g++ -. endif - . else IGNORE= specifies unknown value "${USE_FORTRAN}" for USE_FORTRAN . endif diff --git a/Mk/bsd.port.mk b/Mk/bsd.port.mk index 1b39d374f81e..2035935ec45b 100644 --- a/Mk/bsd.port.mk +++ b/Mk/bsd.port.mk @@ -1276,6 +1276,10 @@ GID_FILES?= ${PORTSDIR}/GIDs UID_OFFSET?= 0 GID_OFFSET?= 0 +# predefined accounts from src/etc/master.passwd +# alpha numeric sort order +USERS_BLACKLIST= _dhcp _pflogd bin bind daemon games kmem mailnull man news nobody operator pop proxy root smmsp sshd toor tty uucp www + LDCONFIG_DIR= libdata/ldconfig LDCONFIG32_DIR= libdata/ldconfig32 @@ -2480,6 +2484,7 @@ PKGREQ?= ${PKGDIR}/pkg-req PKGMESSAGE?= ${PKGDIR}/pkg-message TMPPLIST?= ${WRKDIR}/.PLIST.mktmp +TMPGUCMD?= ${WRKDIR}/.PLIST.gucmd .for _CATEGORY in ${CATEGORIES} PKGCATEGORY?= ${_CATEGORY} @@ -4178,6 +4183,7 @@ create-users-groups: .endif .endfor @${ECHO_MSG} "===> Creating users and/or groups." + @${ECHO_CMD} "@exec echo \"===> Creating users and/or groups.\"" >> ${TMPPLIST} .for _group in ${GROUPS} # _bgpd:*:130: @if ! ${GREP} -h ^${_group}: ${GID_FILES} >/dev/null 2>&1; then \ @@ -4192,7 +4198,9 @@ create-users-groups: else \ ${ECHO_MSG} "Using existing group \`$$group'."; \ fi; \ - ${ECHO_CMD} "@exec if ! ${PW} groupshow $$group >/dev/null 2>&1; then ${PW} groupadd $$group -g $$gid; fi" >> ${TMPPLIST}; \ + ${ECHO_CMD} "@exec if ! ${PW} groupshow $$group >/dev/null 2>&1; then \ + echo \"Creating group '$$group' with gid '$$gid'.\"; \ + ${PW} groupadd $$group -g $$gid; else echo \"Using existing group '$$group'.\"; fi" >> ${TMPPLIST}; \ done .endfor .endif @@ -4220,30 +4228,62 @@ create-users-groups: else \ ${ECHO_MSG} "Using existing user \`$$login'."; \ fi; \ - ${ECHO_CMD} "@exec if ! ${PW} usershow $$login >/dev/null 2>&1; then ${PW} useradd $$login -u $$uid -g $$gid $$class -c \"$$gecos\" -d $$homedir -s $$shell; fi" >> ${TMPPLIST}; \ + ${ECHO_CMD} "@exec if ! ${PW} usershow $$login >/dev/null 2>&1; then \ + echo \"Creating user '$$login' with uid '$$uid'.\"; \ + ${PW} useradd $$login -u $$uid -g $$gid $$class -c \"$$gecos\" -d $$homedir -s $$shell; \ + else echo \"Using existing user '$$login'.\"; fi" >> ${TMPPLIST}; \ case $$homedir in /nonexistent|/var/empty) ;; *) ${ECHO_CMD} "@exec ${INSTALL} -d -g $$gid -o $$uid $$homedir" >> ${TMPPLIST};; esac; \ done .endfor .if defined(GROUPS) .for _group in ${GROUPS} -# _bgpd:*:130: +# mail:*:6:postfix,clamav @IFS=":"; ${GREP} -h ^${_group}: ${GID_FILES} | head -n 1 | while read group foo gid members; do \ gid=$$(($$gid+${GID_OFFSET})); \ IFS=","; for _login in $$members; do \ - list=`${PW} usershow $${_login} -P | ${SED} -ne 's/.*Groups: //p'`; \ - ${ECHO_MSG} "Setting \`$${_login}' groups to \`$$list$${list:+,}${_group}'."; \ - ${PW} usermod $${_login} -G $$list$${list:+,}${_group}; \ - ${ECHO_CMD} "@exec list=\`${PW} usershow $${_login} -P | ${SED} -ne 's/.*Groups: //p'\`; ${PW} usermod $${_login} -G \$${list},${_group}" >> ${TMPPLIST}; \ + for _user in ${USERS}; do \ + if [ "x$${_user}" = "x$${_login}" ]; then \ + list=`${PW} usershow $${_login} -P | ${SED} -ne 's/.*Groups: //p'`; \ + ${ECHO_MSG} "Setting \`$${_login}' groups to \`$$list$${list:+,}${_group}'."; \ + ${PW} usermod $${_login} -G $$list$${list:+,}${_group}; \ + ${ECHO_CMD} "@exec list=\`${PW} usershow $${_login} -P | ${SED} -ne 's/.*Groups: //p'\`; \ + echo \"Setting '$${_login}' groups to '$$list$${list:+,}${_group}'.\"; \ + ${PW} usermod $${_login} -G $${list},${_group}" >> ${TMPPLIST}; \ + else \ + ${ECHO_MSG} "==> DEBUG skip login $${_login} => not defined in USERS \"( ${USERS} )\""; \ + fi; \ + done; \ done; \ done .endfor .endif +.if defined(USERS) +.for _user in ${USERS} + @if [ ! ${USERS_BLACKLIST:M${_user}} ]; then \ + ${ECHO_CMD} "@unexec if ${PW} usershow ${_user} >/dev/null 2>&1; then \ + echo \"==> You should manually remove the \\\"${_user}\\\" user. \"; fi" >> ${TMPPLIST}; \ + fi +.endfor +.endif .endif .else @${DO_NADA} .endif .endif +# PR ports/152498 +# XXX Make sure the commands to create group(s) +# and user(s) are the first in pkg-plist +.if !target(fix-plist-sequence) +fix-plist-sequence: ${TMPPLIST} +.if defined(GROUPS) || defined(USERS) + @${ECHO_CMD} "===> Correct pkg-plist sequence to create group(s) and user(s)" + @${EGREP} -e '^@exec echo.*Creating users and' -e '^@exec.*${PW}' -e '^@exec ${INSTALL} -d -g' ${TMPPLIST} > ${TMPGUCMD} + @${EGREP} -v -e '^@exec echo.*Creating users and' -e '^@exec.*${PW}' -e '^@exec ${INSTALL} -d -g' ${TMPPLIST} >> ${TMPGUCMD} + @${MV} -f ${TMPGUCMD} ${TMPPLIST} +.endif +.endif + .if !defined(DISABLE_SECURITY_CHECK) .if !target(security-check) .if !defined(OLD_SECURITY_CHECK) @@ -4428,10 +4468,10 @@ _INSTALL_SEQ= install-message check-install-conflicts run-depends lib-depends ap pre-install-script generate-plist check-already-installed _INSTALL_SUSEQ= check-umask install-mtree pre-su-install \ pre-su-install-script create-users-groups do-install \ - install-desktop-entries install-license \ + install-desktop-entries install-license install-rc-script \ post-install post-install-script add-plist-info \ add-plist-docs add-plist-examples add-plist-data \ - add-plist-post install-rc-script compress-man \ + add-plist-post fix-plist-sequence compress-man \ install-ldconfig-file fake-pkg security-check _PACKAGE_DEP= install _PACKAGE_SEQ= package-message pre-package pre-package-script \ @@ -5638,8 +5678,14 @@ _DESCR=${DESCR} _DESCR=/dev/null . endif +. if defined(BUILDING_INDEX) && defined(INDEX_PORTS) +INDEX_OUT=${INDEX_TMPDIR}/${INDEXFILE}.desc.aggr +. else +INDEX_OUT=/dev/stdout +. endif + describe: - @${ECHO_CMD} -n "${PKGNAME}|${.CURDIR}|${PREFIX}|"; \ + @(${ECHO_CMD} -n "${PKGNAME}|${.CURDIR}|${PREFIX}|"; \ ${ECHO_CMD} -n ${COMMENT:Q}; \ ${ECHO_CMD} -n "|${_DESCR}|${MAINTAINER}|${CATEGORIES}|${_EXTRACT_DEPENDS}|${_PATCH_DEPENDS}|${_FETCH_DEPENDS}|${_BUILD_DEPENDS:O:u}|${_RUN_DEPENDS:O:u}|"; \ while read one two discard; do \ @@ -5651,7 +5697,7 @@ describe: break; \ ;; \ esac; \ - done < ${DESCR}; ${ECHO_CMD} + done < ${DESCR}; ${ECHO_CMD}) >>${INDEX_OUT} . endif www-site: diff --git a/Mk/bsd.port.subdir.mk b/Mk/bsd.port.subdir.mk index 3fd49394d6f0..0456e41e01da 100644 --- a/Mk/bsd.port.subdir.mk +++ b/Mk/bsd.port.subdir.mk @@ -50,11 +50,6 @@ README= ${TEMPLATES}/README.category MOVEDDIR?= ${PORTSDIR} MOVEDFILE?= MOVED -# XXX Are these needed here? DESCR was set wrong for a few years -MASTERDIR?= ${.CURDIR} -PKGDIR?= ${MASTERDIR} -DESCR?= ${PKGDIR}/pkg-descr - .include "${PORTSDIR}/Mk/bsd.commands.mk" .MAIN: all diff --git a/Mk/bsd.qt.mk b/Mk/bsd.qt.mk index 6d23621c4eaa..244d8ce15732 100644 --- a/Mk/bsd.qt.mk +++ b/Mk/bsd.qt.mk @@ -137,11 +137,7 @@ QMAKESPEC?= ${QT_PREFIX}/share/qt4/mkspecs/freebsd-${QMAKE_COMPILER} QMAKESPEC?= ${QT_PREFIX}/share/qt4/mkspecs/freebsd-${QMAKE_BASE_COMPILER} .endif -.if ${OSVERSION} < 700042 && ${ARCH} == "amd64" -QTCPPFLAGS?= -fno-gcse -.else QTCPPFLAGS?= -.endif QTCGFLIBS?= .endif # !defined(_POSTMKINCLUDED) && !defined(Qt_Pre_Include)