Aaron Bieber writes:
> Marc Espie writes:
>
>> On Wed, Jun 23, 2021 at 07:48:01AM -0600, Aaron Bieber wrote:
>>> Hi,
>>>
>>> Here is a diff that adds:
>>>
>>> - -trimpath to MODGO_FLAGS: This removes paths like
>>> "/build/pobj/blablablablbal" from the resulting binary.
>>> - Teaches modgo-gen-modules-helper how to pass a version to the
>>> get_dist_info stuff.
>>> - Adds a new make target: "modgo-gen-current-modules". This will
>>> generate the MODGO_ bits for the currently defined
>>> MODGO_MODNAME. (existing target generates them for what ever Go
>>> things the latest version of a MODGO_MODNAME is).
>>>
>>> The -trimpath is mostly cosmetic, but it also gets us a bit closer to
>>> "reproducible builds". This would potentially let us produce the same
>>> binaries that an upstream does for releases (assuming build flags and
>>> '-X' things are all the same).
>>>
>>> The new target lets one bump a port to an explicit version (i.e. not the
>>> latest, or a latest that has not yet propagated through the Go module
>>> ecosystem).
>>>
>>> Thoughts? Cluesticks? OKs?
>>>
>>> Cheers,
>>> Aaron
>>>
>>
>>> diff ad22f1f0930c176e1bc87c0d5537a6033669c23a /usr/ports
>>> blob - 60b84fb0ae310786ee5c71a2e4e4e741f0904da9
>>> file + infrastructure/bin/modgo-gen-modules-helper
>>> --- infrastructure/bin/modgo-gen-modules-helper
>>> +++ infrastructure/bin/modgo-gen-modules-helper
>>> @@ -31,7 +31,8 @@ use lib ( "$portdir/infrastructure/lib", "$FindBin::Bi
>>>
>>> use OpenBSD::PortGen::Port::Go;
>>>
>>> -my ( $module ) = @ARGV;
>>> +my ( $module, $version ) = @ARGV;
>>> +$module = "${module}\@${version}" if ($version ne "");
>>>
>>> my $port = OpenBSD::PortGen::Port::Go->new;
>>> my $portinfo = $port->get_dist_info($module);
>>> blob - 924c64a51696a59fd6dc5456b1f3f7abda7e38d6
>>> file + lang/go/go.port.mk
>>
>> That part looks wrong.
>>
>> I expect that having one single parameter will complain loudly about
>> $version being undefined.
>>
>> You want to distinguish between 1 parameter and two.
>>
>> So probably
>>
>> die if @ARGV < 1;
>> my $module = shift;
>> if (@ARGV == 1) {
>> $module .= '@'. shift;
>> }
>>
>> or something like that.
>>
>> (comparing version with "" opens all kinds of issues.
>>
>> Note that *all* portgen stuff should have
>> "use strict;"
>>
>> near use warnings.
>
> Updated diff with the changes above and a suggested change from sthen@.
>
> Now you run "env MODGO_VERSION=current make modgo-gen-modules" to get
> what Go thinks is the latest version of a port. Without the =current bit
> it will fetch the mod files for the current MODGO_VERSION.
>
> I also did a mulk (mini-bulk) of the Go ports to make sure there was no
> fallout from the addition of '-trimpath':
>
> Elapsed time=05:26:21
> I=607 B=0 Q=0 T=0 F=0 !=1
>
> Everything build fine!
>
Had a typo! ty danj@
No comments:
Post a Comment