Skip to content
Browse files

Large update of pcbsd-builder

* Add new option to build the entire ports tree using poudriere
* Move config files to .dist
* Add "make menu" target, to bring up dialog based menu
* Add "make ports" target, to rebuild the ports tree in poudriere
* Add "make ports-update-all" to update the entire ports tree in poudriere
* Add "make ports-update-pcbsd" to update only PC-BSD ports in poudriere
  • Loading branch information...
1 parent 850ebbe commit e5d85c9e3efed93e99ac3dc5dd0e542fc740d9d3 @kmoore134 kmoore134 committed
View
8 Makefile
@@ -10,5 +10,13 @@ iso:
@cd ${.CURDIR}/scripts/ && sh build-iso.sh iso
world:
@cd ${.CURDIR}/scripts/ && sh build-iso.sh world
+ports:
+ @cd ${.CURDIR}/scripts/ && sh build-iso.sh ports
+ports-update-all:
+ @cd ${.CURDIR}/scripts/ && sh build-iso.sh ports-update-all
+ports-update-pcbsd:
+ @cd ${.CURDIR}/scripts/ && sh build-iso.sh ports-update-pcbsd
clean:
@cd ${.CURDIR}/scripts/ && sh build-iso.sh clean
+menu:
+ @cd ${.CURDIR}/scripts/ && sh build-iso.sh menu
View
11 pcbsd.cfg → pcbsd.cfg.dist
@@ -13,10 +13,19 @@ GITFBSDURL="https://github.com/pcbsd/freebsd.git"
GITFBSDBRANCH="releng/9.2"
export GITFBSDURL GITFBSDBRANCH
-# Set the target version for pulling pkgng packages
+# Set the target version for pulling pkgng packages / poudriere jail
TARGETREL="9.2-RELEASE"
export TARGETREL
# Set the target ARCH type for world / pkgng
ARCH="amd64"
export ARCH
+
+# Poudriere data location
+POUD="/usr/local/poudriere"
+export POUD
+
+# Set if we are using a locally built PKGNG repo, or a remote one
+# local / remote
+PKGREPO="local"
+export PKGREPO
View
0 pkg-pubkey.cert → pkg-pubkey.cert.dist
File renamed without changes.
View
0 pkg.conf → pkg.conf.dist
File renamed without changes.
View
53 scripts/build-iso.sh
@@ -4,6 +4,17 @@
# Where is the pcbsd-build program installed
PROGDIR="`realpath | sed 's|/scripts||g'`" ; export PROGDIR
+# Copy .dist files if necessary
+if [ ! -e "${PROGDIR}/pcbsd.cfg" ] ; then
+ cp ${PROGDIR}/pcbsd.cfg.dist ${PROGDIR}/pcbsd.cfg
+fi
+if [ ! -e "${PROGDIR}/pkg.conf" ] ; then
+ cp ${PROGDIR}/pkg.conf.dist ${PROGDIR}/pkg.conf
+fi
+if [ ! -e "${PROGDIR}/pkg-pubkey.cert.dist" ] ; then
+ cp ${PROGDIR}/pkg-pubkey.cert.dist ${PROGDIR}/pkg-pubkey.cert
+fi
+
# Source the config file
. ../pcbsd.cfg
@@ -43,6 +54,44 @@ do_clean()
rm ${PROGDIR}/tmp/All/* 2>/dev/null
}
+do_ports()
+{
+ echo "Building ports"
+
+ if [ ! -e "${DISTDIR}/base.txz" ] ; then
+ exit_err "You must create a world before running poudriere"
+ fi
+
+ # Make sure the jail is created
+ poudriere jail -l | grep -q $PBUILD
+ if [ $? -ne 0 ] ; then
+ update_poudriere_jail
+ fi
+
+ # Check if we have a portstree to build
+ if [ ! -d "${PJPORTSDIR}" ] ; then
+ sh ${PROGDIR}/scripts/portbuild.sh portsnap
+ fi
+
+ sh ${PROGDIR}/scripts/portbuild.sh all
+ if [ $? -ne 0 ] ; then
+ echo "Script failed!"
+ exit 1
+ fi
+}
+
+do_ports_all()
+{
+ sh ${PROGDIR}/scripts/portbuild.sh portsnap
+}
+
+do_ports_pcbsd()
+{
+ if [ ! -d "${PJPORTSDIR}" ] ; then
+ sh ${PROGDIR}/scripts/portbuild.sh portsnap
+ fi
+ sh ${PROGDIR}/scripts/portbuild.sh portmerge
+}
echo "Operation started: `date`"
@@ -54,7 +103,11 @@ case $TARGET in
do_iso ;;
world) do_world ;;
iso) do_iso ;;
+ ports) do_ports ;;
+ports-update-all) do_ports_all ;;
+ports-update-pcbsd) do_ports_pcbsd ;;
clean) do_clean ;;
+ menu) sh ${PROGDIR}/scripts/menu.sh ;;
*) ;;
esac
View
87 scripts/functions.sh
@@ -3,6 +3,12 @@
# Most of these dont need to be modified
#########################################################
+# Where is the pcbsd-build program installed
+PROGDIR="`realpath | sed 's|/scripts||g'`" ; export PROGDIR
+
+# Source vars
+. ${PROGDIR}/pcbsd.cfg
+
# Where on disk is the PCBSD GIT branch
GITBRANCH="${PROGDIR}/git/pcbsd"
export GITBRANCH
@@ -16,8 +22,6 @@ KERNDIST="$DISTDIR/kernel.txz"
L32DIST="$DISTDIR/lib32.txz"
export BASEDIST KERNDIST L32DIST
-# Source pcbsd.cfg
-. ${PROGDIR}/pcbsd.cfg
# Kernel Config
PCBSDKERN="GENERIC" ; export PCBSDKERN
@@ -33,15 +37,7 @@ PDESTDIRFBSD="${PROGDIR}/buildworld-fbsd" ; export PDESTDIRFBSD
PDESTDIRSERVER="${PROGDIR}/buildworld-server" ; export PDESTDIRSERVER
# Set the PC-BSD Version
-REVISION="`cat ${WORLDSRC}/sys/conf/newvers.sh 2>/dev/null | grep '^REVISION=' | cut -d '"' -f 2`"
-if [ -z "$REVISION" ] ; then
- REVISION="UNKNOWN"
-fi
-BRANCH="`cat ${WORLDSRC}/sys/conf/newvers.sh 2>/dev/null | grep '^BRANCH=' | cut -d '"' -f 2`"
-if [ -z "$BRANCH" ] ; then
- BRANCH="UNKNOWN"
-fi
-export PCBSDVER="${REVISION}-${BRANCH}"
+export PCBSDVER="${TARGETREL}"
# Where are the config files
PCONFDIR="${GITBRANCH}/build-files/conf" ; export PCONFDIR
@@ -60,6 +56,24 @@ esac
# Set the location of packages needed for our Meta-Packages
export METAPKGDIR="${PROGDIR}/tmp/All"
+# Poudriere Ports tag, change to use multiple ports trees
+if [ -z "$POUDPORTS" ] ; then
+ POUDPORTS="pcbsdports" ; export POUDPORTS
+fi
+
+
+# Poudriere Ports tag, change to use multiple ports trees
+if [ -z "$POUDPORTS" ] ; then
+ POUDPORTS="pcbsdports" ; export POUDPORTS
+fi
+
+# Poudriere variables
+PBUILD="pcbsd-`echo $TARGETREL | sed 's|\.||g'`"
+PJDIR="$POUD/jails/$PBUILD"
+PPKGDIR="$POUD/data/packages/$PBUILD-$POUDPORTS"
+PJPORTSDIR="$POUD/ports/$POUDPORTS"
+export PBUILD PJDIR PJPORTSDIR PPKGDIR
+
# Check for required dirs
rDirs="/log /git /iso /fbsd-dist /tmp"
for i in $rDirs
@@ -207,6 +221,12 @@ create_pkg_conf()
sed -i '' "s|%RELVERSION%|$TARGETREL|g" ${PROGDIR}/tmp/pkg.conf
sed -i '' "s|%ARCH%|$ARCH|g" ${PROGDIR}/tmp/pkg.conf
sed -i '' "s|%PROGDIR%|$PROGDIR|g" ${PROGDIR}/tmp/pkg.conf
+
+ if [ "$PKGREPO" = "local" ]; then
+ cat ${PROGDIR}/tmp/pkg.conf | grep -v "packagesite:" > ${PROGDIR}/tmp/pkg.conf.local
+ mv ${PROGDIR}/tmp/pkg.conf.local ${PROGDIR}/tmp/pkg.conf
+ echo "packagesite: file://${PPKGDIR}" >> ${PROGDIR}/tmp/pkg.conf
+ fi
}
# Copy the ISO package files to a new location
@@ -247,3 +267,48 @@ cp_iso_pkg_files()
# Copy pkgng
cp ${PROGDIR}/tmp/All/pkg-*.txz ${PROGDIR}/tmp/All/pkg.txz
}
+
+update_poudriere_jail()
+{
+ # Setup fake poudriere file URL
+ mkdir -p /fakeftp/pub/FreeBSD/releases/${ARCH}/${ARCH}/$PCBSDVER >/dev/null 2>/dev/null
+ dfiles="src.txz base.txz doc.xz games.txz kernel.txz"
+ if [ "$ARCH" = "amd64" ] ; then dfiles="$dfiles lib32.txz" ; fi
+ for i in $dfiles
+ do
+ ln -sf "${DISTDIR}/$i" /fakeftp/pub/FreeBSD/releases/${ARCH}/${ARCH}/${PCBSDVER}/$i
+ done
+
+ echo "FREEBSD_HOST=file:///fakeftp/" >> /usr/local/etc/poudriere.conf
+
+ # Clean old poudriere dir
+ poudriere jail -d -j $PBUILD >/dev/null 2>/dev/null
+
+ poudriere jail -c -j $PBUILD -v ${PCBSDVER} -a $ARCH
+ if [ $? -ne 0 ] ; then
+ cat /usr/local/etc/poudriere.conf | grep -v "^FREEBSD_HOST=file:///fakeftp/" >/tmp/.pconf.$$
+ mv /tmp/.pconf.$$ /usr/local/etc/poudriere.conf
+ echo "Failed to create poudriere jail"
+ exit 1
+ fi
+
+ # Cleanup the hostname
+ cat /usr/local/etc/poudriere.conf | grep -v "^FREEBSD_HOST=file:///fakeftp/" >/tmp/.pconf.$$
+ mv /tmp/.pconf.$$ /usr/local/etc/poudriere.conf
+
+ rm -rf /fakeftp
+}
+
+get_last_rev()
+{
+ oPWD=`pwd`
+ rev=0
+ cd "$1"
+ rev=`git log -n 1 --date=raw ${1} | grep 'Date:' | awk '{print $2}'`
+ cd $oPWD
+ if [ $rev -ne 0 ] ; then
+ echo "$rev"
+ return 0
+ fi
+ return 1
+}
View
114 scripts/menu.sh
@@ -0,0 +1,114 @@
+#!/bin/sh
+
+# Where is the pcbsd-build program installed
+PROGDIR="`realpath | sed 's|/scripts||g'`" ; export PROGDIR
+
+# Source the config file
+. ../pcbsd.cfg
+
+cd ${PROGDIR}/scripts
+
+# First, lets check if we have all the required programs to build an ISO
+. ${PROGDIR}/scripts/functions.sh
+
+# Check requirements
+${PROGDIR}/scripts/checkprogs.sh
+
+if [ `id -u` != "0" ] ; then
+ exit_err "Whoops! Need to run me as root!"
+fi
+
+# Set answer file
+ans="/tmp/.ans.$$"
+
+exit_trap()
+{
+ echo -e "Cleaning up...\c"
+ if [ -z "$1" ] ; then
+ status="99"
+ else
+ status="$1"
+ fi
+ if [ -e "$ans" ] ; then
+ rm ${ans}
+ fi
+ if [ -n "$pCleanup" ] ; then
+ sleep 10
+ poudriere jail -k -j ${pCleanup}
+ fi
+ echo -e "Done"
+ exit 0
+}
+
+trap exit_trap 1 2 3 9 15
+
+upload_menu()
+{
+ sh ${PROGDIR}/scripts/upload.sh
+}
+
+ports_menu()
+{
+ cd ${PROGDIR}/scripts
+ TITLE="Ports Menu"
+ while :
+ do
+ cd ${PROGDIR}/scripts
+ dialog --backtitle "$TITLE" --menu "Select a build option:" 14 40 40 merge "Update just PC-BSD ports" pup "Update entire ports tree" back "Back" 2>${ans}
+ if [ $? -ne 0 ] ; then
+ echo "Canceled!"
+ exit_trap
+ fi
+ case `cat $ans` in
+ pup) ./portbuild.sh portsnap ; rtn ;;
+ merge) ./portbuild.sh portmerge ; rtn ;;
+ back) break ;;
+ *) ;;
+ esac
+ done
+
+};
+
+
+cd ${PROGDIR}/scripts
+
+
+while :
+do
+
+TITLE="Main Menu"
+
+cd ${PROGDIR}/scripts
+
+upmenu=""
+if [ -e "upload.sh" ]; then
+ upmenu="upload \"Upload Menu\""
+fi
+
+# Start the main dialog
+dialog --backtitle "$TITLE" --menu "Select a build option:" 16 50 40 world "Rebuild World/Kernel" packages "Build packages (Poudriere)" iso "Create ISO Files" $upmenu ports "Ports menu" exit "Exit" 2>${ans}
+if [ $? -ne 0 ] ; then
+ echo "Canceled!"
+ exit_trap
+fi
+case `cat $ans` in
+ world) echo "Rebuild the FreeBSD world?"
+ echo -e "(Y/N)\c"
+ read tmp
+ if [ "$tmp" = "Y" -o "$tmp" = "y" ] ; then
+ ./build-iso.sh world
+ fi
+ rtn
+ ;;
+ iso) rm ${PROGDIR}/log/.done_9 2>/dev/null
+ ./build-iso.sh iso
+ echo "ISO files created in ${PROGDIR}/iso"
+ rtn ;;
+ packages) ./build-iso.sh packages ; rtn ;;
+ ports) ports_menu ;;
+ upload) upload_menu ;;
+ exit) exit_trap 0 ;;
+ *) ;;
+esac
+
+done
View
85 scripts/mergesvnports
@@ -0,0 +1,85 @@
+#!/bin/sh
+#-
+# Copyright (c) 2002-2006 FreeBSD GNOME Team <freebsd-gnome@FreeBSD.org>
+# Copyright (c) 2009 KDE FreeBSD Team <kde@FreeBSD.org>
+# Copyright (c) 2011 PC-BSD <kris@pcbsd.org>
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in the
+# documentation and/or other materials provided with the distribution.
+#
+# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+# SUCH DAMAGE.
+#
+# Based on marcusmerge, adapted for area51
+# by Martin Wilke <miwi@FreeBSD.org>
+#
+#
+
+# Path to the xorg ports without the trailing /.
+SDIR="$1"
+
+# Path to the ports collection to update
+PORTSDIR="$2"
+
+if [ -z "$SDIR" -o -z "$PORTSDIR" ] ; then
+ echo "Missing SOURCE or TARGET"
+ exit 1
+fi
+
+# Merge MK files
+echo "===> Merging files from $SDIR to $PORTSDIR directory"
+echo "${SDIR} --> ${PORTSDIR}"
+
+# Merge the Mk/ files
+if [ -d ${SDIR}/Mk ]; then
+ for mk in `ls -1 ${SDIR}/Mk/*.mk`; do
+ cp ${mk} ${PORTSDIR}/Mk
+ done
+fi
+
+#Merge Category and Ports
+cd ${SDIR}
+for categorypath in `find . -type d -depth 1`; do
+ category=$(basename "$categorypath")
+
+ if [ ${category} = ".svn" ]; then
+ continue
+ fi
+ for port in `ls -1 ${SDIR}/${category}`; do
+ if [ ${port} = ".svn" ]; then
+ continue
+ fi
+ if [ ! -f ${SDIR}/${category}/${port}/Makefile ]; then
+ fi
+ if [ ! -d ${PORTSDIR}/${category} ]; then
+
+ mkdir -p ${PORTSDIR}/${category}
+ fi
+ if [ -d ${PORTSDIR}/${category}/${port} ]; then
+
+ rm -rf ${PORTSDIR}/${category}/${port}/work
+ find ${PORTSDIR}/${category}/${port} \! -path "*/.svn/*" -type f | \
+ xargs rm -f
+ fi
+
+ cd ${SDIR}/${category}
+ tar --exclude "*/.svn*" -cf - ${port} | \
+ tar -xf - -C ${PORTSDIR}/${category}
+ done
+done
View
237 scripts/portbuild.sh
@@ -0,0 +1,237 @@
+#!/bin/sh
+# Meta pkg building startup script
+#############################################
+
+# Where is the pcbsd-build program installed
+PROGDIR="`realpath | sed 's|/scripts||g'`" ; export PROGDIR
+
+# Source the config file
+. ../pcbsd.cfg
+
+cd ${PROGDIR}/scripts
+
+# First, lets check if we have all the required programs to build an ISO
+. ${PROGDIR}/scripts/functions.sh
+
+# Check if we have required programs
+sh ${PROGDIR}/scripts/checkprogs.sh
+cStat=$?
+if [ $cStat -ne 0 ] ; then exit $cStat; fi
+
+
+exit_trap()
+{
+ echo -e "Cleaning up poudriere build...\c"
+ if [ -z "$1" ] ; then
+ status="99"
+ else
+ status="$1"
+ fi
+ if [ -e "$ans" ] ; then
+ rm ${ans}
+ fi
+ if [ -n "$pCleanup" ] ; then
+ sleep 10
+ poudriere jail -k $pCleanup
+ fi
+ echo -e "Done"
+ exit 0
+}
+
+trap exit_trap 1 2 3 9 15
+
+merge_pcbsd_src_ports()
+{
+ local mcwd=`pwd`
+ local svndir="$1"
+ local portsdir="$2"
+ local distCache=`grep '^DISTFILES_CACHE=' /usr/local/etc/poudriere.conf | cut -d '=' -f 2`
+ if [ -z "$distCache" ] ; then
+ exit_err "Need a DISTFILES_CACHE in poudriere.conf"
+ fi
+
+ if [ ! -d "$distCache" ] ; then rc_halt "mkdir -p ${distCache}" ; fi
+ git_up "$svndir" "$svndir"
+ rc_halt "cd ${svndir}"
+
+
+ echo "Merging PC-BSD ports-overlay..."
+ rc_halt "${PROGDIR}/scripts/mergesvnports ${svndir}/build-files/ports-overlay ${portsdir}"
+
+ # Now massage all the CHGVERSION variables into the REV
+ rc_halt "cd ${portsdir}/misc"
+ for i in `ls -d pcbsd* trueos*`
+ do
+ mREV=`get_last_rev "${svndir}/build-files/ports-overlay/misc/${i}"`
+ rc_halt "cd ${portsdir}/misc"
+ if [ ! -e "${i}/Makefile" ] ; then
+ exit_err "Error: missing Makefile for ${portsdir}/misc/${i}"
+ fi
+ sed -i '' "s|CHGVERSION|$mREV|g" ${i}/Makefile
+ if [ $? -ne 0 ] ; then
+ exit_err "Error: Failed running sed on ${portsdir}/misc/${i}"
+ fi
+ done
+
+ # Make the dist files
+ cliREV=`get_last_rev "${svndir}/src-sh"`
+ guiREV=`get_last_rev "${svndir}/src-qt4"`
+ rc_halt "cd ${svndir}"
+ rc_nohalt "rm ${distCache}/pcbsd-utils*.bz2"
+
+ echo "Creating dist files for version: $cliREV"
+ rc_halt "tar cvjf ${distCache}/pcbsd-utils-${cliREV}.tar.bz2 src-sh" 2>/dev/null
+
+ echo "Creating dist files for version: $guiREV"
+ rc_halt "tar cvjf ${distCache}/pcbsd-utils-qt4-${guiREV}.tar.bz2 src-qt4" 2>/dev/null
+
+ # Copy ports files
+ rm -rf ${portsdir}/sysutils/pcbsd-utils 2>/dev/null
+ rm -rf ${portsdir}/sysutils/pcbsd-utils-qt4 2>/dev/null
+ rm -rf ${portsdir}/sysutils/pcbsd-base 2>/dev/null
+ rm -rf ${portsdir}/sysutils/trueos-base 2>/dev/null
+ rc_halt "cp -r src-sh/port-files ${portsdir}/sysutils/pcbsd-utils"
+ rc_halt "cp -r src-qt4/port-files ${portsdir}/sysutils/pcbsd-utils-qt4"
+
+ # Set the version numbers
+ sed -i '' "s|CHGVERSION|${cliREV}|g" ${portsdir}/sysutils/pcbsd-utils/Makefile
+ sed -i '' "s|CHGVERSION|${guiREV}|g" ${portsdir}/sysutils/pcbsd-utils-qt4/Makefile
+
+ # Create the makesums / distinfo file
+ rc_halt "cd ${portsdir}/sysutils/pcbsd-utils"
+ rc_halt "make makesum DISTDIR=${distCache} PORTSDIR=${portsdir}"
+ rc_halt "cd ${portsdir}/sysutils/pcbsd-utils-qt4"
+ rc_halt "make makesum DISTDIR=${distCache} PORTSDIR=${portsdir}"
+
+ # Need to add these ports to INDEX / SUBDIR
+ rc_halt "cd ${portsdir}"
+ local subdirs="sysutils/pcbsd-utils sysutils/pcbsd-utils-qt4 sysutils/grub2-efi `ls -d misc/pcbsd-* misc/trueos-*`"
+ for i in $subdirs
+ do
+ cDir=`echo $i | cut -d '/' -f 1`
+ pDir=`echo $i | cut -d '/' -f 2`
+ grep -q "SUBDIR += ${pDir}" ${cDir}/Makefile
+ if [ $? -eq 0 ] ; then continue; fi
+
+ echo "Adding ${pDir} to ${cDir}/Makefile..."
+ # Add to $cDir / Makefile
+ mv ${cDir}/Makefile ${cDir}/Makefile.$$
+ echo " SUBDIR += ${pDir}" >${cDir}/Makefile
+ cat ${cDir}/Makefile.$$ >> ${cDir}/Makefile
+ rm ${cDir}/Makefile.$$
+ done
+
+ # Jump back to where we belong
+ rc_halt "cd $mcwd"
+}
+
+mk_metapkg_bulkfile()
+{
+ local bulkList=$1
+ rm $bulkList >/dev/null 2>/dev/null
+
+ # Save the bulk file
+ echo "==> Scheduling build for: sysutils/pcbsd-utils"
+ echo "sysutils/pcbsd-utils" > $bulkList
+ echo "==> Scheduling build for: sysutils/pcbsd-utils-qt4"
+ echo "sysutils/pcbsd-utils-qt4" >> $bulkList
+
+ # Get a listing of all pcbsd-* and trueos-* packages to build
+ for i in `ls -d ${PJPORTSDIR}/misc/pcbsd-* ${PJPORTSDIR}/misc/trueos-* | sed "s|${PJPORTSDIR}/||g"`
+ do
+ # Check the arch type
+ pArch=`make -C ${PJPORTSDIR}/${i} -V ONLY_FOR_ARCHS PORTSDIR=${PJPORTSDIR}`
+ if [ -n "$pArch" -a "$pArch" != "$ARCH" ] ; then continue; fi
+ echo "==> Scheduling build for: $i"
+ echo "${i}" >> $bulkList
+ done
+}
+
+do_portsnap()
+{
+ echo "Updating ports collection..."
+ poudriere -l | grep -q "^{POUDPORTS"
+ if [ $? -eq 0 ] ; then
+ poudriere ports -u -p "$POUDPORTS"
+ if [ $? -ne 0 ] ; then
+ echo "Failed to update ports $POUDPORTS"
+ exit 1
+ fi
+ else
+ poudriere ports -c -p "$POUDPORTS"
+ if [ $? -ne 0 ] ; then
+ echo "Failed to create ports $POUDPORTS"
+ exit 1
+ fi
+ fi
+}
+
+do_pcbsd_portmerge()
+{
+ # Copy our PCBSD port files
+ merge_pcbsd_src_ports "${GITBRANCH}" "${PJPORTSDIR}"
+
+ # Create the ports INDEX file
+ cd ${PJPORTSDIR}
+ make -C ${PJPORTSDIR} PORTSDIR=${PJPORTSDIR} __MAKE_CONF=/usr/local/etc/poudriere.d/$PBUILD-make.conf index
+
+ # Make dist ports files
+ rm ${PROGDIR}/usr/ports 2>/dev/null
+ rmdir ${PROGDIR}/usr 2>/dev/null
+ rc_halt "mkdir ${PROGDIR}/usr"
+ rc_halt "ln -fs ${PJPORTSDIR} ${PROGDIR}/usr/ports"
+ echo "Creating ports distfile.. Will take several minutes.."
+ rc_halt "tar cLvJf /usr/ports.txz --exclude usr/ports/.portsnap.INDEX --exclude usr/ports/.snap --exclude usr/ports/distfiles -C ${PROGDIR} usr/ports"
+ rc_halt "rm ${PROGDIR}/usr/ports"
+ rc_halt "rmdir ${PROGDIR}/usr"
+}
+
+if [ -z "$1" ] ; then
+ target="all"
+else
+ target="$1"
+fi
+
+cd ${PROGDIR}
+
+# Copy over our custom make options
+if [ ! -d "/usr/local/etc/poudriere.d" ]; then
+ mkdir -p /usr/local/etc/poudriere.d
+fi
+if [ ! -d "${GITBRANCH}" ]; then
+ rc_halt "git clone ${GITPCBSDURL} ${GITBRANCH}"
+fi
+git_up "${GITBRANCH}" "${GITBRANCH}"
+rc_halt "cd ${GITBRANCH}/build-files/conf/"
+cp ${GITBRANCH}/build-files/conf/port-make.conf /usr/local/etc/poudriere.d/$PBUILD-make.conf
+if [ -e "/usr/local/etc/poudriere.d/$PBUILD-make.conf.poudriere" ] ; then
+ cat /usr/local/etc/poudriere.d/$PBUILD-make.conf.poudriere >> /usr/local/etc/poudriere.d/$PBUILD-make.conf
+fi
+
+if [ "$target" = "all" ] ; then
+ # Set cleanup var
+ pCleanup="-j ${PBUILD} -p ${POUDPORTS}"
+ export pCleanup
+
+ # Build entire ports tree
+ poudriere bulk -a -j $PBUILD -p $POUDPORTS | tee ${PROGDIR}/log/poudriere.log
+ if [ $? -ne 0 ] ; then
+ echo "Failed poudriere build..."
+ fi
+
+ # Unset cleanup var
+ pCleanup=""
+ export pCleanup
+
+ exit 0
+elif [ "$1" = "portsnap" ] ; then
+ do_portsnap
+ do_pcbsd_portmerge
+ exit 0
+elif [ "$1" = "portmerge" ] ; then
+ do_pcbsd_portmerge
+ exit 0
+else
+ echo "Invalid option!"
+ exit 1
+fi

0 comments on commit e5d85c9

Please sign in to comment.
Something went wrong with that request. Please try again.