tweak: MULTI table now holds pointer to the corresponding subpackage path

This commit is contained in:
espie 2012-05-22 12:04:02 +00:00
parent a0492d2d5f
commit 19aa179987
7 changed files with 61 additions and 14 deletions

View File

@ -1,7 +1,7 @@
# $OpenBSD: Makefile,v 1.41 2012/05/20 11:06:07 espie Exp $
# $OpenBSD: Makefile,v 1.42 2012/05/22 12:04:02 espie Exp $
CATEGORIES = databases
V = 2.1
V = 2.2
DISTNAME = sqlports-$V
DISTFILES =
COMMENT = sqlite database of ports

View File

@ -1,4 +1,4 @@
# $OpenBSD: Info.pm,v 1.1 2012/05/18 12:11:28 espie Exp $
# $OpenBSD: Info.pm,v 1.2 2012/05/22 12:04:02 espie Exp $
#
# Copyright (c) 2012 Marc Espie <espie@openbsd.org>
#
@ -103,15 +103,16 @@ sub new
sub create
{
my ($self, $var, $value, $arch) = @_;
my ($self, $var, $value, $arch, $path) = @_;
my $k = $var;
if (defined $arch) {
$k .= "-$arch";
}
if (defined $vars->{$var}) {
$self->{vars}{$k} = $vars->{$var}->new($var, $value, $arch);
$self->{vars}{$k} = $vars->{$var}->new($var, $value, $arch,
$path);
} else {
$unknown->{$k} //= $self->{path};
$unknown->{$k} //= $path;
}
}

View File

@ -1,5 +1,5 @@
# ex:ts=8 sw=4:
# $OpenBSD: PkgPath.pm,v 1.2 2012/05/20 11:06:07 espie Exp $
# $OpenBSD: PkgPath.pm,v 1.3 2012/05/22 12:04:02 espie Exp $
#
# Copyright (c) 2012 Marc Espie <espie@openbsd.org>
#
@ -62,4 +62,17 @@ sub simplifies_to
{
}
sub change_multi
{
my ($path, $multi) = @_;
# make a tmp copy, non registered
my $tmp = ref($path)->create($path->fullpkgpath);
if ($multi eq '-main') {
$tmp->{m} = undef;
} else {
$tmp->{m} = $multi;
}
return $tmp->normalize;
}
1;

View File

@ -1,4 +1,4 @@
# $OpenBSD: Var.pm,v 1.14 2012/05/20 11:06:07 espie Exp $
# $OpenBSD: Var.pm,v 1.15 2012/05/22 12:04:02 espie Exp $
#
# Copyright (c) 2006-2010 Marc Espie <espie@openbsd.org>
#
@ -31,7 +31,7 @@ sub keyword_table() { undef }
sub new
{
my ($class, $var, $value, $arch) = @_;
print STDERR "$var-$arch\n" if defined $arch;
die "No arch fo $var" if defined $arch;
bless [$var, $value], $class;
}
@ -452,11 +452,39 @@ package MultiVar;
our @ISA = qw(ListVar);
sub table() { 'Multi' }
sub create_tables
{
my ($self, $inserter) = @_;
$inserter->make_table($self, 'UNIQUE(FULLPKGPATH, VALUE)',
TextColumn->new("VALUE"),
PathColumn->new("SUBPKGPATH"));
$inserter->prepare_normal_inserter($self->table,
"VALUE", "SUBPKGPATH");
}
sub new
{
my ($class, $var, $value, $arch, $path) = @_;
die "No arch fo $var" if defined $arch;
bless [$var, $value, $path], $class;
}
sub path
{
return shift->[2];
}
sub add
{
my ($self, $ins) = @_;
return if $self->value eq '-';
$self->SUPER::add($ins);
my $base = $self->path;
$self->AnyVar::add($ins);
for my $d ($self->words) {
my $path = $base->change_multi($d);
my $k = $ins->find_pathkey($path->fullpkgpath);
$self->normal_insert($ins, $d, $k) if $d ne '';
}
}
package ModulesVar;

View File

@ -1,5 +1,5 @@
#! /usr/bin/perl
# $OpenBSD: mksqlitedb,v 1.39 2012/05/20 11:06:07 espie Exp $
# $OpenBSD: mksqlitedb,v 1.40 2012/05/22 12:04:02 espie Exp $
#
# Copyright (c) 2006-2010 Marc Espie <espie@openbsd.org>
#
@ -90,7 +90,7 @@ sub parse_dump
$h->{$o} = $o;
# Note we did it !
$o->{info} //= Info->new($o);
$o->{info}->create($var, $value, $arch);
$o->{info}->create($var, $value, $arch, $o);
} elsif (m/^\>\>\s*Broken dependency:\s*(.*?)\s*non existent/) {
my $dir = PkgPath->new($1);
$dir->break("broken dependency");

View File

@ -58,7 +58,7 @@ MULTI_PACKAGES ports hold several entries with corresponding FULLPKGPATH
- Flavors(FULLPKGPATH, VALUE)
- PseudoFlavors(FULLPKGPATH, VALUE)
- Categories(FULLPKGPATH, VALUE)
- Multi(FULLPKGPATH, VALUE) ('-' values are not stored)
- Multi(FULLPKGPATH, VALUE, SUBPKGPATH) ('-' values are not stored)
- Modules(FULLPKGPATH, VALUE)
- Configure(FULLPKGPATH, VALUE) (corresponds to CONFIGURE_STYLE)
- ConfigureArgs(FULLPKGPATH, VALUE)
@ -88,6 +88,8 @@ All the libraries the FULLPKGPATH depends upon, with optional version
number specification stored in EXTRA
coming from either the WANTLIB variable or various LIB_DEPENDS.
- Multi(FULLPKGPATH, VALUE, SUBPKGPATH)
also contains the normalized pkgpath for the corresponding subpackage.
- Broken(FULLPKGPATH, ARCH, TEXT)
This is stored both in the main table (for now) and in a separate table, with
keywords since it may be arch-dependent

View File

@ -61,7 +61,7 @@ CANONICAL points to the reduced version.
- Flavors(FULLPKGPATH, VALUE)
- Categories(FULLPKGPATH, VALUE)
- Multi(FULLPKGPATH, VALUE)
- Multi(FULLPKGPATH, VALUE, SUBPKGPATH)
- Modules(FULLPKGPATH, VALUE)
- Configure(FULLPKGPATH, VALUE)
- ConfigureArgs(FULLPKGPATH, VALUE)
@ -85,6 +85,9 @@ the rest.
All the libraries the FULLPKGPATH depends upon, with and without version number,
coming from either the WANTLIB variable or various LIB_DEPENDS.
- Multi(FULLPKGPATH, VALUE, SUBPKGPATH)
with SUBPKGPATH the normalized pkgpath for that subpackage.
- BROKEN(FULLPKGPATH, ARCH, VALUE)
All the broken entries, which might be arch-dependent.