diff options
author | Marc Espie <espie@cvs.openbsd.org> | 2018-06-15 09:37:30 +0000 |
---|---|---|
committer | Marc Espie <espie@cvs.openbsd.org> | 2018-06-15 09:37:30 +0000 |
commit | 2242f7aa0442b65a319b8915eda6140589021721 (patch) | |
tree | 2606c27706587fee60b4f3aedd66151482898550 /usr.sbin/pkg_add/OpenBSD | |
parent | 514828e56d82e4ac3d870c539abe3f55686b4b28 (diff) |
Add a -Dstub option to facilitate creating/adding/deleting "stubbed" packages
with just the packing and dependency info with none of the files.
(useful for debugging tricky cases that involve large packages)
Diffstat (limited to 'usr.sbin/pkg_add/OpenBSD')
-rw-r--r-- | usr.sbin/pkg_add/OpenBSD/Add.pm | 7 | ||||
-rw-r--r-- | usr.sbin/pkg_add/OpenBSD/Delete.pm | 12 | ||||
-rw-r--r-- | usr.sbin/pkg_add/OpenBSD/PkgCreate.pm | 47 |
3 files changed, 50 insertions, 16 deletions
diff --git a/usr.sbin/pkg_add/OpenBSD/Add.pm b/usr.sbin/pkg_add/OpenBSD/Add.pm index 3614324c28c..4e00d7af7a6 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.174 2018/02/27 22:46:53 espie Exp $ +# $OpenBSD: Add.pm,v 1.175 2018/06/15 09:37:29 espie Exp $ # # Copyright (c) 2003-2014 Marc Espie <espie@openbsd.org> # @@ -100,6 +100,8 @@ sub perform_installation { my ($handle, $state) = @_; + return if $state->defines('stub'); + $state->{partial} = $handle->{partial}; $state->progress->visit_with_size($handle->{plist}, 'install'); if ($handle->{location}{early_close}) { @@ -113,6 +115,8 @@ sub perform_extraction { my ($handle, $state) = @_; + return if $state->defines('stub'); + $handle->{partial} = {}; $state->{partial} = $handle->{partial}; $state->{archive} = $handle->{location}; @@ -412,6 +416,7 @@ sub prepare_for_addition $state->{problems}++; return; } + return if $state->defines('stub'); my $s = $state->vstat->add($fname, $self->{tieto} ? 0 : $self->{size}, $pkgname); return unless defined $s; diff --git a/usr.sbin/pkg_add/OpenBSD/Delete.pm b/usr.sbin/pkg_add/OpenBSD/Delete.pm index c589c309194..37a46d43b54 100644 --- a/usr.sbin/pkg_add/OpenBSD/Delete.pm +++ b/usr.sbin/pkg_add/OpenBSD/Delete.pm @@ -1,5 +1,5 @@ # ex:ts=8 sw=4: -# $OpenBSD: Delete.pm,v 1.150 2018/02/27 22:46:53 espie Exp $ +# $OpenBSD: Delete.pm,v 1.151 2018/06/15 09:37:29 espie Exp $ # # Copyright (c) 2003-2014 Marc Espie <espie@openbsd.org> # @@ -141,10 +141,12 @@ sub delete_plist my $pkgname = $plist->pkgname; $state->{pkgname} = $pkgname; - if (!$state->{size_only}) { - $plist->register_manpage($state, 'rmman'); - manpages_unindex($state); - $state->progress->visit_with_size($plist, 'delete'); + if (!$state->defines('stub')) { + if (!$state->{size_only}) { + $plist->register_manpage($state, 'rmman'); + manpages_unindex($state); + $state->progress->visit_with_size($plist, 'delete'); + } } unregister_dependencies($plist, $state); diff --git a/usr.sbin/pkg_add/OpenBSD/PkgCreate.pm b/usr.sbin/pkg_add/OpenBSD/PkgCreate.pm index 02beae75e4f..754ac7c48e6 100644 --- a/usr.sbin/pkg_add/OpenBSD/PkgCreate.pm +++ b/usr.sbin/pkg_add/OpenBSD/PkgCreate.pm @@ -1,6 +1,6 @@ #! /usr/bin/perl # ex:ts=8 sw=4: -# $OpenBSD: PkgCreate.pm,v 1.141 2018/06/06 10:13:10 espie Exp $ +# $OpenBSD: PkgCreate.pm,v 1.142 2018/06/15 09:37:29 espie Exp $ # # Copyright (c) 2003-2014 Marc Espie <espie@openbsd.org> # @@ -204,6 +204,7 @@ sub pretend_to_archive } sub record_digest {} +sub stub_digest {} sub archive {} sub really_archived { 0 } sub comment_create_package {} @@ -392,6 +393,12 @@ sub record_digest push(@$new, $self); } +sub stub_digest +{ + my ($self, $ordered) = @_; + push(@$ordered, $self); +} + package OpenBSD::PackingElement::RcScript; sub set_destdir { @@ -460,6 +467,12 @@ sub prepare_for_archival sub forbidden() { 1 } +sub stub_digest +{ + my ($self, $ordered) = @_; + push(@$ordered, $self); +} + # override for CONTENTS: we cannot checksum this. package OpenBSD::PackingElement::FCONTENTS; sub makesum_plist @@ -484,6 +497,12 @@ sub comment_create_package $state->say("GZIP: END OF SIGNATURE CHUNK"); } +sub stub_digest +{ + my ($self, $ordered) = @_; + push(@$ordered, $self); +} + package OpenBSD::PackingElement::Cwd; sub archive { @@ -1605,19 +1624,25 @@ sub parse_and_run exit 0; } $plist->discover_directories($state); - my $ordered; + my $ordered = []; unless (defined $state->opt('q') && defined $state->opt('n')) { $state->set_status("checking dependencies"); $self->check_dependencies($plist, $state); - $state->set_status("checksumming"); - if ($regen_package) { - $state->progress->visit_with_count($plist, 'verify_checksum'); + if ($state->defines("stub")) { + $plist->stub_digest($ordered); } else { - $plist = $self->make_plist_with_sum($state, $plist); + $state->set_status("checksumming"); + if ($regen_package) { + $state->progress->visit_with_count($plist, + 'verify_checksum'); + } else { + $plist = $self->make_plist_with_sum($state, + $plist); + } + $ordered = $self->save_history($plist, + $state->defines('HISTORY_DIR')); + $self->show_bad_symlinks($state); } - $ordered = $self->save_history($plist, - $state->defines('HISTORY_DIR')); - $self->show_bad_symlinks($state); $state->end_status; } @@ -1664,7 +1689,9 @@ sub parse_and_run } else { $self->create_package($state, $plist, $ordered, $wname); } - $self->finish_manpages($state, $plist); + if (!$state->defines("stub")) { + $self->finish_manpages($state, $plist); + } }catch { print STDERR "$0: $_\n"; return 1; |