if we -f -a, then scan SUPBDISTFILES too, and use the Distfile cache

to write a list of all known distfiles, that can be used to remove extra
stuff from /usr/ports/distfiles
This commit is contained in:
espie 2011-05-29 11:06:23 +00:00
parent 84266ee8ac
commit 1e22893e8e
3 changed files with 33 additions and 12 deletions

View File

@ -1,7 +1,7 @@
#! /usr/bin/perl
# ex:ts=8 sw=4:
# $OpenBSD: dpb,v 1.19 2011/05/22 08:21:38 espie Exp $
# $OpenBSD: dpb,v 1.20 2011/05/29 11:06:23 espie Exp $
#
# Copyright (c) 2010 Marc Espie <espie@openbsd.org>
#
@ -90,7 +90,7 @@ sub handle_options
};
$state->SUPER::handle_options('aceqrRsuUh:xA:f:j:m:P:b:L:S:t:T:',
"[-acerRsuUx] [-A arch] [-j N] [-P plist] [-h hosts] [-L logdir]",
"[-acerRsuUx] [-A arch] [-f N] [-j N] [-P plist] [-h hosts] [-L logdir]",
"[-b log] [-t ctimeout] [-m threshold] [path ...]");
$state->{fullrepo} = join("/", $state->{repo}, $state->arch, "all");
$state->{logdir} //= $ENV{LOGDIR} //
@ -381,6 +381,9 @@ if (!$state->opt('e')) {
if ($state->{all}) {
$state->engine->dump_dependencies;
if ($state->opt('f')) {
DPB::Distfile->dump($state->{logger});
}
}
#$state->engine->dump($dump);
$state->engine->check_buildable;

View File

@ -1,5 +1,5 @@
# ex:ts=8 sw=4:
# $OpenBSD: Fetch.pm,v 1.8 2011/05/27 13:13:43 espie Exp $
# $OpenBSD: Fetch.pm,v 1.9 2011/05/29 11:06:23 espie Exp $
#
# Copyright (c) 2010 Marc Espie <espie@openbsd.org>
#
@ -55,6 +55,15 @@ sub new
$cache->{$full} //= $class->create($full, $file, @r);
}
sub dump
{
my ($class, $logger) = @_;
my $log = $logger->create("fetch/distfiles");
for my $f (sort map {$_->{name}} values %$cache) {
print $log $f, "\n";
}
}
sub logname
{
my $self = shift;
@ -175,7 +184,8 @@ sub build_distinfo
for my $v (values %$h) {
my $info = $v->{info};
next unless defined $info->{DISTFILES} ||
defined $info->{PATCHFILES};
defined $info->{PATCHFILES} ||
defined $info->{SUPDISTFILES};
my $dir = $info->{DIST_SUBDIR};
my $checksum_file = $info->{CHECKSUM_FILE};
@ -189,22 +199,29 @@ sub build_distinfo
my $checksums = $distinfo->{$checksum_file};
my $files = {};
for my $d ((keys %{$info->{DISTFILES}}), (keys %{$info->{PATCHFILES}})) {
my $build = sub {
my $arg = shift;
my $site = 'MASTER_SITES';
if ($d =~ m/^(.*)\:(\d)$/) {
$d = $1;
if ($arg =~ m/^(.*)\:(\d)$/) {
$arg = $1;
$site.= $2;
}
if (!defined $info->{$site}) {
die "Can't find $site for $d";
die "Can't find $site for $arg";
}
my $file = DPB::Distfile->new($d, $dir,
return DPB::Distfile->new($arg, $dir,
$info->{$site}, $checksums, $v, $self->{distdir});
};
for my $d ((keys %{$info->{DISTFILES}}), (keys %{$info->{PATCHFILES}})) {
my $file = &$build($d);
$files->{$file} = $file;
}
for my $d (keys %{$info->{SUPDISTFILES}}) {
&$build($d);
}
for my $k (qw(DIST_SUBDIR CHECKSUM_FILE DISTFILES
PATCHFILES MASTER_SITES MASTER_SITES0
PATCHFILES SUPDISTFILES MASTER_SITES MASTER_SITES0
MASTER_SITES1 MASTER_SITES2 MASTER_SITES3
MASTER_SITES4 MASTER_SITES5 MASTER_SITES6
MASTER_SITES7 MASTER_SITES8 MASTER_SITES9)) {

View File

@ -1,5 +1,5 @@
# ex:ts=8 sw=4:
# $OpenBSD: PortInfo.pm,v 1.7 2011/05/22 08:21:39 espie Exp $
# $OpenBSD: PortInfo.pm,v 1.8 2011/05/29 11:06:23 espie Exp $
#
# Copyright (c) 2010 Marc Espie <espie@openbsd.org>
#
@ -177,6 +177,7 @@ my %adder = (
BNEEDED_BY => "AddDepends",
DISTFILES => 'AddList',
PATCHFILES => 'AddList',
SUPDISTFILES => 'AddList',
DIST_SUBDIR => 'AddInfo',
CHECKSUM_FILE => 'AddInfo',
FETCH_MANUALLY => 'FetchManually',