# ex:ts=8 sw=4:
-# $OpenBSD: PackingElement.pm,v 1.249 2018/01/24 16:52:44 espie Exp $
+# $OpenBSD: PackingElement.pm,v 1.250 2018/02/06 15:17:26 espie Exp $
#
# Copyright (c) 2003-2014 Marc Espie <espie@openbsd.org>
#
return ref(shift);
}
+# all the stuff that ends up in signatures
+package OpenBSD::PackingElement::VersionElement;
+our @ISA=qw(OpenBSD::PackingElement::Meta);
+
# all dependency information
package OpenBSD::PackingElement::Depend;
-our @ISA=qw(OpenBSD::PackingElement::Meta);
+our @ISA=qw(OpenBSD::PackingElement::VersionElement);
# Abstract class for all file-like elements
package OpenBSD::PackingElement::FileBase;
}
package OpenBSD::PackingElement::Version;
-our @ISA=qw(OpenBSD::PackingElement::Unique);
+our @ISA=qw(OpenBSD::PackingElement::Unique OpenBSD::PackingElement::VersionElement);
sub keyword() { "version" }
__PACKAGE__->register_with_factory;
});
package OpeNBSD::PackingElement::Libset;
-our @ISA=qw(OpenBSD::PackingElement::Depend);
+our @ISA=qw(OpenBSD::PackingElement::Meta);
sub category() { "libset" }
sub keyword() { "libset" }
# ex:ts=8 sw=4:
-# $OpenBSD: Signature.pm,v 1.19 2017/09/18 13:01:10 espie Exp $
+# $OpenBSD: Signature.pm,v 1.20 2018/02/06 15:17:26 espie Exp $
#
# Copyright (c) 2010 Marc Espie <espie@openbsd.org>
#
use strict;
use warnings;
-package OpenBSD::PackageName::Name;
-sub long_string
+package OpenBSD::PackingElement;
+sub signature {}
+
+package OpenBSD::PackingElement::VersionElement;
+sub signature
{
- my $self = shift;
- return '@'.$self->to_string;
+ my ($self, $hash) = @_;
+ $hash->{$self->signature_key} = $self;
}
sub always
{
- return 0;
+ return 1;
}
-package OpenBSD::LibObject;
-sub long_string
+package OpenBSD::PackingElement::Dependency;
+sub signature_key
{
my $self = shift;
- return $self->to_string;
+ return $self->{pkgpath};
}
-sub always
+sub sigspec
{
- return 1;
+ my $self = shift;
+ return OpenBSD::PackageName->from_string($self->{def});
}
-package OpenBSD::PackingElement;
-sub signature {}
+sub long_string
+{
+ my $self = shift;
+ return '@'.$self->sigspec->to_string;
+}
-package OpenBSD::PackingElement::Dependency;
-sub signature
+sub compare
{
- my ($self, $hash) = @_;
- $hash->{$self->{pkgpath}} = OpenBSD::PackageName->from_string($self->{def});
+ my ($a, $b) = @_;
+ return $a->sigspec->compare($b->sigspec);
}
-package OpenBSD::PackingElement::Wantlib;
-sub signature
+sub always
{
- my ($self, $hash) = @_;
+ return 0;
+}
+package OpenBSD::PackingElement::Wantlib;
+sub signature_key
+{
+ my $self = shift;
my $spec = $self->spec;
if ($spec->is_valid) {
- $hash->{$spec->key} = $spec;
+ return $spec->key;
+ } else {
+ return "???";
}
}
-package OpenBSD::PackingElement::Version;
+sub compare
+{
+ my ($a, $b) = @_;
+ return $a->spec->compare($b->spec);
+}
-sub signature
+sub long_string
{
- my ($self, $hash) = @_;
- $hash->{VERSION} = $self;
+ my $self = shift;
+ return $self->spec->to_string;
+}
+
+
+package OpenBSD::PackingElement::Version;
+sub signature_key
+{
+ return 'VERSION';
}
sub long_string