# ex:ts=8 sw=4:
-# $OpenBSD: PackingElement.pm,v 1.284 2022/11/04 13:22:15 espie Exp $
+# $OpenBSD: PackingElement.pm,v 1.285 2023/05/16 14:28:39 espie Exp $
#
# Copyright (c) 2003-2014 Marc Espie <espie@openbsd.org>
#
# This is the basic class, which is mostly abstract, except for
# create and register_with_factory.
# It does provide base methods for stuff under it, though.
+
+# XXX PackingElement uses (very seldom) multiple inheritance:
+# the subclasses ::DirBase and ::Unique are used as mix-ins
+# and thus contain very limited functionality !
+
package OpenBSD::PackingElement;
our %keyword;
{
}
+# plist keeps a "state" while reading a plist
+# $self->destate($plstate)
sub destate
{
}
return $self;
}
+# $class->add($plist, @args):
+# create an object with the correct arguments
+# returns the actual object created, IF ANY (XXX see subclasses
+# for instances of annotations like @symlink that DON'T create
+# an actual object)
+#
+# most add methods have ONE single argument, except for
+# subclasses generated from comments !
sub add
{
my ($class, $plist, @args) = @_;
}
}
+# specialized version to avoid copying digital signatures over
sub write_no_sig
{
my ($self, $fh) = @_;
return ${$_[0]->{cwd}};
}
+# most objects should be fs relative, but there are
+# exceptions, such as sample files that will get installed
+# under /etc, or rc files !
sub absolute_okay() { 0 }
sub compute_fullname
{
package OpenBSD::PackingElement::Meta;
our @ISA=qw(OpenBSD::PackingElement);
+# XXX mix-in class, see comment at top of file
package OpenBSD::PackingElement::Unique;
our @ISA=qw(OpenBSD::PackingElement::Meta);
sub dirclass() { "OpenBSD::PackingElement::Sampledir" }
+# TODO @ghost data is not yet used
+# it's meant for files that used to be "registered" but are
+# somewhat autogenerated or something, and should vanish in a transparent way.
+#
+# the keyword was introduced very early but is (still) not used
+
package OpenBSD::PackingElement::Ghost;
our @ISA = qw(OpenBSD::PackingElement::FileObject);
sub register_manpage
{
my ($self, $state, $key) = @_;
- # XXX don't bother register stuff from partial packages
+ # optimization: don't bother registering stuff from partial packages
+ # (makewhatis will complain that the names don't match anyway)
return if defined $self->{tempname};
my $fname = $self->fullname;
if ($fname =~ m,^(.*/man(?:/\w+)?)/((?:man|cat)[1-9n]\w*/.*),) {
sub keyword() { "ltlib" }
__PACKAGE__->register_with_factory;
-# Comment is very special
+# Comment is very special:
+# - some annotations are comments for historic reasons
+# - CVSTags need to be recognized for register-plist (obsolescent)
+# - tools like update-plist will recognize @comment'ed entries
+# and thus destate needs to run on normal comments
package OpenBSD::PackingElement::Comment;
our @ISA=qw(OpenBSD::PackingElement::Meta);
sub category() { 'manual-installation' }
-# XXX don't incorporate this in signatures.
+# don't incorporate this in signatures for obvious reasons
sub write_no_sig()
{
}
__PACKAGE__->register_old_keyword($k);
}
-# Real pkgpath objects, with matching properties
+# pkgpath objects are parsed in extrainfo and pkgpath objects
+# so that erroneous pkgpaths will be flagged early
package OpenBSD::PkgPath;
sub new
{