deu / palemoon-overlay

Unofficial Gentoo overlay for the Pale Moon (http://www.palemoon.org/) web browser.
34 stars 12 forks source link

Assertion of compiler should only be done if package will be compiled #120

Open tsjk opened 2 years ago

tsjk commented 2 years ago

First of all, hail to this repo! :) Now, the problem:

I have multiple boxes with the same architectural details that share the burden of compilation and merge each other's binary packages. The latest palemoon however has checks on gcc version which get executed even when the package is merged as a precompiled binary (i e emerge -1uK www-client/palemoon). In addition, the process fails even with ( export PALEMOON_ENABLE_UNSUPPORTED_COMPILERS=1; emerge -1uK www-client/palemoon ).

sedimentation-fault commented 2 years ago

Look at

eclass/palemoon-5.eclass

The logic that checks the compiler's version is fundamentally flawed. Change

    # Ensure that we are on a supported compiler profile:
    einfo "Checking compiler profile..."
    if [[ $PALEMOON_ENABLE_UNSUPPORTED_COMPILERS == 1 ]]; then
        unsupported_compiler_warning $(tc-get-compiler-type)
    else
        if ! [[ tc-is-gcc && "$GCC_SUPPORTED_VERSIONS" =~ (^| )"$(gcc-version)"($| ) ]]; then
            unsupported_compiler_error $(tc-get-compiler-type)
            die
        fi
    fi

to:

    # Ensure that we are on a supported compiler profile:
    einfo "Checking compiler profile..."
    if ! [[ tc-is-gcc && "$GCC_SUPPORTED_VERSIONS" =~ (^| )"$(gcc-version)"($| ) ]]; then
        if [[ $PALEMOON_ENABLE_UNSUPPORTED_COMPILERS == 1 ]]; then
            unsupported_compiler_warning $(tc-get-compiler-type)
        else
            unsupported_compiler_error $(tc-get-compiler-type)
            die
        fi
    fi

The logic of the proposed change is clear:

IF the compiler version is NOT among the supported ones, THEN choose your action depending on whether the user has set $PALEMOON_ENABLE_UNSUPPORTED_COMPILERS or not:

IF he has set it, issue a warning and go on. ELSE issue an error and stop.

Implicit to the above is that:

IF the compiler version IS among the supported ones THEN just go on

@tsjk : I don't know how exactly you integrate the palemoon repository, but I always copy the ebuilds into my own local overlay, where I can do all my changes without interfering with the official one. In that local overlay of mine, I have an 'eclass' directory. That's where my own versions of eclasses go. They take precedence over those of portage for my overlay. That's where I put such a corrected copy of palemoon-5.eclass - just drop it to /path-to-your-own-local-overlay/eclass/.

Thus, next time you sync, your eclass will not be overwritten. And since this palemoon-5.eclass does not change that often, you don't have to worry about it being out-of-sync each time you synchronize 'palemoon'.

Now, I am sure you can add a check there that package name $PN should not contain '-bin', perhaps enclosing the outermost IF in another one: if ! [[ $PN =~ -bin ]]; then... ;-)