Bug 1422625

Summary: RFE: please provide %scl_enable and %scl_disable abstraction
Product: [Fedora] Fedora Reporter: Pavel Raiskup <praiskup>
Component: scl-utilsAssignee: Remi Collet <fedora>
Status: CLOSED WONTFIX QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: rawhideCC: jorton, kardos.lubos, pmatilai, vondruch
Target Milestone: ---Keywords: FutureFeature
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2024-09-12 06:01:40 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Pavel Raiskup 2017-02-15 17:29:48 UTC
A prove of concept [1] I use for some time:

%scl_enable() %{expand:                                               \\\
scl enable %%{?scl} %%{?scl_build_scls} %%{?scl_package_build_scls} - \\\
        <<'_SCL_EOF'                                                    \
set -xe}

%scl_disable() _SCL_EOF

This is to be used as:

    %prep
    %{?scl_enable}
    # Regular shell code.
    %{?scl_disable}

The %{scl} is the actual collection being built, %scl_build_scls are colections
which whole colection depends, and %scl_package_build_scls is to be set in
particular SCL package spec file (when it is desired that we enable it only for
that package).

Note that the name doesn't matter, feel free to use some less general
macro names.

[1] http://copr-dist-git.fedorainfracloud.org/cgit/praiskup/rpm-config/scl-rpm-config.git/tree/macros.scl-helpers

Comment 1 Pavel Raiskup 2017-02-15 17:41:02 UTC
Possibly we could have the terminator parametric, too:
%scl_heredoc_terminator _SCL_EOF

Comment 2 Vít Ondruch 2017-04-05 15:27:08 UTC
Several notes:

* Wouldn't be better to use parameters instead (or in parallel?) of the %scl_package_build_scls?

* The order of listed collection matters. We take the last enabled SCL as a home for installation of currently build package, so the %%{?scl} should be the last.

* Should (not) the macros end up by %{nil}?

Comment 3 Vít Ondruch 2017-04-05 15:37:00 UTC
(In reply to Vít Ondruch from comment #2)
> so the %%{?scl} should be the last.

Or may be the first, not sure now. Would need to check that, sorry ;) Can't find the right example now :(

Comment 4 Pavel Raiskup 2017-04-05 17:21:25 UTC
(In reply to Vít Ondruch from comment #2)
> Several notes:
> 
> * Wouldn't be better to use parameters instead (or in parallel?) of the
> %scl_package_build_scls?

Perhaps there could be both, sounds like a good idea.

> * The order of listed collection matters. We take the last enabled SCL as a
> home for installation of currently build package, so the %%{?scl} should be
> the last.

Correct.  We want %scl to have the highest priority.   

> * Should (not) the macros end up by %{nil}?

Dunno, should they?  I haven't had issues with those macros so far, but
definitely I could be missing something.

Thanks for the review!  That macros should still stay "opt-in" IMO, no strict
guidelines for packagers -- so if we don't cover completely every use-case
out there, it is fine.  Let me know whether it makes sense to update
the proposal.

Comment 5 Vít Ondruch 2017-04-06 06:03:42 UTC
(In reply to Pavel Raiskup from comment #4)
> (In reply to Vít Ondruch from comment #2)
> > * Should (not) the macros end up by %{nil}?
> 
> Dunno, should they?  I haven't had issues with those macros so far, but
> definitely I could be missing something.

AFAIK the difference will be what happens if you write something like:

~~~
%{?scl_enable} something right behind the macro
~~~

This will expand to:

~~~
set -xe something right behind the macro
~~~

Which might be useful/harmful, depends how it is used.

If you end the macro by %{nil} there is new line inserted after the %{nil}. I'm raising this question based on my experience with bug 1121649.

Comment 6 Pavel Raiskup 2017-04-06 06:52:22 UTC
Agreed, <newline>%nil (newline is crucial) makes sense.

Comment 7 Fedora Admin user for bugzilla script actions 2023-09-05 00:53:47 UTC
This package has changed maintainer in Fedora. Reassigning to the new maintainer of this component.

Comment 8 Fedora Admin user for bugzilla script actions 2024-09-11 17:14:55 UTC
This package has changed maintainer in Fedora. Reassigning to the new maintainer of this component.

Comment 9 Remi Collet 2024-09-12 06:01:40 UTC
Package in survival mode, no new features planned