diff options
-rw-r--r-- | usr.sbin/pkg_add/OpenBSD/Add.pm | 5 | ||||
-rw-r--r-- | usr.sbin/pkg_add/OpenBSD/PackingElement.pm | 35 |
2 files changed, 38 insertions, 2 deletions
diff --git a/usr.sbin/pkg_add/OpenBSD/Add.pm b/usr.sbin/pkg_add/OpenBSD/Add.pm index c001ee30d8d..622094c4d2c 100644 --- a/usr.sbin/pkg_add/OpenBSD/Add.pm +++ b/usr.sbin/pkg_add/OpenBSD/Add.pm @@ -1,5 +1,5 @@ # ex:ts=8 sw=4: -# $OpenBSD: Add.pm,v 1.158 2014/07/07 16:45:03 espie Exp $ +# $OpenBSD: Add.pm,v 1.159 2014/07/10 10:32:01 espie Exp $ # # Copyright (c) 2003-2014 Marc Espie <espie@openbsd.org> # @@ -278,6 +278,9 @@ sub set_modes $self->{mode}, $name); } } + if (defined $self->{ts}) { + utime $self->{ts}, $self->{ts}, $name; + } } package OpenBSD::PackingElement::Meta; diff --git a/usr.sbin/pkg_add/OpenBSD/PackingElement.pm b/usr.sbin/pkg_add/OpenBSD/PackingElement.pm index 8732340a15e..09190d331b2 100644 --- a/usr.sbin/pkg_add/OpenBSD/PackingElement.pm +++ b/usr.sbin/pkg_add/OpenBSD/PackingElement.pm @@ -1,5 +1,5 @@ # ex:ts=8 sw=4: -# $OpenBSD: PackingElement.pm,v 1.234 2014/03/18 18:53:29 espie Exp $ +# $OpenBSD: PackingElement.pm,v 1.235 2014/07/10 10:32:01 espie Exp $ # # Copyright (c) 2003-2014 Marc Espie <espie@openbsd.org> # @@ -366,6 +366,9 @@ sub write if (defined $self->{size}) { print $fh "\@size ", $self->{size}, "\n"; } + if (defined $self->{ts}) { + print $fh "\@ts ", $self->{ts}, "\n"; + } if (defined $self->{symlink}) { print $fh "\@symlink ", $self->{symlink}, "\n"; } @@ -401,6 +404,12 @@ sub add_size $self->{size} = $sz; } +sub add_timestamp +{ + my ($self, $ts) = @_; + $self->{ts} = $ts; +} + # XXX symlink/hardlinks are properties of File, # because we want to use inheritance for other stuff. @@ -832,6 +841,19 @@ sub add return; } +package OpenBSD::PackingElement::ts; +our @ISA=qw(OpenBSD::PackingElement::Annotation); + +__PACKAGE__->register_with_factory('ts'); + +sub add +{ + my ($class, $plist, $args) = @_; + + $plist->{state}->{lastfile}->add_timestamp($args); + return; +} + package OpenBSD::PackingElement::Option; our @ISA=qw(OpenBSD::PackingElement::Meta); @@ -1532,6 +1554,11 @@ sub add_size &OpenBSD::PackingElement::FileBase::add_size; } +sub add_timestamp +{ + # just don't +} + sub compute_digest { &OpenBSD::PackingElement::FileObject::compute_digest; @@ -1748,6 +1775,12 @@ sub time_to_iso8601 $year+1900, $month+1, $day, $hour, $min, $sec); } +sub iso8601 +{ + my $self = shift; + return time_to_iso8601($self->{timestamp}); +} + sub iso8601_to_time { if ($_[0] =~ m/^(\d{4})\-(\d{2})\-(\d{2})T(\d{2})\:(\d{2})\:(\d{2})Z$/) { |