head	1.14;
access;
symbols
	pkgsrc-2023Q1:1.13.0.4
	pkgsrc-2023Q1-base:1.13
	pkgsrc-2022Q4:1.13.0.2
	pkgsrc-2022Q4-base:1.13
	pkgsrc-2022Q3:1.12.0.50
	pkgsrc-2022Q3-base:1.12
	pkgsrc-2022Q2:1.12.0.48
	pkgsrc-2022Q2-base:1.12
	pkgsrc-2022Q1:1.12.0.46
	pkgsrc-2022Q1-base:1.12
	pkgsrc-2021Q4:1.12.0.44
	pkgsrc-2021Q4-base:1.12
	pkgsrc-2021Q3:1.12.0.42
	pkgsrc-2021Q3-base:1.12
	pkgsrc-2021Q2:1.12.0.40
	pkgsrc-2021Q2-base:1.12
	pkgsrc-2021Q1:1.12.0.38
	pkgsrc-2021Q1-base:1.12
	pkgsrc-2020Q4:1.12.0.36
	pkgsrc-2020Q4-base:1.12
	pkgsrc-2020Q3:1.12.0.34
	pkgsrc-2020Q3-base:1.12
	pkgsrc-2020Q2:1.12.0.30
	pkgsrc-2020Q2-base:1.12
	pkgsrc-2020Q1:1.12.0.10
	pkgsrc-2020Q1-base:1.12
	pkgsrc-2019Q4:1.12.0.32
	pkgsrc-2019Q4-base:1.12
	pkgsrc-2019Q3:1.12.0.28
	pkgsrc-2019Q3-base:1.12
	pkgsrc-2019Q2:1.12.0.26
	pkgsrc-2019Q2-base:1.12
	pkgsrc-2019Q1:1.12.0.24
	pkgsrc-2019Q1-base:1.12
	pkgsrc-2018Q4:1.12.0.22
	pkgsrc-2018Q4-base:1.12
	pkgsrc-2018Q3:1.12.0.20
	pkgsrc-2018Q3-base:1.12
	pkgsrc-2018Q2:1.12.0.18
	pkgsrc-2018Q2-base:1.12
	pkgsrc-2018Q1:1.12.0.16
	pkgsrc-2018Q1-base:1.12
	pkgsrc-2017Q4:1.12.0.14
	pkgsrc-2017Q4-base:1.12
	pkgsrc-2017Q3:1.12.0.12
	pkgsrc-2017Q3-base:1.12
	pkgsrc-2017Q2:1.12.0.8
	pkgsrc-2017Q2-base:1.12
	pkgsrc-2017Q1:1.12.0.6
	pkgsrc-2017Q1-base:1.12
	pkgsrc-2016Q4:1.12.0.4
	pkgsrc-2016Q4-base:1.12
	pkgsrc-2016Q3:1.12.0.2
	pkgsrc-2016Q3-base:1.12
	pkgsrc-2016Q2:1.11.0.18
	pkgsrc-2016Q2-base:1.11
	pkgsrc-2016Q1:1.11.0.16
	pkgsrc-2016Q1-base:1.11
	pkgsrc-2015Q4:1.11.0.14
	pkgsrc-2015Q4-base:1.11
	pkgsrc-2015Q3:1.11.0.12
	pkgsrc-2015Q3-base:1.11
	pkgsrc-2015Q2:1.11.0.10
	pkgsrc-2015Q2-base:1.11
	pkgsrc-2015Q1:1.11.0.8
	pkgsrc-2015Q1-base:1.11
	pkgsrc-2014Q4:1.11.0.6
	pkgsrc-2014Q4-base:1.11
	pkgsrc-2014Q3:1.11.0.4
	pkgsrc-2014Q3-base:1.11
	pkgsrc-2014Q2:1.11.0.2
	pkgsrc-2014Q2-base:1.11
	pkgsrc-2014Q1:1.8.0.4
	pkgsrc-2014Q1-base:1.8
	pkgsrc-2013Q4:1.8.0.2
	pkgsrc-2013Q4-base:1.8
	pkgsrc-2013Q3:1.7.0.6
	pkgsrc-2013Q3-base:1.7
	pkgsrc-2013Q2:1.7.0.4
	pkgsrc-2013Q2-base:1.7
	pkgsrc-2013Q1:1.7.0.2
	pkgsrc-2013Q1-base:1.7
	pkgsrc-2012Q4:1.6.0.6
	pkgsrc-2012Q4-base:1.6
	pkgsrc-2012Q3:1.6.0.4
	pkgsrc-2012Q3-base:1.6
	pkgsrc-2012Q2:1.6.0.2
	pkgsrc-2012Q2-base:1.6
	pkgsrc-2012Q1:1.5.0.50
	pkgsrc-2012Q1-base:1.5
	pkgsrc-2011Q4:1.5.0.48
	pkgsrc-2011Q4-base:1.5
	pkgsrc-2011Q3:1.5.0.46
	pkgsrc-2011Q3-base:1.5
	pkgsrc-2011Q2:1.5.0.44
	pkgsrc-2011Q2-base:1.5
	pkgsrc-2011Q1:1.5.0.42
	pkgsrc-2011Q1-base:1.5
	pkgsrc-2010Q4:1.5.0.40
	pkgsrc-2010Q4-base:1.5
	pkgsrc-2010Q3:1.5.0.38
	pkgsrc-2010Q3-base:1.5
	pkgsrc-2010Q2:1.5.0.36
	pkgsrc-2010Q2-base:1.5
	pkgsrc-2010Q1:1.5.0.34
	pkgsrc-2010Q1-base:1.5
	pkgsrc-2009Q4:1.5.0.32
	pkgsrc-2009Q4-base:1.5
	pkgsrc-2009Q3:1.5.0.30
	pkgsrc-2009Q3-base:1.5
	pkgsrc-2009Q2:1.5.0.28
	pkgsrc-2009Q2-base:1.5
	pkgsrc-2009Q1:1.5.0.26
	pkgsrc-2009Q1-base:1.5
	pkgsrc-2008Q4:1.5.0.24
	pkgsrc-2008Q4-base:1.5
	pkgsrc-2008Q3:1.5.0.22
	pkgsrc-2008Q3-base:1.5
	cube-native-xorg:1.5.0.20
	cube-native-xorg-base:1.5
	pkgsrc-2008Q2:1.5.0.18
	pkgsrc-2008Q2-base:1.5
	cwrapper-base:1.5
	cwrapper:1.5.0.16
	pkgsrc-2008Q1:1.5.0.14
	pkgsrc-2008Q1-base:1.5
	pkgsrc-2007Q4:1.5.0.12
	pkgsrc-2007Q4-base:1.5
	pkgsrc-2007Q3:1.5.0.10
	pkgsrc-2007Q3-base:1.5
	pkgsrc-2007Q2:1.5.0.8
	pkgsrc-2007Q2-base:1.5
	pkgsrc-2007Q1:1.5.0.6
	pkgsrc-2007Q1-base:1.5
	pkgsrc-2006Q4:1.5.0.4
	pkgsrc-2006Q4-base:1.5
	pkgsrc-2006Q3:1.5.0.2
	pkgsrc-2006Q3-base:1.5
	pkgsrc-2006Q2:1.4.0.2
	pkgsrc-2006Q2-base:1.4
	pkgsrc-2006Q1:1.3.0.2
	pkgsrc-2006Q1-base:1.3;
locks; strict;
comment	@# @;


1.14
date	2023.06.06.10.57.28;	author wiz;	state dead;
branches;
next	1.13;
commitid	n7H1n929eE22oSrE;

1.13
date	2022.11.12.11.26.20;	author gdt;	state Exp;
branches;
next	1.12;
commitid	4OucMlLSZc0yap1E;

1.12
date	2016.07.01.21.50.20;	author wiz;	state Exp;
branches;
next	1.11;
commitid	zIFWsE2XUwwZlFcz;

1.11
date	2014.06.24.15.00.27;	author wiz;	state Exp;
branches;
next	1.10;
commitid	x6pleTnhbttuNMFx;

1.10
date	2014.05.15.23.50.14;	author wiz;	state Exp;
branches;
next	1.9;
commitid	XUKqNwfvL83b1HAx;

1.9
date	2014.05.06.12.41.46;	author wiz;	state Exp;
branches;
next	1.8;
commitid	lXr0cYUk0A3fCtzx;

1.8
date	2013.10.21.10.43.28;	author wiz;	state Exp;
branches;
next	1.7;
commitid	H4BPyDuuVVYci9ax;

1.7
date	2013.03.17.15.27.18;	author obache;	state Exp;
branches;
next	1.6;

1.6
date	2012.06.13.11.39.33;	author obache;	state Exp;
branches;
next	1.5;

1.5
date	2006.07.11.12.52.14;	author wiz;	state Exp;
branches;
next	1.4;

1.4
date	2006.04.13.18.58.17;	author wiz;	state Exp;
branches;
next	1.3;

1.3
date	2006.03.09.17.24.48;	author wiz;	state Exp;
branches;
next	1.2;

1.2
date	2006.03.07.04.30.54;	author wiz;	state Exp;
branches;
next	1.1;

1.1
date	2006.03.05.23.35.49;	author wiz;	state Exp;
branches;
next	;


desc
@@


1.14
log
@revbump: update to 3.2.

Remove old perl scripts. Just use revbump.py.
@
text
@#!@@PERL@@ -w
# -*- perl -*-
#
# $NetBSD: finddepends,v 1.13 2022/11/12 11:26:20 gdt Exp $
#
# Copyright (c) 2006, 2014 The NetBSD Foundation, Inc.
#
# This code was originally contributed to the NetBSD Foundation, Inc.
# by Thomas Klausner <wiz@@NetBSD.org>.
#
# 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 author 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 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.
#

use strict;
use Getopt::Std;

my ($PKGSRCDIR, $arg, $bl3, %bl3content, @@bl3files, @@bl3result,
    $content, $found, $key, $makefile, @@makefiles, %opt,
    @@optionfiles, $pattern, @@searchlist);

$PKGSRCDIR = $ENV{PKGSRCDIR};
if (! $PKGSRCDIR) {
    $PKGSRCDIR = "/usr/pkgsrc";
}

sub usage {
    print STDERR "usage: finddepends [-h] [-p pkgsrcdir] package\n\n";
    print STDERR "Find all packages that depend on the argument package.\n";
    exit 0;
}

getopts('hp:', \%opt);
usage() if $opt{h};
if ($opt{p}) {
    $PKGSRCDIR = $opt{p};
}

usage if (1 ne @@ARGV);
$arg = shift;
$arg =~ s,/$,,g;

@@searchlist = ();
push @@searchlist, $arg;

if (! -d $PKGSRCDIR || ! -d "$PKGSRCDIR/doc" || ! -d "$PKGSRCDIR/mk") {
    print STDERR "Invalid pkgsrc directory $PKGSRCDIR\n";
    exit 1;
}

@@bl3files = <$PKGSRCDIR/*/*/buildlink3.mk>;
push(@@bl3files, "$PKGSRCDIR/lang/ocaml/ocaml.mk");

%bl3content = ();
foreach $bl3 (@@bl3files) {
    open OUT, $bl3 or die "can't open $bl3";
    $content = "";
    while (<OUT>) {
	chomp($_);
	next if m/^\s*#/;
	$content .= $_;
    }
    close OUT;
    $bl3content{$bl3} = $content;
}

@@bl3result = ();
while ($pattern = pop @@searchlist) {
#    print "* Looking for $pattern\n";
    for $key (keys %bl3content) {
#	print "searching $key ($bl3content{$key})\n\n";
	if ($bl3content{$key} =~ m/\Q$pattern/) {
#	    print "\n\n ******** MATCH $key \n\n";
#	    print "** $pattern found in $key\n";
#	    print "** BUMP $key\n";
	    delete($bl3content{$key});
#	    print "\n\n **** ADDING $key \n\n";
	    $key =~ s,$PKGSRCDIR/,,;
#	    print "** Adding $key\n";
	    print "$key\n";
	    push @@searchlist, $key;
	    push @@bl3result, $key;
	}
    }
}

print "\n";

@@makefiles = <$PKGSRCDIR/*/*/Makefile*>;
@@optionfiles = <$PKGSRCDIR/*/*/options.mk>;
push(@@makefiles, @@optionfiles);
@@optionfiles = <$PKGSRCDIR/*/*/modules.mk>;
push(@@makefiles, @@optionfiles);
@@optionfiles = <$PKGSRCDIR/*/*/mozilla-common.mk>;
push(@@makefiles, @@optionfiles);
@@optionfiles = <$PKGSRCDIR/*/*/plugins.mk>;
push(@@makefiles, @@optionfiles);
@@optionfiles = <$PKGSRCDIR/*/*/schemas.mk>;
push(@@makefiles, @@optionfiles);

for $makefile (@@makefiles) {
#    print "* reading $makefile\n";
    open OUT, $makefile or die "can't open $makefile";
    $content = "";
    my @@used_by;
    while (<OUT>) {
	chomp($_);
	if (m/^# used by (.*)/) {
	    push @@used_by, $1;
	}
	next if m/^\s*#/;
	$content .= $_;
    }
    close OUT;
    $found = 0;
    for $pattern (@@bl3result) {
	if ($content =~ m/\Q$pattern/) {
	    $found = 1;
	    last;
	}
    }
#    print "** BUMP $makefile\n" if ($found);
    if ($found) {
	$makefile =~ s,$PKGSRCDIR/,,;
	print "$makefile\n";
	for my $user (@@used_by) {
	    print "$user\n";
	}
    }
}

exit 0;
@


1.13
log
@pkgtools/revbump: Catch up with ocaml.mk move

mk/ocaml.mk has moved to lang/ocaml/ocaml.mk, so simply adjust the
path here.
@
text
@d4 1
a4 1
# $NetBSD: finddepends,v 1.12 2016/07/01 21:50:20 wiz Exp $
@


1.12
log
@Handle mk/ocaml.mk like a buildlink3.mk file.

Helps with bumping ocaml dependencies. Requested by jaapb.

Bump version.
@
text
@d4 1
a4 1
# $NetBSD: finddepends,v 1.11 2014/06/24 15:00:27 wiz Exp $
d75 1
a75 1
push(@@bl3files, "$PKGSRCDIR/mk/ocaml.mk");
@


1.11
log
@Make finddepends(1) parse Makefile.common's "# used by" lines and
also emit packages mentioned there, if a match was found in that
Makefile.common.

Adapt revbump HOWTO slightly, but not completely, since I don't
trust the comments enough yet.

Bump version.
Leaf package.
@
text
@d4 1
a4 1
# $NetBSD: finddepends,v 1.10 2014/05/15 23:50:14 wiz Exp $
d75 2
@


1.10
log
@Do not look for matches in Makefile comments (noted by adam).
Strip trailing slashes on package names.
The reason for this is that the package's own buildlink3.mk file usually
matches category/package, but not category/package/ (because the only
match is "BUILDLINK_PKGSRCDIR.foo").

Bump version.
@
text
@d4 1
a4 1
# $NetBSD: finddepends,v 1.9 2014/05/06 12:41:46 wiz Exp $
d126 1
d129 3
d147 3
@


1.9
log
@Make finddepends look in modules.mk, plugins.mk, and schemas.mk as well.
Suggested by obache.
Bump version.
@
text
@d4 1
a4 1
# $NetBSD: finddepends,v 1.8 2013/10/21 10:43:28 wiz Exp $
d64 1
d81 2
a82 1
	$content .= $_ unless $_ =~ m"^#";
d128 1
@


1.8
log
@2.5:
finddepends: Also search in mozilla-common.mk.
Update instructions.
@
text
@d4 1
a4 1
# $NetBSD: finddepends,v 1.7 2013/03/17 15:27:18 obache Exp $
d6 1
a6 1
# Copyright (c) 2006 The NetBSD Foundation, Inc.
d111 2
d115 4
@


1.7
log
@avoid to match commnented out lines (createbuildlink will create such lines
by default).
@
text
@d4 1
a4 1
# $NetBSD: finddepends,v 1.6 2012/06/13 11:39:33 obache Exp $
d111 2
@


1.6
log
@fix a copy and paste then missing edit error.
@
text
@d4 1
a4 1
# $NetBSD: finddepends,v 1.5 2006/07/11 12:52:14 wiz Exp $
d80 1
a80 1
	$content .= $_;
@


1.5
log
@1.8:
finddepends: Quote package names when they are used as patterns.
Based on an idea by dillo.
@
text
@d4 1
a4 1
# $NetBSD: finddepends,v 1.4 2006/04/13 18:58:17 wiz Exp $
d114 1
a114 1
    open OUT, $makefile or die "can't open $bl3";
@


1.4
log
@finddepends: also look in options.mk files.
Welcome to 1.6\!
@
text
@d4 1
a4 1
# $NetBSD: finddepends,v 1.3 2006/03/09 17:24:48 wiz Exp $
d91 1
a91 1
	if ($bl3content{$key} =~ m/$pattern/) {
d123 1
a123 1
	if ($content =~ m/$pattern/) {
@


1.3
log
@Add -*- perl -*- so emacs recognizes it automatically.
revbump: only print "updated" line when updating was successful.
@
text
@d4 1
a4 1
# $NetBSD: finddepends,v 1.2 2006/03/07 04:30:54 wiz Exp $
d43 1
a43 1
    $pattern, @@searchlist);
d109 2
@


1.2
log
@Standardize option handling (use getopts, provide same options for all
three tools).
use strict and cleanup problems found this way.
Remove some unused variables.
Update documentation.

Welcome to 1.3!
@
text
@d2 1
d4 1
a4 1
# $NetBSD: finddepends,v 1.1 2006/03/05 23:35:49 wiz Exp $
@


1.1
log
@Update to 1.2:
New script "finddepends" that finds all packages that need bumping.
No need for an index, and not as many false positives too.

Update recursive PKGREVISION instructions in revbump(1).
@
text
@d3 1
a3 1
# $NetBSD$
d37 7
d50 1
a50 1
    print STDERR "usage: finddepends package\n\n";
d55 6
a61 1

@

