Teach 'portgen go' how to re-use existing ports. Also remove debug lines
that made it in. OK afresh1@
This commit is contained in:
parent
88c63e476a
commit
096e6c6ae4
@ -1,4 +1,4 @@
|
||||
# $OpenBSD: Go.pm,v 1.5 2020/06/26 23:26:04 abieber Exp $
|
||||
# $OpenBSD: Go.pm,v 1.6 2020/07/11 22:26:01 abieber Exp $
|
||||
#
|
||||
# Copyright (c) 2019 Aaron Bieber <abieber@openbsd.org>
|
||||
#
|
||||
@ -23,14 +23,13 @@ use strict;
|
||||
use warnings qw(FATAL utf8); # fatalize encoding glitches
|
||||
use open qw(:std :encoding(UTF-8)); # undeclared streams in UTF-8
|
||||
use OpenBSD::PackageName;
|
||||
use OpenBSD::PortGen::Utils qw( fetch );
|
||||
use OpenBSD::PortGen::Utils qw( fetch module_in_ports );
|
||||
|
||||
use parent 'OpenBSD::PortGen::Port';
|
||||
|
||||
use Carp;
|
||||
use Cwd;
|
||||
use File::Temp qw/ tempdir /;
|
||||
use Data::Dumper;
|
||||
|
||||
use OpenBSD::PortGen::Dependency;
|
||||
|
||||
@ -168,7 +167,6 @@ sub _go_mod_info
|
||||
my @mods;
|
||||
|
||||
foreach my $mod (@raw_mods) {
|
||||
carp Dumper $mod if ($mod =~ m/markbates/);
|
||||
foreach my $m (split(/ /, $mod)) {
|
||||
$m =~ s/@/ /;
|
||||
$m = $self->_go_mod_normalize($m);
|
||||
@ -244,7 +242,12 @@ sub name_new_port
|
||||
|
||||
my $name = $di->{Name};
|
||||
$name = $self->SUPER::name_new_port($name);
|
||||
$name = "go/$name" unless $name =~ m{/};
|
||||
|
||||
if ( my $p = module_in_ports( $name, 'go-' ) || module_in_ports( $name, '' ) ) {
|
||||
$name = $p;
|
||||
} else {
|
||||
$name = "go/$name" unless $name =~ m{/};
|
||||
}
|
||||
|
||||
return $name;
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
# $OpenBSD: Utils.pm,v 1.6 2019/12/15 00:18:04 afresh1 Exp $
|
||||
# $OpenBSD: Utils.pm,v 1.7 2020/07/11 22:26:01 abieber Exp $
|
||||
#
|
||||
# Copyright (c) 2015 Giannis Tsaraias <tsg@openbsd.org>
|
||||
#
|
||||
@ -73,7 +73,7 @@ sub _module_sth
|
||||
sub module_in_ports
|
||||
{
|
||||
my ( $module, $prefix ) = @_;
|
||||
return unless $module and $prefix;
|
||||
return unless $module and defined $prefix;
|
||||
|
||||
state $sth = _module_sth();
|
||||
END { undef $sth }; # Bus error if destroyed during global destruction
|
||||
@ -95,6 +95,9 @@ sub module_in_ports
|
||||
# possibly without the "-". To catch that, we check if
|
||||
# e.g. pytest got imported as py-test instead of py-pytest
|
||||
( my $start = $prefix ) =~ s/-$//;
|
||||
|
||||
return unless $start;
|
||||
|
||||
if ( $module =~ /^$start-?(.*)$/ ) {
|
||||
return module_in_ports( $1, $prefix );
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user