Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RFE: add way to set macro for --nocheck in rpmbuild #316

Open
ignatenkobrain opened this issue Sep 5, 2017 · 15 comments
Open

RFE: add way to set macro for --nocheck in rpmbuild #316

ignatenkobrain opened this issue Sep 5, 2017 · 15 comments
Labels
handsfree Packaging automation and convenience RFE

Comments

@ignatenkobrain
Copy link
Contributor

currently when I pass --nocheck to rpmbuild, it just skips running check section, but there is no way to know this from spec file. would be nice if rpm would add some bcond for this, so packagers can do things like:

%if %{with check}
BuildRequires: xxx
%endif

or, do something like

%global _without_check 1

I remember that this was requested in RHBZ, but I can't find link (usual situation for bugzillas)..

The problem which I hit that MBS can't pass any parameters to koji (and passing them to mock is complicated in current code), so workaround was to put %__spec_check_pre exit 0 in macros file which I don't like.

@voxik
Copy link
Contributor

voxik commented Sep 5, 2017

I remember people were using BuildRequires(check) until this syntax was prohibited (this might be hint for BZ query 😄)

@ignatenkobrain
Copy link
Contributor Author

@voxik actually when I was looking into #104 I had some similar idea for having BuildRequires(prep) which are basically needed to unpack archive and run some tool to get new BuildRequires. So it might be not that bad idea.

@pmatilai
Copy link
Member

pmatilai commented Sep 5, 2017

BuildRequires(check) never did anything special, it was just a flaw in the spec parser that BuildRequires(whatever) was accepted.

@Conan-Kudo
Copy link
Member

@pmatilai It doesn't sound like a bad idea to have BuildRequires(stage), though. That way global controls on stages would have the proper effects during rpmbuild...

@pmatilai
Copy link
Member

Oh, I'm sure packagers would just luv yet more pesky details to fill in.

@ffesti ffesti added the RFE label Jun 18, 2018
@eclipseo
Copy link

+1 so this. Please make it possible.

@ffesti ffesti added this to Needs triage in Ticket Review (Outdated) Mar 3, 2020
@ffesti ffesti moved this from Needs triage to Yes in Ticket Review (Outdated) Mar 24, 2020
@torsava
Copy link
Contributor

torsava commented Jun 5, 2020

+1 this would be a great way to standardize on disabling tests!

@ffesti ffesti self-assigned this Jun 5, 2020
ffesti added a commit to ffesti/rpm that referenced this issue Jun 5, 2020
signaling and controling whether %check is executed during build.
The macro can be set globally or in the spec file. The --nocheck
parameter of rpmbuild takes precedence, though. If --nocheck is
passed to rpmbuild the macro set accordingly. Otherwise it is set
to 0 if not defined previously.

Resolves: rpm-software-management#316
@ffesti
Copy link
Contributor

ffesti commented Jun 8, 2020

Did a PR for this on Friday. Comments on #1256 are welcome.

@socketpair
Copy link
Contributor

socketpair commented Sep 2, 2020

@ffesti could you make BuildRequires(check) to work as expected ? i.e. ignore them if --nocheck was passed.

Hmmm, dnf builddep should also consider these changes. But it should have special option for that...

@ffesti ffesti removed this from Yes in Ticket Review (Outdated) Jun 23, 2022
@kailiu42
Copy link

I'm a bit confused after reading this issue and the PR. I have a spec file that the %check stage has some specific requirement, but I would like to make that requirement only in place when I do run the %check stage (i.e. when not using the --nocheck option of rpmbuild). Is that possible, and whether this issue is related?

@jiridanek
Copy link

I remember people were using BuildRequires(check) until this syntax was prohibited (this might be hint for BZ query smile)

Found it,

  • Bug 1134397 - RFE: %check-only requirements specification
  • Bug 1394870 - [RFE] Support BuildRequires(check) (closed as duplicate of the previous one)

@pmatilai pmatilai added the handsfree Packaging automation and convenience label Sep 14, 2023
@ffesti ffesti removed their assignment Nov 2, 2023
@sergiomb2
Copy link

we can use : rpmbuild --without check

@kloczek
Copy link
Contributor

kloczek commented Jan 19, 2024

we can use : rpmbuild --without check

This can be added very easy by place in global macros single line modification

# Add handle --{with|without} check
%__spec_check_pre \
        %{!?with_check:echo "%%check disabled."; exit 0} \
        %{___build_pre}

Than you can place in spec file:

%bcond_with   check

to disable %check.
I'm using that hack +3 years.

Do you want this as PR? 🤔

@kloczek
Copy link
Contributor

kloczek commented Jan 19, 2024

# Add handle --{with|without} check
%__spec_check_pre \
        %{!?with_check:echo "%%check disabled."; exit 0} \
        %{___build_pre}

Actually this is not all. It needs to be added default value of the %with_check. So wole solution has two additional lines.

# Add handle --{with|without} check
%with_check   1
%__spec_check_pre \
        %{!?with_check:echo "%%check disabled."; exit 0} \
        %{___build_pre}

@sergiomb2
Copy link

I prefer handle #2362 and #1929

since I don't use it but I found many people that use _without (wrongly)

https://sourcegraph.com/search?q=context:global+r:src.fedoraproject.org+file:.*%5C.spec%24+%5C%3Fwithout_&patternType=regexp&case=yes&sm=0&groupBy=repo

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
handsfree Packaging automation and convenience RFE
Projects
Status: Backlog
Development

Successfully merging a pull request may close this issue.