From 08da7375892de650b8769ec6f1e10fe56fef0327 Mon Sep 17 00:00:00 2001 From: espie Date: Sun, 9 Apr 2000 16:26:13 +0000 Subject: [PATCH] If key, author, category is defined on the command line, build SUBDIRS directly from INDEX. --- Makefile | 19 ++++++++++- infrastructure/build/index-retrieve | 50 +++++++++++++++++++++++++++++ 2 files changed, 68 insertions(+), 1 deletion(-) create mode 100644 infrastructure/build/index-retrieve diff --git a/Makefile b/Makefile index 447055d28bb..b8fe7412423 100644 --- a/Makefile +++ b/Makefile @@ -1,7 +1,23 @@ -# $OpenBSD: Makefile,v 1.22 2000/04/09 12:45:55 espie Exp $ +# $OpenBSD: Makefile,v 1.23 2000/04/09 16:26:13 espie Exp $ # $FreeBSD: Makefile,v 1.36 1997/10/04 15:54:31 jkh Exp $ # + +.if defined(key) || defined(category) || defined(author) + +# set up subdirs from the index, assume it's up-to-date +_CMD=perl ${.CURDIR}/infrastructure/build/index-retrieve index='${.CURDIR}/INDEX' +. if defined(key) +_CMD+=key='${key}' +. endif +. if defined(category) +_CMD+=category='${category}' +. endif +. if defined(author) +_CMD+=author='${author}' +. endif +SUBDIR != ${_CMD} +.else SUBDIR += archivers SUBDIR += astro SUBDIR += audio @@ -36,6 +52,7 @@ SUBDIR += textproc #SUBDIR += vietnamese SUBDIR += www SUBDIR += x11 +.endif PORTSTOP?= yes diff --git a/infrastructure/build/index-retrieve b/infrastructure/build/index-retrieve new file mode 100644 index 00000000000..fcc7b8ff028 --- /dev/null +++ b/infrastructure/build/index-retrieve @@ -0,0 +1,50 @@ +#!/usr/bin/perl +# $OpenBSD: index-retrieve,v 1.1 2000/04/09 16:26:14 espie Exp $ +# Copyright (c) 2000 +# Marc Espie. 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 code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Neither the name of OpenBSD 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 ITS AUTHOR AND THE OpenBSD project ``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 REGENTS 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. + +# simple script to retrieve part of the INDEX + +for (@ARGV) { + $index = $' if m/^index\=/; + $iscategory = $' if m/^category\=/; + $isauthor = $' if m/^author\=/; + $iskey = $' if m/^key\=/; +} + +die "No index" unless defined $index and -e $index; + +open(INDEX, $index); + +while() { + chomp; + ($key, $subdir, $author, $category) = (split(/\|/, $_) )[0, 1, 5, 6]; + $author =~ s/\@.*//; + next if (defined($isauthor) && $author !~ m/$isauthor/); + next if (defined($iscategory) && $category !~ m/$iscategory/); + next if (defined($iskey) && $key !~ m/$iskey/); + print $subdir, " "; +} + + +