If key, author, category is defined on the command line,

build SUBDIRS directly from INDEX.
This commit is contained in:
espie 2000-04-09 16:26:13 +00:00
parent d0fe3f536b
commit 08da737589
2 changed files with 68 additions and 1 deletions

View File

@ -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

View File

@ -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(<INDEX>) {
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, " ";
}