summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormarino <marino@pkgsrc.org>2011-11-02 21:13:10 +0000
committermarino <marino@pkgsrc.org>2011-11-02 21:13:10 +0000
commitdc0dc103e8e6dc55b9be33e92fa576284bba9c5a (patch)
treed30a66f2419bd3922c10b72affb02d4a786b12cc
parenta28e21d8b11258c92653b3f6df78938b7d3f5319 (diff)
downloadpkgsrc-dc0dc103e8e6dc55b9be33e92fa576284bba9c5a.tar.gz
Import pkgtools/tinderbox-dragonfly
Tinderbox is a well-known package building system for FreeBSD. This commit ports the original Tinderbox to DragonFly. The scripts are highly platform specific, so only one operating system can be supported per package. With interest, alternative versions such as tinderbox-netbsd and tinderbox-sunos could be developed fairly easily as they would share the pkgsrc-specific changes with this package. The repository for the project is: https://github.com/jrmarino/pkgsrc-tinderbox
-rw-r--r--pkgtools/tinderbox-dragonfly/DESCR18
-rw-r--r--pkgtools/tinderbox-dragonfly/MESSAGE59
-rw-r--r--pkgtools/tinderbox-dragonfly/Makefile62
-rw-r--r--pkgtools/tinderbox-dragonfly/PLIST143
-rw-r--r--pkgtools/tinderbox-dragonfly/README29
-rw-r--r--pkgtools/tinderbox-dragonfly/distinfo33
-rw-r--r--pkgtools/tinderbox-dragonfly/files/tinderd.sh41
-rw-r--r--pkgtools/tinderbox-dragonfly/options.mk63
-rw-r--r--pkgtools/tinderbox-dragonfly/patches/patch-aa901
-rw-r--r--pkgtools/tinderbox-dragonfly/patches/patch-ab56
-rw-r--r--pkgtools/tinderbox-dragonfly/patches/patch-ac186
-rw-r--r--pkgtools/tinderbox-dragonfly/patches/patch-ad51
-rw-r--r--pkgtools/tinderbox-dragonfly/patches/patch-ae51
-rw-r--r--pkgtools/tinderbox-dragonfly/patches/patch-ag10
-rw-r--r--pkgtools/tinderbox-dragonfly/patches/patch-ai285
-rw-r--r--pkgtools/tinderbox-dragonfly/patches/patch-aj331
-rw-r--r--pkgtools/tinderbox-dragonfly/patches/patch-ak13
-rw-r--r--pkgtools/tinderbox-dragonfly/patches/patch-al13
-rw-r--r--pkgtools/tinderbox-dragonfly/patches/patch-am13
-rw-r--r--pkgtools/tinderbox-dragonfly/patches/patch-an13
-rw-r--r--pkgtools/tinderbox-dragonfly/patches/patch-ao13
-rw-r--r--pkgtools/tinderbox-dragonfly/patches/patch-ap13
-rw-r--r--pkgtools/tinderbox-dragonfly/patches/patch-aq13
-rw-r--r--pkgtools/tinderbox-dragonfly/patches/patch-ar554
-rw-r--r--pkgtools/tinderbox-dragonfly/patches/patch-as188
-rw-r--r--pkgtools/tinderbox-dragonfly/patches/patch-at13
-rw-r--r--pkgtools/tinderbox-dragonfly/patches/patch-au21
-rw-r--r--pkgtools/tinderbox-dragonfly/patches/patch-av88
-rw-r--r--pkgtools/tinderbox-dragonfly/patches/patch-aw237
-rw-r--r--pkgtools/tinderbox-dragonfly/patches/patch-ax13
-rw-r--r--pkgtools/tinderbox-dragonfly/patches/patch-ay13
-rw-r--r--pkgtools/tinderbox-dragonfly/patches/patch-az101
-rw-r--r--pkgtools/tinderbox-dragonfly/patches/patch-ba19
-rw-r--r--pkgtools/tinderbox-dragonfly/patches/patch-bb78
-rw-r--r--pkgtools/tinderbox-dragonfly/patches/patch-bc25
-rw-r--r--pkgtools/tinderbox-dragonfly/patches/patch-be11
36 files changed, 3771 insertions, 0 deletions
diff --git a/pkgtools/tinderbox-dragonfly/DESCR b/pkgtools/tinderbox-dragonfly/DESCR
new file mode 100644
index 00000000000..df2a8c8c653
--- /dev/null
+++ b/pkgtools/tinderbox-dragonfly/DESCR
@@ -0,0 +1,18 @@
+Tinderbox is a package building system for FreeBSD that has been modified
+for use on pkgsrc on DragonFly BSD. Joe Marcus Clarke is the author.
+
+One can define multiple jails (base system versions) and multiple portstrees
+(portstree = pkgsrc tree). The combination of jail and portstree is called
+a build. A Tinderbox jail is not what is understood as a jail in *BSD, it
+is in fact a given world in a chroot. Tinderbox supports automatic tracking
+of dependencies and only rebuilds packages that changed since last run.
+Tinderbox has support for email notification of failed builds.
+
+Tinderbox is designed to easily provide package sets of needed ports for
+specific platforms and architectures. Tinderbox is an excellent tool for
+testing new packages and package upgrades, especially for testing
+dependencies and packing lists. It is also useful for testing packages on
+previous releases of *BSD since it's possible to run a previous release
+world inside a jail on a current release host.
+
+Tinderbox/pkgsrc site: http://github.com/jrmarino/pkgsrc-tinderbox
diff --git a/pkgtools/tinderbox-dragonfly/MESSAGE b/pkgtools/tinderbox-dragonfly/MESSAGE
new file mode 100644
index 00000000000..bf17445c918
--- /dev/null
+++ b/pkgtools/tinderbox-dragonfly/MESSAGE
@@ -0,0 +1,59 @@
+===========================================================================
+$NetBSD: MESSAGE,v 1.1 2011/11/02 21:13:11 marino Exp $
+pkgtools/tinderbox is installed, but it requires some additional setup.
+
+If tinderbox just installed a database, you'll have to create a
+configuration file for it, and move its startup script from
+${PREFIX}/share/examples/rc.d to /etc/rc.d
+
+As mentioned in the README file, this package did not install any web
+server even though it may have installed a web interface. Below
+describes how to configure some common webservers.
+
+Finally, tinderbox itself has to be configured now, and don't forget
+to install tinderd as mentioned above.
+
+****************************************************
+Please do read: ${PREFIX}/tinderbox/scripts/README
+****************************************************
+
+The following walkthrough is the webserver setup:
+
+- In your Apache configuration add the following lines:
+
+ Alias /tb/logs/ "${PREFIX}/tinderbox/logs/"
+ Alias /tb/packages/ "${PREFIX}/tinderbox/packages/"
+ Alias /tb/errors/ "${PREFIX}/tinderbox/errors/"
+ Alias /tb/wrkdirs/ "${PREFIX}/tinderbox/wrkdirs/"
+ Alias /tb/ "${PREFIX}/tinderbox/scripts/webui/"
+ <Directory "${PREFIX}/tinderbox/">
+ Order allow,deny
+ Allow from all
+ </Directory>
+
+
+- In your Lighttpd configuration:
+
+Turn on "mod_alias" and add the following lines:
+
+alias.url = ( "/tb/logs/" => "${PREFIX}/tinderbox/logs/",
+ "/tb/packages/" => "${PREFIX}/tinderbox/packages/",
+ "/tb/errors/" => "${PREFIX}/tinderbox/errors/",
+ "/tb/wrkdirs/" => "${PREFIX}/tinderbox/wrkdirs/",
+ "/tb/" => "${PREFIX}/tinderbox/scripts/webui/" )
+dir-listing.activate = "enable"
+
+
+- In your Hiawatha configuration:
+
+Alias is a built in command, no need to load any special mod
+
+Alias = /tb/logs:${PREFIX}/tinderbox/logs
+Alias = /tb/packages:${PREFIX}/tinderbox/packages
+Alias = /tb/errors:${PREFIX}/tinderbox/errors
+Alias = /tb/wrkdirs:${PREFIX}/tinderbox/wrkdirs
+Alias = /tb/:${PREFIX}/tinderbox/scripts/webui
+
+ Check your system by going to http://localhost/tb/
+
+===========================================================================
diff --git a/pkgtools/tinderbox-dragonfly/Makefile b/pkgtools/tinderbox-dragonfly/Makefile
new file mode 100644
index 00000000000..2cf54214c37
--- /dev/null
+++ b/pkgtools/tinderbox-dragonfly/Makefile
@@ -0,0 +1,62 @@
+# $NetBSD: Makefile,v 1.1 2011/11/02 21:13:12 marino Exp $
+#
+
+DISTNAME= tinderbox-dragonfly-${TBOX_VERSION}
+CATEGORIES= pkgtools
+MASTER_SITES= http://tinderbox.marcuscom.com/
+DISTFILES= tinderbox-${TBOX_VERSION}.tar.gz
+
+MAINTAINER= draco@marino.st
+HOMEPAGE= http://tinderbox/marcuscom.com
+COMMENT= Tinderbox package building system (pkgsrc)
+LICENSE= modified-bsd
+
+DEPENDS+= p5-Compress-Bzip2>=2:../../archivers/p5-Compress-Bzip2
+DEPENDS+= csup>=20100101:../../net/csup
+DEPENDS+= scmgit>1.6:../../devel/scmgit
+
+TBOX_VERSION= 3.4
+PKG_DESTDIR_SUPPORT= user-destdir
+ONLY_FOR_PLATFORM= DragonFly-*-*
+
+USE_TOOLS+= perl perl:run
+NO_CONFIGURE= yes
+NO_BUILD= yes
+RCD_SCRIPTS= tinderd
+WRKSRC= ${WRKDIR}/tinderbox-${TBOX_VERSION}
+TRASH= ${WRKDIR}/trash
+MAN_FILES_cmd= ${SED} -ne "s,^man/man1/,,p" PLIST
+MAN_FILES= ${MAN_FILES_cmd:sh}
+
+INSTALLATION_DIRS+= tinderbox/scripts
+INSTALLATION_DIRS+= ${PKGMANDIR}/man1
+
+.include "options.mk"
+
+post-extract:
+ ${MKDIR} ${TRASH}
+.if empty(PKG_OPTIONS:Mwebui)
+ mv ${WRKSRC}/webui ${TRASH}
+.endif
+ mv ${WRKSRC}/etc/rc.d ${TRASH}
+
+post-patch:
+.if !empty(PKG_OPTIONS:Manybody)
+ perl -i -pe 's/^if \[ `id -u` != 0 \]; then/if false; then/' \
+ ${WRKSRC}/tc
+.endif
+ cd ${WRKSRC} && ${FIND} -E . -regex '.*(orig|bak)' -exec ${RM} {} \;
+
+do-install:
+ for manual in ${MAN_FILES}; do \
+ ${INSTALL_MAN} ${WRKSRC}/man/man1/$${manual} ${DESTDIR}${PREFIX}/${PKGMANDIR}/man1; \
+ done
+ mv ${WRKSRC}/man ${TRASH}
+ cd ${WRKSRC}; for dossier in .version *; do \
+ ${TEST} ! -f "$$dossier" || \
+ ${INSTALL} "$$dossier" ${DESTDIR}${PREFIX}/tinderbox/scripts; \
+ ${TEST} ! -d "$$dossier" || \
+ ${CP} -R "$$dossier" ${DESTDIR}${PREFIX}/tinderbox/scripts; \
+ done
+
+.include "../../mk/bsd.pkg.mk"
diff --git a/pkgtools/tinderbox-dragonfly/PLIST b/pkgtools/tinderbox-dragonfly/PLIST
new file mode 100644
index 00000000000..1c24237adfa
--- /dev/null
+++ b/pkgtools/tinderbox-dragonfly/PLIST
@@ -0,0 +1,143 @@
+@comment $NetBSD: PLIST,v 1.1 2011/11/02 21:13:16 marino Exp $
+man/man1/tc-configCcache.1
+man/man1/tc-configDistfile.1
+man/man1/tc-configGet.1
+man/man1/tc-configJail.1
+man/man1/tc-configTinderd.1
+man/man1/tc-init.1
+share/examples/rc.d/tinderd
+tinderbox/scripts/.version
+tinderbox/scripts/README
+tinderbox/scripts/ds.ph.dist
+tinderbox/scripts/contrib/hooks/make-jobs-safe/README.txt
+tinderbox/scripts/contrib/hooks/make-jobs-safe/make-jobs-safe.sh
+tinderbox/scripts/contrib/hooks/kse-fix/libmap.conf
+tinderbox/scripts/contrib/hooks/kse-fix/README.txt
+tinderbox/scripts/contrib/hooks/kse-fix/kse-fix.sh
+tinderbox/scripts/etc/env/.keep_me
+tinderbox/scripts/lib/Tinderbox/Build.pm
+tinderbox/scripts/lib/Tinderbox/BuildPortsQueue.pm
+tinderbox/scripts/lib/Tinderbox/Config.pm
+tinderbox/scripts/lib/Tinderbox/Hook.pm
+tinderbox/scripts/lib/Tinderbox/Jail.pm
+tinderbox/scripts/lib/Tinderbox/MakeCache.pm
+tinderbox/scripts/lib/Tinderbox/Port.pm
+tinderbox/scripts/lib/Tinderbox/PortFailPattern.pm
+tinderbox/scripts/lib/Tinderbox/PortFailReason.pm
+tinderbox/scripts/lib/Tinderbox/PortsTree.pm
+tinderbox/scripts/lib/Tinderbox/TinderObject.pm
+tinderbox/scripts/lib/Tinderbox/TinderboxDS.pm
+tinderbox/scripts/lib/Tinderbox/User.pm
+tinderbox/scripts/lib/buildscript
+tinderbox/scripts/lib/db-mysql.sh
+tinderbox/scripts/lib/db-pgsql.sh
+tinderbox/scripts/lib/enterbuild
+tinderbox/scripts/lib/makemake
+tinderbox/scripts/lib/pnohang.c
+tinderbox/scripts/lib/portbuild
+tinderbox/scripts/lib/tc_command.pl
+tinderbox/scripts/lib/tc_command.sh
+tinderbox/scripts/lib/tinderbox.env
+tinderbox/scripts/lib/tinderlib.pl
+tinderbox/scripts/lib/tinderlib.sh
+tinderbox/scripts/sql/genschema
+tinderbox/scripts/sql/schema.mysql.post
+tinderbox/scripts/sql/schema.mysql.pre
+tinderbox/scripts/sql/schema.pgsql.post
+tinderbox/scripts/sql/schema.pgsql.pre
+tinderbox/scripts/sql/values.config
+tinderbox/scripts/sql/values.hooks
+tinderbox/scripts/sql/values.lp
+tinderbox/scripts/sql/values.pfp
+tinderbox/scripts/sql/values.pfr
+tinderbox/scripts/tc
+tinderbox/scripts/tinderbox.ph.dist
+tinderbox/scripts/tinderd
+tinderbox/scripts/upgrade/build_ports.map
+tinderbox/scripts/upgrade/build_ports_queue.map
+tinderbox/scripts/upgrade/builds.map
+tinderbox/scripts/upgrade/config.map
+tinderbox/scripts/upgrade/hooks.map
+tinderbox/scripts/upgrade/jails.map
+tinderbox/scripts/upgrade/mig_mysql_tinderbox-3.0_to_3.1.sql
+tinderbox/scripts/upgrade/mig_mysql_tinderbox-3.1_to_3.2.sql
+tinderbox/scripts/upgrade/mig_pgsql_tinderbox-3.0_to_3.1.sql
+tinderbox/scripts/upgrade/mig_pgsql_tinderbox-3.1_to_3.2.sql
+tinderbox/scripts/upgrade/mig_pgsql_tinderbox-3.2_to_3.2.1.sql
+tinderbox/scripts/upgrade/mig_mysql_tinderbox-3.2_to_3.2.1.sql
+tinderbox/scripts/upgrade/order.lst
+tinderbox/scripts/upgrade/user_permissions.map
+${PLIST.WEBUI}tinderbox/scripts/webui/core/Build.php
+${PLIST.WEBUI}tinderbox/scripts/webui/core/BuildGroups.php
+${PLIST.WEBUI}tinderbox/scripts/webui/core/BuildPortsQueue.php
+${PLIST.WEBUI}tinderbox/scripts/webui/core/Config.php
+${PLIST.WEBUI}tinderbox/scripts/webui/core/Hooks.php
+${PLIST.WEBUI}tinderbox/scripts/webui/core/Jail.php
+${PLIST.WEBUI}tinderbox/scripts/webui/core/LogfilePattern.php
+${PLIST.WEBUI}tinderbox/scripts/webui/core/Port.php
+${PLIST.WEBUI}tinderbox/scripts/webui/core/PortFailPattern.php
+${PLIST.WEBUI}tinderbox/scripts/webui/core/PortFailReason.php
+${PLIST.WEBUI}tinderbox/scripts/webui/core/PortsTree.php
+${PLIST.WEBUI}tinderbox/scripts/webui/core/TinderObject.php
+${PLIST.WEBUI}tinderbox/scripts/webui/core/TinderboxDS.php
+${PLIST.WEBUI}tinderbox/scripts/webui/core/User.php
+${PLIST.WEBUI}tinderbox/scripts/webui/core/functions.php
+${PLIST.WEBUI}tinderbox/scripts/webui/inc_ds.php.dist
+${PLIST.WEBUI}tinderbox/scripts/webui/inc_tinderbox.php.dist
+${PLIST.WEBUI}tinderbox/scripts/webui/index.php
+${PLIST.WEBUI}tinderbox/scripts/webui/favicon.ico
+${PLIST.WEBUI}tinderbox/scripts/webui/module/module.php
+${PLIST.WEBUI}tinderbox/scripts/webui/module/moduleBuildGroups.php
+${PLIST.WEBUI}tinderbox/scripts/webui/module/moduleBuildPorts.php
+${PLIST.WEBUI}tinderbox/scripts/webui/module/moduleBuilds.php
+${PLIST.WEBUI}tinderbox/scripts/webui/module/moduleConfig.php
+${PLIST.WEBUI}tinderbox/scripts/webui/module/moduleLogs.php
+${PLIST.WEBUI}tinderbox/scripts/webui/module/modulePortFailureReasons.php
+${PLIST.WEBUI}tinderbox/scripts/webui/module/modulePorts.php
+${PLIST.WEBUI}tinderbox/scripts/webui/module/moduleRss.php
+${PLIST.WEBUI}tinderbox/scripts/webui/module/moduleSession.php
+${PLIST.WEBUI}tinderbox/scripts/webui/module/moduleTinderd.php
+${PLIST.WEBUI}tinderbox/scripts/webui/module/moduleUsers.php
+${PLIST.WEBUI}tinderbox/scripts/webui/templates/default/config.tpl
+${PLIST.WEBUI}tinderbox/scripts/webui/templates/default/current_buildports.tpl
+${PLIST.WEBUI}tinderbox/scripts/webui/templates/default/describe_port.tpl
+${PLIST.WEBUI}tinderbox/scripts/webui/templates/default/display_login.tpl
+${PLIST.WEBUI}tinderbox/scripts/webui/templates/default/display_build_groups.tpl
+${PLIST.WEBUI}tinderbox/scripts/webui/templates/default/display_markup_log.tpl
+${PLIST.WEBUI}tinderbox/scripts/webui/templates/default/failed_buildports.tpl
+${PLIST.WEBUI}tinderbox/scripts/webui/templates/default/latest_buildports.tpl
+${PLIST.WEBUI}tinderbox/scripts/webui/templates/default/list_buildports.tpl
+${PLIST.WEBUI}tinderbox/scripts/webui/templates/default/list_builds.tpl
+${PLIST.WEBUI}tinderbox/scripts/webui/templates/default/list_failure_reasons.tpl
+${PLIST.WEBUI}tinderbox/scripts/webui/templates/default/list_tinderd_queue.tpl
+${PLIST.WEBUI}tinderbox/scripts/webui/templates/default/messages.inc
+${PLIST.WEBUI}tinderbox/scripts/webui/templates/default/please_login.tpl
+${PLIST.WEBUI}tinderbox/scripts/webui/templates/default/rss.tpl
+${PLIST.WEBUI}tinderbox/scripts/webui/templates/default/tinderstyle.css
+${PLIST.WEBUI}tinderbox/scripts/webui/templates/default/tinderstyle.js
+${PLIST.WEBUI}tinderbox/scripts/webui/templates/default/user_admin.tpl
+${PLIST.WEBUI}tinderbox/scripts/webui/templates/default/user_permissions.tpl
+${PLIST.WEBUI}tinderbox/scripts/webui/templates/default/user_properties.tpl
+${PLIST.WEBUI}tinderbox/scripts/webui/templates/paefchen/config.tpl
+${PLIST.WEBUI}tinderbox/scripts/webui/templates/paefchen/current_buildports.tpl
+${PLIST.WEBUI}tinderbox/scripts/webui/templates/paefchen/describe_port.tpl
+${PLIST.WEBUI}tinderbox/scripts/webui/templates/paefchen/display_login.tpl
+${PLIST.WEBUI}tinderbox/scripts/webui/templates/paefchen/display_build_groups.tpl
+${PLIST.WEBUI}tinderbox/scripts/webui/templates/paefchen/display_markup_log.tpl
+${PLIST.WEBUI}tinderbox/scripts/webui/templates/paefchen/failed_buildports.tpl
+${PLIST.WEBUI}tinderbox/scripts/webui/templates/paefchen/footer.inc.tpl
+${PLIST.WEBUI}tinderbox/scripts/webui/templates/paefchen/header.inc.tpl
+${PLIST.WEBUI}tinderbox/scripts/webui/templates/paefchen/images/hdr_fill.png
+${PLIST.WEBUI}tinderbox/scripts/webui/templates/paefchen/latest_buildports.tpl
+${PLIST.WEBUI}tinderbox/scripts/webui/templates/paefchen/list_buildports.tpl
+${PLIST.WEBUI}tinderbox/scripts/webui/templates/paefchen/list_builds.tpl
+${PLIST.WEBUI}tinderbox/scripts/webui/templates/paefchen/list_failure_reasons.tpl
+${PLIST.WEBUI}tinderbox/scripts/webui/templates/paefchen/list_tinderd_queue.tpl
+${PLIST.WEBUI}tinderbox/scripts/webui/templates/paefchen/messages.inc
+${PLIST.WEBUI}tinderbox/scripts/webui/templates/paefchen/please_login.tpl
+${PLIST.WEBUI}tinderbox/scripts/webui/templates/paefchen/rss.tpl
+${PLIST.WEBUI}tinderbox/scripts/webui/templates/paefchen/tinderstyle.css
+${PLIST.WEBUI}tinderbox/scripts/webui/templates/paefchen/tinderstyle.js
+${PLIST.WEBUI}tinderbox/scripts/webui/templates/paefchen/user_admin.tpl
+${PLIST.WEBUI}tinderbox/scripts/webui/templates/paefchen/user_permissions.tpl
+${PLIST.WEBUI}tinderbox/scripts/webui/templates/paefchen/user_properties.tpl
diff --git a/pkgtools/tinderbox-dragonfly/README b/pkgtools/tinderbox-dragonfly/README
new file mode 100644
index 00000000000..048c8671168
--- /dev/null
+++ b/pkgtools/tinderbox-dragonfly/README
@@ -0,0 +1,29 @@
+=====================
+ DRAGONFLY TINDERBOX
+=====================
+
+Tinderbox requires a database backend. You must choose either PostgreSQL
+and MySQL. Selecting the option will only cause the database to be
+installed on the system if it's not already. The actual schema creation
+must be done manually per the Tinderbox guide.
+
+The FreeBSD version of Tinderbox allows one to choose between CSUP
+(preferred) and CVSUP. The DragonFly version doesn't give you a choice,
+CSUP is used automatically.
+
+The Web Interface makes Tinderbox a whole lot more user-friendly. The
+option causes PHP to be installed. The user is expected to install the web
+server of his choice as a separate exercise and configure it to serve the
+directory ${PREFIX}/tinderbox/scripts/webui (usually
+/usr/pkg/tinderbox/scripts/webui).
+
+The default configuration of Tinderbox limits execution to the root user.
+Setting the "anybody" option to true will remove this restriction.
+
+Setting the "lsof" option will install the "LiSt Open Files" package
+(sysutils/lsof) to gain access to the killMountProcesses functionality when
+nullfs is used. Nullfs is the default; the user will have to configure NFS
+manually if that is preferred for chroots.
+
+NOTE: The lsof package is currently broken on DragonFly, so this option has
+ been removed from the default list until further notice.
diff --git a/pkgtools/tinderbox-dragonfly/distinfo b/pkgtools/tinderbox-dragonfly/distinfo
new file mode 100644
index 00000000000..935277a158b
--- /dev/null
+++ b/pkgtools/tinderbox-dragonfly/distinfo
@@ -0,0 +1,33 @@
+$NetBSD: distinfo,v 1.1 2011/11/02 21:13:17 marino Exp $
+
+SHA1 (tinderbox-3.4.tar.gz) = bcabfc7544945b9e832fa573fd13a48005e2a598
+RMD160 (tinderbox-3.4.tar.gz) = 4783292e3d89f9ded643d57c1f0055b5fc53e3a9
+Size (tinderbox-3.4.tar.gz) = 147218 bytes
+SHA1 (patch-aa) = 2366cdbe2d7348100d667d2ae931b18691b7adb1
+SHA1 (patch-ab) = bead83362c0dbba1b71d11a076efb439fe3ac545
+SHA1 (patch-ac) = 7f62eacc4bea13a4fa36f6d84dab8750ca842366
+SHA1 (patch-ad) = 12c92ac0aeaf04260151d2e9e305cb6594cc3107
+SHA1 (patch-ae) = 57443a64d043d6549f19c99b431ea45ad29ba41e
+SHA1 (patch-ag) = 9f83f30fab9efe424c197d3f9fe8d7b3c3b924bc
+SHA1 (patch-ai) = 471bdd94cba0596e641b24d8804c398e11b5cfae
+SHA1 (patch-aj) = 32700b042db1de7b383cf63cae104079189f7168
+SHA1 (patch-ak) = af511026851a0faa893d461c4de44895d0d04410
+SHA1 (patch-al) = 0418a6aacc1ce7071a859bf69e8a29e47b64e197
+SHA1 (patch-am) = 26c9b09e99254d6d12e907876e191822ec3354f2
+SHA1 (patch-an) = f91e604e1487f99374fc3119475ab775cf8257de
+SHA1 (patch-ao) = b8635fa0fb158855a1f20d29f9251e045e2b9357
+SHA1 (patch-ap) = 6dc77ea10efb8bdf26f4fc2330f89b70cba8aaab
+SHA1 (patch-aq) = 7cc9e2f723d192038d196da94fdfd8c569559458
+SHA1 (patch-ar) = 180883fba82d0b63e8d14b8922a67b1c09fa77f9
+SHA1 (patch-as) = 4a00ba9699ba47ec664fcadc3876ae7b8c75f05f
+SHA1 (patch-at) = f46d54fab4f94e0b6778d26ac84ce933f734c6d5
+SHA1 (patch-au) = 27e654af19184d3a5a9028442b80556417bd45c8
+SHA1 (patch-av) = d7ea402be9159a2763a15a05cbcd5789332e0a81
+SHA1 (patch-aw) = a7b10a8e9587469dfd21169c1bc37096a5424e35
+SHA1 (patch-ax) = 72b88ffe0d48e39d04ef5fc7e0adc3b00bc12446
+SHA1 (patch-ay) = cf3d2bb09746f9d88e243d488411a394534d85d1
+SHA1 (patch-az) = 91526a66f47d53357703b2739c1384d4012e7c6c
+SHA1 (patch-ba) = 636adea0d3fb22132e2a6d81fd016a9560017aca
+SHA1 (patch-bb) = 7a007428deeea2f243cebcc84a42e0c5fbebc9a7
+SHA1 (patch-bc) = 4d85687520e2c0d3bd6ab03c4ba9dc3f6ad6c98c
+SHA1 (patch-be) = f5e0e9a00de8d1f8b16d36f7cbe23ecc3daee47d
diff --git a/pkgtools/tinderbox-dragonfly/files/tinderd.sh b/pkgtools/tinderbox-dragonfly/files/tinderd.sh
new file mode 100644
index 00000000000..2261d23554c
--- /dev/null
+++ b/pkgtools/tinderbox-dragonfly/files/tinderd.sh
@@ -0,0 +1,41 @@
+#!/bin/sh
+#
+# $MCom: portstools/tinderbox/etc/rc.d/tinderd,v 1.7.2.2 2011/05/23 15:05:31 marcus Exp $
+#
+
+# PROVIDE: tinderd
+# REQUIRE: LOGIN mysqld pgsql
+# KEYWORD: shutdown
+
+# Add the following line to /etc/rc.conf to enable `tinderd':
+#
+#tinderd_enable="YES"
+#
+
+. /etc/rc.subr
+
+name="tinderd"
+rcvar=`set_rcvar`
+
+# read settings, set default values
+load_rc_config "${name}"
+: ${tinderd_enable="NO"}
+: ${tinderd_directory="/usr/pkg/tinderbox/scripts"}
+: ${tinderd_flags=""}
+: ${tinderd_debug="NO"}
+
+# path to your executable, might be libexec, bin, sbin, ...
+command="${tinderd_directory}/tinderd"
+
+# needed when your daemon is a shell script
+command_interpreter="/bin/sh"
+
+# extra required arguments
+if checkyesno tinderd_debug
+then
+ command_args=" &"
+else
+ command_args=">/dev/null 2>&1 &"
+fi
+
+run_rc_command "$1"
diff --git a/pkgtools/tinderbox-dragonfly/options.mk b/pkgtools/tinderbox-dragonfly/options.mk
new file mode 100644
index 00000000000..1a0cfd6367c
--- /dev/null
+++ b/pkgtools/tinderbox-dragonfly/options.mk
@@ -0,0 +1,63 @@
+# $NetBSD: options.mk,v 1.1 2011/11/02 21:13:17 marino Exp $
+
+PKG_OPTIONS_VAR= PKG_OPTIONS.tbox-dfly
+PKG_SUPPORTED_OPTIONS= pgsql mysql webui anybody lsof emailer
+PKG_SUGGESTED_OPTIONS= pgsql webui
+PLIST_VARS+= WEBUI
+
+.include "../../mk/bsd.options.mk"
+
+########################################
+# WEB INTERFACE AND DATABASE OPTIONS #
+########################################
+
+.if empty(PKG_OPTIONS:Mpgsql) && empty(PKG_OPTIONS:Mmysql)
+PKG_FAIL_REASON+= "Tinderbox requires a database or confirmation you have already installed on."
+PKG_FAIL_REASON+= "Please select either pgsql or mysql"
+.endif
+
+.if !empty(PKG_OPTIONS:Mpgsql)
+.include "../../mk/pgsql.buildlink3.mk"
+.endif
+
+.if !empty(PKG_OPTIONS:Mmysql)
+.include "../../mk/mysql.buildlink3.mk"
+.endif
+
+.if !empty(PKG_OPTIONS:Mwebui)
+PLIST.WEBUI= yes
+.include "../../lang/php/phpversion.mk"
+.endif
+
+.if !empty(PKG_OPTIONS:Mpgsql)
+DEPENDS+= p5-DBD-postgresql>=2.12:../../databases/p5-DBD-postgresql
+.if !empty(PKG_OPTIONS:Mwebui)
+DEPENDS+= ${PHP_PKG_PREFIX}-pear-MDB2_Driver_pgsql:../../databases/pear-MDB2_Driver_pgsql
+DEPENDS+= ${PHP_PKG_PREFIX}-pgsql>=5.1:../../databases/php-pgsql
+.endif
+.endif
+
+.if !empty(PKG_OPTIONS:Mmysql)
+DEPENDS+= p5-DBD-mysql>=4:../../databases/p5-DBD-mysql
+.if !empty(PKG_OPTIONS:Mwebui)
+DEPENDS+= ${PHP_PKG_PREFIX}-pear-MDB2_Driver_mysql>1.5:../../databases/pear-MDB2_Driver_mysql
+DEPENDS+= ${PHP_PKG_PREFIX}-mysql>=5.1:../../databases/php-mysql
+.endif
+.endif
+
+#####################
+# LIST OPEN FILES #
+#####################
+
+.if !empty(PKG_OPTIONS:Mlsof)
+DEPENDS+= lsof>=4.83:../../sysutils/lsof
+PKG_FAIL_REASON+= "LSOF package is broken for DragonFly, remove the option for now."
+.endif
+
+#########################
+# EMAIL NOTIFICATIONS #
+#########################
+
+.if !empty(PKG_OPTIONS:Memailer)
+DEPENDS+= p5-Net>=1.21:../../net/p5-Net
+.endif
diff --git a/pkgtools/tinderbox-dragonfly/patches/patch-aa b/pkgtools/tinderbox-dragonfly/patches/patch-aa
new file mode 100644
index 00000000000..48ee47201ba
--- /dev/null
+++ b/pkgtools/tinderbox-dragonfly/patches/patch-aa
@@ -0,0 +1,901 @@
+$NetBSD: patch-aa,v 1.1 2011/11/02 21:13:20 marino Exp $
+
+--- ../FreeBSD/lib/tc_command.sh 2011-10-16 00:52:55.000000000 +0000
++++ lib/tc_command.sh
+@@ -27,21 +27,46 @@
+ # $MCom: portstools/tinderbox/lib/tc_command.sh,v 1.101.2.45 2011/10/17 01:01:23 marcus Exp $
+ #
+
+-export _defaultUpdateHost="cvsup18.FreeBSD.org"
++export _defaultUpdateHost="cvsup.netbsd.se"
+ export _defaultUpdateType="CSUP"
++export _defaultDragonHost="http://mirror.physik-pool.tu-berlin.de/DragonFlyBSD/dflysnap"
++export _defaultDragonType="RELEASE"
++export _defaultGitSrcHost="koan.bondconsult.net"
+
+ #---------------------------------------------------------------------------
+ # Generic routines
+ #---------------------------------------------------------------------------
++commandTreeChecks () {
++ JT_updateCmd=${1}
++ JT_name=${2}
++ JT_mechanism=${3}
++
++ if [ ! -x "${JT_updateCmd}" ]; then
++ echo "ERROR: ${JT_name} ${JT_mechanism}: ${JT_updateCmd} missing"
++ return 1
++ fi
++
++ if [ -d ${treeDir} ]; then
++ echo "${JT_name}: cleaning out old directories"
++ cleanDirs ${JT_name} ${treeDir}
++ fi
++
++ if [ ! -d ${treeDir} ]; then
++ echo "${JT_name}: creating top-level directory"
++ mkdir -p ${treeDir} >/dev/null 2>&1
++ fi
++ return 0
++}
++
+ generateUpdateCode () {
+ case ${1} in
+
+ "jail") treeDir=$(tinderLoc jail ${2})
+- updateCollection="src-all"
++ updateCollection="not-applicable"
+ ;;
+
+ "portstree") treeDir=$(tinderLoc portstree ${2})
+- updateCollection="ports-all"
++ updateCollection="netbsd-pkgsrc"
+ ;;
+
+ *) echo "ERROR: ${1} ${2}: unknown tree type"
+@@ -64,84 +89,89 @@ generateUpdateCode () {
+ fi
+ ;;
+
+- "LFTP")
+- if [ -z "${5}" -o "${5}" = "UNUSED" ]; then
+- echo "ERROR: ${1} ${2}: no tag specified for ${3}"
++ "RELEASE") # ONLY USED FOR DRAGONFLY ISO RETRIEVAL (JAILS)
++ updateArch=$(uname -p)
++ if [ -z "${5}" -o "${5}" = "UNUSED" ]; then
++ echo "ERROR: ${1} ${2}: no release number specified for ${3} (e.g. 2.10.1)"
+ exit 1
+ fi
+
+- updateArch="${7}"
+- if [ -z "${updateArch}" ]; then
+- updateArch=$(uname -p)
+- fi
++ updateCmd=/usr/bin/fetch
++ iso_image="dfly-${updateArch}-${5}_REL.iso.bz2"
++ iso_server=${4}
+
+- updateCmd="/usr/local/bin/lftp"
+-
+- if [ ! -x "${updateCmd}" ]; then
+- echo "ERROR: ${2} ${3}: ${updateCmd} missing"
++ commandTreeChecks ${updateCmd} ${2} ${3}
++ if [ "$?" -eq "1" ]; then
+ exit 1
+ fi
+
+- if [ -d ${treeDir} ]; then
+- echo "${2}: cleaning out old directories"
+- cleanDirs ${2} ${treeDir}
+- fi
+- if [ ! -d ${treeDir} ]; then
+- echo "${2}: creating top-level directory"
+- mkdir -p ${treeDir} >/dev/null 2>&1
+- fi
+-
+ ( echo "#!/bin/sh"
++ echo "if [ -d ${treeDir}/obj ]; then"
++ echo " echo Jail ${2} cannot be updated!"
++ echo " echo It was created from an official release ISO"
++ echo " exit 1"
++ echo "fi"
+ echo "mkdir -p ${treeDir}/sets"
+ echo "cd ${treeDir}/sets"
+- echo "${updateCmd} -c \"open ftp://${4}/pub/FreeBSD/releases/${updateArch}/${5}/; mirror base\""
+- echo "${updateCmd} -c \"open ftp://${4}/pub/FreeBSD/releases/${updateArch}/${5}/; mirror dict\""
+- if [ "${updateArch}" = "amd64" ]; then
+- echo "${updateCmd} -c \"open ftp://${4}/pub/FreeBSD/releases/${updateArch}/${5}/; mirror lib32\""
+- fi
+- echo "${updateCmd} -c \"open ftp://${4}/pub/FreeBSD/releases/${updateArch}/${5}/; mirror proflibs\""
+- echo "${updateCmd} -c \"open ftp://${4}/pub/FreeBSD/releases/${updateArch}/${5}/; mirror src\""
+- echo "cd src"
+- echo "sed -i \"\" 's|usr/src|src|' install.sh"
+- echo "export DESTDIR=${treeDir}"
+- echo "mkdir ${treeDir}/src"
+- echo "yes | sh ./install.sh all"
++ echo "echo \"SERVER: ${iso_server}/iso-images\""
++ echo "echo \" IMAGE: ${iso_image}\""
++ echo "${updateCmd} ${iso_server}/iso-images/${iso_image}"
++ echo "mkdir -p ../tmp ../obj"
++ echo "echo \"Initial physical jail setup complete.\""
+ ) > ${treeDir}/update.sh
+ chmod +x ${treeDir}/update.sh
+ ;;
+
+- "CVSUP"|"CSUP")
+- if [ -z "${5}" -o "${5}" = "UNUSED" ]; then
+- echo "ERROR: ${1} ${2}: no tag specified for ${3}"
+- exit 1
+- fi
+-
+- updateCmd=""
+- if [ "${3}" = "CVSUP" ]; then
+- updateCmd="/usr/local/bin/cvsup"
+- elif [ "${3}" = "CSUP" ]; then
+- if [ -x /usr/bin/csup ]; then
+- updateCmd="/usr/bin/csup"
++ "SNAPSHOT") # ONLY USED FOR DRAGONFLY SNAPSHOT RETRIEVAL (JAILS)
++ updateArch=$(uname -p)
++ if [ "${5}" = "LATEST" ]; then
++ iso_image="DragonFly-${updateArch}-LATEST-ISO.iso.bz2"
++ else
++ namechk=`echo ${5} | awk '/^20[12][0-9][01][0-9][0-3][0-9]-DEV-v[2-9]\.[0-9][0-9]?\.[0-9]\.[0-9][0-9]?[0-9]?[0-9]?\.g[0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f]?$/'`
++ if [ -n "${namechk}" ]; then
++ iso_image="images/DragonFly-${updateArch}-${5}.iso.bz2"
+ else
+- updateCmd="/usr/local/bin/csup"
++ echo "ERROR: ${1} ${2}: tag for ${3} must either equal 'LATEST' or "
++ echo "it must be in the format YYYYMMDD-DEV-va.b.c.d.gxxxxxx"
++ exit 1
+ fi
+ fi
+- if [ -z "${updateCmd}" ]; then
+- echo "ERROR: ${2}: unable to determine updateCmd for ${3}"
++
++ updateCmd=/usr/bin/fetch
++ iso_server=${4}
++
++ commandTreeChecks ${updateCmd} ${2} ${3}
++ if [ "$?" -eq "1" ]; then
+ exit 1
+ fi
+- if [ ! -x "${updateCmd}" ]; then
+- echo "ERROR: ${2} ${3}: ${updateCmd} missing"
++
++ ( echo "#!/bin/sh"
++ echo "if [ -d ${treeDir}/obj ]; then"
++ echo " echo Jail ${2} cannot be updated!"
++ echo " echo It was created from a daily snapshot ISO"
++ echo " exit 1"
++ echo "fi"
++ echo "mkdir -p ${treeDir}/sets"
++ echo "cd ${treeDir}/sets"
++ echo "echo \"SERVER: ${iso_server}/snapshots/${updateArch}\""
++ echo "echo \" IMAGE: ${iso_image}\""
++ echo "${updateCmd} ${iso_server}/snapshots/${updateArch}/${iso_image}"
++ echo "mkdir -p ../tmp ../obj"
++ echo "echo \"Initial physical jail setup complete.\""
++ ) > ${treeDir}/update.sh
++ chmod +x ${treeDir}/update.sh
++ ;;
++
++ "CSUP") # ONLY USED FOR PKGSRC UPDATES FROM NETBSD (PORTSTREES)
++ if [ -z "${5}" -o "${5}" = "UNUSED" ]; then
++ echo "ERROR: ${1} ${2}: no tag specified for ${3}"
+ exit 1
+ fi
+
+- if [ -d ${treeDir} ]; then
+- echo "${2}: cleaning out old directories"
+- cleanDirs ${2} ${treeDir}
+- fi
+- if [ ! -d ${treeDir} ]; then
+- echo "${2}: creating top-level directory"
+- mkdir -p ${treeDir} >/dev/null 2>&1
++ updateCmd=/usr/pkg/bin/csup
++ commandTreeChecks ${updateCmd} ${2} ${3}
++ if [ "$?" -eq "1" ]; then
++ exit 1
+ fi
+
+ ( echo "*default host=${4}"
+@@ -160,6 +190,45 @@ generateUpdateCode () {
+ chmod +x ${treeDir}/update.sh
+ ;;
+
++ "GIT") # ONLY USED FOR RETREIVING DRAGONFLY SOURCE FOR BUILDING JAIL
++ if [ -z "${5}" -o "${5}" = "UNUSED" ]; then
++ echo "ERROR: ${1} ${2}: no git branch specified for ${3}"
++ exit 1
++ fi
++
++ updateCmd=/usr/pkg/bin/git
++ commandTreeChecks ${updateCmd} ${2} ${3}
++ if [ "$?" -eq "1" ]; then
++ exit 1
++ fi
++
++ ( echo "#!/bin/sh"
++ echo "echo 'SERVER: ${4}'"
++ echo "echo 'BRANCH: ${5}'"
++ echo "if [ -d ${treeDir}/src ]; then"
++ echo " cd ${treeDir}/src"
++ echo "else"
++ echo " echo 'Creating shallow source repository.'"
++ echo " mkdir ${treeDir}/src"
++ echo " cd ${treeDir}/src"
++ echo " mkdir ../tmp ../obj"
++ echo " ${updateCmd} init"
++ echo " ${updateCmd} remote add origin git://${4}/dragonfly.git"
++ echo " ${updateCmd} fetch --depth=1 origin"
++ echo " ${updateCmd} branch master origin/master"
++ echo " echo 'Repository creation complete.'"
++ echo "fi"
++ echo "BRANCH=\`${updateCmd} branch | /usr/bin/grep -w ${5}\`"
++ echo "if [ \"\${BRANCH}\" = \"\" ]; then"
++ echo " ${updateCmd} branch ${5} origin/${5}"
++ echo "fi"
++ echo "echo 'Ready to pull updates from branch.'"
++ echo "${updateCmd} checkout ${5}"
++ echo "${updateCmd} pull"
++ ) > ${treeDir}/update.sh
++ chmod +x ${treeDir}/update.sh
++ ;;
++
+ *) echo "ERROR: ${1} ${2}: unknown update type: ${3}"
+ exit 1;;
+
+@@ -177,6 +246,15 @@ setupDefaults () {
+ if [ -z "${defaultUpdateType}" ]; then
+ export defaultUpdateType=${_defaultUpdateType}
+ fi
++ if [ -z "${defaultDragonHost}" ]; then
++ export defaultDragonHost=${_defaultDragonHost}
++ fi
++ if [ -z "${defaultDragonfType}" ]; then
++ export defaultDragonType=${_defaultDragonType}
++ fi
++ if [ -z "${defaultGitSrcHost}" ]; then
++ export defaultGitSrcHost=${_defaultGitSrcHost}
++ fi
+ }
+
+ tcExists () {
+@@ -211,16 +289,21 @@ updateTree () {
+
+ echo "${name}: updating ${what} with ${updateCmd}"
+
++ logpipe=/tmp/tbox_logpipe
++ mkfifo ${logpipe}
++ tee ${dir}/update.log < ${logpipe} &
+ if [ "${updateCmd}" = "USER" ]; then
+- eval ${dir}/update.sh ${name} > ${dir}/update.log 2>&1
++ ${dir}/update.sh ${name} > ${logpipe}
+ else
+- eval ${dir}/update.sh > ${dir}/update.log 2>&1
++ ${dir}/update.sh > ${logpipe}
+ fi
+ if [ $? -ne 0 ]; then
++ rm ${logpipe}
+ echo "updateTree: ${what} ${name}: update failed"
+ echo " see ${dir}/update.log for more details"
+ return 1
+ fi
++ rm ${logpipe}
+ }
+
+ #---------------------------------------------------------------------------
+@@ -228,8 +311,8 @@ updateTree () {
+ #---------------------------------------------------------------------------
+
+ Setup () {
+- MAN_PREREQS="lang/perl5.[81]*"
+- OPT_PREREQS="lang/php[45] databases/pear-MDB2 www/php[45]-session archivers/p5-Compress-Bzip2"
++ MAN_PREREQS="perl"
++ OPT_PREREQS="php php*-pear-MDB2 p5-Compress-Bzip2"
+ PREF_FILES="tinderbox.ph"
+ README="$(tinderLoc scripts README)"
+ TINDERBOX_URL="http://tinderbox.marcuscom.com/"
+@@ -509,7 +592,7 @@ Upgrade () {
+ for jail in ${jails}; do
+ f=$(tinderLoc jail ${jail})
+ ucmd=$(${tc} getUpdateCmd -j ${jail} 2>/dev/null)
+- if [ x"${ucmd}" != x"CVSUP" -a x"${ucmd}" != x"CSUP" -a x"${ucmd}" != x"NONE" ]; then
++ if [ x"${ucmd}" != x"CSUP" -a x"${ucmd}" != x"NONE" ]; then
+ if [ -f "${ucmd}" ]; then
+ mv -f "${ucmd}" "${f}/update.sh"
+ chmod +x "${f}/update.sh"
+@@ -524,11 +607,8 @@ Upgrade () {
+ tinderEcho "WARN: You must manually set the update command for ${jail} to \"USER\" using the query ${query}."
+ fi
+ fi
+- elif [ x"${ucmd}" = x"CVSUP" -o x"${ucmd}" = x"CSUP" ]; then
+- updateCmd="/usr/bin/csup"
+- if [ x"${ucmd}" = x"CVSUP" ]; then
+- updateCmd="/usr/local/bin/cvsup"
+- fi
++ elif [ x"${ucmd}" = x"CSUP" ]; then
++ updateCmd="/usr/pkg/bin/csup"
+ ( echo "#!/bin/sh"
+ echo "${updateCmd} ${f}/supfile"
+ ) > ${f}/update.sh
+@@ -542,7 +622,7 @@ Upgrade () {
+ for portstree in ${portstrees}; do
+ f=$(tinderLoc portstree ${portstree})
+ ucmd=$(${tc} getUpdateCmd -p ${portstree} 2>/dev/null)
+- if [ x"${ucmd}" != x"CVSUP" -a x"${ucmd}" != x"CSUP" -a x"${ucmd}" != x"NONE" ]; then
++ if [ x"${ucmd}" != x"CSUP" -a x"${ucmd}" != x"NONE" ]; then
+ if [ -f "${ucmd}" ]; then
+ mv -f "${ucmd}" "${f}/update.sh"
+ chmod +x "${f}/update.sh"
+@@ -557,17 +637,14 @@ Upgrade () {
+ tinderEcho "WARN: You must manually set the update command for ${portstree} to \"USER\" using the query ${query}."
+ fi
+ fi
+- elif [ x"${ucmd}" = x"CVSUP" -o x"${ucmd}" = "CSUP" ]; then
+- updateCmd="/usr/bin/csup"
+- if [ x"${ucmd}" = x"CVSUP" ]; then
+- updateCmd="/usr/local/bin/cvsup"
+- fi
++ elif [ x"${ucmd}" = "CSUP" ]; then
++ updateCmd="/usr/pkg/bin/csup"
+ ( echo "#!/bin/sh"
+ echo "${updateCmd} ${f}/supfile"
+ ) > ${f}/update.sh
+ chmod +x ${f}/update.sh
+- if [ -f "${f}/ports-supfile" ]; then
+- mv -f "${f}/ports-supfile" "${f}/supfile"
++ if [ -f "${f}/pkgsrc-supfile" ]; then
++ mv -f "${f}/pkgsrc-supfile" "${f}/supfile"
+ fi
+ fi
+ done
+@@ -741,38 +818,55 @@ buildJail () {
+ return 1
+ fi
+
+- if [ "${updateCmd}" = "LFTP" ]; then
+- export DESTDIR=${J_TMPDIR}
+- cd ${jailBase}/sets/base && yes | sh ./install.sh > ${jailBase}/world.tmp 2>&1
++ if [ "${updateCmd}" = "RELEASE" -o "${updateCmd}" = "SNAPSHOT" ]; then
++ iso_image=`ls ${jailBase}/sets`
++ /usr/bin/tar -xf ${jailBase}/sets/${iso_image} -C ${J_TMPDIR} > ${jailBase}/world.tmp 2>&1
+ rc=$?
+- if [ ${rc} -eq 0 -a -d "${jailBase}/sets/lib32" ]; then
+- cd ${jailBase}/sets/lib32 && yes | sh ./install.sh >> ${jailBase}/world.tmp 2>&1
+- rc=$?
++ if [ ${rc} -ne 0 ]; then
++ echo "ERROR: extract world failed - see ${jailBase}/world.tmp"
++ buildJailCleanup 1 ${jailName} ${J_SRCDIR}
++ return 1
+ fi
++ DFVERS=`awk '/^#define __DragonFly_version/ {print $3}' < ${J_TMPDIR}/usr/include/sys/param.h`
++ MAJOR=`echo $DFVERS | awk '{print substr($0,1,1)}'`
++ MINOR=`echo $DFVERS | awk '{print substr($0,2,3)}' | sed 's/0*//'`
++ if [ `expr $MINOR % 2` -eq 0 ]; then
++ fakebranch="BRANCH=\"RELEASE_${MAJOR}_${MINOR}\""
++ else
++ fakebranch="BRANCH=\"DEVELOPMENT_${MAJOR}_${MINOR}\""
++ fi
++ mkdir -p ${jailBase}/src/sys/sys ${jailBase}/src/sys/conf
++ echo ${fakebranch} > ${jailBase}/src/sys/conf/newvers.sh
++ cp ${J_TMPDIR}/usr/include/sys/param.h ${jailBase}/src/sys/sys
++ rm -rf ${J_TMPDIR}/usr/src
++ cp -R ${jailBase}/src ${J_TMPDIR}/usr
++ mkdir ${J_TMPDIR}/usr/4bootstrap
++ mv ${J_TMPDIR}/usr/pkg/bin/bmake ${J_TMPDIR}/usr/4bootstrap
++ mv ${J_TMPDIR}/usr/pkg/etc/mk.conf ${J_TMPDIR}/usr/4bootstrap
++ mv ${J_TMPDIR}/usr/pkg/share/mk ${J_TMPDIR}/usr/4bootstrap
++ mv ${J_TMPDIR}/usr/pkg/sbin/pkg_* ${J_TMPDIR}/usr/4bootstrap
++ rm -rf ${J_TMPDIR}/usr/pkg ${J_TMPDIR}/usr/src-sys.tar.bz2
++ rm -rf ${J_TMPDIR}/var/db/pkg
+ execute_hook "postJailBuild" "JAIL=${jailName} DESTDIR=${J_TMPDIR} JAIL_ARCH=${jailArch} MY_ARCH=${myArch} JAIL_OBJDIR=${JAIL_OBJDIR} SRCBASE=${SRCBASE} PB=${pb} RC=${rc}"
+- if [ ${rc} -ne 0 ]; then
+- echo "ERROR: world failed - see ${jailBase}/world.tmp"
++ if [ $? -ne 0 ]; then
++ echo "buildJail: Terminating Jail build since hook postJailBuild failed."
+ buildJailCleanup 1 ${jailName} ${J_SRCDIR}
++ return 1
+ fi
+ else
+ # Make world
+ echo "${jailName}: making world"
+
+- # determine if we're cross-building world
+- crossEnv=""
+- if [ "${jailArch}" != "${myArch}" ]; then
+- crossEnv="TARGET_ARCH=${jailArch}"
+- fi
+-
+ ncpus=$(/sbin/sysctl hw.ncpu | awk '{print $2}')
+- factor=$(echo "$ncpus*2+1" | /usr/bin/bc -q)
++ factor=$(echo "$ncpus*2+1" | /usr/bin/bc)
+
+ if [ -n "${NO_JAIL_JOBS}" ]; then
+ factor=1
+ fi
+
+- cd ${SRCBASE} && env DESTDIR=${J_TMPDIR} ${crossEnv} \
+- make -j${factor} -DNO_CLEAN world > ${jailBase}/world.tmp 2>&1
++ cd ${SRCBASE} && env DESTDIR=${J_TMPDIR} \
++ make -DNO_GCC41 -DNO_GAMES -DNOPROFILE -j${factor} world \
++ > ${jailBase}/world.tmp 2>&1
+ rc=$?
+ execute_hook "postJailBuild" "JAIL=${jailName} DESTDIR=${J_TMPDIR} JAIL_ARCH=${jailArch} MY_ARCH=${myArch} JAIL_OBJDIR=${JAIL_OBJDIR} SRCBASE=${SRCBASE} PB=${pb} RC=${rc}"
+ if [ ${rc} -ne 0 ]; then
+@@ -783,21 +877,80 @@ buildJail () {
+ # Make a complete distribution
+ echo "${jailName}: making distribution"
+
+- # determine if we're cross-building world
+- crossEnv=""
+- if [ "${jailArch}" != "${myArch}" ]; then
+- crossEnv="TARGET_ARCH=${jailArch} MACHINE_ARCH=${jailArch} MAKEOBJDIRPREFIX=${J_OBJDIR}/${jailArch} MACHINE=${jailArch}"
+- fi
+- cd ${SRCBASE}/etc && env DESTDIR=${J_TMPDIR} ${crossEnv} \
++ cd ${SRCBASE}/etc && env DESTDIR=${J_TMPDIR} \
+ make -m ${J_TMPDIR}/usr/share/mk distribution > ${jailBase}/distribution.tmp 2>&1
+ if [ $? -ne 0 ]; then
+ echo "ERROR: distribution failed - see ${jailBase}/distribution.tmp"
+ buildJailCleanup 1 ${jailName} ${J_SRCDIR}
++ return 1
+ fi
++
++ # Bootstrap pkgsrc tools using host machine's pkgsrc for source files
++ echo "${jailName}: bootstrapping pkgsrc basic tools"
++
++ CYCLE="devel/bmake \
++ sysutils/install-sh \
++ pkgtools/bootstrap-mk-files \
++ pkgtools/libnbcompat \
++ pkgtools/pkg_install \
++ archivers/bzip2 \
++ archivers/libarchive \
++ security/openssl \
++ net/libfetch \
++ devel/zlib \
++ bootstrap \
++ mk"
++
++ PBS=/usr/pkgsrcbs
++ WKZONE=${J_TMPDIR}${PBS}
++ mkdir ${WKZONE}
++ for component in ${CYCLE}; do
++ mkdir -p ${WKZONE}/${component}
++ dossiers=`ls -A /usr/pkgsrc/${component} | grep -vE '^(README|work$)'`
++ for dossier in ${dossiers}; do
++ cp -R /usr/pkgsrc/${component}/${dossier} ${WKZONE}/${component}
++ done
++ done
++
++ mount_devfs ${J_TMPDIR}/dev
++ chroot ${J_TMPDIR} ${PBS}/bootstrap/bootstrap --prefix=/usr/pkg \
++ --workdir=${PBS}/work > ${jailBase}/pkgsrc.tmp 2>&1
++
++ if [ $? -ne 0 ]; then
++ umount ${J_TMPDIR}/dev
++ echo "ERROR: pkgsrc bootstrap failed - see ${jailBase}/pkgsrc.tmp"
++ buildJailCleanup 1 ${jailName} ${J_SRCDIR}
++ return 1
++ fi
++ umount ${J_TMPDIR}/dev
++
++ mkdir ${J_TMPDIR}/usr/4bootstrap
++
++ # Create appropriate mk.conf, same as ISO version
++ ( echo ".ifdef BSD_PKG_MK # begin pkgsrc settings"
++ echo "PKG_DBDIR= /var/db/pkg"
++ echo "LOCALBASE= /usr/pkg"
++ echo "VARBASE= /var"
++ echo "PKG_TOOLS_BIN= /usr/pkg/sbin"
++ echo "PKGMANDIR= man"
++ echo "FETCH_CMD= /usr/bin/ftp"
++ echo ".endif # end pkgsrc settings"
++ ) > ${J_TMPDIR}/usr/4bootstrap/mk.conf
++
++ mv ${J_TMPDIR}/usr/pkg/bin/bmake ${J_TMPDIR}/usr/4bootstrap
++ mv ${J_TMPDIR}/usr/pkg/share/mk ${J_TMPDIR}/usr/4bootstrap
++ mv ${J_TMPDIR}/usr/pkg/sbin/pkg_* ${J_TMPDIR}/usr/4bootstrap
++ rm -rf ${J_TMPDIR}/usr/pkg ${J_TMPDIR}/var/db/pkg ${WKZONE}
++
++ execute_hook "postJailBuild" "JAIL=${jailName} DESTDIR=${J_TMPDIR} JAIL_ARCH=${jailArch} MY_ARCH=${myArch} JAIL_OBJDIR=${JAIL_OBJDIR} SRCBASE=${SRCBASE} PB=${pb} RC=${rc}"
++ if [ $? -ne 0 ]; then
++ echo "buildJail: Terminating Jail build since hook postJailBuild failed."
++ buildJailCleanup 1 ${jailName} ${J_SRCDIR}
++ return 1
++ fi
+ fi
+
+ # Various hacks to keep the ports building environment happy
+- touch -f ${J_TMPDIR}/etc/fstab
+
+ MTREE_DIR=${SRCBASE}/etc/mtree
+ mtree -deU -f ${MTREE_DIR}/BSD.root.dist \
+@@ -809,11 +962,8 @@ buildJail () {
+ mtree -deU -f ${MTREE_DIR}/BSD.local.dist \
+ -p ${J_TMPDIR}/usr/local >/dev/null 2>&1
+
+- date '+%Y%m%d' > ${J_TMPDIR}/var/db/port.mkversion
+ mkdir -p ${J_TMPDIR}/var/run
+
+- rm -f ${J_TMPDIR}/usr/lib/aout/lib*_p.a
+-
+ # Create the jail tarball
+ echo "${jailName}: creating tarball"
+ jailDir=$(tinderLoc jail ${jailName})
+@@ -827,7 +977,7 @@ buildJail () {
+ fi
+
+ # Move new logfiles into place
+- for logfile in world distribution
++ for logfile in world distribution pkgsrc
+ do
+ rm -f ${jailBase}/${logfile}.log
+ mv -f ${jailBase}/${logfile}.tmp ${jailBase}/${logfile}.log 2>/dev/null
+@@ -883,22 +1033,22 @@ createJail () {
+ init=1
+
+ setupDefaults
+- updateHost=${defaultUpdateHost}
+- updateType=${defaultUpdateType}
++ updateHostISO=${defaultDragonHost}
++ updateHostSRC=${defaultGitSrcHost}
++ updateType=${defaultDragonType}
+
+ # argument handling
+- while getopts a:d:j:m:t:u:CH:I arg >/dev/null 2>&1
++ while getopts d:j:m:t:u:H:I arg >/dev/null 2>&1
+ do
+ case "${arg}" in
+
+- a) jailArch="${OPTARG}";;
+ d) descr="${OPTARG}";;
+ j) jailName="${OPTARG}";;
+ m) mountSrc="${OPTARG}";;
+ t) updateTag="${OPTARG}";;
+ u) updateType="${OPTARG}";;
+- C) updateCompress=1;;
+- H) updateHost="${OPTARG}";;
++ H) updateHostISO="${OPTARG}"
++ updateHostSRC="${OPTTAG}";;
+ I) init=0;;
+ ?) return 1;;
+
+@@ -913,7 +1063,7 @@ createJail () {
+
+ valid=$(echo ${jailName} | awk '{if (/^[[:digit:]]/) {print;}}')
+ if [ -z "${valid}" ]; then
+- echo "createJail: jail name must begin with a FreeBSD major version"
++ echo "createJail: jail name must begin with a DragonFly BSD major version"
+ return 1
+ fi
+
+@@ -927,6 +1077,17 @@ createJail () {
+ return 1
+ fi
+
++ if [ "${updateType}" = "CSUP" ]; then
++ echo "createJail: CSUP type cannot be used for DragonFly sources"
++ return 1
++ fi
++
++ updateHost=${updateHostISO}
++ if [ "${updateType}" = "GIT" ]; then
++ updateHost=${updateHostSRC}
++ fi
++
++
+ echo "${jailName}: initializing tree"
+ generateUpdateCode jail ${jailName} ${updateType} ${updateHost} \
+ ${updateTag} ${updateCompress} ${jailArch}
+@@ -1040,20 +1201,21 @@ createPortsTree () {
+ init=1
+ mountSrc=""
+ portsTreeName=""
++ cvsTag="."
+
+ setupDefaults
+ updateHost=${defaultUpdateHost}
+ updateType=${defaultUpdateType}
+
+ # argument handling
+- while getopts d:m:p:u:w:CH:I arg >/dev/null 2>&1
++ while getopts d:m:t:p:w:CH:I arg >/dev/null 2>&1
+ do
+ case "${arg}" in
+
+ d) descr="${OPTARG}";;
+ m) mountSrc="${OPTARG}";;
+ p) portsTreeName="${OPTARG}";;
+- u) updateType="${OPTARG}";;
++ t) cvsTag="${OPTARG}";;
+ w) cvswebUrl="${OPTARG}";;
+ C) updateCompress=1;;
+ H) updateHost="${OPTARG}";;
+@@ -1079,9 +1241,15 @@ createPortsTree () {
+ return 1
+ fi
+
++ if [ "${updateType}" != "CSUP" ]; then
++ echo "createPortsTree: The defaultUpdateType variable in env was changed to ${updateType}"
++ echo "Please change it back to 'CSUP', which is the only method supported to get pkgsrc"
++ return 1
++ fi
++
+ echo "${portsTreeName}: initializing tree"
+ generateUpdateCode portstree ${portsTreeName} ${updateType} \
+- ${updateHost} "." ${updateCompress}
++ ${updateHost} ${cvsTag} ${updateCompress}
+
+ # add portstree to datastore
+ echo -n "${portsTreeName}: adding to datastore... "
+@@ -1158,7 +1326,7 @@ enterBuild () {
+ fi
+
+ sleepName=$(echo ${portDir} | sed -e 'y/\//_/')
+- portFullDir=${buildRoot}/usr/ports/${portDir}
++ portFullDir=${buildRoot}/usr/pkgsrc/${portDir}
+
+ if [ ! -d ${portFullDir} ]; then
+ echo "enterBuild: Build environment does not exist yet, sleeping."
+@@ -1182,7 +1350,7 @@ enterBuild () {
+ sleep 15
+ done
+
+- echo 
++ echo
+ cp $(tinderLoc scripts lib/enterbuild) ${buildRoot}/root
+ chroot ${buildRoot} /root/enterbuild ${portDir}
+ rm -f ${buildRoot}/tmp/.sleep_${sleepName}
+@@ -1269,7 +1437,6 @@ makeBuild () {
+ resetBuild () {
+ # set up defaults
+ build=""
+- nullfs=""
+ cleandistfiles="0"
+
+ # argument handling
+@@ -1278,7 +1445,6 @@ resetBuild () {
+ case "${arg}" in
+
+ b) build="${OPTARG}";;
+- n) nullfs="-n";;
+ ?) exit 1;;
+
+ esac
+@@ -1434,22 +1600,23 @@ tinderbuild_setup () {
+ echo "tinderbuild: Finalizing chroot environment"
+
+ # Mount ports/
+- if ! requestMount -t buildports -b ${build} -r ${nullfs}; then
++ if ! requestMount -t buildports -b ${build} -r ; then
+ echo "tinderbuild: cannot mount ports source"
+ tinderbuild_cleanup 1
+ fi
+- ln -sf ../a/ports ${buildRoot}/usr/ports
++ rm -rf ${buildRoot}/usr/pkgsrc
++ ln -s ../a/pkgsrc ${buildRoot}/usr/pkgsrc
+
+ # Mount src/
+- if ! requestMount -t buildsrc -b ${build} -r ${nullfs}; then
++ if ! requestMount -t buildsrc -b ${build} -r ; then
+ echo "tinderbuild: cannot mount jail source"
+ tinderbuild_cleanup 1
+ fi
+
+ # For use by pnohang
+ # XXX: though killall may not work since it's a dynamic executable
+- cp -p /rescue/mount /rescue/umount ${buildRoot}/sbin
+- cp -p /rescue/ps ${buildRoot}/bin
++ cp -p /sbin/mount /sbin/umount ${buildRoot}/sbin
++ cp -p /bin/ps ${buildRoot}/bin
+
+ # Mount /dev, since we're going to be chrooting shortly
+ mount -t devfs devfs ${buildRoot}/dev >/dev/null 2>&1
+@@ -1466,12 +1633,6 @@ tinderbuild_setup () {
+ tinderbuild_cleanup 1
+ fi
+
+- # Hack to fix some recent pkg_add problems in some releases
+- pitar=$(tinderLoc jail ${jail})/pkg_install.tar
+- if [ -f ${pitar} ]; then
+- tar -C ${buildRoot} -xf ${pitar}
+- fi
+-
+ # Handle the distfile cache
+ if [ -n "${DISTFILE_CACHE}" ]; then
+ if ! requestMount -t builddistcache -b ${build} \
+@@ -1501,7 +1662,7 @@ tinderbuild_setup () {
+ mkdir -p ${ccacheDir} $(tinderLoc buildccache ${build})
+
+ if ! requestMount -t buildccache -b ${build} \
+- -s ${ccacheDir} ${nullfs}; then
++ -s ${ccacheDir} ; then
+ echo "tinderbuild: cannot mount ccache"
+ tinderbuild_cleanup 1
+ fi
+@@ -1518,8 +1679,7 @@ tinderbuild_setup () {
+
+ mkdir -p ${optionsDir} $(tinderLoc buildoptions ${build})
+
+- if ! requestMount -t buildoptions -b ${build} \
+- -s ${optionsDir} ${nullfs}; then
++ if ! requestMount -t buildoptions -b ${build} -s ${optionsDir} ; then
+ echo "tinderbuild: cannot mount options"
+ tinderbuild_cleanup 1
+ fi
+@@ -1605,7 +1765,6 @@ tinderbuild () {
+ onceonly=0
+ onlymake=0
+ noduds=""
+- nullfs=""
+ pbargs=""
+ skipmake=0
+ updateports=0
+@@ -1652,7 +1811,6 @@ tinderbuild () {
+ x-fetch-original) pbargs="${pbargs} -fetch-original";;
+ x-noclean) pbargs="${pbargs} -noclean";;
+ x-nolog) pbargs="${pbargs} -nolog";;
+- x-nullfs) pbargs="${pbargs} -nullfs"; nullfs="-n";;
+ x-plistcheck) pbargs="${pbargs} -plistcheck";;
+ x-onceonly) onceonly=1;;
+
+@@ -1780,7 +1938,8 @@ tinderbuild () {
+ echo "tinderbuild: cannot mount portstree: ${portstree}"
+ exit 1
+ fi
+- env PORTSDIR=$(tinderLoc portstree ${portstree})/ports \
++ env PORTSDIR=$(tinderLoc portstree ${portstree})/pkgsrc \
++ OPTNFILE=$(tinderLoc options $build)/pkg_options \
+ $(tinderLoc scripts lib/makemake) ${noduds} ${build} ${ports}
+ )
+ if [ $? -ne 0 ]; then
+@@ -1799,10 +1958,6 @@ tinderbuild () {
+
+ # Set up the chrooted environment
+ osmajor=$(echo ${jail} | sed -E -e 's|(^[[:digit:]]+).*$|\1|')
+- if [ ${osmajor} -lt 6 ]; then
+- echo "tinderbuild: unhandled OS version: ${osmajor}"
+- tinderbuild_cleanup 1
+- fi
+
+ tinderbuild_setup
+
+@@ -1829,21 +1984,46 @@ init () {
+ mkdir -p ${pb}/${dir}
+ done
+
+- read -p "Enter a default cvsup host [${_defaultUpdateHost}]: " host
++ read -p "Enter a default cvsup server for pkgsrc [${_defaultUpdateHost}]: " host
+ if [ -z "${host}" ]; then
+ host=${_defaultUpdateHost}
+ fi
+
+- read -p "Enter a default update type or command [${_defaultUpdateType}]: " type
+- if [ -z "${type}" ]; then
+- type=${_defaultUpdateType}
++ # Update type is not optional, it's CSUP only, so we won't ask.
++
++ defaultDragonType="n"
++ while [ "${defaultDragonType}" != "RELEASE" -a "${defaultDragonType}" != "SNAPSHOT" ]; do
++ read -p "Enter a DragonFly branch type [${_defaultDragonType}]: " defaultDragonType
++ if [ -z "${defaultDragonType}" ]; then
++ defaultDragonType=${_defaultDragonType}
++ fi
++ done
++
++ if [ "${defaultDragonType}" = "RELEASE" ]; then
++ echo "Server format: (http|ftp)://(host)/path_to_iso-images_directory"
++ else
++ echo "Server format: (http|ftp)://(host)/path_to_snapshots_directory"
++ fi
++ read -p "Enter a default ISO server for DragonFly [${_defaultDragonHost}]: " dragonhost
++ if [ -z "${dragonhost}" ]; then
++ dragonhost=${_defaultDragonHost}
+ fi
+
++ read -p "Enter a default Git server for DragonFly [${_defaultGitSrcHost}]: " gitsrchost
++ if [ -z "${gitsrchost}" ]; then
++ gitsrchost=${_defaultGitSrcHost}
++ fi
++
++ # Git Update type for Git is limited to git://, so we won't ask
++
+ globalenv=$(tinderLoc scripts etc/env)/GLOBAL
+ echo "export defaultUpdateHost=${host}" >> ${globalenv}
+- echo "export defaultUpdateType=${type}" >> ${globalenv}
++ echo "export defaultUpdateType=${_defaultUpdateType}" >> ${globalenv}
++ echo "export defaultDragonHost=${dragonhost}" >> ${globalenv}
++ echo "export defaultDragonType=${_defaultDragonType}" >> ${globalenv}
++ echo "export defaultGitSrcHost=${gitsrchost}" >> ${globalenv}
+
+- tinderEcho "Default update host and type have been set. These can be changed later by modifying ${globalenv}."
++ tinderEcho "The defaults have been set. These can be changed later by modifying ${globalenv}."
+
+ return 0
+ }
+@@ -1892,7 +2072,8 @@ addPortToBuild () {
+ buildenv ${jail} ${portsTree} ${build}
+ buildenvNoHost ${build}
+
+- export PORTSDIR=$(tinderLoc portstree ${portsTree})/ports
++ export PORTSDIR=$(tinderLoc portstree ${portsTree})/pkgsrc
++ export OPTNFILE=$(tinderLoc options $build)/pkg_options
+ if [ -z "${portDir}" ]; then
+ ${tc} addPortToOneBuild -b ${build} ${norecurse}
+ else
+@@ -1902,36 +2083,7 @@ addPortToBuild () {
+ fi
+ ${tc} addPortToOneBuild -b ${build} -d ${portDir} ${norecurse}
+ fi
+- if [ ${options} -eq 1 -a ${OPTIONS_ENABLED} -eq 1 ]; then
+- pdirs=""
+- if [ -z "${portDir}" ]; then
+- pdirs=$(${tc} getPortsForBuild -b ${build} 2>/dev/null)
+- else
+- pdirs="${PORTSDIR}/${portDir}"
+- fi
+- rmconfig=true
+- if [ ${cleanOptions} -eq 1 ]; then
+- if [ -z "${norecurse}" ]; then
+- rmconfig="make rmconfig-recursive"
+- else
+- rmconfig="make rmconfig"
+- fi
+- fi
+- for pdir in ${pdirs}; do
+- if [ -d ${pdir} ]; then
+- export TERM=${save_TERM}
+- read -p "Generating options for ${build}; hit Enter to continue..." key
+- echo ""
+- if [ -z "${norecurse}" ]; then
+- ( cd ${pdir} && ${rmconfig} \
+- && make -k config-recursive )
+- else
+- ( cd ${pdir} && ${rmconfig} \
+- && make config )
+- fi
+- fi
+- done
+- fi
++ # FreeBSD-style interactive option entering not supported yet
+
+ if [ -n "${save_SRCBASE}" ]; then
+ export SRCBASE=${save_SRCBASE}
+@@ -2118,10 +2270,7 @@ copyBuild () {
+ if [ ! -d ${destOptionsDir} ]; then
+ mkdir -p ${destOptionsDir}
+ fi
+- (
+- cd ${srcOptionsDir}
+- tar -cpf - . | tar -C ${destOptionsDir} -xpf -
+- )
++ cp ${srcOptionsDir}/pkg_options ${destOptionsDir}
+ else
+ echo "copyBuild: not copying OPTIONS to ${dest} since it has no OPTIONS directory"
+ fi
+@@ -2237,13 +2386,13 @@ tbcleanup () {
+ pathFound=0
+ for portstree in ${portstrees} ; do
+ path=$(tinderLoc portstree ${portstree})
+- path="${path}/ports/${port}/Makefile"
++ path="${path}/pkgsrc/${port}/Makefile"
+ if [ -e ${path} ]; then
+ if [ ${cleanDistfiles} = 1 ]; then
+ oldcwd=${PWD}
+ path=$(tinderLoc portstree ${portstree})
+- cd "${path}/ports/${port}"
+- distinfo=$(env PORTSDIR="${path}/ports" make -V MD5_FILE)
++ cd "${path}/pkgsrc/${port}"
++ distinfo=$(env PORTSDIR="${path}/pkgsrc" bmake -V MD5_FILE)
+ if [ -f "${distinfo}" ]; then
+ for df in $(grep '^MD5' ${distinfo} | awk -F '[\(\)]' '{print $2}'); do
+ if ! grep -q "^${df}\$" ${disttmp}; then
+@@ -2327,7 +2476,7 @@ tbcleanup () {
+ fi
+
+ path=$(tinderLoc portstree ${portstree})
+- path="${path}/ports/${port}/Makefile"
++ path="${path}/pkgsrc/${port}/Makefile"
+
+ if [ ! -e ${path} ]; then
+ echo "Removing build port database entry for nonexistent port ${build}/${port}"
diff --git a/pkgtools/tinderbox-dragonfly/patches/patch-ab b/pkgtools/tinderbox-dragonfly/patches/patch-ab
new file mode 100644
index 00000000000..3bd5ca2aa3e
--- /dev/null
+++ b/pkgtools/tinderbox-dragonfly/patches/patch-ab
@@ -0,0 +1,56 @@
+$NetBSD: patch-ab,v 1.1 2011/11/02 21:13:20 marino Exp $
+
+--- ../FreeBSD/lib/tinderbox.env 2011-10-16 00:52:55.000000000 +0000
++++ lib/tinderbox.env
+@@ -5,36 +5,24 @@
+ #
+ # There are no longer any user-servicable parts in this file
+
+-#6PKGSUFFIX=.tbz
+-#6PKGZIPCMD=bzip2
+-#6INDEXFILE=INDEX-6
+-#6X_WINDOW_SYSTEM=xorg
+-#7PKGSUFFIX=.tbz
+-#7PKGZIPCMD=bzip2
+-#7INDEXFILE=INDEX-7
+-#7X_WINDOW_SYSTEM=xorg
+-#8PKGSUFFIX=.tbz
+-#8PKGZIPCMD=bzip2
+-#8INDEXFILE=INDEX-8
+-#8X_WINDOW_SYSTEM=xorg
+-#9PKGSUFFIX=.tbz
+-#9PKGZIPCMD=bzip2
+-#9INDEXFILE=INDEX-9
+-#9X_WINDOW_SYSTEM=xorg
+-#10PKGSUFFIX=.tbz
+-#10PKGZIPCMD=bzip2
+-#10INDEXFILE=INDEX-10
+-#10X_WINDOW_SYSTEM=xorg
+-#
+-LOCALBASE=/usr/local
+-OSVERSION=`awk '/^#define __FreeBSD_version/ {print $3}' < ^^SRCBASE^^/sys/sys/param.h`
+-OSREL=`awk 'BEGIN {FS="\""}; /^REVISION/ {print $2}' < ^^SRCBASE^^/sys/conf/newvers.sh`
+-BRANCH=`awk 'BEGIN {FS="\""}; /^BRANCH/ {print $2}' < ^^SRCBASE^^/sys/conf/newvers.sh`
++#2PKGSUFFIX=.tgz
++#2PKGZIPCMD=gzip
++#2INDEXFILE=INDEX-2
++#2X_WINDOW_SYSTEM=xorg
++#3PKGSUFFIX=.tgz
++#3PKGZIPCMD=gzip
++#3INDEXFILE=INDEX-3
++#3X_WINDOW_SYSTEM=xorg
++
++LOCALBASE=/usr/pkg
++OSVERSION=`awk '/^#define __DragonFly_version/ {print $3}' < ^^SRCBASE^^/sys/sys/param.h`
++OSREL=`awk 'BEGIN {FS="\""}; /^BRANCH=\"/ {split($2,array,"_"); printf ("%s.%s\n", array[2],array[3])}' < ^^SRCBASE^^/sys/conf/newvers.sh`
++BRANCH=`awk 'BEGIN {FS="\""}; /^BRANCH=\"/ {split($2,array,"_"); print array[1]}' < ^^SRCBASE^^/sys/conf/newvers.sh`
+ ARCH=`uname -p`
+ UNAME_n=tinderbox.host
+ UNAME_r=^^OSREL^^-^^BRANCH^^
+-UNAME_s=FreeBSD
+-UNAME_v="FreeBSD ^^OSREL^^-^^BRANCH^^ #0: `date` root@tinderbox.host:/usr/src/sys/magic/kernel/path"
++UNAME_s=DragonFly
++UNAME_v="DragonFly ^^OSREL^^-^^BRANCH^^ #0: `date` root@tinderbox.host:/usr/src/sys/magic/kernel/path"
+ #
+ BATCH=1
+ PACKAGE_BUILDING=1
diff --git a/pkgtools/tinderbox-dragonfly/patches/patch-ac b/pkgtools/tinderbox-dragonfly/patches/patch-ac
new file mode 100644
index 00000000000..ce009525945
--- /dev/null
+++ b/pkgtools/tinderbox-dragonfly/patches/patch-ac
@@ -0,0 +1,186 @@
+$NetBSD: patch-ac,v 1.1 2011/11/02 21:13:21 marino Exp $
+
+--- ../FreeBSD/lib/tinderlib.sh 2011-10-16 00:52:55.000000000 +0000
++++ lib/tinderlib.sh
+@@ -50,10 +50,10 @@ tinderLoc () {
+ fi
+ ;;
+ "builddata") echo "${pb}/builds/${what}";;
+- "buildports") echo "$(tinderLoc buildroot ${what})/a/ports";;
++ "buildports") echo "$(tinderLoc buildroot ${what})/a/pkgsrc";;
+ "buildsrc") echo "$(tinderLoc buildroot ${what})/usr/src";;
+ "buildccache") echo "$(tinderLoc buildroot ${what})/ccache";;
+- "buildoptions") echo "$(tinderLoc buildroot ${what})/var/db/ports";;
++ "buildoptions") echo "$(tinderLoc buildroot ${what})/var/db/options";;
+ "builddistcache") echo "$(tinderLoc buildroot ${what})/distcache";;
+ "builderrors") echo "${pb}/errors/${what}";;
+ "buildlogs") echo "${pb}/logs/${what}";;
+@@ -197,7 +197,7 @@ cleanupMounts () {
+ echo "cleanupMounts: ${_type}: missing portstree"
+ return 1
+ fi
+- _dstloc=${_dstloc:-$(tinderLoc portstree ${_portstree})/ports}
++ _dstloc=${_dstloc:-$(tinderLoc portstree ${_portstree})/pkgsrc}
+ ;;
+
+ *)
+@@ -227,7 +227,6 @@ requestMount () {
+ _type=""
+ _srcloc=""
+ _dstloc=""
+- _nullfs=0
+ _readonly=0
+ _build=""
+ _jail=""
+@@ -242,7 +241,6 @@ requestMount () {
+ b) _build=${OPTARG};;
+ d) _dstloc=${OPTARG};;
+ j) _jail=${OPTARG};;
+- n) _nullfs=1;;
+ p) _portstree=${OPTARG};;
+ r) _readonly=1;;
+ s) _srcloc=${OPTARG};;
+@@ -267,7 +265,7 @@ requestMount () {
+ if [ -z "${_srcloc}" ] ; then
+ _srcloc=$(${tc} getPortsMount -p ${_portstree})
+ if [ -z "${_srcloc}" ] ; then
+- _srcloc=${_srcloc:=$(tinderLoc portstree ${_portstree})/ports}
++ _srcloc=${_srcloc:=$(tinderLoc portstree ${_portstree})/pkgsrc}
+ else
+ _fqsrcloc=1
+ fi
+@@ -332,7 +330,7 @@ requestMount () {
+ echo "requestMount: ${_type}: missing portstree"
+ return 1
+ fi
+- _dstloc=${_dstloc:-$(tinderLoc portstree ${_portstree})/ports}
++ _dstloc=${_dstloc:-$(tinderLoc portstree ${_portstree})/pkgsrc}
+ _srcloc=${_srcloc:-$(${tc} getPortsMount -p ${_portstree})}
+ _fqsrcloc=1
+ ;;
+@@ -355,64 +353,31 @@ requestMount () {
+ fi
+
+ # is the filesystem already mounted?
+- fsys=$(df ${_dstloc} 2>/dev/null | awk '{a=$1} END {print a}')
+- mtpt=$(df ${_dstloc} 2>/dev/null | awk '{a=$NF} END {print a}')
++ # We can't use df $_dstloc directly because HAMMER returns the
++ # PFS address rather than the source location like UFS does
++ fsys=$(df | grep '^${_dstloc}' | awk '{a=$1} END {print a}')
++ mtpt=$(df | grep '^${_dstloc}' | awk '{a=$NF} END {print a}')
+
+ if [ "${fsys}" = "${_srcloc}" -a "${mtpt}" = "${_dstloc}" ]; then
+ return 0
+ fi
+
+- # is _nullfs mount specified?
+- if [ ${_nullfs} -eq 1 -a ${_fqsrcloc} -ne 1 ] ; then
+- _options="-t nullfs"
+- else
+- # it probably has to be a nfs mount then
+- # lets check what kind of _srcloc we have. If it is allready in
+- # a nfs format, we don't need to adjust anything
+- case ${_srcloc} in
+-
+- [a-zA-Z0-9\.-_]*:/*)
+- _options="-o nfsv3,intr,tcp"
+- ;;
+-
+- *)
+- if [ ${_fqsrcloc} -eq 1 ] ; then
+- # some _srcloc's are full qualified sources, means
+- # don't try to detect sth. or fallback to localhost.
+- # The user wants exactly what he specified as _srcloc
+- # don't modify anything. If it's not a nfs mount, it has
+- # to be a nullfs mount.
+- _options="-t nullfs"
+- else
+- _options="-o nfsv3,intr,tcp"
+-
+- # find out the filesystem the requested source is in
+- fsys=$(df ${_srcloc} | awk '{a=$1} END {print a}')
+- mtpt=$(df ${_srcloc} | awk '{a=$NF} END {print a}')
+- # determine if the filesystem the requested source
+- # is a nfs mount, or a local filesystem
+-
+- case ${fsys} in
+-
+- [a-zA-Z0-9\.-_]*:/*)
+- # maybe our destination is a subdirectory of the
+- # mountpoint and not the mountpoint itself.
+- # if that is the case, add the subdir to the mountpoint
+- _srcloc="${fsys}/$(echo $_srcloc | \
+- sed 's|'${mtpt}'||')"
+- ;;
+-
+- *)
+- # not a nfs mount, nullfs not specified, so
+- # mount it as nfs from localhost
+- _srcloc="localhost:/${_srcloc}"
+- ;;
+-
+- esac
+-
+- fi
+- ;;
+- esac
++ # The default mounting option is nullfs for DragonFly. This is required
++ # for HAMMER filesystems as it's not possible to have NFS mounts directly
++ # there. For UFS, it's still the preferred option for performance
++ # reasons. Therefore the only attempt to use NFS is if the mount point
++ # is defined in the database and it's in the NFS server:directory format.
++
++ _options="-t null"
++ if [ ${_fqsrcloc} -eq 1 ]; then
++ case ${_srcloc} in
++
++ [a-zA-Z0-9\.-_]*:/*)
++ _options="-o nfsv3,intr,tcp"
++ ;;
++ *)
++ ;;
++ esac
+ fi
+
+ if [ ${_readonly} -eq 1 ] ; then
+@@ -424,6 +389,7 @@ requestMount () {
+ mkdir -p ${_dstloc}
+ fi
+
++ echo "mount ${_options} ${_srcloc} ${_dstloc}"
+ mount ${_options} ${_srcloc} ${_dstloc}
+ return ${?}
+ }
+@@ -506,15 +472,16 @@ buildenvNoHost () {
+ eval "export __MAKE_CONF=${jailBase}/make.conf" >/dev/null 2>&1
+ eval "export LOCALBASE=/nonexistentlocal" >/dev/null 2>&1
+ eval "export PKG_DBDIR=/nonexistentdb" >/dev/null 2>&1
+- if [ x"${OPTIONS_ENABLED}" != x"1" ]; then
+- eval "export PORT_DBDIR=/nonexistentportdb" >/dev/null 2>&1
+- else
+- optionsDir=$(tinderLoc options ${build})
+-
+- eval "export PORT_DBDIR=${optionsDir}" >/dev/null 2>&1
+- fi
+ eval "export LINUXBASE=/nonexistentlinux" >/dev/null 2>&1
+ eval "unset DISPLAY" >/dev/null 2>&1
++
++ # When the tinderd is launched by the rc system at boot time (normal)
++ # it doesn't have the /usr/pkg/bin path set. FreeBSD has their make
++ # in the path that rc scripts can access, but this is not true for
++ # pkgsrc bmake on any system other than NetBSD. Let's add it to
++ # path while we're in the subshell.
++
++ eval "export PATH=${PATH}:/usr/pkg/bin" >/dev/null 2>&1
+ }
+
+ getDbDriver () {
+@@ -629,7 +596,7 @@ checkPreReqs () {
+ missing=""
+
+ for r in ${reqs} ; do
+- if [ -z $(pkg_info -Q -O ${r}) ]; then
++ if [ -z $(pkg_info -e ${r}) ]; then
+ missing="${missing} ${r}"
+ error=1
+ fi
diff --git a/pkgtools/tinderbox-dragonfly/patches/patch-ad b/pkgtools/tinderbox-dragonfly/patches/patch-ad
new file mode 100644
index 00000000000..fff59f22e39
--- /dev/null
+++ b/pkgtools/tinderbox-dragonfly/patches/patch-ad
@@ -0,0 +1,51 @@
+$NetBSD: patch-ad,v 1.1 2011/11/02 21:13:21 marino Exp $
+
+--- ../FreeBSD/lib/db-pgsql.sh 2011-10-16 00:52:55.000000000 +0000
++++ lib/db-pgsql.sh
+@@ -24,30 +24,30 @@
+ #
+ # $MCom: portstools/tinderbox/lib/db-pgsql.sh,v 1.2.2.5 2009/02/07 20:15:49 marcus Exp $
+ #
+-export DB_MAN_PREREQS="databases/p5-DBD-Pg databases/postgresql*-client"
+-export DB_OPT_PREREQS="databases/php5-pgsql"
++export DB_MAN_PREREQS="p5-DBD-postgresql postgresql*-client"
++export DB_OPT_PREREQS="php5*-pgsql"
+
+ if [ -n "${db_admin_pass}" ]; then
+ export PGPASSWORD=${db_admin_pass}
+ export DB_PROMPT='true'
+- export DB_SCHEMA_LOAD='/usr/local/bin/psql -U ${db_user} -h ${db_host} -d ${db_name} < "${schema_file}"'
+- export DB_DUMP='/usr/local/bin/pg_dump -U ${db_admin} -h ${db_host} --data-only --inserts --table=%%TABLE%% ${db_name} >> ${tmpfile}'
+- export DB_DROP='/usr/local/bin/dropdb -U ${db_admin} -h ${db_host} ${db_name}'
+- export DB_CHECK='/usr/local/bin/psql -U ${db_admin} -h ${db_host} -c "SELECT 0" ${db_name}'
+- export DB_CREATE='/usr/local/bin/createdb -O ${db_user} -U ${db_admin} -h ${db_host} ${db_name}'
++ export DB_SCHEMA_LOAD='/usr/pkg/bin/psql -U ${db_user} -h ${db_host} -d ${db_name} < "${schema_file}"'
++ export DB_DUMP='/usr/pkg/bin/pg_dump -U ${db_admin} -h ${db_host} --data-only --inserts --table=%%TABLE%% ${db_name} >> ${tmpfile}'
++ export DB_DROP='/usr/pkg/bin/dropdb -U ${db_admin} -h ${db_host} ${db_name}'
++ export DB_CHECK='/usr/pkg/bin/psql -U ${db_admin} -h ${db_host} -c "SELECT 0" ${db_name}'
++ export DB_CREATE='/usr/pkg/bin/createdb -O ${db_user} -U ${db_admin} -h ${db_host} ${db_name}'
+ export DB_GRANT='echo "Make sure ${db_user} owns the database ${db_name} as well as all of its tables."'
+- export DB_QUERY='/usr/local/bin/psql -U ${db_admin} -h ${db_host} -t -q -A -F "`printf \"\t\"`" -c "${query}" ${db_name}'
++ export DB_QUERY='/usr/pkg/bin/psql -U ${db_admin} -h ${db_host} -t -q -A -F "`printf \"\t\"`" -c "${query}" ${db_name}'
+ export DB_USER_PROMPT='echo "The next prompt will be for the new user'"'"'s (${db_user}) password on the database server ${db_host}."'
+- export DB_CREATE_USER='/usr/local/bin/createuser -E -S -d -R -h ${db_host} -U ${db_admin} -P ${db_user}'
++ export DB_CREATE_USER='/usr/pkg/bin/createuser -E -S -d -R -h ${db_host} -U ${db_admin} -P ${db_user}'
+ else
+ export DB_PROMPT='echo "The next prompt will be for ${db_admin}'"'"'s password to the ${db_name} database." | /usr/bin/fmt 75 79'
+- export DB_SCHEMA_LOAD='/usr/local/bin/psql -U ${db_user} -W -h ${db_host} -d ${db_name} < "${schema_file}"'
+- export DB_DUMP='/usr/local/bin/pg_dump -U ${db_admin} -W -h ${db_host} --data-only --inserts --table=%%TABLE%% ${db_name} >> ${tmpfile}'
+- export DB_DROP='/usr/local/bin/dropdb -U ${db_admin} -h ${db_host} -W ${db_name}'
+- export DB_CHECK='/usr/local/bin/psql -U ${db_admin} -h ${db_host} -W -c "SELECT 0" ${db_name}'
+- export DB_CREATE='/usr/local/bin/createdb -O ${db_user} -U ${db_admin} -h ${db_host} -W ${db_name}'
++ export DB_SCHEMA_LOAD='/usr/pkg/bin/psql -U ${db_user} -W -h ${db_host} -d ${db_name} < "${schema_file}"'
++ export DB_DUMP='/usr/pkg/bin/pg_dump -U ${db_admin} -W -h ${db_host} --data-only --inserts --table=%%TABLE%% ${db_name} >> ${tmpfile}'
++ export DB_DROP='/usr/pkg/bin/dropdb -U ${db_admin} -h ${db_host} -W ${db_name}'
++ export DB_CHECK='/usr/pkg/bin/psql -U ${db_admin} -h ${db_host} -W -c "SELECT 0" ${db_name}'
++ export DB_CREATE='/usr/pkg/bin/createdb -O ${db_user} -U ${db_admin} -h ${db_host} -W ${db_name}'
+ export DB_GRANT='echo "Make sure ${db_user} owns the database ${db_name} as well as all of its tables."'
+- export DB_QUERY='/usr/local/bin/psql -U ${db_admin} -W -h ${db_host} -t -q -A -F "`printf \"\t\"`" -c "${query}" ${db_name}'
++ export DB_QUERY='/usr/pkg/bin/psql -U ${db_admin} -W -h ${db_host} -t -q -A -F "`printf \"\t\"`" -c "${query}" ${db_name}'
+ export DB_USER_PROMPT='echo "The next prompt will be for the new user'"'"'s (${db_user}) password on the database server ${db_host}. The prompt after that will be for ${db_admin}'"'"'s password."'
+- export DB_CREATE_USER='/usr/local/bin/createuser -E -S -d -R -h ${db_host} -U ${db_admin} -W -P ${db_user}'
++ export DB_CREATE_USER='/usr/pkg/bin/createuser -E -S -d -R -h ${db_host} -U ${db_admin} -W -P ${db_user}'
+ fi
diff --git a/pkgtools/tinderbox-dragonfly/patches/patch-ae b/pkgtools/tinderbox-dragonfly/patches/patch-ae
new file mode 100644
index 00000000000..b5b245e3722
--- /dev/null
+++ b/pkgtools/tinderbox-dragonfly/patches/patch-ae
@@ -0,0 +1,51 @@
+$NetBSD: patch-ae,v 1.1 2011/11/02 21:13:22 marino Exp $
+
+--- ../FreeBSD/lib/db-mysql.sh 2011-10-16 00:52:55.000000000 +0000
++++ lib/db-mysql.sh
+@@ -24,30 +24,30 @@
+ #
+ # $MCom: portstools/tinderbox/lib/db-mysql.sh,v 1.3.2.3 2010/01/02 20:04:29 marcus Exp $
+ #
+-export DB_MAN_PREREQS="databases/p5-DBD-mysql[456][0145] databases/mysql[456][0145]-client"
+-export DB_OPT_PREREQS="databases/php5-mysql"
++export DB_MAN_PREREQS="p5-DBD-mysql mysql-client"
++export DB_OPT_PREREQS="php5*-mysql"
+
+ if [ -n "${db_admin_pass}" ]; then
+ export DB_PROMPT='true'
+ export db_admin_pass
+- export DB_SCHEMA_LOAD='/usr/local/bin/mysql -u${db_admin} --password="${db_admin_pass}" -h ${db_host} ${db_name} < "${schema_file}"'
+- export DB_DUMP='/usr/local/bin/mysqldump --no-create-info --skip-opt -u${db_admin} --password="${db_admin_pass}" -h ${db_host} ${db_name} %%TABLE%% >> ${tmpfile}'
+- export DB_DROP='/usr/local/bin/mysqladmin -u${db_admin} --password=${db_admin_pass} -h ${db_host} drop ${db_name}'
+- export DB_CHECK='/usr/local/bin/mysql -u${db_admin} -B -s --password="${db_admin_pass}" -h ${db_host} -e "SELECT 0" ${db_name}'
+- export DB_CREATE='/usr/local/bin/mysqladmin -u${db_admin} --password="${db_admin_pass}" -h ${db_host} create ${db_name}'
+- export DB_GRANT='/usr/local/bin/mysql -u${db_admin} --password="${db_admin_pass}" -h ${db_host} -e "GRANT SELECT, INSERT, UPDATE, DELETE ON ${db_name}.* TO '"'"'${db_user}'"'"'@'"'"'${grant_host}'"'"' IDENTIFIED BY '"'"'${db_pass}'"'"' ; FLUSH PRIVILEGES" mysql'
+- export DB_QUERY='/usr/local/bin/mysql --batch --skip-column-names -u${db_admin} --password="${db_admin_pass}" -h ${db_host} -e "${query}" ${db_name}'
++ export DB_SCHEMA_LOAD='/usr/pkg/bin/mysql -u${db_admin} --password="${db_admin_pass}" -h ${db_host} ${db_name} < "${schema_file}"'
++ export DB_DUMP='/usr/pkg/bin/mysqldump --no-create-info --skip-opt -u${db_admin} --password="${db_admin_pass}" -h ${db_host} ${db_name} %%TABLE%% >> ${tmpfile}'
++ export DB_DROP='/usr/pkg/bin/mysqladmin -u${db_admin} --password=${db_admin_pass} -h ${db_host} drop ${db_name}'
++ export DB_CHECK='/usr/pkg/bin/mysql -u${db_admin} -B -s --password="${db_admin_pass}" -h ${db_host} -e "SELECT 0" ${db_name}'
++ export DB_CREATE='/usr/pkg/bin/mysqladmin -u${db_admin} --password="${db_admin_pass}" -h ${db_host} create ${db_name}'
++ export DB_GRANT='/usr/pkg/bin/mysql -u${db_admin} --password="${db_admin_pass}" -h ${db_host} -e "GRANT SELECT, INSERT, UPDATE, DELETE ON ${db_name}.* TO '"'"'${db_user}'"'"'@'"'"'${grant_host}'"'"' IDENTIFIED BY '"'"'${db_pass}'"'"' ; FLUSH PRIVILEGES" mysql'
++ export DB_QUERY='/usr/pkg/bin/mysql --batch --skip-column-names -u${db_admin} --password="${db_admin_pass}" -h ${db_host} -e "${query}" ${db_name}'
+ export DB_USER_PROMPT='true'
+ export DB_CREATE_USER='true'
+ else
+ export DB_PROMPT='echo "The next prompt will be for ${db_admin}'"'"'s password to the ${db_name} database." | /usr/bin/fmt 75 79'
+- export DB_SCHEMA_LOAD='/usr/local/bin/mysql -u${db_admin} -p -h ${db_host} ${db_name} < "${schema_file}"'
+- export DB_DUMP='/usr/local/bin/mysqldump --no-create-info --skip-opt -u${db_admin} -p -h ${db_host} ${db_name} %%TABLE%% >> ${tmpfile}'
+- export DB_DROP='/usr/local/bin/mysqladmin -u${db_admin} -p -h ${db_host} drop ${db_name}'
+- export DB_CHECK='/usr/local/bin/mysql -u${db_admin} -B -s -p -h ${db_host} -e "SELECT 0" ${db_name}'
+- export DB_CREATE='/usr/local/bin/mysqladmin -u${db_admin} -p -h ${db_host} create ${db_name}'
+- export DB_GRANT='/usr/local/bin/mysql -u${db_admin} -p -h ${db_host} -e "GRANT SELECT, INSERT, UPDATE, DELETE ON ${db_name}.* TO '"'"'${db_user}'"'"'@'"'"'${grant_host}'"'"' IDENTIFIED BY '"'"'${db_pass}'"'"' ; FLUSH PRIVILEGES" mysql'
+- export DB_QUERY='/usr/local/bin/mysql --batch --skip-column-names -u${db_admin} -p -h ${db_host} -e "${query}" ${db_name}'
++ export DB_SCHEMA_LOAD='/usr/pkg/bin/mysql -u${db_admin} -p -h ${db_host} ${db_name} < "${schema_file}"'
++ export DB_DUMP='/usr/pkg/bin/mysqldump --no-create-info --skip-opt -u${db_admin} -p -h ${db_host} ${db_name} %%TABLE%% >> ${tmpfile}'
++ export DB_DROP='/usr/pkg/bin/mysqladmin -u${db_admin} -p -h ${db_host} drop ${db_name}'
++ export DB_CHECK='/usr/pkg/bin/mysql -u${db_admin} -B -s -p -h ${db_host} -e "SELECT 0" ${db_name}'
++ export DB_CREATE='/usr/pkg/bin/mysqladmin -u${db_admin} -p -h ${db_host} create ${db_name}'
++ export DB_GRANT='/usr/pkg/bin/mysql -u${db_admin} -p -h ${db_host} -e "GRANT SELECT, INSERT, UPDATE, DELETE ON ${db_name}.* TO '"'"'${db_user}'"'"'@'"'"'${grant_host}'"'"' IDENTIFIED BY '"'"'${db_pass}'"'"' ; FLUSH PRIVILEGES" mysql'
++ export DB_QUERY='/usr/pkg/bin/mysql --batch --skip-column-names -u${db_admin} -p -h ${db_host} -e "${query}" ${db_name}'
+ export DB_USER_PROMPT='true'
+ export DB_CREATE_USER='true'
+ fi
diff --git a/pkgtools/tinderbox-dragonfly/patches/patch-ag b/pkgtools/tinderbox-dragonfly/patches/patch-ag
new file mode 100644
index 00000000000..3f0dd413402
--- /dev/null
+++ b/pkgtools/tinderbox-dragonfly/patches/patch-ag
@@ -0,0 +1,10 @@
+$NetBSD: patch-ag,v 1.1 2011/11/02 21:13:22 marino Exp $
+
+--- ../FreeBSD/sql/values.lp 2011-10-16 00:52:55.000000000 +0000
++++ sql/values.lp
+@@ -1,4 +1,4 @@
+-INSERT INTO logfile_patterns VALUES ( 10, 'File not found', 'error', '/^(?!fetch).*No such file or directory/', 'Red' );
++INSERT INTO logfile_patterns VALUES ( 10, 'File not found', 'error', '/^(?!(fetch|.*\sconftest\*:)).*No such file or directory/', 'Red' );
+ INSERT INTO logfile_patterns VALUES ( 500, 'Declaration prototype', 'warning', '/warning: function declaration isn''t a prototype/', 'Violet' );
+ INSERT INTO logfile_patterns VALUES ( 510, 'No prototype', 'warning', '/warning: no previous prototype for ''.*''/', 'Violet' );
+ INSERT INTO logfile_patterns VALUES ( 520, 'Implicit function', 'warning', '/warning: implicit declaration of function ''.*''/', 'Magenta' );
diff --git a/pkgtools/tinderbox-dragonfly/patches/patch-ai b/pkgtools/tinderbox-dragonfly/patches/patch-ai
new file mode 100644
index 00000000000..106ef603789
--- /dev/null
+++ b/pkgtools/tinderbox-dragonfly/patches/patch-ai
@@ -0,0 +1,285 @@
+$NetBSD: patch-ai,v 1.1 2011/11/02 21:13:23 marino Exp $
+
+--- ../FreeBSD/lib/portbuild 2011-10-16 00:52:55.000000000 +0000
++++ lib/portbuild
+@@ -5,7 +5,7 @@
+ . ${pb}/scripts/lib/tinderlib.sh
+
+ usage () {
+- echo "usage: $0 <build name> <jail name> <portstree name> [-noclean] [-plistcheck] [-nullfs] [-fetch-original] [-nolog] ED PD FD BD RD TD pkgname dirname"
++ echo "usage: $0 <build name> <jail name> <portstree name> [-noclean] [-plistcheck] [-fetch-original] [-nolog] ED PD FD BD RD TD SD pkgname dirname"
+ exit 1
+ }
+
+@@ -17,9 +17,10 @@ cleanup()
+ cleandirs=$4
+ pkgname=$5
+ build=$6
+- nullfs=$7
+
+- umount ${chroot}/compat/linux/proc >/dev/null
++ if [ ${ARCH} = "i386" ]; then
++ umount ${chroot}/compat/linux/proc >/dev/null
++ fi
+ umount ${chroot}/proc >/dev/null
+
+ if [ $noclean -eq 0 ]; then
+@@ -31,11 +32,8 @@ cleanup()
+ rm -rf ${chroot}/tmp/*
+
+ chroot ${chroot} /sbin/ldconfig -R
+- if [ ${ARCH} = "i386" ]; then
+- chroot ${chroot} /sbin/ldconfig -aout -R
+- fi
+ else
+- ${tc} resetBuild -b ${build} ${nullfs}
++ ${tc} resetBuild -b ${build}
+ fi
+ fi
+
+@@ -56,7 +54,12 @@ mark_failed() {
+ return
+ fi
+
+- dependents=$(grep ${pkgname} ${mf} | grep '^[[:space:]]\{1,\}@' | awk '{print $NF}' | sed -e 's|^/usr/ports/||' | grep -v ${portdir})
++ dependents=$(grep ${pkgname} ${mf} | \
++ grep '^[[:space:]]\{1,\}@' | \
++ awk '{print $NF}' | \
++ sed -e 's|^/usr/pkgsrc/||' | \
++ sed -e 's|^../../||' | \
++ grep -v ${portdir})
+ if [ $? -ne 0 ]; then
+ return
+ fi
+@@ -71,7 +74,6 @@ mark_failed() {
+ error=0
+ init=0
+ noclean=0
+-nullfs=""
+ fetchorig=0
+ nolog=0
+ plistcheck=""
+@@ -107,9 +109,6 @@ while [ $# -gt 0 -a ${doneargs} -eq 0 ];
+ x-plistcheck) plistcheck="plistcheck"
+ shift;;
+
+- x-nullfs) nullfs="-n"
+- shift;;
+-
+ x-fetch-original) fetchorig=1
+ shift;;
+
+@@ -142,8 +141,9 @@ FD=$3
+ BD=$4
+ RD=$5
+ TD=$6
+-pkgname=$(basename $7 ${PKGSUFFIX})
+-dirname=$8
++SD=$7
++pkgname=$(basename $8 ${PKGSUFFIX})
++dirname=$9
+
+ echo ${pkgname}
+ echo ${dirname}
+@@ -151,7 +151,7 @@ echo ${dirname}
+ tc=$(tinderLoc scripts tc)
+ chroot=$(tinderLoc buildroot ${build})
+ echo "chroot is: ${chroot}"
+-portdir=$(echo ${dirname} | sed -e 's|^/usr/ports/||')
++portdir=$(echo ${dirname} | sed -e 's|^/usr/pkgsrc/||')
+
+ total_size=$(${tc} getPortTotalSize -d ${portdir} -b ${build})
+ execute_hook "prePortBuild" "PACKAGE_NAME=${pkgname} BUILD=${build} JAIL=${jail} PORTSTREE=${portstree} CHROOT=${chroot} PORTDIR=${portdir} PB=${pb} TOTAL_SIZE=${total_size}"
+@@ -167,7 +167,7 @@ if [ -f ${dudsfile} ]; then
+ if grep -qxF ${pkgname} ${dudsfile}; then
+ echo "skipping ${pkgname} (found in duds)"
+ ${tc} updatePortStatus -d ${portdir} -b ${build} \
+- -L -s DUD -v ${pkgname}
++ -L -s DUD -v ${pkgname} -r arch
+ mark_failed ${tc} ${build} ${pkgname} ${portdir}
+ execute_hook "postPortBuild" "PACKAGE_NAME=${pkgname} BUILD=${build} JAIL=${jail} PORTSTREE=${portstree} CHROOT=${chroot} STATUS=DUD PORTDIR=${portdir} PB=${pb} FAIL_REASON=dud TOTAL_SIZE=0"
+ exit 1
+@@ -175,12 +175,12 @@ if [ -f ${dudsfile} ]; then
+ fi
+
+ # directories to clean
++# These are created/recreated after blowing the directories away
+ cleandirs="${LOCALBASE} /compat /var/db/pkg"
+
+ for dir in ${cleandirs}; do
+ cleanDirs ${build} ${chroot}${dir}
+ done
+-rm -rf ${chroot}/var/db/pkg/*
+
+ # reset mtrees for plist checking
+ mtree -deU -f ${chroot}/etc/mtree/BSD.root.dist \
+@@ -190,17 +190,48 @@ mtree -deU -f ${chroot}/etc/mtree/BSD.va
+ mtree -deU -f ${chroot}/etc/mtree/BSD.usr.dist \
+ -p ${chroot}/usr >/dev/null 2>&1
+
+-mkdir -p ${chroot}${LOCALBASE}
+-if [ -f ${chroot}/a/ports/Templates/BSD.local.dist ]; then
+- mtree -deU -f ${chroot}/a/ports/Templates/BSD.local.dist -p ${chroot}${LOCALBASE} \
++if [ -f ${chroot}/a/pkgsrc/Templates/BSD.local.dist ]; then
++ mtree -deU -f ${chroot}/a/pkgsrc/Templates/BSD.local.dist -p ${chroot}${LOCALBASE} \
+ >/dev/null 2>&1
+ else
+ mtree -deU -f ${chroot}/etc/mtree/BSD.local.dist -p ${chroot}${LOCALBASE} \
+ >/dev/null 2>&1
+ fi
+
+-# mount linprocfs if required
+-if [ "${ARCH}" = "i386" -o "${ARCH}" = "amd64" ]; then
++# pkgsrc is "helpful" that it removes directories that result empty after
++# as the plist removes files of a package. This includes standard mtree
++# directories such as man/man1, so we need to touch a file in every directory
++# of pkgsrc to prevent this side-effect which often fails the fs state check.
++
++find ${chroot}${LOCALBASE}/ -type d -exec touch {}/.keep \;
++
++# copy over pkgsrc bootstrap tools, ${LOCALBASE}/bin & /etc exist now
++cp ${chroot}/usr/4bootstrap/bmake ${chroot}${LOCALBASE}/bin/
++cp ${chroot}/usr/4bootstrap/pkg_* ${chroot}${LOCALBASE}/sbin/
++cp ${chroot}/usr/4bootstrap/mk.conf ${chroot}${LOCALBASE}/etc/
++cp -R ${chroot}/usr/4bootstrap/mk ${chroot}${LOCALBASE}/share/
++
++# By default, Tinderbox/pkgsrc will build all vulnerable software and
++# accept all licenses. The next file will add these directives to the mk.conf.
++# If this is unwanted on a per-build bases, use the more_make.conf file
++# to override it.
++
++cat ${pb}/scripts/lib/boilerplate_mk.conf >> ${chroot}${LOCALBASE}/etc/mk.conf
++
++# Add per-build custom make options to etc/mk.conf
++# Intended to default versions e.g. PYTHON_VERSION_DEFAULT
++# During catenation, comments, blank lines, MAKE_JOBS= and PKG_OPTIONS.xxxx
++# variables are stripped out. The latter is handled by pkg_options, and it's
++# better not to have two sources.
++
++more_mkconf=$(tinderLoc options ${build})/more_mk.conf
++if [ -f ${more_mkconf} ]; then
++ cat ${more_mkconf} | awk "!/^[ \t]*($|#|PKG_OPTIONS\.|MAKE_JOBS=)/" \
++ >> ${chroot}${LOCALBASE}/etc/mk.conf
++fi
++
++# mount linprocfs if available
++if [ ${ARCH} = "i386" ]; then
+ mkdir -p ${chroot}/compat/linux/proc
+ mount -t linprocfs linprocfs ${chroot}/compat/linux/proc
+ fi
+@@ -251,8 +282,10 @@ if [ x"${CCACHE_ENABLED}" = x"1" ]; then
+ export PATH=/opt:${PATH}
+ fi
+
+-if [ x"${OPTIONS_ENABLED}" = x"1" ]; then
+- export PORT_DBDIR=/var/db/ports
++export PKG_OPTIONS_FILE=
++original_options=$(tinderLoc options ${build})/pkg_options
++if [ x"${OPTIONS_ENABLED}" = x"1" -a -f ${original_options} ]; then
++ export PKG_OPTIONS_FILE=/var/db/options/pkg_options
+ fi
+
+ echo "building $pkgname in $chroot"
+@@ -264,11 +297,7 @@ packages=$(tinderLoc packages ${build})
+ major_version=$(echo ${jail} | sed -E -e 's|(^[[:digit:]]+).*$|\1|')
+
+ if [ -n "${DISTFILE_CACHE}" ]; then
+- export DISTCACHE=/distcache
+- if [ ${fetchorig} -eq 0 ]; then
+- _MSO='file:///distcache/${DIST_SUBDIR}/'
+- export MASTER_SITE_OVERRIDE="${_MSO} ${MASTER_SITE_OVERRIDE}"
+- fi
++ export DISTDIR=/distcache
+ fi
+
+ if [ -n "${DISTFILE_URI}" ]; then
+@@ -282,7 +311,7 @@ mkdir -p ${chroot}/tmp/depends ${chroot}
+ echo "building ${pkgname} in directory ${chroot}" | \
+ tee ${chroot}/tmp/${pkgname}.log
+
+-trap "cleanup ${chroot} ${noclean} ${error} \"${cleandirs}\" ${pkgname} ${build} ${nullfs}" 1 2 3 9 10 11 15
++trap "cleanup ${chroot} ${noclean} ${error} \"${cleandirs}\" ${pkgname} ${build}" 1 2 3 9 10 11 15
+
+ # Don't build in a world-writable standard directory because some ports
+ # hardcode this path and try to load things from it at runtime, which is
+@@ -294,7 +323,7 @@ if [ x"${CCACHE_ENABLED}" ]; then
+ unset CCACHE_DISABLE
+ fi
+
+-_ldconfig_dirs="/lib /usr/lib /usr/lib/compat"
++_ldconfig_dirs="/usr/lib"
+ ldconfig_dirs=""
+ for i in ${_ldconfig_dirs}; do
+ if [ -d ${chroot}/${i} ]; then
+@@ -302,11 +331,8 @@ for i in ${_ldconfig_dirs}; do
+ fi
+ done
+ chroot ${chroot} /sbin/ldconfig ${ldconfig_dirs}
+-if [ ${ARCH} = "i386" ]; then
+- chroot ${chroot} /sbin/ldconfig -aout /usr/lib/aout /usr/lib/compat/aout
+-fi
+
+-set x $ED $FD $PD $BD $RD $TD
++set x $ED $FD $PD $BD $RD $TD $SD
+ shift 1
+
+ cd ${chroot}/tmp/depends
+@@ -337,7 +363,7 @@ if [ $? -ne 0 ]; then
+ exit 1
+ fi
+
+-chroot ${chroot} /buildscript ${dirname} 1 "$ED" "$PD" "$FD" "$BD" "$RD" "$TD" "${plistcheck}" 2>&1 | tee -a ${chroot}/tmp/${pkgname}.log
++chroot ${chroot} /buildscript ${dirname} 1 "$ED" "$PD" "$FD" "$BD" "$RD" "$TD" "$SD" "${plistcheck}" 2>&1 | tee -a ${chroot}/tmp/${pkgname}.log
+ if [ -f ${chroot}/tmp/status ]; then
+ error=$(cat ${chroot}/tmp/status)
+ else
+@@ -351,14 +377,7 @@ errorsDir=$(tinderLoc builderrors ${buil
+
+ if [ "${error}" = "0" ]; then
+ ln -sf ${pkgname}.log2 ${chroot}/tmp/make.log
+- # Cache the distfiles if requested. We will wait a maximum of
+- # ten minutes before giving up on the lock.
+- if [ -n "${DISTFILE_CACHE}" ]; then
+- lockf -t 600 ${chroot}${DISTCACHE}/.lock tar -C ${chroot}/${DISTDIR} \
+- -cf - . | tar --unlink -C ${chroot}${DISTCACHE} -xvf -
+- fi
+-
+- chroot ${chroot} /usr/bin/nice -n $nice /buildscript ${dirname} 2 "$ED" "$PD" "$FD" "$BD" "$RD" "$TD" "${plistcheck}" > ${chroot}/tmp/${pkgname}.log2 2>&1
++ chroot ${chroot} /usr/bin/nice -n $nice /buildscript ${dirname} 2 "$ED" "$PD" "$FD" "$BD" "$RD" "$TD" "$SD" "${plistcheck}" > ${chroot}/tmp/${pkgname}.log2 2>&1
+
+ grep pnohang ${chroot}/tmp/${pkgname}.log2
+ cat ${chroot}/tmp/${pkgname}.log2 >> ${chroot}/tmp/${pkgname}.log
+@@ -372,6 +391,7 @@ if [ "${error}" = "0" ]; then
+ cp ${chroot}/tmp/${pkgname}.log ${logsDir}/${pkgname}.log
+ fi
+ if [ -n "${logdir}" ]; then
++ rm -f ${logdir}/${pkgname}.log${lext}
+ if [ ${docopy} -eq 1 ]; then
+ cp ${logsDir}/${pkgname}.log${lext} ${logdir}/${pkgname}.log${lext}
+ else
+@@ -388,6 +408,7 @@ if [ "${error}" = "0" ]; then
+ cp ${chroot}/tmp/work.tbz ${workDir}/${pkgname}.tbz
+ fi
+
++ rm -f ${errorsDir}/${pkgname}.log*
+ if [ "${error}" = "0" ]; then
+ if [ ! -z "${last_version}" ]; then
+ oldpkgs=$(find ${packages} -name "${last_version}${PKGSUFFIX}")
+@@ -400,8 +421,8 @@ if [ "${error}" = "0" ]; then
+ tar --unlink -C ${packages} -xvf -
+ [ -f ${packages}/All/${pkgname}${PKGSUFFIX} ] && \
+ touch ${packages}/All/${pkgname}${PKGSUFFIX}
+- rm -f ${errorsDir}/${pkgname}.log*
+- if bzgrep -q "${pkgname} is marked as broken: " ${logsDir}/${pkgname}.log${lext} ; then
++ BROKE=`zgrep -q "${pkgname} is marked as broken: " ${logsDir}/${pkgname}.log${lext}`
++ if [ "${BROKE}" != "" ] ; then
+ status="BROKEN"
+ elif [ -f ${chroot}/tmp/leftovers ]; then
+ status="LEFTOVERS"
+@@ -476,5 +497,5 @@ else
+ execute_hook "postPortBuild" "PACKAGE_NAME=${pkgname} BUILD=${build} JAIL=${jail} PORTSTREE=${portstree} CHROOT=${chroot} STATUS=FAIL PORTDIR=${portdir} PB=${pb} ${reasonenv} TOTAL_SIZE=${total_size}"
+ fi
+
+-cleanup ${chroot} ${noclean} ${error} "${cleandirs}" ${pkgname} ${build} ${nullfs}
++cleanup ${chroot} ${noclean} ${error} "${cleandirs}" ${pkgname} ${build}
+ exit ${error}
diff --git a/pkgtools/tinderbox-dragonfly/patches/patch-aj b/pkgtools/tinderbox-dragonfly/patches/patch-aj
new file mode 100644
index 00000000000..fd3e4de6987
--- /dev/null
+++ b/pkgtools/tinderbox-dragonfly/patches/patch-aj
@@ -0,0 +1,331 @@
+$NetBSD: patch-aj,v 1.1 2011/11/02 21:13:23 marino Exp $
+
+--- ../FreeBSD/lib/buildscript 2011-10-16 00:52:55.000000000 +0000
++++ lib/buildscript
+@@ -1,6 +1,6 @@
+ #!/bin/sh
+
+-# usage: $0 DIRNAME PHASE ED PD FD BD RD TD [PLISTCHECK]
++# usage: $0 DIRNAME PHASE ED PD FD BD RD TD SD [PLISTCHECK]
+ # PHASE is 1 (checksum) or 2 (package)
+
+ cleanup() {
+@@ -8,7 +8,7 @@ cleanup() {
+
+ if [ -e ${dir}/.keep ]; then
+ cd ${dir}
+- objdir=$(make -V WRKDIR)
++ objdir=`bmake -V '\${WRKDIR}'`
+ tar cfjC /tmp/work.tbz ${objdir}/.. work
+ fi
+
+@@ -36,7 +36,6 @@ add_pkg() {
+ for i in $pkgs; do
+ echo "pkg_add $i"
+ base=$(basename $i .tgz)
+- base=$(basename $base .tbz)
+ if pkg_info -q -e $base; then
+ echo "skipping $base, already added"
+ else
+@@ -48,6 +47,8 @@ add_pkg() {
+ fi
+ done
+ fi
++ # pkgsrc requires PKG_PATH variable be unset
++ unset PKG_PATH
+ }
+
+ del_pkg() {
+@@ -91,6 +92,37 @@ del_pkg() {
+ done
+ fi
+ find /var/db/pkg -type f -empty -delete
++ # pkgsrc requires PKG_PATH variable be unset
++ unset PKG_PATH
++}
++
++get_package_options() {
++ # If the option file exists, it's stored in PKG_OPTIONS_FILE env var.
++ # The format is ${DISTNAME}:jobs override:options list
++ # example: gcc-4.6.1::-gcc-fortran
++ # In this example, there is no makejob override, fortran removed
++ # example: gawk-3.1.8:1:portals
++ # In the above example, MAKE_JOBS=1, portals option added
++ # Don't include any "nbX" suffixes, that is ${PKGNAME}.
++ # Use the "DISTNAME" definition in the makefile.
++
++ INFO_DISTNAME=$1
++ MAKEJOBS_OVERRIDE=
++ SPECIFIC_OPTIONS=
++ if [ -z "${PKG_OPTIONS_FILE}" ]; then
++ return
++ fi
++
++ instructions=`grep ${INFO_DISTNAME}: ${PKG_OPTIONS_FILE}`
++ if [ -z "${instructions}" ]; then
++ return
++ fi
++
++ test_override=`echo ${instructions} | awk 'BEGIN {FS=":"}; /^.+:[0-9]+:/ {print $2}'`
++ if [ -n "{test_override}" ]; then
++ MAKEJOBS_OVERRIDE="${test_override}"
++ fi
++ SPECIFIC_OPTIONS="`echo ${instructions} | awk 'BEGIN {FS=":"}; /^.+:[0-9]*:/ {print $3}'`"
+ }
+
+ dir=$1
+@@ -102,37 +134,46 @@ FD=$5
+ BD=$6
+ RD=$7
+ TD=$8
+-PLISTCHECK=$9
++SD=$9
++PLISTCHECK=${10}
+
+ L=$(echo ${LOCALBASE} | sed 's,^/,,')
+
++export NO_PKGTOOLS_REQD_CHECK=1
++export WRKOBJDIR=/work
++
++cd $dir || exit 1
++
++pkgname=`bmake -V '\${PKGNAME}'`
++INFO_OPTVAR=`bmake -V '\${PKG_OPTIONS_VAR}'`
++get_package_options `bmake -V '\${DISTNAME}'`
++
+ if [ $phase = 1 ]; then
+
+- cd $dir || exit 1
++ INFO_MAINTAINER=`bmake -V '\${MAINTAINER}'`
++ INFO_PREFIX=`bmake -V '\${PREFIX}'`
+ echo "build started at $(date)"
+ echo "port directory: ${dir}"
+ echo "building for: $(uname -rm)"
+- echo "maintained by: $(make maintainer)"
+- echo "Makefile ident: $(ident ${dir}/Makefile | grep 'FreeBSD:' | sed 's/^[ \t]*//')"
+- echo "prefixes: LOCALBASE=${L} PREFIX=$(make -V PREFIX)"
++ echo "maintained by: ${INFO_MAINTAINER}"
++ echo "Makefile ident: $(ident ${dir}/Makefile | grep 'NetBSD:' | sed 's/^[ \t]*//')"
++ echo "prefixes: LOCALBASE=${L} PREFIX=${INFO_PREFIX}"
+ echo "Begin Configuration:"
+ echo "---Begin Environment---"
+- printenv
++ printenv | sort
+ echo "---End Environment---"
+ echo ""
+ echo "---Begin OPTIONS List---"
+- make showconfig
++ if [ -n "${INFO_OPTVAR}" -a -n "${SPECIFIC_OPTIONS}" ]; then
++ bmake show-options ${INFO_OPTVAR}="${SPECIFIC_OPTIONS}"
++ else
++ bmake show-options
++ fi
+ echo "---End OPTIONS List---"
+ echo ""
+- optionsfile=$(make -V OPTIONSFILE)
+- if [ -f "${optionsfile}" ]; then
+- echo "---Begin OPTIONS configuration---"
+- cat ${optionsfile}
+- echo "---End OPTIONS configuration---"
+- echo ""
+- fi
+ echo "End Configuration."
+
++ echo "BOOTSTRAP_DEPENDS=${SD}"
+ echo "FETCH_DEPENDS=${FD}"
+ echo "PATCH_DEPENDS=${PD}"
+ echo "EXTRACT_DEPENDS=${ED}"
+@@ -165,19 +206,20 @@ if [ $phase = 1 ]; then
+ ./${L}/share/xml
+ ./${L}/etc/gconf
+ ./var/db/fontconfig
++./distcache
+ EOF
+
+ # Record a "pristine" mtree.
+ mtree -X /tmp/mtree.preexclude -xcn -k uid,gid,mode -p / > /tmp/mtree.pristine
+
+- add_pkg $FD
++ add_pkg $SD $FD
+
+ cd $dir || exit 1
+- pkgname=$(make package-name)
++
+ echo "================================================================"
+ echo "====================<phase 1: make checksum>===================="
+
+- if /pnohang $TIMEOUT /tmp/make.log1 ${pkgname} make checksum; then
++ if /pnohang $TIMEOUT /tmp/make.log1 ${pkgname} bmake checksum; then
+ cat /tmp/make.log1
+ echo "0" > /tmp/status
+ else
+@@ -186,15 +228,27 @@ EOF
+
+ else
+
+- cd $dir || exit 1
+- pkgname=$(make package-name)
+-
+ echo "================================================================"
+ echo "====================<phase 2: make extract>===================="
+
+ add_pkg ${ED}
++
++ # For an unfathomable reason, pkgsrc insists on bringing in build
++ # dependencies in order to extract the files. Not only is this
++ # annoying if you want to check the contents of the tarball and you
++ # have to build all the dependencies first, it means this script
++ # has to be reordered where build dependencies come in very early.
++
++ add_pkg ${BD}
++
+ cd $dir
+- /pnohang $TIMEOUT /tmp/make.log2 ${pkgname} make extract || cleanup 2
++ # The config options need to come here because make extract pulls in
++ # make configure first, which is where this input is needed.
++ if [ -n "${INFO_OPTVAR}" -a -n "${SPECIFIC_OPTIONS}" ]; then
++ /pnohang $TIMEOUT /tmp/make.log2 ${pkgname} bmake extract ${INFO_OPTVAR}="${SPECIFIC_OPTIONS}" || cleanup 2
++ else
++ /pnohang $TIMEOUT /tmp/make.log2 ${pkgname} bmake extract || cleanup 2
++ fi
+ cat /tmp/make.log2
+ del_pkg ${ED}
+
+@@ -207,15 +261,13 @@ else
+ echo "====================<phase 3: make patch>===================="
+ add_pkg ${PD}
+ cd $dir
+- /pnohang $TIMEOUT /tmp/make.log3 ${pkgname} make patch || cleanup 3
++ /pnohang $TIMEOUT /tmp/make.log3 ${pkgname} bmake patch || cleanup 3
+ cat /tmp/make.log3
+ del_pkg ${PD}
+
+ echo "================================================================"
+ echo "====================<phase 4: make build>===================="
+
+- add_pkg ${BD}
+-
+ # Files we do not care about changing between pre-build and post-cleanup
+ cat > /tmp/mtree.buildexclude <<EOF
+ ./var/log/*
+@@ -247,7 +299,7 @@ EOF
+ fi
+
+ cd $dir
+- portdir=$(echo ${dir} | sed -e 's|^/usr/ports/||' -e 'y/\//_/')
++ portdir=$(echo ${dir} | sed -e 's|^/usr/pkg/||' -e 'y/\//_/')
+
+ if [ -f .sleepme ]; then
+ set > /tmp/.set_${portdir}
+@@ -259,32 +311,32 @@ EOF
+ rm -f /tmp/.set_${portdir}
+ fi
+
+- /pnohang $TIMEOUT /tmp/make.log4 ${pkgname} make build || cleanup 4
++ # MAKE_JOBS normally defined in $LOCALBASE/etc/mk.conf, but it's
++ # inside the tarball. By default it's not set, so we override it here.
++ # We can use the options file to specify exactly the number of jobs we want
++
++ if [ -n "${MAKEJOBS_OVERRIDE}" ]; then
++ echo "=> Number jobs set to ${MAKEJOBS_OVERRIDE} in options file"
++ PORT_JOBS="MAKE_JOBS=${MAKEJOBS_OVERRIDE}"
++ else
++ ncpus=$(/sbin/sysctl hw.ncpu | awk '{print $2}')
++ if [ "${npcus}" = "1" ]; then
++ echo "=> Single job, only 1 CPU"
++ PORT_JOBS="MAKE_JOBS=1"
++ else
++ factor=$(echo "$ncpus*2+1" | /usr/bin/bc)
++ echo "=> Multiple CPUs: ${factor} jobs set"
++ PORT_JOBS="MAKE_JOBS=${factor}"
++ fi
++ fi
++
++ /pnohang $TIMEOUT /tmp/make.log4 ${pkgname} bmake build ${PORT_JOBS} || cleanup 4
+ cat /tmp/make.log4
+
+ echo "================================================================"
+ echo "====================<phase 5: make test>===================="
+
+- pkg_info | awk '{print $1}' | sort > /tmp/pkgs_pre_test
+- add_pkg ${TD}
+- pkg_info | awk '{print $1}' | sort > /tmp/pkgs_post_test
+- cd $dir
+- /pnohang $TIMEOUT /tmp/make.log5 ${pkgname} make -k regression-test
+- cat /tmp/make.log5
+-
+- RTD=`comm -3 /tmp/pkgs_pre_test /tmp/pkgs_post_test | tr -d '\t'`
+- del_pkg ${RTD}
+- rm /tmp/pkgs_pre_test /tmp/pkgs_post_test
+-
+- mtree -X /tmp/mtree.buildexclude -x -f /tmp/mtree.prebuild -p / | egrep -v "^(${L}/var|${L}/lib/X11/xserver/SecurityPolicy|${L}/share/nls/POSIX|${L}/share/nls/en_US.US-ASCII|etc/services|compat |${L} |etc/manpath.config|etc/.*.bak|${L}/info/dir|${L}/lib/X11/fonts/.*/fonts\.|${L}/man/..( |/man. )|${L}/lib/X11/fonts/TrueType|${L}/etc/gconf/gconf.xml.defaults/%gconf-tree.*.xml|usr/X11R6 )" > /tmp/list.preinstall
+-
+- if [ -s /tmp/list.preinstall ]; then
+- echo "================================================================"
+- echo "Fatal error: filesystem was touched prior to 'make install' phase"
+- cat /tmp/list.preinstall
+- echo "================================================================"
+- cleanup 0
+- fi
++ echo "Pkgsrc does not have per-package regression test capability, skipped."
+
+ echo "================================================================"
+ echo "====================<phase 6: make install>===================="
+@@ -306,7 +358,7 @@ EOF
+ mtree -X /tmp/mtree.exclude -xcn -k uid,gid,mode -p / > /tmp/mtree
+
+ cd $dir
+- if /pnohang $TIMEOUT /tmp/make.log6 ${pkgname} make install; then
++ if /pnohang $TIMEOUT /tmp/make.log6 ${pkgname} bmake install; then
+ cat /tmp/make.log6
+ echo "0" > /tmp/status
+ else
+@@ -316,14 +368,14 @@ EOF
+ echo "================================================================"
+ echo "====================<phase 7: make package>===================="
+ cd $dir
+- if /pnohang $TIMEOUT /tmp/make.log7 ${pkgname} make package; then
++ if /pnohang $TIMEOUT /tmp/make.log7 ${pkgname} bmake package; then
+ echo "0" > /tmp/status
+ else
+ echo "1" > /tmp/status
+ fi
+
+ cat /tmp/make.log7
+- prefix=$(make -V PREFIX)
++ prefix=`bmake -V '\${PREFIX}'`
+ du -skx / | awk '{print $1}' > /tmp/size
+ del_pkg ${pkgname}
+
+@@ -349,8 +401,10 @@ EOF
+ echo "================================================================"
+ fi
+
+-
+ echo
++ echo "=== Deleting /var/db/pkg/pkgdb.byfile.db"
++ rm -f /var/db/pkg/pkgdb.byfile.db
++
+ echo "=== Checking filesystem state"
+
+ if [ -s /tmp/list4 ]; then
+@@ -374,8 +428,8 @@ EOF
+
+ # BUILD_DEPENDS need to be present at install-time, e.g. gmake
+ # Concatenate and remove duplicates
+- BRD=$(echo $BD $RD | tr ' ' '\n' | sort -u | tr '\n' ' ')
+- del_pkg ${BRD}
++ BRSD=$(echo $BD $RD $SD | tr ' ' '\n' | sort -u | tr '\n' ' ')
++ del_pkg ${BRSD}
+ cd /var/db/pkg
+ if [ $(echo $(echo * | wc -c)) != 2 ]; then
+ echo "leftover packages:" *
+@@ -430,7 +484,7 @@ EOF
+
+ if [ -e ${dir}/.keep ]; then
+ cd ${dir}
+- objdir=$(make -V WRKDIR)
++ objdir=`bmake -V '\${WRKDIR}'`
+ tar cfjC /tmp/work.tbz ${objdir}/.. work
+ fi
+
diff --git a/pkgtools/tinderbox-dragonfly/patches/patch-ak b/pkgtools/tinderbox-dragonfly/patches/patch-ak
new file mode 100644
index 00000000000..e2dfc73c781
--- /dev/null
+++ b/pkgtools/tinderbox-dragonfly/patches/patch-ak
@@ -0,0 +1,13 @@
+$NetBSD: patch-ak,v 1.1 2011/11/02 21:13:23 marino Exp $
+
+--- ../FreeBSD/contrib/hooks/mass-build-pgsql/mass-build-pgsql.sh 2011-05-27 23:54:22.000000000 +0000
++++ contrib/hooks/mass-build-pgsql/mass-build-pgsql.sh
+@@ -2,7 +2,7 @@
+ # postPortBuild
+
+ # If PGSQL needs authentication use ~/.pgpass !
+-PSQL=/usr/local/bin/psql
++PSQL=/usr/pkg/bin/psql
+ USR=tinderbox_user
+ DB=tinderbox_database
+
diff --git a/pkgtools/tinderbox-dragonfly/patches/patch-al b/pkgtools/tinderbox-dragonfly/patches/patch-al
new file mode 100644
index 00000000000..948f85c3613
--- /dev/null
+++ b/pkgtools/tinderbox-dragonfly/patches/patch-al
@@ -0,0 +1,13 @@
+$NetBSD: patch-al,v 1.1 2011/11/02 21:13:23 marino Exp $
+
+--- ../FreeBSD/man/man1/tc-configCcache.1 2011-10-16 00:52:55.000000000 +0000
++++ man/man1/tc-configCcache.1
+@@ -24,7 +24,7 @@
+ .\" $MCom: portstools/tinderbox/man/man1/tc-configCcache.1,v 1.3 2007/10/13 02:28:46 ade Exp $
+ .\"
+ .Dd July 21, 2005
+-.Os FreeBSD
++.Os DragonFly
+ .Dt TC-CONFIGCCACHE 1
+ .Sh NAME
+ .Nm "tc configCcache"
diff --git a/pkgtools/tinderbox-dragonfly/patches/patch-am b/pkgtools/tinderbox-dragonfly/patches/patch-am
new file mode 100644
index 00000000000..2249c132653
--- /dev/null
+++ b/pkgtools/tinderbox-dragonfly/patches/patch-am
@@ -0,0 +1,13 @@
+$NetBSD: patch-am,v 1.1 2011/11/02 21:13:24 marino Exp $
+
+--- ../FreeBSD/man/man1/tc-configDistfile.1 2011-10-16 00:52:55.000000000 +0000
++++ man/man1/tc-configDistfile.1
+@@ -24,7 +24,7 @@
+ .\" $MCom: portstools/tinderbox/man/man1/tc-configDistfile.1,v 1.2 2007/10/13 02:28:46 ade Exp $
+ .\"
+ .Dd July 21, 2005
+-.Os FreeBSD
++.Os DragonFly
+ .Dt TC-CONFIGDISTFILE 1
+ .Sh NAME
+ .Nm "tc configDistfile"
diff --git a/pkgtools/tinderbox-dragonfly/patches/patch-an b/pkgtools/tinderbox-dragonfly/patches/patch-an
new file mode 100644
index 00000000000..8097bf51d28
--- /dev/null
+++ b/pkgtools/tinderbox-dragonfly/patches/patch-an
@@ -0,0 +1,13 @@
+$NetBSD: patch-an,v 1.1 2011/11/02 21:13:24 marino Exp $
+
+--- ../FreeBSD/man/man1/tc-configGet.1 2011-10-16 00:52:55.000000000 +0000
++++ man/man1/tc-configGet.1
+@@ -24,7 +24,7 @@
+ .\" $MCom: portstools/tinderbox/man/man1/tc-configGet.1,v 1.2 2007/10/13 02:28:46 ade Exp $
+ .\"
+ .Dd July 21, 2005
+-.Os FreeBSD
++.Os DragonFly
+ .Dt TC-CONFIGGET 1
+ .Sh NAME
+ .Nm "tc configGet"
diff --git a/pkgtools/tinderbox-dragonfly/patches/patch-ao b/pkgtools/tinderbox-dragonfly/patches/patch-ao
new file mode 100644
index 00000000000..d9ec2502671
--- /dev/null
+++ b/pkgtools/tinderbox-dragonfly/patches/patch-ao
@@ -0,0 +1,13 @@
+$NetBSD: patch-ao,v 1.1 2011/11/02 21:13:24 marino Exp $
+
+--- ../FreeBSD/man/man1/tc-configJail.1 2011-10-16 00:52:55.000000000 +0000
++++ man/man1/tc-configJail.1
+@@ -24,7 +24,7 @@
+ .\" $MCom: portstools/tinderbox/man/man1/tc-configJail.1,v 1.2 2007/10/13 02:28:46 ade Exp $
+ .\"
+ .Dd July 21, 2005
+-.Os FreeBSD
++.Os DragonFly
+ .Dt TC-CONFIGJAIL 1
+ .Sh NAME
+ .Nm "tc configJail"
diff --git a/pkgtools/tinderbox-dragonfly/patches/patch-ap b/pkgtools/tinderbox-dragonfly/patches/patch-ap
new file mode 100644
index 00000000000..1fefee18c7c
--- /dev/null
+++ b/pkgtools/tinderbox-dragonfly/patches/patch-ap
@@ -0,0 +1,13 @@
+$NetBSD: patch-ap,v 1.1 2011/11/02 21:13:25 marino Exp $
+
+--- ../FreeBSD/man/man1/tc-configTinderd.1 2011-10-16 00:52:55.000000000 +0000
++++ man/man1/tc-configTinderd.1
+@@ -24,7 +24,7 @@
+ .\" $MCom: portstools/tinderbox/man/man1/tc-configTinderd.1,v 1.2 2007/10/13 02:28:47 ade Exp $
+ .\"
+ .Dd July 21, 2005
+-.Os FreeBSD
++.Os DragonFly
+ .Dt TC-CONFIGTINDERD 1
+ .Sh NAME
+ .Nm "tc configTinderd"
diff --git a/pkgtools/tinderbox-dragonfly/patches/patch-aq b/pkgtools/tinderbox-dragonfly/patches/patch-aq
new file mode 100644
index 00000000000..4f12bee0854
--- /dev/null
+++ b/pkgtools/tinderbox-dragonfly/patches/patch-aq
@@ -0,0 +1,13 @@
+$NetBSD: patch-aq,v 1.1 2011/11/02 21:13:25 marino Exp $
+
+--- ../FreeBSD/man/man1/tc-init.1 2011-10-16 00:52:55.000000000 +0000
++++ man/man1/tc-init.1
+@@ -24,7 +24,7 @@
+ .\" $MCom: portstools/tinderbox/man/man1/tc-init.1,v 1.1 2005/07/27 03:59:49 marcus Exp $
+ .\"
+ .Dd July 21, 2005
+-.Os FreeBSD
++.Os DragonFly
+ .Dt TC-INIT 1
+ .Sh NAME
+ .Nm "tc init"
diff --git a/pkgtools/tinderbox-dragonfly/patches/patch-ar b/pkgtools/tinderbox-dragonfly/patches/patch-ar
new file mode 100644
index 00000000000..b3a44cc8523
--- /dev/null
+++ b/pkgtools/tinderbox-dragonfly/patches/patch-ar
@@ -0,0 +1,554 @@
+$NetBSD: patch-ar,v 1.1 2011/11/02 21:13:25 marino Exp $
+
+--- ../FreeBSD/README 2011-10-30 17:11:08.876006000 +0000
++++ README
+@@ -2,23 +2,30 @@
+
+ Tinderbox is a package building system for FreeBSD ports, based on
+ official Portbuild scripts used on pointyhat building cluster.
+- Tinderbox was written by Joe Marcus Clarke.
++ Tinderbox was written by Joe Marcus Clarke, and has
++ been ported to DragonFly BSD by John Marino.
+
+ You can define multiple jails (base system versions) and multiple
+ portstrees. The combination of jail and portstree is called a
+ build. A Tinderbox jail is not what is understood as a jail in
+- FreeBSD, it is in fact a given world in a chroot. Tinderbox
+- supports automatic tracking of dependencies and only rebuilds
+- packages that changed since last run. Tinderbox has support for
+- email notification of failed builds. Tinderbox also integrates
+- well with ccache.
++ FreeBSD and DragonFly, it is in fact a given world in a
++ chroot. DragonFly uses NetBSD's pkgsrc to build software which
++ is known as "packages" rather than "ports". Rather than update
++ DragonFly Tinderbox to change numerous references to "ports" and
++ "portstrees", the users of pkgsrc are asked to equate the term
++ "port" with "package" whenever they encounter it.
++
++ Tinderbox supports automatic tracking of dependencies and only
++ rebuilds packages that changed since last run. Tinderbox has
++ support for email notification of failed builds. Tinderbox also
++ integrates well with ccache.
+
+ Tinderbox is designed to easily provide package sets of ports you
+ need, for platforms and architectures you need. Tinderbox is also
+ excellent tool for testing new ports and port upgrades, especially
+ for testing dependencies and packing lists. It's also useful for
+- testing ports on various releases of FreeBSD, since you can run
+- FreeBSD 7.X/8.X world as a jail on a FreeBSD 9.X host.
++ testing ports on various releases of DragonFly, since you can run
++ earlier releases as a jail on the DragonFly-current.
+
+ --------------------------------------------------------------
+
+@@ -96,34 +103,28 @@
+ * ports-mgmt/tinderbox which tracks the latest stable release
+ (plus sometimes back-ported fixes from the STABLE branch)
+
+- * ports-mgmt/tinderbox-devel which tracks HEAD and might contain
+- additional experimental patches not (yet) present in the CVS.
++ The pkgsrc/DragonFly version of Tinderbox repository is
++ located at https://github.com/jrmarino/pkgsrc-tinderbox
+
+ --------------------------------------------------------------
+
+ Chapter 2 Requirements
+
+- Recent FreeBSD (development happens on 9-CURRENT only, but
+- Tinderbox is known to work on RELENG_7 and RELENG_8 too), Perl 5.8
+- or later (lang/perl5.8), and either MySQL 4.1 or later
+- (databases/mysql41-server) or PostgreSQL 7.4 or later
+- (databases/postgres74-server).
++ Recent DragonFly, Perl 5.8 or later (lang/perl5), and either
++ MySQL 5.0 or later (databases/mysql51-server) or
++ PostgreSQL 8.4 or later (databases/postgres84-server).
+
+ If MySQL is used, the MySQL Perl module must also be installed
+- (databases/p5-DBD-mysql41). If PostgreSQL is used, the Pg Perl
+- module must also be installed (databases/p5-DBD-Pg).
++ (databases/p5-DBD-mysql). If PostgreSQL is used, the Pg Perl
++ module must also be installed (databases/p5-DBD-postgresql).
+
+- Please note, however, that is is recommended that either MySQL 5.0
+- or PostgreSQL 8.1 (or later) be used. There are currently no plans
+- to make this a requirement, but it may happen in the future.
+-
+- PHP 4.x is now EOL, so the web front-end (found in the webui/
+- subdirectory) requires PHP 5 (lang/php5), PEAR::MDB2_Driver_mysql
+- (databases/pear-MDB2_Driver_mysql) or PEAR::MDB2_Driver_pgsql
+- (databases/pear-MDB2_Driver_pgsql), PHP Session
+- (www/php5-session), and one of the PHP MySQL
+- (databases/php5-mysql) or PHP Pgsql (databases/php5-pgsql)
+- depending on your choice of backend database above.
++ The web front-end (found in the webui/ subdirectory)
++ requires PHP 5 (lang/php5),
++ PEAR::MDB2_Driver_mysql (databases/pear-MDB2_Driver_mysql) or
++ PEAR::MDB2_Driver_pgsql (databases/pear-MDB2_Driver_pgsql),
++ and one of the PHP MySQL (databases/php-mysql) or
++ PHP Pgsql (databases/php-pgsql) depending on your choice of
++ backend database above.
+
+ If you will be sending emails from Tinderbox (e.g. build failure
+ or build completion emails) you must install net/p5-Net to get the
+@@ -218,12 +219,12 @@
+
+ 9. Tinderbox can use either NFS or nullfs to mount the required
+ file systems within the build chroots (called Builds in
+- Tinderbox). If you wish to use nullfs, skip to step 12.
++ Tinderbox). If you wish to use nullfs (default), skip to step 12.
+
+ 10. Setup the Tinderbox server as an NFS server by adding the
+ following to /etc/exports:
+
+- ${pb} -alldirs -maproot=0:0 localhost
++ ${pb} -alldirs -maproot=root localhost
+
+ Important: ${pb} CANNOT be a symlink. It should be a real,
+ fully qualified path (hint: use realpath on your desired
+@@ -238,84 +239,78 @@
+ nfs_server_enable="YES"
+ nfs_reserved_port_only="YES"
+
++ NullFS will still be used unless the mount point is defined, and
++ it's defined in the format server:directory.
++
+ 12. Create the required Jails using the tc command. A Jail is
+- nothing more than a version of FreeBSD. For example, to create
+- a Jail for FreeBSD 8.2-RELEASE:
++ nothing more than a version of DragonFly. For example, to create
++ a Jail for DragonFly 2.12-RELEASE:
+
+- # cd ${pb}/scripts && ./tc createJail -j 8.2 -d "FreeBSD 8.2-RELEASE" \
+- -t RELENG_8_2_0_RELEASE -u CVSUP
++ # cd ${pb}/scripts && ./tc createJail -j 2.12 -d "DragonFly 2.12-RELEASE" \
++ -t DragonFly_RELEASE_2_12 -u GIT
+
+ or
+
+- # cd ${pb}/scripts && ./tc createJail -j 8.2 -d "FreeBSD 8.2-RELEASE" \
+- -t 8.2-RELEASE -u LFTP -H ftp.freebsd.org
+-
+- The first method will download source via cvsup and use make
+- world to compile a complete FreeBSD installation.
++# cd ${pb}/scripts && ./tc createJail -j 2.12 -d "DragonFly 2.12-RELEASE" \
++ -t 2.12.1 -u RELEASE -H http://ftp.dragonflybsd.org/dragonflybsd
+
+- The second method will instead download binary release sets
+- (used on CDs) and install them, making the process much
+- shorter. As the command suggests, the second method requires
+- lftp (ftp/lftp) to be installed. You need to specify what
+- release (not the CVS tag, as opposed to the first method) you
+- want to download with the -t option. Also note that you need
+- to provide an FTP server to download the sets from (with the
+- -H option).
+-
+- Important: All Jail names MUST begin with their FreeBSD
+- major version number. That is, the following is an illegal
+- jail name: "FreeBSD-8.2".
+-
+- Tip: It is recommended that the Jail begin with the FreeBSD
+- major.minor version (i.e. "8.2-FreeBSD" instead of just
+- "8-FreeBSD") as this may prove useful when using things such
++ Note:The protocol for DragonFly host servers can be either
++ http or ftp. The protocol and the path up but not including the
++ repository directory must be provided. For the RELEASE type, the
++ directory is called "iso-images" and for the SNAPSHOT type the
++ directory is called "snapshots". For the RELEASE type, the <tag>
++ must be the release represented by three numbers in
++ <major.minor.point> format, and for the SNAPSHOT type, the <tag>
++ must either be the value "LATEST" for the latest snapshot or
++ in the pattern "YYYYMMDD-DEV-va.b.c.d.gxxxxxx" (YYYYMMDD is the
++ calendar date, a.b.c is major.minor.point release, d is an
++ index, and xxxxxx is the first 5 characters of the git commit hash.
++
++ The first method will download source via git and use
++ make world to compile a complete DragonFly installation.
++ The next method will download binary release and snapshot ISO
++ images and install them, making the process much shorter. You
++ can provide an alternative to the default FTP server to download
++ the sets from (with the -H option).
++
++ Important: All Jail names MUST begin with their DragonFly
++ major version number. That is, the following is an illegal
++ jail name: "DragonFly-2.12".
++
++ Tip: It is recommended that the Jail begin with the DragonFly
++ major.minor version (i.e. "2.12-DragonFly" instead of just
++ "2-DragonFly") as this may prove useful when using things such
+ as Hooks (Section 8.8).
+
+ 13. Create the required PortsTrees using the tc command. A
+ PortsTree is a set of ports you wish to build. A PortsTree
+- does not have to be a complete FreeBSD ports tree. However,
++ does not have to be a complete pkgsrc tree. However,
+ all ports within a tree must have all of their dependencies
+ within the same tree.
+
+- For example, to create a portstree that tracks the full
+- FreeBSD ports tree:
++ For example, to create a portstree based on 2011Q3 quarterly
++ branch that tracks the full pkgsrc tree:
++
++# cd ${pb}/scripts && ./tc createPortsTree -p pkgsrc \
++ -d "pkgsrc tree" \
++ -t "pkgsrc-2011Q3" \
++ -w http://cvsweb.se.netbsd.org/cgi-bin/bsdweb.cgi/pkgsrc/
+
+- # cd ${pb}/scripts && ./tc createPortsTree -p FreeBSD \
+- -d "FreeBSD ports tree" \
+- -w http://www.freebsd.org/cgi/cvsweb.cgi/ports/
++ Omit the "-t" option if you want the HEAD, or alternatively,
++ use -t "." instead.
+
+ 14. Create the required Builds using the tc command. A Build is a
+ combination of a Jail and a PortsTree. The build is the object
+ in which packages are created. To create a build that combines
+- a 8.2 Jail with the FreeBSD ports tree:
++ a 2.12 Jail with the DragonFly pkgsrc tree:
+
+- # cd ${pb}/scripts && ./tc createBuild -b 8.2-FreeBSD -j 8.2 \
+- -p FreeBSD -d "8.2-RELEASE with FreeBSD ports tree"
++# cd ${pb}/scripts && ./tc createBuild -b 2.12-DragonFly -j 2.12 \
++ -p pkgsrc -d "2.12-RELEASE with DragonFly pkgsrc tree"
+
+ Note: the recommended way to name Builds is "Jail-PortsTree".
+- All builds must also begin with their FreeBSD major version
++ All builds must also begin with their DragonFly major version
+ number.
+
+- Note: tc uses cvsup12 as its default cvsup mirror. If you would
+- like to use another server or enable cvsup compression use the
+- -H and -C line arguments to the tc script respectively. For
+- example, to use cvsup2.freebsd.org and enable cvsup compression
+- for all Jail updates, use the following command:
+-
+- # cd ${pb}/scripts && ./tc createJail -j 8-STABLE \
+- -d "FreeBSD 8-STABLE" -t RELENG_8 -u CVSUP -C \
+- -H cvsup2.freebsd.org
+-
+- Tip: It is possible to suppress spurious setuid warnings from
+- periodic if ${pb} is on a dedicated partition. Simply add the
+- nosuid flag to the partition; for UFS in /etc/fstab:
+-
+- /dev/ad5s1f /usr/local/tinderbox ufs rw,nosuid 1 1
+-
+- and for ZFS:
+-
+- # zfs set setuid=off $(zfs list ${pb} | tail -n 1 | cut -d ' ' -f 1)
+-
+ --------------------------------------------------------------
+
+ Chapter 4 Upgrading
+@@ -359,9 +354,9 @@
+ Where {BUILD} is the name of the Build for which this port should
+ be built and {PORT DIRECTORY} is the directory within the
+ PortsTree where this port can be found. For example, to build the
+- GNOME 2 Desktop port for the Build "8.2-FreeBSD":
++ Joe editor port for the Build "2.12-DragonFly":
+
+- # cd ${pb}/scripts && ./tc addPort -b 8.2-FreeBSD -d x11/gnome2
++ # cd ${pb}/scripts && ./tc addPort -b 2.12-DragonFly -d editors/joe
+
+ Note: A port does not have to be added to the database for
+ Tinderbox to build it. If you just want to do a quick ad hoc
+@@ -376,10 +371,9 @@
+
+ # cd ${pb}/scripts && ./tc tinderbuild -b {BUILD} {PORT DIRECTORY}
+
+- For example, to build the GNOME 2 Desktop for the Build
+- 8.2-FreeBSD:
++ For example, to build the Joe editor for the Build 2.12-DragonFly:
+
+- # cd ${pb}/scripts && ./tc tinderbuild -b 8.2-FreeBSD x11/gnome2
++# cd ${pb}/scripts && ./tc tinderbuild -b 2.12-DragonFly editors/joe
+
+ Tip: The example above will run the build in the foreground with
+ all messages and errors echoing to the terminal. To capture all
+@@ -388,13 +382,13 @@
+
+ * Bourne shell equivalents:
+
+- # cd ${pb}/scripts && ./tc tinderbuild -b 8.2-FreeBSD \
+- x11/gnome2 > ${pb}/builds/8.2-FreeBSD/build.log 2>&1 &
++# cd ${pb}/scripts && ./tc tinderbuild -b 2.12-DragonFly \
++ editors/joe > ${pb}/builds/2.12-DragonFly/build.log 2>&1 &
+
+ * C shell equivalents:
+
+- # cd ${pb}/scripts && ./tc tinderbuild -b 8.2-FreeBSD \
+- x11/gnome2 >& ${pb}/builds/8.2-FreeBSD/build.log &
++# cd ${pb}/scripts && ./tc tinderbuild -b 2.12-DragonFly \
++ editors/joe >& ${pb}/builds/2.12-DragonFly/build.log &
+
+ More advanced logging options are also available. All log files
+ including tinderbuild output, make logs, and individual port
+@@ -404,7 +398,7 @@
+ If set to a directory, a subdirectory will be created in the
+ format of {BUILD}-{DATE} where {BUILD} is the Build name, and
+ {DATE} is the date in the format YYYYMMDDHHMMSS (e.g.
+- 8.2-FreeBSD-20091012112105). Within this subdirectory will be
++ 2.6-DragonFly-20091012112105). Within this subdirectory will be
+ the tinderbuild log, and symlinks to the make logs and
+ individual port build logs. If you would rather have the log
+ files copied to this location (instead of using symlinks), set
+@@ -432,8 +426,6 @@
+ Table 5-2. tinderbuild Commands
+
+ -init updates the Jail then updates the Build
+- -nullfs uses nullfs instead of NFS to mount Jail and
+- PortsTree file systems
+ -cleanpackages removes all packages already built fors the
+ specified Build
+ -updateports updates the Build's PortsTree (NOTE: dangerous if
+@@ -472,23 +464,23 @@
+
+ To update existing Jails:
+
+- # cd ${pb}/scripts && ./tc makeJail -j 8.2
++ # cd ${pb}/scripts && ./tc makeJail -j 2.12
+
+ The output of the Jail build will go to stdout. The output of
+- update (e.g cvsup) will go to ${pb}/jails/{JAIL}/update.log (where
++ update (e.g git) will go to ${pb}/jails/{JAIL}/update.log (where
+ {JAIL} is the name of the Jail in question).
+
+ To update existing PortsTrees, use tc with the updatePortsTree
+ command. For example:
+
+- # cd ${pb}/scripts && ./tc updatePortsTree -p FreeBSD
++# cd ${pb}/scripts && ./tc updatePortsTree -p DragonFly
+
+ If you want to clone various aspects of an existing Build, use the
+ tc application with the copyBuild command. For example:
+
+- # cd ${pb}/scripts && ./tc copyBuild -s 8.2-FreeBSD -d 9-FreeBSD
++# cd ${pb}/scripts && ./tc copyBuild -s 2.12-DragonFly -d 2.13-DragonFly
+
+- The source and destination Builds (i.e. 8.2-FreeBSD and 9-FreeBSD
++ The source and destination Builds (i.e. 2.12-DFly and 2.13-DFly
+ respectively in this example) must already exist. By default,
+ copyBuild will copy the environment file, OPTIONS, and ports from
+ the source Build to the destination Build. It can also optionally
+@@ -597,47 +589,48 @@
+
+ 8.1 Alternative Means of Creating Jail Sources and PortsTrees
+
+- By default, Jails and PortsTrees are updated using csup
+- (/usr/bin/csup). Every time a new Jail or PortsTree is created,
+- they will inherit the default update type. This update type is
+- stored in ${pb}/scripts/etc/env/GLOBAL as defaultUpdateType. The
+- allowed values are CVSUP, CSUP, LFTP, USER, and NONE. For CVSUP
+- and CSUP there is also a defaultUpdateHost. This can also be
+- changed in ${pb}/scripts/etc/env/GLOBAL.
++ PortsTrees are updated using csup (/usr/pkg/bin/csup) and Jails
++ are updated by fetch or git. Variables controlling how these
++ are updated are stored at ${pb}/scripts/etc/env/GLOBAL:
++
++ defaultUpdateHost: The host name of the cvsup server that
++ creates and updates the NetBSD pkgsrc tree
++ defaultUpdateType: CSUP. Don't modify.
++ defaultDragonHost: The protocol + host + path-to-iso-images
++ directory that contains DragonFly release ISO
++ images. The protocol can be http:// or ftp://
++ and the path-to-iso-images (which does not
++ include "/iso-images") can be omitted if the
++ it's a top level directory.
++ defaultDragonType: RELEASE (for Release ISO)
++ SNAPSHOT (for daily build ISOs)
++ GIT (to build world from source)
++ defaultGitSrcHost: The host name of the DragonFly Git mirror
+
+ A Jail or PortsTree's update type can also be set when creating
+ the Jail or PortsTree. To do this, specify the -u option to the
+- appropriate create command. If the value of the update type is
+- CVSUP, then /usr/local/bin/cvsup will be used to update the Jail
+- or PortsTree. If the value is NONE, then no updates can be
++ appropriate create command. If the value is NONE, then no updates can be
+ performed once the Jail or PortsTree is created. Instead, it is
+ assumed these trees already exist in the appropriate format.
+
+ If the value is USER, then an update.sh script must be created
+ under the Jail or PortsTree's root directory. This script will be
+ called when an update is required. For example, if you have a Jail
+- called "8.2", an executable update.sh script must be placed under
+- ${pb}/jails/8.2. If you have a PortsTree called "FreeBSD", an
++ called "2.2", an executable update.sh script must be placed under
++ ${pb}/jails/2.2. If you have a PortsTree called "DragonFly", an
+ executable update.sh script must be placed under
+- ${pb}/portstrees/FreeBSD.
++ ${pb}/portstrees/DragonFly.
+
+ --------------------------------------------------------------
+
+ 8.2 Alternative Mounting
+
+ If you want to mount /ports inside your PortsTree or /src inside
+- your Jail via nullfs or NFS from another location, use -m switch
+- to create.
++ your Jail via NFS from another location, use -m switch to create.
+
+ Examples for NFS:
+-
+- # ./tc createPortsTree -p FreeBSD -m server:/directory
+- # ./tc createJail -j 8-FreeBSD -m server:/directory
+-
+- Examples for nullfs:
+-
+- # ./tc createPortsTree -p FreeBSD -m /directory
+- # ./tc createJail -j 8-FreeBSD -m /directory
++# ./tc createPortsTree -p DragonFly -m server:/directory
++# ./tc createJail -j 2.8-DragonFly -m server:/directory
+
+ Tinderbuild will ensure that these file systems are correctly
+ mounted so you do not need to mount them by your own before
+@@ -662,7 +655,7 @@
+
+ # ./tc configDistfile -c localhost:${distfiles}
+
+- * nullfs:
++ * nullfs (default):
+
+ # ./tc configDistfile -c ${distfiles}
+
+@@ -719,8 +712,8 @@
+ PERL_VERSION=5.6.2
+
+ Likewise, if you want to enable debugging for a particular
+- PortsTree (e.g. "FreeBSD-debug"), create the following
+- portstree.FreeBSD-debug in ${pb}/scripts/etc/env/:
++ PortsTree (e.g. "DragonFly-debug"), create the following
++ portstree.DragonFly-debug in ${pb}/scripts/etc/env/:
+
+ CFLAGS="-O -g -pipe"
+ STRIP=
+@@ -740,27 +733,14 @@
+
+ 8.7 Configuring port OPTIONS
+
+- It is possible to manipulate port OPTIONS on a per-Build basis. To
+- do this, create a directory under which all build OPTIONS
+- sub-directories will go (e.g. ${pb}/options/). For each Build that
+- you wish to use to use OPTIONS, create a subdirectory named for
+- that build (e.g. 8-STABLE-FreeBSD/). This directory should look
+- like /var/db/ports/ in that it contains sub-directories for each
+- OPTIONS-supporting port.
+-
+- For example, if you wanted to build net/wireshark with RTP support
+- for the Build 8-STABLE-FreeBSD, you would have the following
+- directory structure:
+-
+- ${pb}/options/8-STABLE-FreeBSD/wireshark/options
+-
+- The contents of the wireshark/options file would be:
+-
+- _OPTIONS_READ=wireshark-0.99.4
+- WITH_RTP=true
+- WITH_SNMP=true
+- WITH_ADNS=true
+- WITH_PCRE=true
++ It is possible to manipulate port OPTIONS on a per-Build basis.
++ To do this, create a directory under which all build OPTIONS
++ sub-directories will go (e.g. ${pb}/options/). For each Build
++ that you wish to use to use OPTIONS, create a subdirectory
++ named for that build (e.g. 2.12-DragonFly/), and place a single
++ text file named "pkg_options" in that directory. This file will
++ contain the customized options for every port in the build on a
++ per-distname basis.
+
+ Once this structure is setup, then enable OPTIONS support in
+ Tinderbox, and specify the path to the OPTIONS directory
+@@ -776,15 +756,52 @@
+
+ -e enable OPTIONS support
+ -d disable OPTIONS support
+- -o set an OPTIONS source directory tree
++ -o set an OPTIONS source directory tree
+
+- If you would like to interactively choose OPTIONS for your ports,
+- specify the -o option to "./tc addPort". This will perform a make
+- config on all ports, displaying the ncurses OPTIONS dialog. All
+- OPTIONS settings will be automatically saved to the correct
+- location. Each time addPort or rescanPorts is run with the -o
+- flag, all existing OPTIONS settings will be purged. If you want to
+- retain existing OPTIONS, use the -O flag instead.
++ As an example of a per-distname basis, net/wget-1.12 and
++ net/wget-1.13.4 are considered two separate ports. If you had set
++ the options for version 1.12, then you would have to create a new
++ entry for net/wget-1.13.4 when it's time to upgrade that port.
++
++ Each line reports a port, and the line format is as follows:
++ <PKGNAME>:<JOB OVERRIDE>:<PKGSRC OPTIONS>
++
++ The <PKGNAME> would be wget-1.13.4 in this example, not
++ wget-1.13.4nb2. Leave off the nbX suffixes, otherwise the entry
++ will be ignored.
++
++ The <JOB OVERRIDE> is normally empty. For single CPU systems,
++ there is no point to set this. SMP systems will assume a job
++ number of 2 * number of CPUs + 1. If the port crashes and it's
++ suspect that it's an jobs-unsafe issue, set <JOB OVERRIDE> to 1
++ and try the port again.
++
++ The <PKGSRC OPTIONS> is the same as you'd see in the
++ $LOCALBASE/etc/mk.conf file.
++
++ sample pkg_options file:
++ gawk-3.1.8::portals
++ gcc-4.6.1:5:-gcc-fortran -gcc-objc nls
++ heirloom-070715:1:
++
++ Note that heirloom doesn't use the options framework, but we
++ still need to have an entry for it to override the MAKE_JOBS.
++
++ Unique to Tinderbox/pkgsrc is a file named
++ ${pb}/scripts/lib/boilerplate_mk.conf, and it contains settings
++ for mk.conf that aren't found in the standard ISO/snapshot make.conf
++ files. For example, it sets all licenses to be skipped and to
++ build vulnerable ports. It should not be modified since the digest
++ hash won't match when it's time to deinstall tinderbox-dragonfly.
++
++ There is another way to add settings, but on a per-build basis. In the
++ same directory as the pkg_options file (${optionsDir}/${build}),
++ one may add a file named "more_mk.conf". This file gets appended
++ to the standard + boilerplate make.conf. It actively filters out
++ MAKE_JOBS and PKG_OPTIONS* settings. Remember, pkg_options takes care
++ of those. The file more_mk.conf should contain settings like:
++ PYTHON_VERSION_DEFAULT= 27
++ PGSQL_VERSION_DEFAULT= 90
+
+ --------------------------------------------------------------
+
+@@ -904,14 +921,14 @@
+
+ 8.11 Running Tinderbox in a Jail
+
+- Tinderbox can be run in a FreeBSD jail with some concessions.
++ Tinderbox can be run in a DragonFly jail with some concessions.
+
+ Since neither NFS nor nullfs (at the time of writing) are usable
+ in a jail, we cannot simply install and use as normal. Instead, we
+ simply use a chroot.
+
+ 1. Create a jail for your Tinderbox using the instructions in the
+- FreeBSD Handbook.
++ DragonFly Handbook.
+
+ 2. Install dependencies into the jail (Chapter 2).
+
+@@ -919,7 +936,7 @@
+
+ # mkdir ${pb}
+ # cd ${pb} && \
+- fetch -o - path_to_tinderbox-3.3.tar.gz | \
++ fetch -o - path_to_tinderbox-3.4.tar.gz | \
+ tar xvf -
+
+ 4. Now we need to leave the jail, and on the host system chroot
+@@ -938,7 +955,6 @@
+ tinderd_enable="YES"
+ tinderd_chroot="${jail_dir}"
+ tinderd_directory="${pb}"
+- tinderd_flags="-nullfs"
+
+ 7. Install a web server of your choice in the jail, and follow
+ the webserver setup.
diff --git a/pkgtools/tinderbox-dragonfly/patches/patch-as b/pkgtools/tinderbox-dragonfly/patches/patch-as
new file mode 100644
index 00000000000..4a38578f788
--- /dev/null
+++ b/pkgtools/tinderbox-dragonfly/patches/patch-as
@@ -0,0 +1,188 @@
+$NetBSD: patch-as,v 1.1 2011/11/02 21:13:27 marino Exp $
+
+--- ../FreeBSD/lib/tc_command.pl 2011-10-16 00:52:55.000000000 +0000
++++ lib/tc_command.pl
+@@ -1,4 +1,4 @@
+-#!/usr/bin/perl
++#!/usr/pkg/bin/perl
+ #-
+ # Copyright (c) 2004-2008 FreeBSD GNOME Team <freebsd-gnome@FreeBSD.org>
+ # All rights reserved.
+@@ -188,15 +188,15 @@ my $ds = new Tinderbox::TinderboxDS();
+ help =>
+ "Add a jail to the datastore (do NOT call this directly; use createJail instead)",
+ usage =>
+- "-j <jail name> -u CSUP|CVSUP|LFTP|USER|NONE -t <jail tag> [-d <jail description>] [-m <src mount source>] [-a <arch>]",
++ "-j <jail name> -u GIT|RELEASE|SNAPSHOT|USER|NONE -t <jail tag> [-d <jail description>] [-m <src mount source>] [-a <arch>]",
+ optstr => 'm:j:t:u:d:a:',
+ },
+ "addPortsTree" => {
+ func => \&addPortsTree,
+ help => "Add a portstree to the datastore",
+ usage =>
+- "-p <portstree name> -u CSUP|CVSUP|USER|NONE [-d <portstree description>] [-m <ports mount source>] [-w <CVSweb URL>]",
+- optstr => 'm:p:u:d:w:',
++ "-p <portstree name> [-t <cvs tag>] [-d <portstree description>] [-m <ports mount source>] [-w <CVSweb URL>]",
++ optstr => 'm:p:u:t:d:w:',
+ },
+ "addPort" => {
+ help => "Add a port to the datastore",
+@@ -240,9 +240,16 @@ my $ds = new Tinderbox::TinderboxDS();
+ func => \&getDependenciesForPort,
+ help => "Get stored dependencies for a given port and build",
+ usage =>
+- "-b <build name> -d <port directory> [-t EXTRACT_DEPENDS|PATCH_DEPENDS|FETCH_DEPENDS|BUILD_DEPENDS|LIB_DEPENDS|RUN_DEPENDS|TEST_DEPENDS]",
++ "-b <build name> -d <port directory> [-t BOOTSTRAP_DEPENDS|EXTRACT_DEPENDS|PATCH_DEPENDS|FETCH_DEPENDS|BUILD_DEPENDS|LIB_DEPENDS|RUN_DEPENDS|TEST_DEPENDS|DEPENDS]",
+ optstr => 'b:d:t:',
+ },
++ "getDependencyCascades" => {
++ func => \&getDependencyCascades,
++ help => "Get unique dependencies of port's dependencies, recursively",
++ usage =>
++ "-b <build name> -d <port directory>",
++ optstr => 'b:d:',
++ },
+ "listHooks" => {
+ func => \&listHooks,
+ help =>
+@@ -560,15 +567,15 @@ my $ds = new Tinderbox::TinderboxDS();
+ "createJail" => {
+ help => "Create a new jail",
+ usage =>
+- "-j <jailname> -u CSUP|CVSUP|LFTP|USER|NONE [-t <tag>] [-d <description>] [-C] [-H <updatehost>] [-m <mountsrc>] [-I] [-a <arch>]",
+- optstr => 'j:t:d:CH:m:u:Ia:',
++ "-j <jailname> -u GIT|RELEASE|SNAPSHOT|USER|NONE -t <tag> [-d <description>] [-H <updatehost>] [-m <mountsrc>] [-I]",
++ optstr => 'j:t:d:H:m:u:I:',
+ },
+
+ "createPortsTree" => {
+ help => "Create a new portstree",
+ usage =>
+- "-p <portstreename> -u CSUP|CVSUP|USER|NONE [-d <description>] [-C] [-H <updatehost>] [-m <mountsrc>] [-w <cvsweburl>] [-I]",
+- optstr => 'p:d:CH:Im:u:w:',
++ "-p <portstreename> [-t <cvs tag>] [-d <description>] [-C] [-H <updatehost>] [-m <mountsrc>] [-w <cvsweburl>] [-I]",
++ optstr => 'p:t:d:CH:Im:u:w:',
+ },
+
+ "createBuild" => {
+@@ -592,21 +599,21 @@ my $ds = new Tinderbox::TinderboxDS();
+
+ "resetBuild" => {
+ help => "Cleanup and reset a Build environment",
+- usage => "-b <buildname> [-n]",
+- optstr => 'b:n',
++ usage => "-b <buildname>",
++ optstr => 'b:',
+ },
+
+ "tinderbuild" => {
+ help => "Generate packages from an installed Build",
+ usage =>
+- "-b <build name> [-init] [-cleanpackages] [-updateports] [-skipmake] [-noclean] [-noduds] [-plistcheck] [-nullfs] [-cleandistfiles] [-fetch-original] [-onceonly] [portdir/portname [...]]",
++ "-b <build name> [-init] [-cleanpackages] [-updateports] [-skipmake] [-noclean] [-noduds] [-plistcheck] [-cleandistfiles] [-fetch-original] [-onceonly] [portdir/portname [...]]",
+ optstr => 'b:',
+ },
+
+ "updatePortsTree" => {
+ help => "Update an existing ports tree",
+ usage => "-p <portstreename>",
+- optstr => 'p',
++ optstr => 'p:',
+ },
+
+ "copyBuild" => {
+@@ -1489,7 +1496,7 @@ sub addPortsTree {
+ sub addPortToOneBuild {
+ my $build = $ds->getBuildByName($opts->{'b'});
+ my $makecache =
+- new Tinderbox::MakeCache($ENV{'PORTSDIR'}, $ENV{'PKGSUFFIX'});
++ new Tinderbox::MakeCache($ENV{'PORTSDIR'}, $ENV{'OPTNFILE'});
+ my @bports = ();
+
+ if (!$opts->{'d'}) {
+@@ -1524,6 +1531,8 @@ sub addPortToOneBuild {
+ LIB_DEPENDS => 'LibDepends',
+ RUN_DEPENDS => 'RunDepends',
+ TEST_DEPENDS => 'TestDepends',
++ BOOTSTRAP_DEPENDS => 'BootstrapDepends',
++ DEPENDS => 'Buildlink3Depends',
+ );
+
+ $ds->clearDependenciesForPort($pCls, $build, undef);
+@@ -1548,7 +1557,6 @@ sub addPortToOneBuild {
+ }
+ }
+ }
+-
+ }
+ }
+
+@@ -1600,7 +1608,7 @@ sub addBuildPortsQueueEntry {
+ $ds->addBuildPortsQueueEntry($build, $portdir, $priority,
+ $user_id);
+ if (!$rc) {
+- warn( "Failed to add port "
++ warn( "Failed to add port "
+ . $portdir
+ . " to the datastore: "
+ . $ds->getError()
+@@ -1720,6 +1728,8 @@ sub getDependenciesForPort {
+ LIB_DEPENDS => 4,
+ RUN_DEPENDS => 5,
+ TEST_DEPEND => 6,
++ BOOTSTRAP_DEPENDS => 7,
++ DEPENDS => 8,
+ );
+
+ if (!$opts->{'b'} || !$opts->{'d'}) {
+@@ -1773,6 +1783,50 @@ sub getDependenciesForPort {
+ );
+ }
+ }
++
++sub getDependencyCascades {
++ if (!$opts->{'b'} || !$opts->{'d'}) {
++ usage("getDependencyCascades");
++ }
++
++ my $port = $ds->getPortByDirectory($opts->{'d'});
++ if (!defined($port)) {
++ cleanup($ds, 1,
++ "Port, "
++ . $opts->{'d'}
++ . " is not in the datastore.\n");
++ }
++
++ if (!$ds->isValidBuild($opts->{'b'})) {
++ cleanup($ds, 1, "Unknown build, " . $opts->{'b'} . "\n");
++ }
++
++ my $build = $ds->getBuildByName($opts->{'b'});
++
++ if (!$ds->isPortForBuild($port, $build)) {
++ cleanup($ds, 1,
++ "Port, "
++ . $opts->{'d'}
++ . " is not a valid port for build, "
++ . $opts->{'b'}
++ . "\n");
++ }
++
++ my @deps = $ds->getDependencyCascades($port, $build);
++
++ if (@deps) {
++ map { print $_->getDirectory() . "\n" } @deps;
++ } elsif (defined($ds->getError())) {
++ cleanup($ds, 1,
++ "Failed to get cascading dependencies for this port from the datastore: "
++ . $ds->getError()
++ . "\n");
++ } else {
++ cleanup($ds, 0,
++ "There are no cascading dependencies for this port in the datastore.\n"
++ );
++ }
++}
+
+ sub listBuildPortsQueue {
+ my $build_filter;
diff --git a/pkgtools/tinderbox-dragonfly/patches/patch-at b/pkgtools/tinderbox-dragonfly/patches/patch-at
new file mode 100644
index 00000000000..9fd60955236
--- /dev/null
+++ b/pkgtools/tinderbox-dragonfly/patches/patch-at
@@ -0,0 +1,13 @@
+$NetBSD: patch-at,v 1.1 2011/11/02 21:13:28 marino Exp $
+
+--- ../FreeBSD/webui/templates/paefchen/list_buildports.tpl 2011-10-29 23:52:39.000000000 +0000
++++ webui/templates/paefchen/list_buildports.tpl
+@@ -19,7 +19,7 @@ include 'header.inc.tpl';
+ </tr>
+ <tr>
+ <th>System</th>
+- <td>FreeBSD <?php echo $jail_name?> (<?php echo $jail_tag?>)</td>
++ <td>DragonFly <?php echo $jail_name?> (<?php echo $jail_tag?>)</td>
+ <td><?php echo $jail_lastbuilt?></td>
+ </tr>
+ <tr>
diff --git a/pkgtools/tinderbox-dragonfly/patches/patch-au b/pkgtools/tinderbox-dragonfly/patches/patch-au
new file mode 100644
index 00000000000..f9913eac2c8
--- /dev/null
+++ b/pkgtools/tinderbox-dragonfly/patches/patch-au
@@ -0,0 +1,21 @@
+$NetBSD: patch-au,v 1.1 2011/11/02 21:13:28 marino Exp $
+
+--- ../FreeBSD/lib/enterbuild 2011-10-16 00:52:55.000000000 +0000
++++ lib/enterbuild
+@@ -30,14 +30,14 @@
+ portDir=$1
+ sleepName=$(echo ${portDir} | sed -e 'y/\//_/')
+
+-cd /usr/ports/${portDir}
++cd /usr/pkgsrc/${portDir}
+ . /tmp/.set_${sleepName}
+ for i in $(set | grep = | awk -F= '{ print $1 }') ; do
+ export ${i}
+ done
+
+ echo "Current directory is now $(pwd)."
+-echo "Workdir is set to ${WRKDIRPREFIX}/ports/${portDir}."
++echo "Workdir is set to ${WRKDIRPREFIX}/pkgsrc/${portDir}."
+ echo "Exit to continue the port build."
+
+ /bin/sh
diff --git a/pkgtools/tinderbox-dragonfly/patches/patch-av b/pkgtools/tinderbox-dragonfly/patches/patch-av
new file mode 100644
index 00000000000..ee24d09cf54
--- /dev/null
+++ b/pkgtools/tinderbox-dragonfly/patches/patch-av
@@ -0,0 +1,88 @@
+$NetBSD: patch-av,v 1.1 2011/11/02 21:13:28 marino Exp $
+
+--- ../FreeBSD/lib/makemake 2011-10-16 00:52:55.000000000 +0000
++++ lib/makemake
+@@ -1,4 +1,4 @@
+-#!/usr/bin/perl
++#!/usr/pkg/bin/perl
+ #-
+ # Copyright (c) 2004-2005 FreeBSD GNOME Team <freebsd-gnome@FreeBSD.org>
+ # All rights reserved.
+@@ -135,11 +135,11 @@ if (!scalar(@ARGV)) {
+ my (
+ %pkgdir, %pkgdeps, %pkgedeps, %pkgpdeps, %pkgfdeps,
+ %pkgbdeps, %pkgrdeps, @duds, $portbase, $makecache,
+- %pkgtdeps,
++ %pkgtdeps, %pkgsdeps,
+ );
+
+ $portbase = $ENV{'PORTSDIR'};
+-$makecache = new Tinderbox::MakeCache($portbase, $ENV{'PKGSUFFIX'});
++$makecache = new Tinderbox::MakeCache($portbase, $ENV{'OPTNFILE'});
+
+ while (scalar(@PORTS)) {
+ my $port = shift @PORTS;
+@@ -162,14 +162,15 @@ while (scalar(@PORTS)) {
+ $pkgname = $makecache->PkgName($portdir);
+
+ # Create a list of duds (ports that will not be attempted because they
+- # are marked IGNORE or FORBIDDEN).
++ # are marked _CBBH (aka not for this platform) ).
+ if (!$noduds) {
+ my $dudpkg = $makecache->IgnoreList($portdir);
+ push @duds, $dudpkg if ($dudpkg);
+ }
+
+- my (@edeps, @pdeps, @fdeps, @bdeps, @rdeps, @tdeps) = ();
++ my (@sdeps, @edeps, @pdeps, @fdeps, @bdeps, @rdeps, @tdeps) = ();
+ $pkgdeps{$portdir} = [];
++ $pkgsdeps{$portdir} = [];
+ $pkgedeps{$portdir} = [];
+ $pkgpdeps{$portdir} = [];
+ $pkgfdeps{$portdir} = [];
+@@ -177,6 +178,7 @@ while (scalar(@PORTS)) {
+ $pkgrdeps{$portdir} = [];
+ $pkgtdeps{$portdir} = [];
+ $pkgdir{$portdir} = $pkgname;
++ push @sdeps, $makecache->BootstrapDependsList($portdir);
+ push @edeps, $makecache->ExtractDependsList($portdir);
+ push @pdeps, $makecache->PatchDependsList($portdir);
+ push @fdeps, $makecache->FetchDependsList($portdir);
+@@ -184,6 +186,7 @@ while (scalar(@PORTS)) {
+ push @rdeps, $makecache->RunDependsList($portdir);
+ push @tdeps, $makecache->TestDependsList($portdir);
+
++ findRunDepends(\@sdeps, \%pkgsdeps, $portdir, $makecache, \@PORTS);
+ findRunDepends(\@edeps, \%pkgedeps, $portdir, $makecache, \@PORTS);
+ findRunDepends(\@pdeps, \%pkgpdeps, $portdir, $makecache, \@PORTS);
+ findRunDepends(\@fdeps, \%pkgfdeps, $portdir, $makecache, \@PORTS);
+@@ -192,6 +195,7 @@ while (scalar(@PORTS)) {
+ findRunDepends(\@tdeps, \%pkgtdeps, $portdir, $makecache, \@PORTS);
+
+ foreach my $depport (
++ @{$pkgsdeps{$portdir}},
+ @{$pkgedeps{$portdir}}, @{$pkgpdeps{$portdir}},
+ @{$pkgfdeps{$portdir}}, @{$pkgbdeps{$portdir}},
+ @{$pkgrdeps{$portdir}}, @{$pkgtdeps{$portdir}},
+@@ -216,6 +220,7 @@ cleanup($ds, 1, "Failed to open $builddi
+ foreach my $key (keys %pkgdir) {
+ my $pname = $pkgdir{$key} . $ENV{'PKGSUFFIX'};
+ my $pkgnames = makeList(\%pkgdir, 1, $makecache, @{$pkgdeps{$key}});
++ my $sdeplst = makeList(\%pkgdir, 1, $makecache, @{$pkgsdeps{$key}});
+ my $edeplst = makeList(\%pkgdir, 1, $makecache, @{$pkgedeps{$key}});
+ my $pdeplst = makeList(\%pkgdir, 1, $makecache, @{$pkgpdeps{$key}});
+ my $fdeplst = makeList(\%pkgdir, 1, $makecache, @{$pkgfdeps{$key}});
+@@ -229,9 +234,10 @@ foreach my $key (keys %pkgdir) {
+ printf MK "\t@%s %s %s %s %s %s ",
+ tinderLoc($pb, 'scripts', 'lib/portbuild'), $BUILD_NAME, $JAIL_NAME,
+ $PORTSTREE_NAME, $ENV{'PORTBUILD_ARGS'};
+- printf MK "\"%s\" \"%s\" \"%s\" \"%s\" \"%s\" \"%s\" ", $edeplst, $pdeplst,
+- $fdeplst, $bdeplst, $rdeplst, $tdeplst;
+- printf MK "%s /usr/ports/%s\n", $pname, $key;
++ printf MK "\"%s\" \"%s\" \"%s\" \"%s\" \"%s\" \"%s\" \"%s\" ",
++ $edeplst, $pdeplst, $fdeplst, $bdeplst, $rdeplst, $tdeplst,
++ $sdeplst;
++ printf MK "%s /usr/pkgsrc/%s\n", $pname, $key;
+ }
+
+ close(MK);
diff --git a/pkgtools/tinderbox-dragonfly/patches/patch-aw b/pkgtools/tinderbox-dragonfly/patches/patch-aw
new file mode 100644
index 00000000000..c842c32795c
--- /dev/null
+++ b/pkgtools/tinderbox-dragonfly/patches/patch-aw
@@ -0,0 +1,237 @@
+$NetBSD: patch-aw,v 1.1 2011/11/02 21:13:29 marino Exp $
+
+--- ../FreeBSD/lib/Tinderbox/MakeCache.pm 2011-10-16 00:52:55.000000000 +0000
++++ lib/Tinderbox/MakeCache.pm
+@@ -31,14 +31,14 @@ use strict;
+
+ # a list of variables that we pull from the port Makefile
+ our @makeTargets = (
+- 'PKGNAME', 'IGNORE',
+- 'NO_PACKAGE', 'FORBIDDEN',
++ 'PKGNAME', '_CBBH',
+ 'EXTRACT_DEPENDS', 'PATCH_DEPENDS',
+ 'FETCH_DEPENDS', 'BUILD_DEPENDS',
+ 'LIB_DEPENDS', 'RUN_DEPENDS',
+ 'TEST_DEPENDS', 'MAINTAINER',
+- 'COMMENT', 'PORTNAME',
+- 'DISTFILES',
++ 'COMMENT', 'PKGBASE',
++ 'DISTFILES', 'BOOTSTRAP_DEPENDS',
++ 'DEPENDS'
+ );
+
+ # Create a new cache object
+@@ -48,6 +48,7 @@ sub new {
+ CACHE => undef,
+ SEEN => undef,
+ BASEDIR => shift,
++ OPTFILE => shift,
+ }, $name;
+
+ $self;
+@@ -60,13 +61,18 @@ sub _execMake {
+ my $self = shift;
+ my $port = shift;
+ my @ret;
+- my $tmp;
++ my $target;
++ my $tmp = '';
+
+ return if ($self->{SEEN}->{$port} eq 1);
+
+- $tmp = '-V ' . join(' -V ', @makeTargets);
++ foreach $target (@makeTargets) {
++ $tmp .= "-V '\${" . $target . "}' ";
++ }
+ my $dir = $self->{BASEDIR} . '/' . $port;
+- @ret = split("\n", `cd $dir && make $tmp`);
++ my $customOptions = $self->_package_options ($dir);
++ my $nativeOptions = $self->_native_preferences ();
++ @ret = split("\n", `cd $dir && bmake $customOptions $nativeOptions $tmp`);
+
+ foreach $tmp (@makeTargets) {
+ $self->{CACHE}->{$port}{$tmp} = shift @ret;
+@@ -74,6 +80,66 @@ sub _execMake {
+ $self->{SEEN}->{$port} = 1;
+ }
+
++# Get option variable name and requested options
++sub _package_options {
++ my $self = shift;
++ my $dir = shift;
++ unless (-e $self->{OPTFILE}) {
++ return "";
++ }
++ my @data = split("\n",
++ `cd $dir && bmake -V '\${PKGNAME}' -V '\${PKG_OPTIONS_VAR}'`);
++ my $pkname = $data[0];
++ my $optvar = $data[1];
++ $pkname =~ s/nb[0-9]+$//;
++ my $instruction = `grep ^$pkname: $self->{OPTFILE}`;
++ unless ($instruction) {
++ return "";
++ }
++ my @customSet = split(/:/, $instruction);
++ unless (scalar (@customSet) >= 3) {
++ return "";
++ }
++ return $optvar . '="' . $customSet[2] . '"';
++}
++
++# Recreate a trim function
++sub _trim {
++ my $self = shift;
++ my $string = shift;
++ $string =~ s/^\s+//;
++ $string =~ s/\s+$//;
++ return $string;
++}
++
++# Figure out if we want to avoid built-in dependencies or not
++sub _native_preferences {
++ my $self = shift;
++ my $moremk = $self->{OPTFILE};
++ $moremk =~ s!/?[^/]*/*$!!;
++ $moremk .= '/more_mk.conf';
++ unless (-e $moremk) {
++ return "";
++ }
++ my @worker;
++ my $result = "";
++ my $ppkgsrc=`grep PREFER_PKGSRC $moremk`;
++ my $pnative=`grep PREFER_NATIVE $moremk`;
++ if ($ppkgsrc) {
++ @worker = split(/=/, $ppkgsrc);
++ if (scalar (@worker) >= 2) {
++ $result = 'PREFER_PKGSRC="' . $self->_trim($worker[1]) . '" ';
++ }
++ }
++ if ($pnative) {
++ @worker = split(/=/, $pnative);
++ if (scalar (@worker) >= 2) {
++ $result .= 'PREFER_NATIVE="' . $self->_trim($worker[1]) . '"';
++ }
++ }
++ return $result;
++}
++
+ # Internal function for returning a port variable
+ sub _getVariable {
+ my $self = shift;
+@@ -90,16 +156,28 @@ sub _getList {
+ my $port = shift;
+ my $item = shift;
+ my @deps;
++ my $found;
+
+ $self->_execMake($port);
+ foreach my $dep (split(/\s+/, $self->{CACHE}->{$port}{$item})) {
++ $dep =~ s/^\s+//;
++ $dep =~ s/\s+$//;
+ my ($d, $ddir) = split(/:/, $dep);
+- if (!defined($ddir) || $item eq 'DEPENDS') {
++ if (!defined($ddir)) {
+ $ddir = $d;
+ }
+ $ddir =~ s|^$self->{BASEDIR}/||;
++ $ddir =~ s|^\.\.\/\.\.\/||;
+ if ($ddir) {
+- push @deps, $ddir;
++ $found = 0;
++ foreach my $storedep (@deps) {
++ if ($storedep eq $ddir) {
++ $found = 1;
++ }
++ }
++ if (!$found) {
++ push @deps, $ddir;
++ }
+ }
+ }
+ return @deps;
+@@ -109,7 +187,7 @@ sub _getList {
+ sub Name {
+ my $self = shift;
+ my $port = shift;
+- return $self->_getVariable($port, 'PORTNAME');
++ return $self->_getVariable($port, 'PKGBASE');
+ }
+
+ # Package name
+@@ -133,6 +211,20 @@ sub Maintainer {
+ return $self->_getVariable($port, 'MAINTAINER');
+ }
+
++# Bootstrap dependencies
++sub BootstrapDepends {
++ my $self = shift;
++ my $port = shift;
++ return $self->_getList($port, 'BOOTSTRAP_DEPENDS');
++}
++
++# Buildlink3 dependencies
++sub Buildlink3Depends {
++ my $self = shift;
++ my $port = shift;
++ return $self->_getList($port, 'DEPENDS');
++}
++
+ # Extract dependencies
+ sub ExtractDepends {
+ my $self = shift;
+@@ -189,8 +281,8 @@ sub IgnoreList {
+
+ my $n = 0;
+ $self->_execMake($port);
+- foreach my $var ('NO_PACKAGE', 'IGNORE', 'FORBIDDEN') {
+- $n++ if ($self->{CACHE}->{$port}{$var} ne "");
++ foreach my $var ('_CBBH') {
++ $n++ if ($self->{CACHE}->{$port}{$var} ne "yes");
+ }
+ return $n eq 0 ? "" : $self->PkgName($port);
+ }
+@@ -206,6 +298,28 @@ sub FetchDependsList {
+ return grep { !$uniq{$_}++ } @deps;
+ }
+
++sub BootstrapDependsList {
++ my $self = shift;
++ my $port = shift;
++
++ my @deps;
++ push(@deps, $self->BootstrapDepends($port));
++
++ my %uniq;
++ return grep { !$uniq{$_}++ } @deps;
++}
++
++sub Buildlink3DependsList {
++ my $self = shift;
++ my $port = shift;
++
++ my @deps;
++ push(@deps, $self->Buildlink3Depends($port));
++
++ my %uniq;
++ return grep { !$uniq{$_}++ } @deps;
++}
++
+ sub ExtractDependsList {
+ my $self = shift;
+ my $port = shift;
+@@ -250,6 +364,7 @@ sub BuildDependsList {
+ push(@deps, $self->FetchDepends($port));
+ push(@deps, $self->BuildDepends($port));
+ push(@deps, $self->LibDepends($port));
++ push(@deps, $self->Buildlink3Depends($port));
+
+ my %uniq;
+ return grep { !$uniq{$_}++ } @deps;
+@@ -263,6 +378,7 @@ sub RunDependsList {
+ my @deps;
+ push(@deps, $self->LibDepends($port));
+ push(@deps, $self->RunDepends($port));
++ push(@deps, $self->Buildlink3Depends($port));
+
+ my %uniq;
+ return grep { !$uniq{$_}++ } @deps;
diff --git a/pkgtools/tinderbox-dragonfly/patches/patch-ax b/pkgtools/tinderbox-dragonfly/patches/patch-ax
new file mode 100644
index 00000000000..a1d7a5b70d5
--- /dev/null
+++ b/pkgtools/tinderbox-dragonfly/patches/patch-ax
@@ -0,0 +1,13 @@
+$NetBSD: patch-ax,v 1.1 2011/11/02 21:13:29 marino Exp $
+
+--- ../FreeBSD/sql/schema.pgsql.pre 2011-10-16 00:52:55.000000000 +0000
++++ sql/schema.pgsql.pre
+@@ -101,7 +101,7 @@ CREATE TABLE port_dependencies (
+ port_dependency_id SERIAL PRIMARY KEY,
+ build_port_id INTEGER REFERENCES build_ports(build_port_id) ON UPDATE CASCADE ON DELETE CASCADE,
+ port_id INTEGER REFERENCES ports(port_id) ON UPDATE CASCADE ON DELETE CASCADE,
+- dependency_type VARCHAR(16) CHECK (dependency_type IN ('UNKNOWN', 'EXTRACT_DEPENDS', 'PATCH_DEPENDS', 'FETCH_DEPENDS', 'BUILD_DEPENDS', 'LIB_DEPENDS', 'DEPENDS', 'RUN_DEPENDS')) DEFAULT 'UNKNOWN'
++ dependency_type VARCHAR(18) CHECK (dependency_type IN ('UNKNOWN', 'BOOTSTRAP_DEPENDS', 'EXTRACT_DEPENDS', 'PATCH_DEPENDS', 'FETCH_DEPENDS', 'BUILD_DEPENDS', 'LIB_DEPENDS', 'DEPENDS', 'RUN_DEPENDS')) DEFAULT 'UNKNOWN'
+ );
+ CREATE INDEX port_dependencies_build_port_id_idx ON port_dependencies(build_port_id);
+ CREATE INDEX port_dependencies_port_id_idx ON port_dependencies(port_id);
diff --git a/pkgtools/tinderbox-dragonfly/patches/patch-ay b/pkgtools/tinderbox-dragonfly/patches/patch-ay
new file mode 100644
index 00000000000..f92bac6f8eb
--- /dev/null
+++ b/pkgtools/tinderbox-dragonfly/patches/patch-ay
@@ -0,0 +1,13 @@
+$NetBSD: patch-ay,v 1.1 2011/11/02 21:13:29 marino Exp $
+
+--- ../FreeBSD/sql/schema.mysql.pre 2011-10-16 00:52:55.000000000 +0000
++++ sql/schema.mysql.pre
+@@ -104,7 +104,7 @@ CREATE TABLE port_dependencies (
+ port_dependency_id SERIAL PRIMARY KEY,
+ build_port_id INTEGER REFERENCES build_port(build_port_id) ON UPDATE CASCADE ON DELETE CASCADE,
+ port_id INTEGER REFERENCES ports(port_id) ON UPDATE CASCADE ON DELETE CASCADE,
+- dependency_type ENUM('UNKNOWN', 'EXTRACT_DEPENDS', 'PATCH_DEPENDS', 'FETCH_DEPENDS', 'BUILD_DEPENDS', 'LIB_DEPENDS', 'DEPENDS', 'RUN_DEPENDS') DEFAULT 'UNKNOWN'
++ dependency_type ENUM('UNKNOWN', 'BOOTSTRAP_DEPENDS', 'EXTRACT_DEPENDS', 'PATCH_DEPENDS', 'FETCH_DEPENDS', 'BUILD_DEPENDS', 'LIB_DEPENDS', 'DEPENDS', 'RUN_DEPENDS') DEFAULT 'UNKNOWN'
+ );
+ CREATE INDEX port_dependencies_build_port_id_idx ON port_dependencies(build_port_id);
+ CREATE INDEX port_dependencies_port_id_idx ON port_dependencies(port_id);
diff --git a/pkgtools/tinderbox-dragonfly/patches/patch-az b/pkgtools/tinderbox-dragonfly/patches/patch-az
new file mode 100644
index 00000000000..9d30d4eaa4f
--- /dev/null
+++ b/pkgtools/tinderbox-dragonfly/patches/patch-az
@@ -0,0 +1,101 @@
+$NetBSD: patch-az,v 1.1 2011/11/02 21:13:30 marino Exp $
+
+--- ../FreeBSD/lib/Tinderbox/TinderboxDS.pm 2011-10-16 00:52:55.000000000 +0000
++++ lib/Tinderbox/TinderboxDS.pm
+@@ -753,6 +753,96 @@ sub clearDependenciesForPort {
+ return $rc;
+ }
+
++sub getDependencyCascades_search {
++ my $self = shift;
++ my $build_id = shift;
++ my $port_id = shift;
++ my $typelimit = shift;
++
++ my @results = ();
++ my @params = ($build_id, $port_id);
++ my $query = "SELECT build_port_id " .
++ "FROM build_ports " .
++ "WHERE build_id=? AND port_id=?";
++ my $rc = $self->_doQueryHashRef($query, \@results, @params);
++ if (!$rc) {
++ return undef;
++ }
++ my $build_port_id = $results[0]->{'build_port_id'};
++
++ @results = ();
++ @params = ($build_port_id);
++ $query = "SELECT port_id " .
++ "FROM port_dependencies " .
++ "WHERE build_port_id=? ";
++
++ if ($typelimit) {
++ $query .= "AND dependency_type IN " .
++ "('DEPENDS','RUN_DEPENDS','LIB_DEPENDS')";
++ }
++
++ $rc = $self->_doQueryHashRef($query, \@results, @params);
++ if (!$rc) {
++ return undef;
++ }
++
++ my @deps = ();
++ foreach my $result (@results) {
++ push @deps, $result->{'port_id'};
++ }
++ return @deps;
++}
++
++sub getDependencyCascades {
++ my $self = shift;
++ my $port = shift;
++ my $build = shift;
++
++ $self->verifyType(1, $port, 'Port');
++ $self->verifyType(2, $build, 'Build');
++
++ my $pkg;
++ my @CascadeSet = ();
++ my %CheckList = ($port->getId(), 1);
++ my @FirstList = $self->getDependencyCascades_search (
++ $build->getId(), $port->getId(), 0);
++ foreach $pkg(@FirstList) {
++ $CheckList{$pkg} = 0;
++ }
++ my $cascadePkg;
++ my @NextList;
++ my @mandate = @FirstList;
++ my $advance = (scalar keys %CheckList > 0);
++ while ($advance) {
++ foreach $pkg (@mandate) {
++ $CheckList{$pkg} = 1;
++ @NextList = $self->getDependencyCascades_search (
++ $build->getId(), $pkg, 1);
++ foreach $cascadePkg (@NextList) {
++ if (!exists $CheckList{$cascadePkg}) {
++ $CheckList{$cascadePkg} = 0;
++ push @CascadeSet, $cascadePkg;
++ }
++ }
++ }
++ @mandate = ();
++ $advance = 0;
++ foreach $pkg (keys %CheckList) {
++ if ($CheckList{$pkg} == 0) {
++ push @mandate, $pkg;
++ $advance = 1;
++ }
++ }
++ }
++
++ my @deps = ();
++ foreach $pkg (@CascadeSet) {
++ my $pCls = $self->getPortById($pkg);
++ push @deps, $pCls if (defined($pCls));
++ }
++ return @deps;
++}
++
+ sub getDependenciesForPort {
+ my $self = shift;
+ my $port = shift;
diff --git a/pkgtools/tinderbox-dragonfly/patches/patch-ba b/pkgtools/tinderbox-dragonfly/patches/patch-ba
new file mode 100644
index 00000000000..5d072207f36
--- /dev/null
+++ b/pkgtools/tinderbox-dragonfly/patches/patch-ba
@@ -0,0 +1,19 @@
+$NetBSD: patch-ba,v 1.1 2011/11/02 21:13:30 marino Exp $
+
+--- ../FreeBSD/tc 2011-10-16 00:52:55.000000000 +0000
++++ tc
+@@ -87,12 +87,12 @@ copyBuild|\
+ tbversion|\
+ updatePortsTree)
+ ${command} ${1+"$@"} || \
+- perl ${pb}/scripts/lib/tc_command.pl ${command} ${1+"$@"}
++ /usr/pkg/bin/perl ${pb}/scripts/lib/tc_command.pl ${command} ${1+"$@"}
+ rc=$?
+ ;;
+
+ # Otherwise we punt over to the perl dispatcher
+-*) perl ${pb}/scripts/lib/tc_command.pl ${command} ${1+"$@"}
++*) /usr/pkg/bin/perl ${pb}/scripts/lib/tc_command.pl ${command} ${1+"$@"}
+ rc=$?
+ ;;
+
diff --git a/pkgtools/tinderbox-dragonfly/patches/patch-bb b/pkgtools/tinderbox-dragonfly/patches/patch-bb
new file mode 100644
index 00000000000..24a80fb81da
--- /dev/null
+++ b/pkgtools/tinderbox-dragonfly/patches/patch-bb
@@ -0,0 +1,78 @@
+$NetBSD: patch-bb,v 1.1 2011/11/02 21:13:31 marino Exp $
+
+--- ../FreeBSD/webui/templates/paefchen/tinderstyle.css 2011-10-16 00:52:55.000000000 +0000
++++ webui/templates/paefchen/tinderstyle.css
+@@ -17,14 +17,18 @@ body, td, li, input, select, label, #con
+
+ a:link, a:visited {
+ color : #900;
++ text-decoration : none;
++ margin : 2px 4px;
+ }
+
++
+ a:hover {
+- color : #000;
++ color : #C30;
++ text-decoration : underline;
+ }
+
+ table {
+- background-color : #EEE;
++ background-color : #F7F7F7;
+ border-collapse : collapse;
+ border-color : #CACACA;
+ border-spacing : 0;
+@@ -69,6 +73,12 @@ input[type="submit"] {
+ border-width : 1px 2px 2px 1px;
+ }
+
++#member {
++ margin-left : 10px;
++ color : #666;
++ font-weight : bold;
++}
++
+ input:focus, input:hover, select:focus, select:hover {
+ background-color : #FFF;
+ }
+@@ -237,7 +247,7 @@ label {
+ }
+
+ td.port_success {
+- background-color : #E8FFE8;
++ background-color : #BEFEEB;
+ }
+ td.port_dud {
+ background-color : yellow;
+@@ -263,11 +273,11 @@ td.port_depend {
+ background-color : #FFA500;
+ }
+ td.port_default {
+- background-color : #808080;
++ background-color : #C0C0C0;
+ }
+
+ td.build_portbuild {
+- background-color : green;
++ background-color : #3C9;
+ }
+ td.build_prepare {
+ background-color : #ADD8E6;
+@@ -276,13 +286,13 @@ td.build_default {
+ }
+
+ td.queue_entry_enqueued {
+- background-color : #808080;
++ background-color : #C0C0C0;
+ }
+ td.queue_entry_processing {
+- background-color : green;
++ background-color : #3C9;
+ }
+ td.queue_entry_success {
+- background-color : #E8FFE8;
++ background-color : #BEFEEB;
+ }
+ td.queue_entry_fail {
+ background-color : red;
diff --git a/pkgtools/tinderbox-dragonfly/patches/patch-bc b/pkgtools/tinderbox-dragonfly/patches/patch-bc
new file mode 100644
index 00000000000..20876a7973c
--- /dev/null
+++ b/pkgtools/tinderbox-dragonfly/patches/patch-bc
@@ -0,0 +1,25 @@
+$NetBSD: patch-bc,v 1.1 2011/11/02 21:13:31 marino Exp $
+
+--- ../FreeBSD/webui/templates/paefchen/header.inc.tpl 2011-10-16 00:52:55.000000000 +0000
++++ webui/templates/paefchen/header.inc.tpl
+@@ -19,11 +19,6 @@ if (preg_match('@<!-- (\w+):(\w+);(\w+):
+ <div class="left">
+ <h1><a href="index.php"><?php echo $tinderbox_title?></a><?php if (! empty($header_title)) print " - ".$header_title; ?></h1>
+ </div>
+- <div class="right">
+- <?php if (! empty($user_name)) { ?>
+- <h1>Welcome <?php echo $user_name?>!</h1>
+- <?php } ?>
+- </div>
+ </div>
+ <div id="topmenu">
+ <a id="top"></a>
+@@ -46,7 +41,7 @@ if (preg_match('@<!-- (\w+):(\w+);(\w+):
+ <li><a href="index.php?action=display_add_user">Add User</a></li>
+ <?php } ?>
+ <li><a href="index.php?action=display_modify_user&amp;modify_user_id=<?php echo $user_id?>">Modify Me</a></li>
+- <li><input type="submit" name="do_logout" value="Logout" /></li>
++ <li><input type="submit" name="do_logout" value="Logout" id="logout_ctrl"/><span id="member"><?php echo $user_name ?></span></li>
+ <?php } ?>
+ </ul>
+ </form>
diff --git a/pkgtools/tinderbox-dragonfly/patches/patch-be b/pkgtools/tinderbox-dragonfly/patches/patch-be
new file mode 100644
index 00000000000..2162eb68826
--- /dev/null
+++ b/pkgtools/tinderbox-dragonfly/patches/patch-be
@@ -0,0 +1,11 @@
+$NetBSD: patch-be,v 1.1 2011/11/02 21:13:32 marino Exp $
+
+--- /dev/null
++++ lib/boilerplate_mk.conf
+@@ -0,0 +1,6 @@
++### HEAD: BOILERPLATE MK.CONF SETTINGS ###
++
++SKIP_LICENSE_CHECK= yes
++ALLOW_VULNERABLE_PACKAGES= yes
++
++### TAIL: BOILERPLATE MK.CONF SETTINGS ###