new check libs that should work with a.out, and uses the current framework

for accessing plists.
okay naddy@
This commit is contained in:
espie 2004-09-18 08:12:11 +00:00
parent ea33829538
commit fb42eebbe1

View File

@ -1,6 +1,6 @@
#!/usr/bin/perl -w
# $OpenBSD: check-libs-elf,v 1.3 2004/02/12 14:04:43 espie Exp $
# $OpenBSD: check-libs-elf,v 1.4 2004/09/18 08:12:11 espie Exp $
# Copyright (c) 2001 Marc Espie
#
@ -29,28 +29,24 @@
# Check that all libraries are mentioned in lib depends.
use strict;
use OpenBSD::PackageInfo;
use OpenBSD::PackingList;
sub find_library
{
my $libname = shift;
my $LIBDIR=$ENV{'PKG_DBDIR'};
my @list = `fgrep -l lib$libname.so $LIBDIR/*/+CONTENTS`;
local $_;
if (@list != 1) {
return '???';
}
my $pkgname = $list[0];
chomp $pkgname;
open(FILE, $pkgname);
while (<FILE>) {
chomp;
if (m/^\@comment subdir\=(\S+)/) {
close FILE;
return $1;
my @list=();
for my $pkg (installed_packages()) {
my $plist = OpenBSD::PackingList->fromfile(installed_info($pkg).CONTENTS, \&OpenBSD::PackingList::LibraryOnly);
for my $file (@{$plist->{items}}) {
next unless $file->isa('OpenBSD::PackingElement::Lib');
if ($file->fullname() =~ m/\Q$libname\E/) {
push(@list, $plist->{extrainfo}->{subdir});
last;
}
}
}
$pkgname =~ s|$LIBDIR/(.*?)/\+CONTENTS|$1|;
return $pkgname;
return join(' ', @list);
}
my $error = 0;
@ -72,7 +68,13 @@ close($builds);
while (<$libs>) {
my ($path, $name, $major, $minor);
chomp;
if (m/^lib(\S+)\s+(\d+)\s+(\d+)$/) {
# older a.out
if (m/^\tlibrary: (\S+)\s(\d+)\s(\-?\d+)$/) {
($name, $major, $minor) = ($1, $2, $3);
} elsif (m/^\t\-l(.*?)(\.\d+)?(\.\d+)?(?: \=\> .*)?$/) {
($name, $major, $minor) = ($1, $2, $3);
# newer elf
} elsif (m/^lib(\S+)\s+(\d+)\s+(\d+)$/) {
($name, $major, $minor) = ($1, $2, $3);
} elsif (m/^(.*)\/lib(\S+)\s+(\d+)\s+(\d+)$/) {
($path, $name, $major, $minor) = ($1, $2, $3, $4);