Date: Mon, 11 Feb 2013 22:59:11 +0000 (UTC) From: Mark Linimon <linimon@FreeBSD.org> To: src-committers@freebsd.org, svn-src-projects@freebsd.org Subject: svn commit: r246694 - in projects/portbuild: admin/scripts scripts Message-ID: <201302112259.r1BMxB7E079501@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: linimon (doc,ports committer) Date: Mon Feb 11 22:59:10 2013 New Revision: 246694 URL: http://svnweb.freebsd.org/changeset/base/246694 Log: makeworld and mkbindist need to belong to SRCBUILD_USER, not PORTBUILD_USER, in the new privilege separation world. Added: projects/portbuild/admin/scripts/makeworld - copied unchanged from r246683, projects/portbuild/scripts/makeworld projects/portbuild/admin/scripts/mkbindist - copied unchanged from r246683, projects/portbuild/scripts/mkbindist Deleted: projects/portbuild/scripts/makeworld projects/portbuild/scripts/mkbindist Copied: projects/portbuild/admin/scripts/makeworld (from r246683, projects/portbuild/scripts/makeworld) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ projects/portbuild/admin/scripts/makeworld Mon Feb 11 22:59:10 2013 (r246694, copy of r246683, projects/portbuild/scripts/makeworld) @@ -0,0 +1,122 @@ +#!/bin/sh + +# +# XXX lockfile and interlock with mkbindist to avoid overlapping +# builds + +if [ $# -lt 2 ]; then + echo "usage: makeworld <arch> <branch> [<buildid>] [args]" + exit 1 +fi + +arch=$1 +branch=$2 +shift 2 + +buildid="latest" +if [ $# -gt 0 ]; then + case "$1" in + -client) + ;; + -nocvs|-novcs) + ;; + *) + buildid="$1" + shift + ;; + esac +fi + +pbc=${PORTBUILD_CHECKOUT:-/var/portbuild} +pbd=${PORTBUILD_DATA:-/var/portbuild} + +builddir=${pbd}/${arch}/${branch}/builds/${buildid} +if [ ! -d ${builddir} ]; then + echo "build directory ${builddir} does not exist!" + exit 1 +fi + +. ${pbc}/conf/server.conf +. ${pbc}/conf/common.conf +. ${pbd}/${arch}/portbuild.conf +if [ -f ${builddir}/portbuild.conf ]; then + . ${builddir}/portbuild.conf +fi +# NB: we can't use buildenv because it sets ARCH and MACHINE_ARCH that +# confuses cross-builds + +export TARGET_ARCH=${arch} +# Workaround needed for zfs - 20090321 erwin +export NO_FSCHG=1 + +client=0 +novcs=0 + +# optional arguments +while [ $# -gt 0 ]; do + case "$1" in + -client) + client=1 + ;; + -nocvs|-novcs) + novcs=1 + ;; + *) + args="$1 ${args}" + ;; + esac + shift +done + +# XXX MCL I don't know what -client is supposed to do. +if [ "$client" = "1" ]; then + SRC_BASE=${pbd}/${arch}/src-client + shift 1 +else + SRC_BASE=${builddir}/src + + # allow for per-build make.conf + if [ -f ${builddir}/make.conf.server ]; then + export __MAKE_CONF=${builddir}/make.conf.server + else + export __MAKE_CONF=/dev/null + fi + + # allow for per-build src.conf + if [ -f ${builddir}/src.conf.server ]; then + export SRCCONF=${builddir}/src.conf.server + else + export SRCCONF=/dev/null + fi +fi + +cd ${SRC_BASE} || exit $? + +if [ "$novcs" = "0" ]; then + echo "==> Updating source tree" + # XXX MCL 20121120 not yet tested. + ${VCS_UPDATE_COMMAND} ${SRC_BASE} || exit $? +fi + +echo "==> Starting make buildworld" +make buildworld ${args} || exit $? + +echo "==> Cleaning up destdir" +destdir=${WORLDDIR}/${arch}/${branch} +rm -rf ${destdir}/ +chflags -R noschg ${destdir}/ +rm -rf ${destdir}/ +mkdir -p ${destdir} || exit $? + +echo "==> Starting make installworld" +if [ "$client" = "0" ]; then + export NEWSPARC_TIMETYPE=__int64_t + make installworld DESTDIR=${destdir} || exit $? + + echo "==> Starting make distribute" + make DESTDIR=${destdir} distrib-dirs && \ + make DESTDIR=${destdir} distribution || exit $? + +else + echo "==> Not doing installworld of client source tree" +fi Copied: projects/portbuild/admin/scripts/mkbindist (from r246683, projects/portbuild/scripts/mkbindist) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ projects/portbuild/admin/scripts/mkbindist Mon Feb 11 22:59:10 2013 (r246694, copy of r246683, projects/portbuild/scripts/mkbindist) @@ -0,0 +1,93 @@ +#!/bin/sh + +# XXX merge with makeworld? + +usage () { + echo "usage: mkbindist <arch> <branch> [<buildid>]" + exit 1 +} + +cleandir() { + dir=$1 + rm -rf ${dir} 2>/dev/null + if [ -d ${dir} ]; then + chflags -R noschg ${dir} + rm -rf ${dir} + fi +} + +if [ $# -lt 2 ]; then + usage +fi + +arch=$1 +branch=$2 +shift 2 + +buildid="latest" +if [ $# -gt 0 ]; then + buildid="$1" + shift +fi + +pbc=${PORTBUILD_CHECKOUT:-/var/portbuild} +pbd=${PORTBUILD_DATA:-/var/portbuild} + +builddir=${pbd}/${arch}/${branch}/builds/${buildid} +if [ ! -d ${builddir} ]; then + echo "build directory ${builddir} does not exist!" + exit 1 +fi + +. ${pbc}/conf/server.conf +. ${pbd}/${arch}/portbuild.conf +if [ -f ${builddir}/portbuild.conf ]; then + . ${builddir}/portbuild.conf +fi + +. ${pbc}/scripts/buildenv + +if ! validate_env ${arch} ${branch}; then + echo "Invalid build environment ${arch}/${branch}" + exit 1 +fi + +tmpdir=${builddir}/bindist/tmp + +# Clean up ${tmpdir} +cleandir ${tmpdir} +mkdir -p ${tmpdir} + +# Copy the files into the tmpdir from an existing built world +destdir=${WORLDDIR}/${arch}/${branch} +cd ${destdir}; find -dx . | \ + grep -v -E '^./usr/(local|obj|opt|ports|src)' | \ + grep -v '^./home' | \ + grep -v '^./var/db/pkg' | \ + cpio -dump ${tmpdir} + +cd ${tmpdir} + +# Customize the tmpdir +if [ -s "${builddir}/bindist/delete" ]; then + sed -e "s,^,${tmpdir}," ${builddir}/bindist/delete | xargs rm -rf +fi +if [ -s "${builddir}/bindist/dirlist" ]; then + cat "${builddir}/bindist/dirlist" | xargs mkdir -p +fi +# XXX MCL seems to be obsoleted by individual files in clients/? +if [ -d ${builddir}/bindist/files ]; then + cd ${builddir}/bindist/files; find -dx . | cpio -dump ${tmpdir} +fi + +# Post-processing of installed world +date '+%Y%m%d' > ${tmpdir}/var/db/port.mkversion + +# Create the tarball +tar cfCj ${builddir}/.bindist.tbz ${tmpdir} . +mv -f ${builddir}/.bindist.tbz ${builddir}/bindist.tbz +md5 ${builddir}/bindist.tbz > ${builddir}/bindist.tbz.md5 + +# Clean up +cd ${builddir} +cleandir ${tmpdir}
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201302112259.r1BMxB7E079501>