Quantcast

tweak: allow simulation of register-plist

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

tweak: allow simulation of register-plist

Marc Espie-2
There are actually two patches, one for src, the other for port.

1st patch unconditionally regenerates special files, even in -n mode,
so that they can be checksummed. As a result, the  printed plist contains
@sha256 markers for these.

Con: very slightly slower.

2nd patch allows register-plist to take '-' as a parameter, so that it can
read a packing-list on STDIN.

Together, those two patches allow something like

make print-plist-with-depends | register-plist ${PLIST_DB} -
to work (as register-plist does need checksums for special files)

With this, it should be easy to add a convenience target to the infrastructure
that would  just register all plists without building anything.

One application would be to be able to do broad changes in the ports tree,
like tweaking WANTLIB in modules, and quickly checked that ports didn't change
or didn't change too much.

This should not change anything to existing applications... well, unless
someone has issues with @sha256 in packing-lists.

Index: OpenBSD/PkgCreate.pm
===================================================================
RCS file: /cvs/src/usr.sbin/pkg_add/OpenBSD/PkgCreate.pm,v
retrieving revision 1.123
diff -u -p -r1.123 PkgCreate.pm
--- OpenBSD/PkgCreate.pm 3 Oct 2016 13:17:30 -0000 1.123
+++ OpenBSD/PkgCreate.pm 14 May 2017 14:13:01 -0000
@@ -147,6 +147,7 @@ sub pretend_to_archive
  $self->comment_create_package($state);
 }
 
+sub makesum_special_file {}
 sub record_digest {}
 sub archive {}
 sub really_archived { 0 }
@@ -358,6 +359,12 @@ sub pretend_to_archive
  &OpenBSD::PackingElement::FileBase::pretend_to_archive;
 }
 
+sub makesum_special_file
+{
+ my ($self, $state) = @_;
+ $self->add_digest($self->compute_digest($self->fullname));
+}
+
 sub set_destdir
 {
 }
@@ -410,6 +417,10 @@ sub makesum_plist
 {
 }
 
+sub makesum_special_file
+{
+}
+
 sub verify_checksum
 {
 }
@@ -1109,8 +1120,6 @@ sub add_description
  if (!defined $opt_d) {
  $state->usage("Description required");
  }
- return if $state->opt('q');
-
  open(my $fh, '>', $o->fullname) or die "Can't write to DESC: $!";
  if (defined $comment) {
  print $fh $subst->do($comment), "\n";
@@ -1227,9 +1236,7 @@ sub create_plist
  }
  $state->say("Creating package #1", $pkgname)
     if !(defined $state->opt('q')) && $state->opt('v');
- if (!$state->opt('q')) {
- $plist->set_infodir(OpenBSD::Temp->dir);
- }
+ $plist->set_infodir(OpenBSD::Temp->dir);
 
  unless (defined $state->opt('q') && defined $state->opt('n')) {
  $state->set_status("reading plist");
@@ -1472,6 +1479,9 @@ sub parse_and_run
     $state->defines('HISTORY_DIR'));
  $self->show_bad_symlinks($state);
  $state->end_status;
+ }
+ if ($state->opt('n')) {
+ $plist->makesum_special_file($state);
  }
 
  if (!defined $plist->pkgname) {

Index: register-plist
===================================================================
RCS file: /cvs/ports/infrastructure/bin/register-plist,v
retrieving revision 1.14
diff -u -p -r1.14 register-plist
--- register-plist 1 Nov 2016 15:34:39 -0000 1.14
+++ register-plist 14 May 2017 14:13:17 -0000
@@ -534,14 +534,19 @@ if ($state->opt('p')) {
 my $error =0;
 
 for my $pkgfile (@ARGV) {
- my $pkg = $state->repo->find($pkgfile);
- if (!$pkg) {
- $state->fatal("Bad package #1", $pkgfile);
- }
+ my $plist;
+ if ($pkgfile eq '-') {
+ $plist = OpenBSD::PackingList->read(\*STDIN);
+ } else {
+ my $pkg = $state->repo->find($pkgfile);
+ if (!$pkg) {
+ $state->fatal("Bad package #1", $pkgfile);
+ }
 
- my $plist = $pkg->plist;
- $pkg->close;
- $pkg->wipe_info;
+ $plist = $pkg->plist;
+ $pkg->close;
+ $pkg->wipe_info;
+ }
 
  $plist->forget_details;
  for my $dir (@dirs) {

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: tweak: allow simulation of register-plist

Marc Espie-2
Forget hope, I forgot about the symlinks registration and everything.
I guess I'll have to do something smarter in register-plist, should be
feasible.

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: tweak: allow simulation of register-plist

Marc Espie-2
On Sun, May 14, 2017 at 10:21:21PM +0200, Marc Espie wrote:
> Forget hope, I forgot about the symlinks registration and everything.
> I guess I'll have to do something smarter in register-plist, should be
> feasible.

More specifically, my current plans involve being able to "merge" wantlib
or similar innocuous things while keeping symlinks and crossing fingers.

Should work well for the scenarios I want to handle.

The other "fast" possibility just involves running
make plist-with-depends on the full portslist written by sqlports,
and diffing after a dangerous change...

Loading...