From: Sascha Wildner Date: Tue, 28 Oct 2014 17:46:34 +0000 (+0100) Subject: Remove various pkgsrc remains. X-Git-Url: https://gitweb.dragonflybsd.org/~nant/dragonfly.git/commitdiff_plain/45fa0bf89f1d861380af8c3559584d0dada250f5 Remove various pkgsrc remains. * Remove pkgsrcaudit periodic script. * Remove pkg_radd(1) and pkg_search. pkg(8) will do. * Remove pkgsrc(7) manual page. * Remove test/fastbulk (meant to be a faster alternative to pbulk but it never took off). * Remove searching of /usr/pkgsrc searching via whereis(1). * Various small adjustments. --- diff --git a/Makefile_upgrade.inc b/Makefile_upgrade.inc index 1c25f18ac6..4ed69d3893 100644 --- a/Makefile_upgrade.inc +++ b/Makefile_upgrade.inc @@ -2670,6 +2670,16 @@ TO_REMOVE+=/usr/share/man/man4/savagedrm.4.gz TO_REMOVE+=/usr/share/man/man4/sisdrm.4.gz TO_REMOVE+=/usr/share/man/man4/tdfx.4.gz TO_REMOVE+=/usr/share/man/man4/tdfxdrm.4.gz +TO_REMOVE+=/etc/periodic/security/670.pkgsrcaudit +TO_REMOVE+=/etc/pkg_radd.conf +TO_REMOVE+=/usr/bin/pkg_radd +TO_REMOVE+=/usr/bin/pkg_search +TO_REMOVE+=/usr/share/man/cat1/pkg_radd.1.gz +TO_REMOVE+=/usr/share/man/man1/pkg_radd.1.gz +TO_REMOVE+=/usr/share/man/cat1/pkg_search.1.gz +TO_REMOVE+=/usr/share/man/man1/pkg_search.1.gz +TO_REMOVE+=/usr/share/man/cat7/pkgsrc.7.gz +TO_REMOVE+=/usr/share/man/man7/pkgsrc.7.gz .if ${MACHINE_ARCH} == "x86_64" TO_REMOVE+=/usr/sbin/stlstats diff --git a/doc/porting_drivers.txt b/doc/porting_drivers.txt index 7e529f7ddb..cabc6fd1eb 100644 --- a/doc/porting_drivers.txt +++ b/doc/porting_drivers.txt @@ -5,7 +5,7 @@ /usr/src/sys/dev/disk/blah in DragonFly. * Keep all the SVN IDs in the files as a future reference point. dports' SVN - will do that by default. When using pkgsrc's SVN client, please note the + will do that by default. When using the FreeBSD git repo, please note the files' IDs manually, either in the files themselves or in the commit message. The general idea is that it must not get lost. diff --git a/etc/defaults/periodic.conf b/etc/defaults/periodic.conf index 77ae2941fe..8e71c19283 100644 --- a/etc/defaults/periodic.conf +++ b/etc/defaults/periodic.conf @@ -175,11 +175,6 @@ daily_status_security_ip6fwdenied_enable="YES" # 650.ip6fwlimit daily_status_security_ip6fwlimit_enable="YES" -# 670.pkgsrcaudit -daily_status_pkgsrc_fetch_vulnerabilities="YES" -daily_status_pkgsrc_audit_enable="YES" -daily_status_pkgsrc_check_signatures="YES" - # 700.kernelmsg daily_status_security_kernelmsg_enable="YES" diff --git a/etc/periodic/security/670.pkgsrcaudit b/etc/periodic/security/670.pkgsrcaudit deleted file mode 100644 index 79bcba2a38..0000000000 --- a/etc/periodic/security/670.pkgsrcaudit +++ /dev/null @@ -1,79 +0,0 @@ -#!/bin/sh - -# -# Copyright (c) 2010 The DragonFly Project -# All rights reserved. -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions -# are met: -# 1. Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. -# 2. Redistributions in binary form must reproduce the above copyright -# notice, this list of conditions and the following disclaimer in the -# documentation and/or other materials provided with the distribution. -# -# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND -# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE -# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS -# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) -# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY -# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF -# SUCH DAMAGE. -# - -if [ ! -f /usr/pkg/sbin/pkg_info ]; then - exit 0 -fi - -# If there is a global system configuration file, suck it in. -# -if [ -r /etc/defaults/periodic.conf ] -then - . /etc/defaults/periodic.conf - source_periodic_confs -fi - -PATH=$PATH:/usr/pkg/sbin -pkgdb_dir=${pkgdb_dir:-/var/db/pkg} - -if pkg_info -K ${pkgdb_dir} -q -E '*'; then - case "$daily_status_pkgsrc_fetch_vulnerabilities" in - [Yy][Ee][Ss]) - echo "" - echo 'Fetching package vulnerabilities database:' - pkg_admin -K ${pkgdb_dir} fetch-pkg-vulnerabilities -u - rc0=$? - ;; - *) rc0=0; - esac - case "$daily_status_pkgsrc_audit_enable" in - [Yy][Ee][Ss]) - echo "" - echo 'Checking pkgsrc packages for vulnerabilities:' - pkg_admin -K ${pkgdb_dir} audit - rc1=$? - ;; - *) rc1=0; - esac - case "$daily_status_pkgsrc_check_signatures" in - [Yy][Ee][Ss]) - echo "" - echo 'Checking pkgsrc file signatures:' - pkg_admin -K ${pkgdb_dir} check - rc2=$? - ;; - *) rc2=0 - esac - if [ $rc0 -gt 0 ] || [ $rc1 -gt 0 ] || [ $rc2 -gt 0 ]; then - rc=1 - else - rc=0 - fi -else - rc=0 -fi -exit "$rc" diff --git a/etc/periodic/security/Makefile b/etc/periodic/security/Makefile index 555ba788bc..92e74e2569 100644 --- a/etc/periodic/security/Makefile +++ b/etc/periodic/security/Makefile @@ -10,7 +10,6 @@ FILES= 100.chksetuid \ 550.ipfwlimit \ 600.ip6fwdenied \ 650.ip6fwlimit \ - 670.pkgsrcaudit \ 700.kernelmsg \ 800.loginfail \ 900.tcpwrap \ diff --git a/etc/pkg_radd.conf b/etc/pkg_radd.conf deleted file mode 100644 index e9682b6071..0000000000 --- a/etc/pkg_radd.conf +++ /dev/null @@ -1,9 +0,0 @@ -# This config file controls where pkg_radd looks for pkgsrc binaries. -# The example here is the default. -# Consult the dragonflybsd.org website for a list of mirrors. -# The path should lead to a directory containing the architectures, -# like 'i386' and x86_64. The correct arch and DragonFly version is -# automatically appended to the path by pkg_radd. -# -# BINPKG_BASE=http://mirror-master.dragonflybsd.org/packages -# diff --git a/lib/libc/gen/dlvsym.3 b/lib/libc/gen/dlvsym.3 index ff03d03224..ba043c2e54 100644 --- a/lib/libc/gen/dlvsym.3 +++ b/lib/libc/gen/dlvsym.3 @@ -31,7 +31,7 @@ .\" .\" $FreeBSD: src/lib/libc/gen/dlopen.3 211397 2010-08-16 15:18:30Z joel $ .\" -.Dd April 28, 2011 +.Dd October 10, 2014 .Dt DLVSYM 3 .Os .Sh NAME @@ -83,8 +83,8 @@ main (int argc, char *argv[]) void *handle; int (*func_sum)(int a, int b); - /* open the pkgsrc shared gcc library */ - handle = dlopen("/usr/pkg/lib/libgcc_s.so", RTLD_LAZY); + /* open the dports shared gcc410 library */ + handle = dlopen("/usr/local/lib/gcc410/libgcc_s.so", RTLD_LAZY); if (!handle) { fprintf (stderr, "%s\en", dlerror ()); exit (EXIT_FAILURE); diff --git a/nrelease/root/README b/nrelease/root/README index 733021e263..9d2a7f07e0 100644 --- a/nrelease/root/README +++ b/nrelease/root/README @@ -338,19 +338,19 @@ asking for help. - OBTAINING A PKGSRC TREE TO BUILD/INSTALL PACKAGES + OBTAINING A DPORTS TREE TO BUILD/INSTALL PACKAGES - In order to obtain a reasonably current snapshot of the pkgsrc tree, use + In order to obtain a reasonably current snapshot of the dports tree, use our repo: cd /usr make help - make pkgsrc-create + make dports-create This tree can then be kept up to date with: cd /usr - make pkgsrc-update + make dports-update EMERGENCY RECOVERY FROM THE 'Live CD' diff --git a/share/man/man5/periodic.conf.5 b/share/man/man5/periodic.conf.5 index 113cf7b290..d12d93de78 100644 --- a/share/man/man5/periodic.conf.5 +++ b/share/man/man5/periodic.conf.5 @@ -25,7 +25,7 @@ .\" .\" $FreeBSD: src/share/man/man5/periodic.conf.5,v 1.8.2.22 2003/02/08 21:42:01 gshapiro Exp $ .\" -.Dd January 24, 2010 +.Dd October 10, 2014 .Dt PERIODIC.CONF 5 .Os .Sh NAME @@ -562,23 +562,6 @@ Set to to display .Xr ip6fw 8 rules that have reached their verbosity limit. -.It Va daily_status_pkgsrc_audit_enable -.Pq Vt bool -Set to -.Dq YES -to check the currently installed packages against a database of known -vulnerabilities and report those that are vulnerable. -.It Va daily_status_pkgsrc_check_signatures -.Pq Vt bool -Set to -.Dq YES -to check the digital signature of all files installed by packages against -the expected values stored in the packages database. -.It Va daily_status_pkgsrc_fetch_vulnerabilities -.Pq Vt bool -Set to -.Dq YES -to refresh the local database of package vulnerabilities. .It Va daily_status_security_kernelmsg_enable .Pq Vt bool Set to diff --git a/share/man/man7/Makefile b/share/man/man7/Makefile index f361e01cf9..4c8fe8948f 100644 --- a/share/man/man7/Makefile +++ b/share/man/man7/Makefile @@ -16,7 +16,6 @@ MAN= ascii.7 \ mailaddr.7 \ nls.7 \ operator.7 \ - pkgsrc.7 \ release.7 \ script.7 \ security.7 \ diff --git a/share/man/man7/build.7 b/share/man/man7/build.7 index 33daf690b5..96faa50637 100644 --- a/share/man/man7/build.7 +++ b/share/man/man7/build.7 @@ -286,7 +286,6 @@ will tell you to do so. .Xr make.conf 5 , .Xr development 7 , .Xr dports 7 , -.Xr pkgsrc 7 , .Xr release 7 , .Xr config 8 , .Xr reboot 8 , diff --git a/share/man/man7/hier.7 b/share/man/man7/hier.7 index eb27269a12..683a51b7d5 100644 --- a/share/man/man7/hier.7 +++ b/share/man/man7/hier.7 @@ -28,7 +28,7 @@ .\" @(#)hier.7 8.1 (Berkeley) 6/5/93 .\" $FreeBSD: src/share/man/man7/hier.7,v 1.29.2.17 2003/01/13 21:43:50 ceri Exp $ .\" -.Dd March 6, 2014 +.Dd October 10, 2014 .Dt HIER 7 .Os .Sh NAME @@ -360,33 +360,6 @@ and architecture-specific target tree produced by building the .Pa /usr/src tree -.It Pa pkg/ -default destination directory for the -.Xr pkgsrc 7 -collection. -Within -.Pa pkg/ , -the general layout sketched out by -.Xr hier 7 -for -.Pa /usr -should be used. -Exceptions are the -.Pa man/ -directory (directly under -.Pa pkg/ -rather than under -.Pa pkg/share/ ) , -documentation (in -.Pa share/doc// ) , -and -.Pa /usr/pkg/etc -.Pf ( mimics -.Pa /etc ) . -.It Pa pkgsrc/ -The -.Xr pkgsrc 7 -collection (optional). .It Pa sbin/ system daemons & system utilities (executed by users) .It Pa share/ diff --git a/share/man/man7/pkgsrc.7 b/share/man/man7/pkgsrc.7 deleted file mode 100644 index ee8b65746c..0000000000 --- a/share/man/man7/pkgsrc.7 +++ /dev/null @@ -1,80 +0,0 @@ -.\" $NetBSD: pkgsrc.7,v 1.4 2007/09/05 15:29:10 rillig Exp $ -.\" $DragonFly: src/share/man/man7/pkgsrc.7,v 1.3 2008/04/30 21:45:28 swildner Exp $ -.\" -.\" Copyright (c) 2007 The NetBSD Foundation, Inc. -.\" All rights reserved. -.\" -.\" This code is derived from software contributed to The NetBSD Foundation -.\" by Thomas Klausner. -.\" -.\" Redistribution and use in source and binary forms, with or without -.\" modification, are permitted provided that the following conditions -.\" are met: -.\" 1. Redistributions of source code must retain the above copyright -.\" notice, this list of conditions and the following disclaimer. -.\" 2. Redistributions in binary form must reproduce the above copyright -.\" notice, this list of conditions and the following disclaimer in the -.\" documentation and/or other materials provided with the distribution. -.\" -.\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS -.\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED -.\" TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -.\" PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS -.\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -.\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -.\" POSSIBILITY OF SUCH DAMAGE. -.\" -.Dd May 9, 2009 -.Dt PKGSRC 7 -.Os -.Sh NAME -.Nm pkgsrc -.Nd NetBSD packages collection (framework for third-party software) -.Sh DESCRIPTION -The -.Nx -Packages Collection -.Nm ( ) -is a framework for building and maintaining third-party software on -.Nx , -.Dx -and other -.Ux Ns -like -systems. -It is used to enable freely available software to be configured -and built easily on supported platforms. -.Pp -Tools are available to install ready-to-use packages and to perform -various administrative tasks for the package system. -.Pp -For building packages from source, -.Pa /usr/Makefile -offers a number of targets to checkout and update the -.Nm -and -.Nm pkgsrc-wip -trees. -.Sq Nm cd Pa /usr ; Nm make Ar help -gives a quick overview. -.Pp -Note that due to compatibility issues -.Xr bmake 1 -has to be used instead of -.Xr make 1 -for -.Nm -related tasks. -.Sh SEE ALSO -.Xr pkg_add 1 , -.Xr pkg_delete 1 , -.Xr pkg_info 1 , -.Xr pkg_radd 1 , -.Xr pkg_search 1 -.Pp -.Pa http://www.NetBSD.org/docs/pkgsrc/ -.Pp -.Pa http://pkgsrc-wip.sourceforge.net/ diff --git a/test/fastbulk/Makefile b/test/fastbulk/Makefile deleted file mode 100644 index 01a46e0927..0000000000 --- a/test/fastbulk/Makefile +++ /dev/null @@ -1,238 +0,0 @@ -# Makefile for fastbulk - fast incremental pkgsrc bulk [re]build -# -# deinstall _UPDATE_RUNNING=YES DEINSTALLDEPENDS=ALL -# package -# show-depends (output format wildcard:relative_path_to_pkgsrc_dir) - -BUILDBASE=/build/fastbulk -BUILDROOT=${BUILDBASE}/root -SYSPKGSRC=/usr/pkgsrc -SYSROOT=/ -CHROOTENV=chroot ${BUILDROOT} /bin/sh -c -NPARALLEL?= 8 -# -DNOTMPFS - -all: - @echo "fastbulk build options" - @echo " make init - create/initialize topology" - @echo " make build - build all packages from sources" - @echo " make quick - incremental build restart" - @echo " make umount - umount the build environment" - @echo " make cleanup - umount, rm binpkgs and pkgs" - @echo "" - @echo " make changes - deinstall modified packages" - @echo " make destroy - destroy the fastbulk setup" - @echo "" - @echo "make variables (defaults shown):" - @echo "" - @echo " BUILDBASE=/build/fastbulk all fastbulk-generated files" - @echo " SYSPKGSRC=/usr/pkgsrc where to get pkgsrc from" - @echo " SYSROOT=/ rootenv to replicate" - @echo " NPARALLEL=8 maximum concurrency" - @echo "" - @echo "NOTE: ${BUILDBASE}/{distfiles,packages} are normally retained" - @echo " to avoid having to re-pull and for incremental operation." - @echo " 'build' will delete all packages, 'quick' will not." - @echo "" - @echo "NOTE: When building, the current progress is in " - @echo " ${BUILDROOT}/tmp/logs/{run,good,bad}. Each build" - @echo " has its own log file named after the pkgsrc path." - -init: umount initialize mount - -build: umount mount bootstrap - ${CHROOTENV} "cd /tmp/track; ./fastbulk -j ${NPARALLEL} /usr/pkgsrc" - -quick: umount mount quickstrap - ${CHROOTENV} "cd /tmp/track; ./fastbulk -j ${NPARALLEL} /usr/pkgsrc" - -cleanup: umount - cpdup -i0 -s0 -o ${BUILDBASE}/packages ${BUILDBASE}/packages.save - find -x ${BUILDBASE}/packages -depth -depth +0 -delete - find -x ${BUILDBASE}/track -depth -depth +0 -delete - find -x ${BUILDBASE}/bin -depth -depth +0 -delete - find -x ${BUILDBASE}/tmp/logs -depth -depth +0 -delete - find -x ${BUILDBASE}/var.db.pkg -depth -depth +0 -delete - find -x ${BUILDBASE}/var.db.pkg.refcount -depth -depth +0 -delete - find -x ${BUILDBASE}/usr.pkg -depth -depth +0 -delete - rm -rf ${BUILDBASE}/usr.obj/work - mkdir -p ${BUILDBASE}/tmp/logs/run - mkdir -p ${BUILDBASE}/tmp/logs/good - mkdir -p ${BUILDBASE}/tmp/logs/bad - -destroy: umount - rm -rf ${BUILDBASE} - -umount: - -resident -d ${BUILDROOT}/usr/pkg/bin/bmake - -umount ${BUILDROOT}/usr/pkgsrc/distfiles > /dev/null 2>&1 - -umount ${BUILDROOT}/usr/pkgsrc/packages > /dev/null 2>&1 - -umount ${BUILDROOT}/usr/pkgsrc > /dev/null 2>&1 - -umount ${BUILDROOT}/dev > /dev/null 2>&1 - -umount ${BUILDROOT}/var/db/pkg.refcount > /dev/null 2>&1 - -umount ${BUILDROOT}/var/db/pkg > /dev/null 2>&1 - -umount ${BUILDROOT}/var/db > /dev/null 2>&1 - -umount ${BUILDROOT}/usr/obj > /dev/null 2>&1 - -umount ${BUILDROOT}/usr/pkg > /dev/null 2>&1 - -umount ${BUILDROOT}/etc > /dev/null 2>&1 - -umount ${BUILDROOT}/var/tmp > /dev/null 2>&1 - -umount ${BUILDROOT}/tmp/track > /dev/null 2>&1 - -umount ${BUILDROOT}/tmp > /dev/null 2>&1 - -umount ${BUILDROOT}/var > /dev/null 2>&1 - -umount ${BUILDROOT}/usr > /dev/null 2>&1 - -umount ${BUILDROOT} > /dev/null 2>&1 - -mount: - mount_null -o ro ${SYSROOT} ${BUILDROOT} - mount_null -o ro ${SYSROOT}/usr ${BUILDROOT}/usr - mount_null -o ro ${SYSROOT}/var ${BUILDROOT}/var - mount_null ${BUILDBASE}/tmp ${BUILDROOT}/tmp - mount_null ${BUILDBASE}/tmp ${BUILDROOT}/var/tmp - mount_null ${BUILDBASE}/track ${BUILDROOT}/tmp/track - mount_null ${BUILDBASE}/etc ${BUILDROOT}/etc - mount_null ${BUILDBASE}/usr.pkg ${BUILDROOT}/usr/pkg - mount_null ${BUILDBASE}/usr.pkgsrc ${BUILDROOT}/usr/pkgsrc -.if defined(NOTMPFS) - mount_null ${BUILDBASE}/usr.obj ${BUILDROOT}/usr/obj -.else - mount_tmpfs dummy ${BUILDROOT}/usr/obj -.endif - mount_null ${BUILDBASE}/var.db ${BUILDROOT}/var/db - mount_null ${BUILDBASE}/var.db.pkg ${BUILDROOT}/var/db/pkg - mount_null ${BUILDBASE}/var.db.pkg.refcount \ - ${BUILDROOT}/var/db/pkg.refcount - mount_null ${SYSROOT}/dev ${BUILDROOT}/dev - mount_null ${BUILDBASE}/packages ${BUILDROOT}/usr/pkgsrc/packages - mount_null ${BUILDBASE}/distfiles ${BUILDROOT}/usr/pkgsrc/distfiles - -resident ${BUILDROOT}/usr/pkg/bin/bmake > /dev/null 2>&1 - -initialize: - # - # The real root must contain these directories so - # we can do NULL mounts on them. - # - mkdir -p ${SYSROOT}/var/db/pkg - mkdir -p ${SYSROOT}/var/db/pkg.refcount - mkdir -p ${SYSROOT}/usr/pkgsrc - mkdir -p ${SYSROOT}/usr/pkg - mkdir -p ${BUILDBASE} - # - # buildbase directory structure (this is not the chroot topology) - # - mkdir -p ${BUILDBASE} - mkdir -p ${BUILDBASE}/packages - mkdir -p ${BUILDBASE}/packages.save - mkdir -p ${BUILDBASE}/distfiles - mkdir -p ${BUILDBASE}/bin - mkdir -p ${BUILDBASE}/tmp - mkdir -p ${BUILDBASE}/tmp/track - mkdir -p ${BUILDBASE}/tmp/logs - mkdir -p ${BUILDBASE}/tmp/logs/run - mkdir -p ${BUILDBASE}/tmp/logs/good - mkdir -p ${BUILDBASE}/tmp/logs/bad - mkdir -p ${BUILDBASE}/etc - mkdir -p ${BUILDBASE}/usr.pkg - mkdir -p ${BUILDBASE}/usr.pkgsrc - mkdir -p ${BUILDBASE}/usr.obj - mkdir -p ${BUILDBASE}/var.db - mkdir -p ${BUILDBASE}/var.db/pkg - mkdir -p ${BUILDBASE}/var.db/pkg.refcount - mkdir -p ${BUILDBASE}/var.db.pkg - mkdir -p ${BUILDBASE}/var.db.pkg.refcount - mkdir -p ${BUILDBASE}/track - # - # Copy stuff we need, make sure the pkgsrc copy we - # make has the needed mount points for packages and distfiles. - # - cpdup -s0 -i0 ${SYSROOT}/etc ${BUILDBASE}/etc - cpdup -s0 -i0 -X ${.CURDIR}/vardb.ign \ - ${SYSROOT}/var/db ${BUILDBASE}/var.db - cpdup -s0 -i0 -X ${.CURDIR}/pkgsrc.ign \ - ${SYSPKGSRC} ${BUILDBASE}/usr.pkgsrc - mkdir -p ${BUILDBASE}/usr.pkgsrc/packages - mkdir -p ${BUILDBASE}/usr.pkgsrc/distfiles - mkdir -p ${BUILDROOT} - #find -x -X ${BUILDROOT}/usr/pkgsrc -name work | xargs rm -rf - -# quickstrap - get ready to start a fastbulk build -# -# NOTE: ${BUILDROOT}/usr/obj might be mounted from a tmpfs and not -# from ${BUILDBASE}/usr.obj -# -quickstrap: prestage - rm -rf ${BUILDBASE}/usr.obj/work - rm -rf ${BUILDROOT}/usr/obj/work - rm -rf ${BUILDROOT}/tmp/logs/run - rm -rf ${BUILDROOT}/tmp/logs/bad - mkdir -p ${BUILDROOT}/tmp/logs/run - mkdir -p ${BUILDROOT}/tmp/logs/bad - mkdir -p ${BUILDROOT}/usr/obj/work - # - # Sometimes we get blah.core files in /var/db/pkg, which - # interferes with pkg_add. Make sure they are gone. - # - find ${BUILDROOT}/var/db/pkg -name '*.core' -delete - find ${BUILDROOT}/var/db/pkg -type d -depth 1 -delete - -bootstrap: quickstrap - -resident -d ${BUILDROOT}/usr/pkg/bin/bmake - cpdup -i0 -s0 -o ${BUILDBASE}/packages ${BUILDBASE}/packages.save - find -x ${BUILDBASE}/packages -depth -depth +0 -delete - find -x ${BUILDBASE}/usr.pkgsrc/packages -depth -depth +0 -delete - find -x ${BUILDBASE}/var.db.pkg -depth -depth +0 -delete - find -x ${BUILDBASE}/var.db.pkg.refcount -depth -depth +0 -delete - find -x ${BUILDBASE}/usr.pkg -depth -depth +0 -delete - # note: work dir might be either tmpfs or null mount - #${CHROOTENV} "pkg_admin -K /var/db/pkg fetch-pkg-vulnerabilities" - #${CHROOTENV} "pkg_admin rebuild" - rm -rf ${BUILDROOT}/usr/obj/work - ${CHROOTENV} "cd /usr/pkgsrc/bootstrap; ./bootstrap --workdir=/usr/obj/work" - -resident ${BUILDROOT}/usr/pkg/bin/bmake > /dev/null 2>&1 - cat mk.conf.add >> ${BUILDROOT}/usr/pkg/etc/mk.conf - -# Figure out what has changed and deinstall the related packages -# - -PRESTAGE= ${BUILDBASE}/bin/getpkgsrcdir -PRESTAGE+= ${BUILDBASE}/bin/fastbulk -PRESTAGE+= ${BUILDBASE}/track/Makefile -PRESTAGE+= ${BUILDBASE}/track/dochanges -PRESTAGE+= ${BUILDBASE}/track/dobuild -PRESTAGE+= ${BUILDBASE}/track/fastbulk - -prestage: ${PRESTAGE} - -changes: ${PRESTAGE} - @if [ ! -f ${BUILDBASE}/track/dochanges ]; then \ - touch ${BUILDBASE}/track/dochanges; fi - @if [ ! -f ${BUILDBASE}/track/changes.raw ]; then \ - touch ${BUILDBASE}/track/changes.raw; fi - ( cat ${BUILDBASE}/track/changes.raw; \ - find ${SYSPKGSRC} -mnewer ${BUILDBASE}/track/dochanges ) | \ - sort | uniq | ${BUILDBASE}/bin/getpkgsrcdir ${SYSPKGSRC} | \ - sort | uniq > ${BUILDBASE}/track/changes.raw.new - mv ${BUILDBASE}/track/changes.raw.new ${BUILDBASE}/track/changes.raw - ${BUILDBASE}/bin/getpkgsrcdir -s ${SYSPKGSRC} < \ - ${BUILDBASE}/track/changes.raw > \ - ${BUILDBASE}/track/changes.txt - cp Makefile ${BUILDBASE}/track/Makefile - ${CHROOTENV} "cd /tmp/track; ./dochanges" - - -${BUILDBASE}/bin/getpkgsrcdir: getpkgsrcdir.c - cc getpkgsrcdir.c -o ${BUILDBASE}/bin/getpkgsrcdir - -${BUILDBASE}/bin/fastbulk: fastbulk.c - cc fastbulk.c -o ${BUILDBASE}/bin/fastbulk - -${BUILDBASE}/track/Makefile: ${.CURDIR}/Makefile - cp -p ${.CURDIR}/Makefile ${BUILDBASE}/track/Makefile - -${BUILDBASE}/track/dochanges: ${.CURDIR}/dochanges - cp -p ${.CURDIR}/dochanges ${BUILDBASE}/track/dochanges - -${BUILDBASE}/track/dobuild: ${.CURDIR}/dobuild - cp -p ${.CURDIR}/dobuild ${BUILDBASE}/track/dobuild - -${BUILDBASE}/track/fastbulk: ${BUILDBASE}/bin/fastbulk - cp -p ${BUILDBASE}/bin/fastbulk ${BUILDBASE}/track/fastbulk diff --git a/test/fastbulk/dobuild b/test/fastbulk/dobuild deleted file mode 100755 index 1353a32ef0..0000000000 --- a/test/fastbulk/dobuild +++ /dev/null @@ -1,140 +0,0 @@ -#!/bin/csh -# -# This is run from the chroot via fastbulk, which has CDd -# into a particular pkgsrc directory and wants us to build it. -# The script is run as /tmp/track/dobuild - -set logname = "$argv[1]" - -# We do not want to interfere with builds of other versions -# of the same package, use a temporary lock file to prevent a -# conflict. -# -if ( $#argv == 1 ) then - set pkgwild = "`bmake show-var VARNAME=PKGWILDCARD`.lck" - set pkgname = "`bmake show-var VARNAME=PKGNAME`" - - if ( -f /usr/pkgsrc/packages/All/${pkgname}.tgz ) then - if ( -f /tmp/logs/good/$logname ) then - rm -f /tmp/logs/run/$logname - echo "FASTBULK QUICK ${logname}: `date`" \ - >> /tmp/logs/good/$logname - echo "FASTBULK: Package already exists, will not build" \ - >> /tmp/logs/good/$logname - else - echo "FASTBULK: Package already exists, will not build" - endif - exit 0 - endif - - mkdir -p /tmp/track/locks - echo "FASTBULK START ${argv[1]}: `date`" - lockf "/tmp/track/locks/$pkgwild" /tmp/track/dobuild ${argv[1]} "$pkgwild" - if ( $status == 0 ) then - echo "FASTBULK SUCCESS ${argv[1]}: `date`" - exit 0 - else - echo "FASTBULK FAILURE ${argv[1]}: `date`" - find /var/db/pkg/$pkgname -name '*.core' -delete - rmdir /var/db/pkg/$pkgname >& /dev/null - exit 1 - endif -endif - -# Get the package name and clean up any garbage that might -# interfere with the build. -# -set pkgname = "`bmake show-var VARNAME=PKGNAME`" -set pkgwild = "$argv[2]" -unsetenv PKG_PATH - -# Make sure /var/db/pkg/ does not have any .core files messing it up, -# remove the recorded installation if it becomes empty. -# -find /var/db/pkg/$pkgname -name '*.core' -delete -rmdir /var/db/pkg/$pkgname >& /dev/null - -# Check if already installed, prevent overwrite of -# previous run's logfile if it exists, by deleting -# the current run file. Else put in a simple logfile. -# -pkg_info -q -e $pkgname -if ( $status == 0 ) then - if ( -f /tmp/logs/good/$logname ) then - rm -f /tmp/logs/run/$logname - endif - echo "(already installed from previous run)" - exit 0 -endif - -# Delete potential conflicts -# -pkg_delete -r "$pkgwild" - -# If we already have a binary package just install -# it. -# -if ( -f /usr/pkgsrc/packages/All/${pkgname}.tgz ) then - echo "(found in /usr/pkgsrc/packages)" - bmake deinstall DEINSTALLDEPENDS=ALL SKIP_LICENSE_CHECK=yes - setenv PKG_PATH /usr/pkgsrc/packages/All - echo "pkg_add -f ${pkgname}" - pkg_add -f ${pkgname} - exit $status -endif - -# We need to build the package. -# -# Delete any conflicting installed packages or the one we want to build -# will refuse to build. The binary package files are left intact. -# -foreach i ( `bmake show-var VARNAME=CONFLICTS` ) - echo "DELETING CONFLICTING PACKAGE: $i" - pkg_delete -r "$i" -end - -# If the dist file checksum fails and the dist file is over -# 4 hours old we re-download it. -# - -set dollar = '$' -set distfiles = "`bmake -V '${dollar}{DISTFILES}'`" -bmake checksum SKIP_LICENSE_CHECK=yes -if ( $status != 0 ) then - echo "Deleting distfiles ( $distfiles ) if over 4h old" - foreach dfile ( $distfiles ) - find /usr/pkgsrc/distfiles -name "$dfile" -mtime +4h -delete - end -endif - -# To ensure a clean build deinstall anything that -# may cause our build repackage to fail. -# -# Clean after repackaging to keep the work topology footprint small. -# -# We create a binary package and then pkg_add it. -# -bmake deinstall DEINSTALLDEPENDS=ALL SKIP_LICENSE_CHECK=yes -bmake repackage SKIP_LICENSE_CHECK=yes -if ( $status == 0 ) then - bmake clean SKIP_LICENSE_CHECK=yes - setenv PKG_PATH /usr/pkgsrc/packages/All - echo "pkg_add -f ${pkgname}" - pkg_add -f ${pkgname} - if ( $status != 0 ) then - if ( -f ${PKG_PATH}/${pkgname}.tgz ) then - echo "FASTBULK WARNING: Cannot install due to probable conflicts" - echo " but the binary package DID build." - echo " Exiting w/code 0 to mark as successful." - else - exit 1 - endif - endif - exit 0 -endif - -# comment this bmake out if you want to keep the work dir -# for failed builds. -# -bmake clean SKIP_LICENSE_CHECK=yes -exit 1 diff --git a/test/fastbulk/dochanges b/test/fastbulk/dochanges deleted file mode 100755 index a4df188498..0000000000 --- a/test/fastbulk/dochanges +++ /dev/null @@ -1,14 +0,0 @@ -#!/bin/csh -# -# This is run from the chroot - -foreach pkgsrcdir ( `cat /tmp/track/changes.txt` ) - echo "DEINSTALLING ${pkgsrcdir}" - pushd /usr/pkgsrc/${pkgsrcdir} - bmake clean - set pkgname = "`bmake show-var VARNAME=PKGNAME`" - bmake deinstall DEINSTALLDEPENDS=ALL - bmake package-eat-cookie - rm -f /usr/pkgsrc/packages/*/${pkgname}.tgz ) - popd -end diff --git a/test/fastbulk/fastbulk.c b/test/fastbulk/fastbulk.c deleted file mode 100644 index 174dc490d8..0000000000 --- a/test/fastbulk/fastbulk.c +++ /dev/null @@ -1,654 +0,0 @@ -/* - * Copyright (c) 2010 The DragonFly Project. All rights reserved. - * - * This code is derived from software contributed to The DragonFly Project - * by Matthew Dillon - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * 3. Neither the name of The DragonFly Project nor the names of its - * contributors may be used to endorse or promote products derived - * from this software without specific, prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE - * COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY OR CONSEQUENTIAL DAMAGES (INCLUDING, - * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED - * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT - * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ -/* - * fastbulk.c - * - * fastbulk - * - * This program iterates all pkgsrc directories, runs 'bmake show-depends-dirs' - * recursively, and builds a dependency tree on the fly. - * - * As the dependency tree is being built, terminal dependencies are built - * and packaged on the fly (well, really it runs /tmp/track/dobuild inside - * the chroot). As these builds complete additional dependencies may be - * satisfied and be added to the build order. Ultimately the entire tree - * is built. - * - * Only one attempt is made to build any given package, no matter how many - * other packages depend on it. - */ -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include - -struct item; - -struct depn { - struct depn *dnext; - struct item *item; -}; - -struct item { - enum { XWAITING, XDEPFAIL, XBUILD, XRUN, XDONE } status; - struct item *hnext; /* ItemHash next */ - struct item *bnext; /* BuildList/RunList next */ - struct depn *dbase; /* packages depending on us */ - char *rpath; /* e.g. "shells/tcsh" */ - char *lpath; /* e.g. "shells.tcsh" (log path) */ - int dcount; /* build completion for our dependencies */ - int xcode; /* exit code from build */ - pid_t pid; /* running build */ -}; - -#define ITHSIZE 1024 -#define ITHMASK (ITHSIZE - 1) - -static struct item *ItemHash[ITHSIZE]; -static struct item *BuildList; -static struct item **BuildListP = &BuildList; -static struct item *RunList; - -static void ordered_scan(const char *bpath, const char *path, size_t blen); -static struct item *ordered_depends(const char *bpath, const char *npath); -static struct item *lookupItem(const char *npath); -static struct item *addItem(const char *npath); -static void addDepn(struct item *item, struct item *xitem); - -static void addBuild(struct item *item); -static void runBuilds(const char *bpath); -static struct item *waitRunning(int flags); -static void processCompletion(struct item *item); - -static const char *neednl(void); -static void usage(void); - -int NParallel = 1; -int VerboseOpt; -int NRunning; -int NeedNL; - -int -main(int ac, char **av) -{ - char *bpath; - size_t blen; - int ch; - - while ((ch = getopt(ac, av, "j:v")) != -1) { - switch(ch) { - case 'j': - NParallel = strtol(optarg, NULL, 0); - break; - case 'v': - VerboseOpt = 1; - break; - default: - usage(); - /* NOT REACHED */ - } - } - ac -= optind; - av += optind; - - if (ac != 1) { - fprintf(stderr, "requires base directory as first argument\n"); - exit(1); - } - - /* - * Base dir - */ - bpath = strdup(av[0]); - blen = strlen(bpath); - while (blen && bpath[blen-1] == '/') - --blen; - bpath[blen] = 0; - - /* - * Do recursive directory scan - */ - ordered_scan(bpath, bpath, strlen(bpath)); - - /* - * Wait for all current builds to finish running, keep the pipeline - * full until both the BuildList and RunList have been exhausted. - */ - runBuilds(bpath); - while (waitRunning(0) != NULL) - runBuilds(bpath); - return(0); -} - -/* - * Recursively scan the requested directory tree looking for pkgsrc - * stuff to build. - */ -static void -ordered_scan(const char *bpath, const char *path, size_t blen) -{ - DIR *dir; - struct dirent *den; - char *npath; - char *xpath; - struct stat st; - - if ((dir = opendir(path)) != NULL) { - while ((den = readdir(dir)) != NULL) { - if (den->d_name[0] == '.') - continue; - asprintf(&npath, "%s/%s", path, den->d_name); - asprintf(&xpath, "%s/DESCR", npath); - - if (lookupItem(npath + blen + 1) == NULL && - stat(npath, &st) == 0 && S_ISDIR(st.st_mode)) { - if (stat(xpath, &st) == 0) { - ordered_depends(bpath, - npath + blen + 1); - } else { - ordered_scan(bpath, npath, blen); - } - } - free(npath); - free(xpath); - } - closedir(dir); - } -} - -/* - * Recursively execute 'bmake show-depends-dirs' to calculate all required - * dependencies. - */ -static struct item * -ordered_depends(const char *bpath, const char *npath) -{ - struct item *item; - struct item *xitem; - char buf[1024]; - FILE *fp; - char *cmd; - int len; - - item = addItem(npath); - - /* - * Retrieve and process dependencies recursively. Note that - * addDepn() can modify item's status. - * - * Guard the recursion by bumping dcount to prevent the item - * from being processed for completion while we are still adding - * its dependencies. This would normally not occur but it can - * if pkgsrc has a broken dependency loop. - */ - ++item->dcount; - asprintf(&cmd, "cd %s/%s; bmake show-depends-dirs", bpath, npath); - fp = popen(cmd, "r"); - while (fgets(buf, sizeof(buf), fp) != NULL) { - len = strlen(buf); - if (len && buf[len-1] == '\n') - buf[--len] = 0; - xitem = lookupItem(buf); - if (xitem == NULL) - xitem = ordered_depends(bpath, buf); - addDepn(item, xitem); - } - pclose(fp); - free(cmd); - --item->dcount; - - /* - * If the item has no dependencies left either add it to the - * build list or do completion processing (i.e. if some of the - * dependencies failed). - */ - if (item->dcount == 0) { - switch(item->status) { - case XWAITING: - addBuild(item); - break; - case XDEPFAIL: - processCompletion(item); - break; - default: - assert(0); - /* NOT REACHED */ - break; - } - } else { - if (VerboseOpt) - printf("Deferred %s\n", item->rpath); - } - runBuilds(bpath); - return (item); -} - -/* - * Item hashing and dependency helper routines, called during the - * directory scan. - */ -static int -itemhash(const char *npath) -{ - int hv = 0xA1B5F342; - int i; - - for (i = 0; npath[i]; ++i) - hv = (hv << 5) ^ (hv >> 23) ^ npath[i]; - return(hv & ITHMASK); -} - -static struct item * -lookupItem(const char *npath) -{ - struct item *item; - - for (item = ItemHash[itemhash(npath)]; item; item = item->hnext) { - if (strcmp(npath, item->rpath) == 0) - return(item); - } - return(NULL); -} - -static struct item * -addItem(const char *npath) -{ - struct item **itemp; - struct item *item = calloc(sizeof(*item), 1); - int i; - - itemp = &ItemHash[itemhash(npath)]; - item->status = XWAITING; - item->hnext = *itemp; - item->rpath = strdup(npath); - item->lpath = strdup(npath); - *itemp = item; - for (i = 0; item->lpath[i]; ++i) { - if (item->lpath[i] == '/') - item->lpath[i] = '.'; - } - - return(item); -} - -/* - * Add a reverse dependency from the deepest point (xitem) to the - * packages that depend on xitem (item in this case). - * - * Caller will check dcount after it is through adding dependencies. - */ -static void -addDepn(struct item *item, struct item *xitem) -{ - struct depn *depn = calloc(sizeof(*depn), 1); - char *logpath3; - FILE *fp; - - depn->item = item; - depn->dnext = xitem->dbase; - xitem->dbase = depn; - if (xitem->status == XDONE) { - if (xitem->xcode) { - assert(item->status == XWAITING || - item->status == XDEPFAIL); - item->xcode = xitem->xcode; - item->status = XDEPFAIL; - asprintf(&logpath3, - "/tmp/logs/bad/%s", item->lpath); - fp = fopen(logpath3, "a"); - fprintf(fp, "Dependency failed: %s\n", - xitem->rpath); - fclose(fp); - free(logpath3); - } - } else { - ++item->dcount; - } -} - -/* - * Add the item to the build request list. This routine is called - * after all build dependencies have been satisfied for the item. - * runBuilds() will pick items off of BuildList to keep the parallel - * build pipeline full. - */ -static void -addBuild(struct item *item) -{ - printf("%sBuildOrder %s\n", neednl(), item->rpath); - *BuildListP = item; - BuildListP = &item->bnext; - item->status = XBUILD; -} - -/* - * Start new builds from the build list and handle build completions, - * which can potentialy add new items to the build list. - * - * This routine will maintain up to NParallel builds. A new build is - * only started once its dependencies have completed successfully so - * when the bulk build starts it typically takes a little while before - * fastbulk can keep the parallel pipeline full. - */ -static void -runBuilds(const char *bpath) -{ - struct rlimit rlm; - struct item *item; - char *logpath; - FILE *fp; - int fd; - - /* - * Try to maintain up to NParallel builds - */ - while (NRunning < NParallel && BuildList) { - item = BuildList; - if ((BuildList = item->bnext) == NULL) - BuildListP = &BuildList; - printf("%sBuildStart %s\n", neednl(), item->rpath); - - /* - * When [re]running a build remove any bad log from prior - * attempts. - */ - asprintf(&logpath, "/tmp/logs/bad/%s", item->lpath); - remove(logpath); - free(logpath); - - asprintf(&logpath, "/tmp/logs/run/%s", item->lpath); - - item->status = XRUN; - - item->pid = fork(); - if (item->pid == 0) { - /* - * Child process - setup the log file and exec - */ - if (chdir(bpath) < 0) - _exit(99); - if (chdir(item->rpath) < 0) - _exit(99); - - /* - * Connect log file up, disconnect tty (in case a - * 'patch' command tries to ask for help). - */ - fd = open(logpath, O_RDWR|O_CREAT|O_TRUNC, 0666); - if (fd != 1) - dup2(fd, 1); - if (fd != 2) - dup2(fd, 2); - if (fd != 1 && fd != 2) - close(fd); - fd = open("/dev/null", O_RDWR); - if (fd != 0) { - dup2(fd, 0); - close(fd); - } - - /* - * Set resource limits: - * - * ~2 hours cpu - prevent runaways from stalling - * the build. - * - * ~2GB file size - prevent endless growing log files. - * - * ~5GB footprint - prevent processes w/ out of - * control memory usage. - * - * ~0 core - No core dumps cluttering - * directories, please. - */ - if (getrlimit(RLIMIT_CPU, &rlm) == 0 && - rlm.rlim_cur > 2 * 60 * 60) { - rlm.rlim_cur = 2 * 60 * 60; - setrlimit(RLIMIT_CPU, &rlm); - } - if (getrlimit(RLIMIT_FSIZE, &rlm) == 0 && - rlm.rlim_cur > 2LL * 1024 * 1024 * 1024) { - rlm.rlim_cur = 2LL * 1024 * 1024 * 1024; - setrlimit(RLIMIT_FSIZE, &rlm); - } - if (getrlimit(RLIMIT_AS, &rlm) == 0 && - rlm.rlim_cur > 5LL * 1024 * 1024 * 1024) { - rlm.rlim_cur = 5LL * 1024 * 1024 * 1024; - setrlimit(RLIMIT_AS, &rlm); - } - if (getrlimit(RLIMIT_CORE, &rlm) == 0 && - rlm.rlim_cur > 0) { - rlm.rlim_cur = 0; - setrlimit(RLIMIT_CORE, &rlm); - } - - /* - * Disconnect tty so utilities which try to ask - * for help (like patch) or Y/N answers on /dev/tty - * do not stall. - */ - fd = open("/dev/tty", O_RDWR); - if (fd >= 0) { - ioctl(fd, TIOCNOTTY, 0); - close(fd); - } - setsid(); - - /* - * we tack a 'clean' on to the repackage to clean - * the work directory on success. If a failure - * occurs we leave the work directory intact. - * - * leaving work directories around when doing a - * bulk build can fill up the filesystem very fast. - */ - execl("/tmp/track/dobuild", "dobuild", - item->lpath, NULL); - _exit(99); - } else if (item->pid < 0) { - /* - * Parent fork() failed, log the problem and - * do completion processing. - */ - item->xcode = -98; - fp = fopen(logpath, "a"); - fprintf(fp, "fastbulk: Unable to fork/exec bmake\n"); - fclose(fp); - processCompletion(item); - } else { - /* - * Parent is now tracking the running child, - * add the item to the RunList. - */ - item->bnext = RunList; - RunList = item; - ++NRunning; - } - free(logpath); - } - - /* - * Process any completed builds (non-blocking) - */ - while (waitRunning(WNOHANG) != NULL) - ; -} - -/* - * Wait for a running build to finish and process its completion. - * Return the build or NULL if no builds are pending. - * - * The caller should call runBuilds() in the loop to keep the build - * pipeline full until there is nothing left in the build list. - */ -static struct item * -waitRunning(int flags) -{ - struct item *item; - struct item **itemp; - pid_t pid; - int status; - - if (RunList == NULL) - return(NULL); - while ((pid = wait3(&status, flags, NULL)) < 0 && flags == 0) - ; - - /* - * NOTE! The pid may be associated with one of our popen()'s - * so just ignore it if we cannot find it. - */ - if (pid > 0) { - status = WEXITSTATUS(status); - itemp = &RunList; - while ((item = *itemp) != NULL) { - if (item->pid == pid) - break; - itemp = &item->bnext; - } - if (item) { - *itemp = item->bnext; - item->bnext = NULL; - item->xcode = status; - --NRunning; - processCompletion(item); - } - } else { - item = NULL; - } - return (item); -} - -/* - * Process the build completion for an item. - */ -static void -processCompletion(struct item *item) -{ - struct depn *depn; - struct item *xitem; - char *logpath1; - char *logpath2; - char *logpath3; - FILE *fp; - - /* - * If XRUN we have to move the logfile to the correct directory. - * (If XDEPFAIL the logfile is already in the correct directory). - */ - if (item->status == XRUN) { - asprintf(&logpath1, "/tmp/logs/run/%s", item->lpath); - asprintf(&logpath2, "/tmp/logs/%s/%s", - (item->xcode ? "bad" : "good"), item->lpath); - rename(logpath1, logpath2); - free(logpath1); - free(logpath2); - } - - printf("%sFinish %-3d %s\n", neednl(), item->xcode, item->rpath); - assert(item->status == XRUN || item->status == XDEPFAIL); - item->status = XDONE; - for (depn = item->dbase; depn; depn = depn->dnext) { - xitem = depn->item; - assert(xitem->dcount > 0); - --xitem->dcount; - if (xitem->status == XWAITING || xitem->status == XDEPFAIL) { - /* - * If our build went well add items dependent - * on us to the build, otherwise fail the items - * dependent on us. - */ - if (item->xcode) { - xitem->xcode = item->xcode; - xitem->status = XDEPFAIL; - asprintf(&logpath3, - "/tmp/logs/bad/%s", xitem->lpath); - fp = fopen(logpath3, "a"); - fprintf(fp, "Dependency failed: %s\n", - item->rpath); - fclose(fp); - free(logpath3); - } - if (xitem->dcount == 0) { - if (xitem->status == XWAITING) - addBuild(xitem); - else - processCompletion(xitem); - } - } else if (xitem->status == XDONE && xitem->xcode) { - /* - * The package depending on us has already run - * (this case should not occur). - * - * Add this dependency failure to its log file - * (which has already been renamed). - */ - asprintf(&logpath3, - "/tmp/logs/bad/%s", xitem->lpath); - fp = fopen(logpath3, "a"); - fprintf(fp, "Dependency failed: %s\n", - item->rpath); - fclose(fp); - free(logpath3); - } - } -} - -static const char * -neednl(void) -{ - if (NeedNL) { - NeedNL = 0; - return("\n"); - } else { - return(""); - } -} - -static void -usage(void) -{ - fprintf(stderr, "fastbulk [-j parallel] /usr/pkgsrc\n"); - exit(1); -} diff --git a/test/fastbulk/getpkgsrcdir.c b/test/fastbulk/getpkgsrcdir.c deleted file mode 100644 index 8fcb1f9d6f..0000000000 --- a/test/fastbulk/getpkgsrcdir.c +++ /dev/null @@ -1,108 +0,0 @@ -/* - * - */ - -#include -#include -#include -#include -#include - -static void usage(void); - -/* - * Process paths on stdin and generate a directory path if it looks - * like a pkgsrc directory. - * - * av[1] - */ -int -main(int ac, char **av) -{ - char buf[1024]; - char *path; - char *bpath; - struct stat st; - size_t len; - size_t blen; - int count; - int ch; - int stripOpt = 0; - - while ((ch = getopt(ac, av, "s")) != -1) { - switch(ch) { - case 's': - stripOpt = 1; - break; - default: - usage(); - /* NOT REACHED */ - } - } - ac -= optind; - av += optind; - if (ac != 1) { - fprintf(stderr, "requires base directory as first argument\n"); - exit(1); - } - - /* - * Base dir - */ - bpath = strdup(av[0]); - blen = strlen(bpath); - while (blen && bpath[blen-1] == '/') - --blen; - bpath[blen] = 0; - - /* - * Process lines - */ - while (fgets(buf, sizeof(buf) - 32, stdin) != NULL) { - path = strtok(buf, " \t\r\n"); - if (path == NULL || *path == 0) - continue; - len = strlen(path); - if (len < blen || bcmp(path, bpath, blen) != 0) - continue; - if (stat(path, &st) != 0) - continue; - len = strlen(path); - if (!S_ISDIR(st.st_mode)) { - while (len && path[len-1] != '/') - --len; - } - while (len && path[len-1] == '/') - --len; - strcpy(path + len, "/Makefile"); - if (stat(path, &st) != 0) - continue; - strcpy(path + len, "/DESCR"); - if (stat(path, &st) != 0) - continue; - path[len] = 0; - - /* - * Must be at least one sub-directory - */ - count = 0; - for (len = blen; path[len]; ++len) { - if (path[len] == '/') - ++count; - } - if (count < 2) - continue; - if (stripOpt) - printf("%s\n", path + blen + 1); - else - printf("%s\n", path); - } - return(0); -} - -static void -usage(void) -{ - fprintf(stderr, "getpkgsrcdir: unsupported option\n"); - exit(1); -} diff --git a/test/fastbulk/mk.conf.add b/test/fastbulk/mk.conf.add deleted file mode 100644 index 36a0dc2e5c..0000000000 --- a/test/fastbulk/mk.conf.add +++ /dev/null @@ -1,8 +0,0 @@ - -# Fastbulk additions to /usr/pkg/etc/mk.conf -# -.ifdef BSD_PKG_MK - -WRKOBJDIR= /usr/obj/work - -.endif diff --git a/test/fastbulk/pkgsrc.ign b/test/fastbulk/pkgsrc.ign deleted file mode 100644 index 1fb56d9050..0000000000 --- a/test/fastbulk/pkgsrc.ign +++ /dev/null @@ -1,4 +0,0 @@ -distfiles -packages -.git -work diff --git a/test/fastbulk/vardb.ign b/test/fastbulk/vardb.ign deleted file mode 100644 index 51178ddfed..0000000000 --- a/test/fastbulk/vardb.ign +++ /dev/null @@ -1,2 +0,0 @@ -pkg -pkg.refcount diff --git a/usr.bin/Makefile b/usr.bin/Makefile index 187bbae776..82a1bc1782 100644 --- a/usr.bin/Makefile +++ b/usr.bin/Makefile @@ -151,7 +151,6 @@ SUBDIR= alias \ pctrack \ perror \ pkg_radd \ - pkg_search \ pkill \ pr \ printenv \ diff --git a/usr.bin/pkg_radd/Makefile b/usr.bin/pkg_radd/Makefile deleted file mode 100644 index 36144bbb3d..0000000000 --- a/usr.bin/pkg_radd/Makefile +++ /dev/null @@ -1,7 +0,0 @@ -# $DragonFly: src/usr.bin/pkg_radd/Makefile,v 1.1 2008/01/05 10:14:26 matthias Exp $ -# - -SCRIPTS=pkg_radd.sh -MAN= pkg_radd.1 - -.include diff --git a/usr.bin/pkg_radd/pkg_radd.1 b/usr.bin/pkg_radd/pkg_radd.1 deleted file mode 100644 index 322b794711..0000000000 --- a/usr.bin/pkg_radd/pkg_radd.1 +++ /dev/null @@ -1,112 +0,0 @@ -.\"- -.\" Copyright (c) 2007 The DragonFly Project. -.\" -.\" All rights reserved. -.\" -.\" Redistribution and use in source and binary forms, with or without -.\" modification, are permitted provided that the following conditions are met: -.\" -.\" - Redistributions of source code must retain the above copyright notice, -.\" this list of conditions and the following disclaimer. -.\" - Redistributions in binary form must reproduce the above copyright notice, -.\" this list of conditions and the following disclaimer in the documentation -.\" and/or other materials provided with the distribution. -.\" - Neither the name of The DragonFly Project nor the names of its -.\" contributors may be used to endorse or promote products derived -.\" from this software without specific, prior written permission. -.\" -.\" THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -.\" "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -.\" LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -.\" A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR -.\" CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -.\" EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -.\" PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -.\" PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -.\" LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -.\" NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -.\" SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -.\" -.Dd February 6, 2011 -.Dt PKG_RADD 1 -.Os -.Sh NAME -.Nm pkg_radd -.Nd installs packages -.Sh SYNOPSIS -.Nm -.Ar package ... -.Sh DESCRIPTION -.Nm -acts as a wrapper for -.Xr pkg_add 1 . -It sets the -.Ev PKG_PATH -variable to the -.Dx -default -.Xr pkgsrc 7 -binary package server or uses the global -.Pa /etc/pkg_radd.conf -config file to calculate -.Ev PKG_PATH . -In -.Pa /etc/pkg_radd.conf , -set -.Ev BINPKG_BASE -to your favorite binary packages mirror URL to allow -.Nm -to automatically retrieve the latest set of binary packages for your -.Dx -release. -If you want to use a specific set of packages, set -.Ev BINPKG_SITES -instead. -.Pp -All options passed to -.Nm -are passed to -.Xr pkg_add 1 . -.Sh EXAMPLES -The following is an example of a typical usage of the -.Nm -command: -.Pp -.Dl "# pkg_radd host" -.Pp -If you don't know which version of your desired package to install you can -use -.Xr pkg_search 1 -to find the correct version. -.Pp -.Dl "# pkg_search fvwm2" -.Dl "# pkg_radd -v fvwm-2.4.20nb1" -.Pp -If you add the following line -.Pp -.Dl "BINPKG_BASE=http://mirror-master.dragonflybsd.org/packages" -.Pp -to -.Pa /etc/pkg_radd.conf , -.Nm -fetches packages from the main -.Dx -server. -If possible, replace the entry with one of the mirrors as listed in -.Pa http://www.dragonflybsd.org/mirrors/ . -.Sh SEE ALSO -.Xr pkg_add 1 , -.Xr pkg_create 1 , -.Xr pkg_delete 1 , -.Xr pkg_info 1 , -.Xr pkg_search 1 , -.Xr pkgsrc 7 -.Sh HISTORY -The -.Nm -utility first appeared in -.Dx 1.11 . -.Sh AUTHORS -.Nm -was written by -.An Simon 'corecode' Schubert Aq Mt corecode@fs.ei.tum.de . diff --git a/usr.bin/pkg_radd/pkg_radd.sh b/usr.bin/pkg_radd/pkg_radd.sh deleted file mode 100644 index be2bacbec6..0000000000 --- a/usr.bin/pkg_radd/pkg_radd.sh +++ /dev/null @@ -1,53 +0,0 @@ -#!/bin/sh -# -# Copyright (c) 2007 The DragonFly Project. All rights reserved. -# -# This code is derived from software contributed to The DragonFly Project -# by Simon 'corecode' Schubert . -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions are met: -# -# - Redistributions of source code must retain the above copyright notice, -# this list of conditions and the following disclaimer. -# - Redistributions in binary form must reproduce the above copyright notice, -# this list of conditions and the following disclaimer in the documentation -# and/or other materials provided with the distribution. -# - Neither the name of The DragonFly Project nor the names of its -# contributors may be used to endorse or promote products derived -# from this software without specific, prior written permission. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR -# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -# PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -# LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -osver=`uname -r | awk -F - '{ print $1; }'` -cpuver=`uname -p | awk -F - '{ print $1; }'` -[ -f /etc/pkg_radd.conf ] && . /etc/pkg_radd.conf - -# If dports is installed it takes priority over pkgsrc. -# -# dports uses /usr/local/etc/pkg.conf -# -if [ -e /usr/local/sbin/pkg ]; then - if [ ! -f /usr/local/etc/pkg.conf ]; then - echo "You need to setup /usr/local/etc/pkg.conf first." - echo "See the sample in /usr/local/etc/pkg.conf.sample" - exit 1 - fi - exec pkg install "$@" -else - : ${BINPKG_BASE:=http://mirror-master.dragonflybsd.org/packages} - : ${BINPKG_SITES:=$BINPKG_BASE/$cpuver/DragonFly-$osver/stable} - : ${PKG_PATH:=$BINPKG_SITES/All} - export PKG_PATH - exec pkg_add "$@" -fi diff --git a/usr.bin/pkg_search/Makefile b/usr.bin/pkg_search/Makefile deleted file mode 100644 index d5e1158a81..0000000000 --- a/usr.bin/pkg_search/Makefile +++ /dev/null @@ -1,8 +0,0 @@ -# $DragonFly: src/usr.bin/pkg_search/Makefile,v 1.1 2007/12/04 18:24:18 dillon Exp $ -# - -SCRIPTS=pkg_search.sh -MAN= pkg_search.1 - -.include - diff --git a/usr.bin/pkg_search/pkg_search.1 b/usr.bin/pkg_search/pkg_search.1 deleted file mode 100644 index 6580876915..0000000000 --- a/usr.bin/pkg_search/pkg_search.1 +++ /dev/null @@ -1,99 +0,0 @@ -.\"- -.\" Copyright (c) 2007-09 The DragonFly Project. All rights reserved. -.\" -.\" This code is derived from software contributed to The DragonFly Project -.\" by Matthias Schmidt , University of Marburg. -.\" -.\" All rights reserved. -.\" -.\" Redistribution and use in source and binary forms, with or without -.\" modification, are permitted provided that the following conditions are met: -.\" -.\" - Redistributions of source code must retain the above copyright notice, -.\" this list of conditions and the following disclaimer. -.\" - Redistributions in binary form must reproduce the above copyright notice, -.\" this list of conditions and the following disclaimer in the documentation -.\" and/or other materials provided with the distribution. -.\" - Neither the name of The DragonFly Project nor the names of its -.\" contributors may be used to endorse or promote products derived -.\" from this software without specific, prior written permission. -.\" -.\" THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -.\" "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -.\" LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -.\" A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR -.\" CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -.\" EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -.\" PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -.\" PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -.\" LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -.\" NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -.\" SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -.\" -.Dd February 8, 2009 -.Dt PKG_SEARCH 1 -.Os -.Sh NAME -.Nm pkg_search -.Nd print information about a package -.Sh SYNOPSIS -.Nm -.Op Fl kv -.Ar package -.Nm -.Fl s -.Ar package -.Nm -.Fl d -.Sh DESCRIPTION -.Nm -queries the -.Xr pkgsrc 7 -index for a given -.Ar package . -If the -.Xr pkgsrc 7 -index is not available -.Nm -fetches the -.Xr pkg_summary 5 -file. -This file contains information about each package in a binary repository. -.Pp -The options are as follows: -.Bl -tag -width indent -.It Fl d -Download the -.Xr pkg_summary 5 -file. -It gets overwritten if it is already installed. -.It Fl k -Also query the Info and WWW field. -.It Fl s -Show the description of a package. -.It Fl v -Print verbose information (Ports directory, URL, depencies) -.El -.Sh EXAMPLES -The following is an example of a typical usage -of the -.Nm -command: -.Pp -.Dl "pkg_search -v fvwm" -.Sh SEE ALSO -.Xr pkg_add 1 , -.Xr pkg_create 1 , -.Xr pkg_delete 1 , -.Xr pkg_info 1 , -.Xr pkg_summary 5 , -.Xr pkgsrc 7 -.Sh HISTORY -The -.Nm -utility first appeared in -.Dx 1.11 . -.Sh AUTHORS -.Nm -was written by -.An Matthias Schmidt Aq Mt matthias@dragonflybsd.org . diff --git a/usr.bin/pkg_search/pkg_search.sh b/usr.bin/pkg_search/pkg_search.sh deleted file mode 100644 index d318e151e2..0000000000 --- a/usr.bin/pkg_search/pkg_search.sh +++ /dev/null @@ -1,229 +0,0 @@ -#!/bin/sh -# -# Copyright (c) 2007-09 The DragonFly Project. All rights reserved. -# -# This code is derived from software contributed to The DragonFly Project -# by Matthias Schmidt , University of Marburg. -# -# All rights reserved. -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions are met: -# -# - Redistributions of source code must retain the above copyright notice, -# this list of conditions and the following disclaimer. -# - Redistributions in binary form must reproduce the above copyright notice, -# this list of conditions and the following disclaimer in the documentation -# and/or other materials provided with the distribution. -# - Neither the name of The DragonFly Project nor the names of its -# contributors may be used to endorse or promote products derived -# from this software without specific, prior written permission. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR -# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -# PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -# LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -set_binpkg_sites() { - : ${BINPKG_BASE:=http://mirror-master.dragonflybsd.org/packages} - : ${BINPKG_SITES:=$BINPKG_BASE/$cpuver/DragonFly-$osver/stable} -} - -UNAME=`uname -s` -osver=`uname -r | awk -F - '{ print $1; }'` -cpuver=`uname -p | awk -F - '{ print $1; }'` -[ -f /etc/pkg_radd.conf ] && . /etc/pkg_radd.conf -set_binpkg_sites - -NO_INDEX=0 -PORTSDIR=/usr/pkgsrc -PKGSUM=${PORTSDIR}/pkg_summary -INDEXFILE=INDEX - -# Download the pkg_summary file -download_summary() -{ - echo "Fetching pkg_summary(5) file." - for tries in 1 2 - do - FETCHPATH=${BINPKG_SITES}/All/pkg_summary.bz2 - fetch -o ${PKGSUM}.bz2 ${FETCHPATH} - [ $? -eq 0 ] && break - - # retry with default - unset BINPKG_BASE - unset BINPKG_SITES - set_binpkg_sites - done - if [ $? -ne 0 ]; then - echo "Unable to fetch pkg_summary(5) file." - exit 1 - fi - bunzip2 < ${PKGSUM}.bz2 > ${PKGSUM} - rm -f ${PKGSUM}.bz2 -} - -# Perform simple search in pkg_summary -bin_simple_search() -{ - awk -F= -v name="$1" '{ - if ($1 == "PKGNAME") { - if (tolower($2) ~ name) { - printf("%-20s\t", $2); - found = 1; - } - else found = 0; - } - if (found == 1 && $1 == "COMMENT") printf("%-25s\n", $2); - }' ${PKGSUM} -} - -# Perform extended search in pkg_summary -bin_ext_search() -{ - awk -F= -v name="$1" '{ - if ($1 == "PKGNAME") - if (tolower($2) ~ name) { - printf("\nName\t: %-50s\n", $2); - found = 1; - } - else found = 0; - - if (found == 1 && $1 == "COMMENT") - printf("Desc\t: %-50s\n", $2); - if (found == 1 && $1 == "PKGPATH") - printf("Path\t: %-50s\n", $2); - if (found == 1 && $1 == "HOMEPAGE") - printf("URL\t: %-50s\n", $2); - }' ${PKGSUM} -} - -# Perform extended search in INDEX -index_v_search() -{ - if [ ${KFLAG} -eq 0 ]; then - awk -F\| -v name="$1" '{ - if (tolower($1) ~ name) { - printf("Name\t: %s-50\nDir\t: %-50s\nDesc\t: %-50s"\ - "\nURL\t: %-50s\nDeps\t: %s\n\n", $1, $2, - $4, $12, $9); - } - }' ${PORTSDIR}/${INDEXFILE} - else - awk -F\| -v name="$1" '{ - if (tolower($1) ~ name || tolower($4) ~ name || - tolower($12) ~ name) { - printf("Name\t: %s-50\nDir\t: %-50s\nDesc\t: %-50s"\ - "\nURL\t: %-50s\nDeps\t: %s\n\n", $1, $2, - $4, $12, $9); - } - }' ${PORTSDIR}/${INDEXFILE} - fi -} - -# Perform simple search in INDEX -index_search() -{ - if [ ${KFLAG} -eq 0 ]; then - awk -F\| -v name="$1" '{ - if (tolower($1) ~ name) { - printf("%-20s\t%-25s\n", $1, $4); - } - }' ${PORTSDIR}/${INDEXFILE} - else - awk -F\| -v name="$1" '{ - if (tolower($1) ~ name || tolower($4) ~ name || - tolower($12) ~ name) { - printf("%-20s\t%-25s\n", $1, $4); - } - }' ${PORTSDIR}/${INDEXFILE} - fi -} - -show_description() -{ - PDESC=`awk -F\| -v name="$1" '{ - if (tolower($1) == name) { - split($2, ppath, "/"); - printf("%s\n", $5); - } - }' ${PORTSDIR}/${INDEXFILE}` - if [ -f "${PORTSDIR}/${PDESC}" ]; then - cat "${PORTSDIR}/${PDESC}" - else - echo "Unable to locate package $1. Please provide the exact" - echo "package name as given by pkg_search(1). You need the" - echo "complete pkgsrc(7) tree to perform this operation." - fi -} - -usage() -{ - echo "usage: `basename $0` [-kv] package" - echo " `basename $0` -s package" - echo " `basename $0` -d" - exit 1 -} - -if [ ! -f ${PKGSUM} -a ! -e ${PORTSDIR}/${INDEXFILE} ]; then - echo "No pkgsrc(7) tree found." - mkdir -p ${PORTSDIR} - download_summary - NO_INDEX=1 -fi -if [ -e ${PKGSUM} -a ! -e ${PORTSDIR}/${INDEXFILE} ]; then - NO_INDEX=1 -fi - -args=`getopt dksv $*` - -SFLAG=0 -KFLAG=0 -VFLAG=0 -DFLAG=0 - -set -- $args -for i; do - case "$i" in - -d) - DFLAG=1; shift;; - -k) - KFLAG=1; shift;; - -s) - SFLAG=1; shift;; - -v) - VFLAG=1; shift;; - --) - shift; break;; - esac -done - -if [ ${DFLAG} -eq 0 -a -z ${1} ]; then - usage -fi - -if [ ${DFLAG} -eq 1 ]; then - download_summary - exit $? -fi - -if [ ${VFLAG} -eq 0 -a ${NO_INDEX} -eq 1 ]; then - bin_simple_search $1 -elif [ ${VFLAG} -eq 1 -a ${NO_INDEX} -eq 1 ]; then - bin_ext_search $1 -elif [ ${SFLAG} -eq 1 -a ${NO_INDEX} -eq 0 ]; then - show_description $1 -elif [ ${VFLAG} -eq 0 -a ${NO_INDEX} -eq 0 ]; then - index_search $1 -elif [ ${VFLAG} -eq 1 -a ${NO_INDEX} -eq 0 ]; then - index_v_search $1 -fi - -exit $? diff --git a/usr.bin/whereis/pathnames.h b/usr.bin/whereis/pathnames.h index 061d398e38..51b95f07ac 100644 --- a/usr.bin/whereis/pathnames.h +++ b/usr.bin/whereis/pathnames.h @@ -44,9 +44,6 @@ /* Each subdirectory of PATH_DPORTS will be appended to PATH_SOURCES. */ #define PATH_DPORTS "/usr/dports" -/* Each subdirectory of PATH_PKGSRC will be appended to PATH_SOURCES. */ -#define PATH_PKGSRC "/usr/pkgsrc" - /* How to query the current manpath. */ #define MANPATHCMD "manpath -q" diff --git a/usr.bin/whereis/whereis.1 b/usr.bin/whereis/whereis.1 index 762ba0e212..6656ac121e 100644 --- a/usr.bin/whereis/whereis.1 +++ b/usr.bin/whereis/whereis.1 @@ -31,7 +31,7 @@ .\" .\" $FreeBSD: src/usr.bin/whereis/whereis.1,v 1.21 2002/11/26 17:33:36 ru Exp $ .\" -.Dd May 20, 2013 +.Dd October 10, 2014 .Dt WHEREIS 1 .Os .Sh NAME @@ -74,10 +74,9 @@ Manual pages are searched by default along the .Ev $MANPATH . Program sources are located in a list of known standard places, including all the subdirectories of -.Pa /usr/src , -.Pa /usr/dports +.Pa /usr/src and -.Pa /usr/pkgsrc . +.Pa /usr/dports . .Pp The following options are available: .Bl -tag -width indent diff --git a/usr.bin/whereis/whereis.c b/usr.bin/whereis/whereis.c index 379a775a99..d42911da92 100644 --- a/usr.bin/whereis/whereis.c +++ b/usr.bin/whereis/whereis.c @@ -305,10 +305,7 @@ defaults(void) decolonify(b, &mandirs, &nele); } - /* - * -s defaults to precompiled list, plus subdirs of /usr/dports and - * /usr/pkgsrc - */ + /* -s defaults to precompiled list, plus subdirs of /usr/dports */ if (!sourcedirs) { if ((b = malloc(strlen(sourcepath) + 1)) == NULL) abort(); @@ -353,44 +350,6 @@ defaults(void) } closedir(dir); } - if (stat(PATH_PKGSRC, &sb) == -1) { - if (errno == ENOENT) - /* no /usr/pkgsrc, we are done */ - return; - err(EX_OSERR, "stat(" PATH_PKGSRC ")"); - } - if ((sb.st_mode & S_IFMT) != S_IFDIR) - /* /usr/pkgsrc is not a directory, ignore */ - return; - if (access(PATH_PKGSRC, R_OK | X_OK) != 0) - return; - if ((dir = opendir(PATH_PKGSRC)) == NULL) - err(EX_OSERR, "opendir" PATH_PKGSRC ")"); - while ((dirp = readdir(dir)) != NULL) { - if (dirp->d_name[0] == '.' || - strcmp(dirp->d_name, "CVS") == 0) - /* ignore dot entries and CVS subdir */ - continue; - if ((b = malloc(sizeof PATH_PKGSRC + 1 + dirp->d_namlen)) - == NULL) - abort(); - strcpy(b, PATH_PKGSRC); - strcat(b, "/"); - strcat(b, dirp->d_name); - if (stat(b, &sb) == -1 || - (sb.st_mode & S_IFMT) != S_IFDIR || - access(b, R_OK | X_OK) != 0) { - free(b); - continue; - } - sourcedirs = realloc(sourcedirs, - (nele + 2) * sizeof(char *)); - if (sourcedirs == NULL) - abort(); - sourcedirs[nele++] = b; - sourcedirs[nele] = NULL; - } - closedir(dir); } }