Reversing use_bzip2

Rainer Müller raimue at macports.org
Thu Sep 14 15:49:47 UTC 2017


On 2017-09-14 11:30, Mojca Miklavec wrote:
>> Therefore you also need to override these options:
>>
>>  use_xz yes
>>  distfiles       gcc-${version}.tar.xz:gcc
>>  extract.only    gcc-${version}.tar.xz
>>
>> To make this easier for the gcc ports, we could pass the suffix to
>> crossgcc.setup as an optional parameter and use that instead of always
>> hardcoding bz2.
> 
> That sounds weird and ugly because each and every single port would
> have to do that.>
> Maybe there could be a conditional in the PortGroup checking if the
> version is higher (or equal) than 7 and if so, use xz.

+1

That sounds even better and easier than requiring an explicit argument
in the crossgcc.setup line.

> Would it be difficult to make "use_bzip2 no" revert any changes
> introduced by "use_bzip2 yes"?

We could look into deleting the dependencies added to depends_build.
Although automatically removing dependencies already lead to confusion
and unexpected results with use_autoconf...

In this case the problem with the crossgcc port group is that we cannot
"revert" what it did to extract.suffix when this variable was already
expanded when another option was set.

  use_bzip2 yes
  distfiles ${version}${extract.suffix}

The suffix will always stay hardcoded as .tar.bz2 in the distfiles
option, even if extract.suffix would be changed later.

In case you are wondering why this seems to work in other cases, only
the default of options is expanded lazily. So if an option was not
explicitly set, the first time this option is read, the default value
will be expanded to the value of variables at this point in time.

Rainer


More information about the macports-dev mailing list