# ex:ts=8 sw=4:
-# $OpenBSD: LibSpec.pm,v 1.20 2023/06/13 09:07:17 espie Exp $
+# $OpenBSD: LibSpec.pm,v 1.21 2023/10/08 12:45:31 espie Exp $
#
# Copyright (c) 2010 Marc Espie <espie@openbsd.org>
#
package OpenBSD::LibObject;
+sub systemlibraryclass($self)
+{
+ return ref($self);
+}
+
sub key($self)
{
if (defined $self->{dir}) {
package OpenBSD::Library;
our @ISA = qw(OpenBSD::LibObject);
+sub systemlibraryclass($)
+{
+ "OpenBSD::Library::System";
+}
+
sub from_string($class, $filename)
{
if (my ($dir, $stem, $major, $minor) = $filename =~ m/^(.*)\/lib([^\/]+)\.so\.(\d+)\.(\d+)$/o) {
sub set_origin($self, $origin)
{
$self->{origin} = $origin;
+ if ($origin eq 'system') {
+ bless $self, $self->systemlibraryclass;
+ }
return $self;
}
return 0;
}
+# could be used for better reporting
+# is used for regression testing
+package OpenBSD::Library::System;
+our @ISA = qw(OpenBSD::Library);
+
package OpenBSD::LibSpec;
our @ISA = qw(OpenBSD::LibObject);