First cut at a lib-depends checker: this version does use WRKINST instead
of the actual package, so it WILL get things wrong in some multi-packages case.
This commit is contained in:
parent
22c02484ba
commit
5906a566ef
85
infrastructure/install/check-libs
Executable file
85
infrastructure/install/check-libs
Executable file
@ -0,0 +1,85 @@
|
||||
#!/usr/bin/perl -w
|
||||
|
||||
# $OpenBSD: check-libs,v 1.1 2001/10/24 11:57:34 espie Exp $
|
||||
|
||||
# Copyright (c) 2001 Marc Espie
|
||||
#
|
||||
# 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.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 AUTHOR 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.
|
||||
#
|
||||
|
||||
# Check that all libraries are mentioned in lib depends.
|
||||
# For now, we do a summary check, without taking version numbers into
|
||||
# account.
|
||||
|
||||
use strict;
|
||||
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;
|
||||
}
|
||||
}
|
||||
$pkgname =~ s|$LIBDIR/(.*?)/\+CONTENTS|$1|;
|
||||
return $pkgname;
|
||||
}
|
||||
|
||||
my $error = 0;
|
||||
|
||||
my %registered = map { s/(?:\.\d+)+//; s/\.$//; ($_, 1); }
|
||||
split(/[ ,\n]/, $ENV{'LIB_DEPENDS'});
|
||||
|
||||
open(LIBS, '<', shift);
|
||||
open(BUILDS, '<', shift);
|
||||
while (<BUILDS>) {
|
||||
chomp;
|
||||
s/^.*\/lib(.*?)\.so(?:\.\d+)+$/$1/;
|
||||
$registered{$_} = 1;
|
||||
}
|
||||
close(BUILDS);
|
||||
while (<LIBS>) {
|
||||
chomp;
|
||||
if (m/^\tlibrary: (\S+)\s(\d+)\s(\-?\d+)$/) {
|
||||
my ($name, $major, $minor) = ($1, $2, $3);
|
||||
$_ = $name;
|
||||
} else {
|
||||
s/^\t\-l(.*?)(\.\d+){0,2}(?: \=\> .*)?$/$1/;
|
||||
}
|
||||
unless (defined $registered{$_}) {
|
||||
print "lib-depends-check: no mention of $_ (".find_library($_).")\n";
|
||||
$error = 1;
|
||||
}
|
||||
}
|
||||
close(LIBS);
|
||||
|
||||
exit($error);
|
@ -1,6 +1,6 @@
|
||||
#-*- mode: Fundamental; tab-width: 4; -*-
|
||||
# ex:ts=4 sw=4 filetype=make:
|
||||
FULL_REVISION=$$OpenBSD: bsd.port.mk,v 1.480 2001/10/24 11:53:54 espie Exp $$
|
||||
FULL_REVISION=$$OpenBSD: bsd.port.mk,v 1.481 2001/10/24 11:57:34 espie Exp $$
|
||||
# $FreeBSD: bsd.port.mk,v 1.264 1996/12/25 02:27:44 imp Exp $
|
||||
# $NetBSD: bsd.port.mk,v 1.62 1998/04/09 12:47:02 hubertf Exp $
|
||||
#
|
||||
@ -1353,12 +1353,25 @@ ${_BUILDLIBLIST}: ${_FAKE_COOKIE}
|
||||
|
||||
.if defined(IGNORE) && !defined(NO_IGNORE)
|
||||
fetch checksum extract patch configure all build install regress \
|
||||
uninstall deinstall fake package:
|
||||
uninstall deinstall fake package lib-depends-check:
|
||||
. if !defined(IGNORE_SILENT)
|
||||
@${ECHO_MSG} "===> ${FULLPKGNAME${SUBPACKAGE}} ${IGNORE}."
|
||||
. endif
|
||||
|
||||
.else
|
||||
# For now, just check all libnames are present
|
||||
# The check is done on the fake area, be wary of multi-packages situation,
|
||||
# since we don't take it into account yet.
|
||||
#
|
||||
# Note that we cache needed library names, and libraries we're allowed to
|
||||
# depend upon, but not the actual list of lib depends, since this list is
|
||||
# going to be tweaked as a result of running lib-depends-check.
|
||||
#
|
||||
lib-depends-check: ${_LIBLIST} ${_BUILDLIBLIST}
|
||||
@LIB_DEPENDS="`${MAKE} _recurse-lib-depends`" PKG_DBDIR='${PKG_DBDIR}' \
|
||||
perl ${PORTSDIR}/infrastructure/install/check-libs \
|
||||
${_LIBLIST} ${_BUILDLIBLIST}
|
||||
|
||||
|
||||
|
||||
# Most standard port targets create a cookie to avoid being re-run.
|
||||
@ -2718,4 +2731,4 @@ unlink-categories:
|
||||
link-categories unlink-categories _package new-depends \
|
||||
dir-depends _recurse-dir-depends package-dir-depends \
|
||||
_package-recurse-dir-depends recursebuild-depends-list run-depends-list \
|
||||
bulk-packages bulk-do _recurse-lib-depends
|
||||
bulk-packages bulk-do _recurse-lib-depends lib-depends-check
|
||||
|
@ -1,5 +1,5 @@
|
||||
# from: @(#)bsd.subdir.mk 5.9 (Berkeley) 2/1/91
|
||||
# $OpenBSD: bsd.port.subdir.mk,v 1.42 2001/10/24 11:47:41 espie Exp $
|
||||
# $OpenBSD: bsd.port.subdir.mk,v 1.43 2001/10/24 11:57:34 espie Exp $
|
||||
# FreeBSD Id: bsd.port.subdir.mk,v 1.20 1997/08/22 11:16:15 asami Exp
|
||||
#
|
||||
# The include file <bsd.port.subdir.mk> contains the default targets
|
||||
@ -151,7 +151,7 @@ ${SUBDIR}::
|
||||
show obj fetch-makefile all-packages cdrom-packages \
|
||||
dir-depends package-dir-depends bulk-packages \
|
||||
ftp-packages packageinstall link-categories \
|
||||
unlink-categories regress bulk-do
|
||||
unlink-categories regress bulk-do lib-depends-check
|
||||
|
||||
.if !target(${__target})
|
||||
${__target}: _SUBDIRUSE
|
||||
@ -216,4 +216,4 @@ README.html:
|
||||
beforeinstall afterinstall install realinstall fake \
|
||||
all-packages cdrom-packages ftp-packages packageinstall \
|
||||
link-categories unlink-categories dir-depends package-dir-depends \
|
||||
regress
|
||||
regress lib-depends-check
|
||||
|
Loading…
Reference in New Issue
Block a user