Paco Esteban writes:

> On Wed, 23 Jun 2021, 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?
>
> If I understand this correctly, the new target is the same as the old
> one but with the version added.  Instead of creating a new target, can't
> we modify the old one to accept a version ?  Then we call it with or
> without the MODGO_VERSION and have the same functionality, right ?
>
> I don't see how having a new target so similar is beneficial, but I may
> be missing something.

My thought was to not alter existing behavior that people might have
come to expect.

I don't know how easy it would be to make the existing target do
something conditional..

>
> Cheers,
> Paco.
>
>> 
>> 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
>> --- lang/go/go.port.mk
>> +++ lang/go/go.port.mk
>> @@ -71,7 +71,7 @@ DISTNAME_ESC =             ${DISTNAME${_s}}
>>  EXTRACT_SUFX ?=             .zip
>>  PKGNAME ?=          ${DISTNAME:S/-v/-/}
>>  ALL_TARGET ?=               ${MODGO_MODNAME}
>> -MODGO_FLAGS +=              -modcacherw
>> +MODGO_FLAGS +=              -modcacherw -trimpath
>>  DISTFILES +=                
>> ${DISTNAME_ESC}${EXTRACT_SUFX}{${MODGO_VERSION}${EXTRACT_SUFX}}
>>  EXTRACT_ONLY =              ${DISTNAME_ESC}${EXTRACT_SUFX}
>>  MASTER_SITES ?=             ${MASTER_SITE_ATHENS}${MODGO_MODNAME_ESC}/@v/
>> @@ -177,7 +177,8 @@ do-test:
>>  .  endif
>>  .endif
>>  
>> -# modgo-gen-modules will output MODGO_MODULES and MODGO_MODFILES
>> +# modgo-gen-modules will output MODGO_MODULES and MODGO_MODFILES for
>> +# the latest version of a given MODGO_MODNAME
>>  modgo-gen-modules:
>>  .if empty(MODGO_MODNAME)
>>      @${ECHO_MSG} "No MODGO_MODNAME set"
>> @@ -185,3 +186,13 @@ modgo-gen-modules:
>>  .else
>>      @${_PERLSCRIPT}/modgo-gen-modules-helper ${MODGO_MODNAME}
>>  .endif
>> +
>> +# modgo-gen-current-modules will output MODGO_MODULES and MODGO_MODFILES for
>> +# the currently set MODGO_VERSION
>> +modgo-gen-current-modules:
>> +.if empty(MODGO_MODNAME)
>> +    @${ECHO_MSG} "No MODGO_MODNAME set"
>> +    @exit 1
>> +.else
>> +    @${_PERLSCRIPT}/modgo-gen-modules-helper ${MODGO_MODNAME} 
>> ${MODGO_VERSION}
>> +.endif

Reply via email to