Results 1 to 9 of 9

Thread: Confuse about build condition (%bcond_with/out)

  1. #1
    Join Date
    Oct 2018
    Location
    Atlantis
    Posts
    191

    Default Confuse about build condition (%bcond_with/out)

    Hello,

    I am confuse about how to use %bcond

    Lets say "A" depend on "B" for testing.
    But B hard depend on A.

    So therefore should the spec file of A be like this?

    Code:
    %bcond_with test
    ...
    %if %{with test}
    BuildRequires:  B
    %endif
    The reason I ask is because python repo maintainer suggest the correct way to do it is,
    Code:
    %bcond_without test
    ...
    %if %{with test}
    BuildRequires:  B
    %endif
    But this result in unsolvable (using %bcond_without ): https://build.opensuse.org/package/s...ython-tifffile

    The package using %bcond_with that I did which fix the unsolvable is here: https://build.opensuse.org/package/show/home:andythe_great/python-tifffile

    Thanks.

  2. #2
    Join Date
    Sep 2012
    Posts
    5,924

    Default Re: Confuse about build condition (%bcond_with/out)

    %bcond_with defaults value to 0, %bcond_without defaults to 1. This is the only difference. It works in your case because it evaluates to 0 and so skips whatever requires you defined.

  3. #3
    Join Date
    Oct 2018
    Location
    Atlantis
    Posts
    191

    Default Re: Confuse about build condition (%bcond_with/out)

    Quote Originally Posted by arvidjaar View Post
    %bcond_with defaults value to 0, %bcond_without defaults to 1. This is the only difference. It works in your case because it evaluates to 0 and so skips whatever requires you defined.
    I see, so the plan is to skip requires with %bcond_with, then after other dependencies arrived change it to %bcond_without?

  4. #4
    Join Date
    Sep 2012
    Posts
    5,924

    Default Re: Confuse about build condition (%bcond_with/out)

    Quote Originally Posted by andythe_great View Post
    so the plan is
    Was it question to me?

    to skip requires with %bcond_with, then after other dependencies arrived change it to %bcond_without?
    I suspect you misunderstand what %bcond macros do and how to use them, but as you neither describe what you are trying to achieve nor show any real code used to implement your requirement there is not much to say.

  5. #5
    Join Date
    Oct 2018
    Location
    Atlantis
    Posts
    191

    Default Re: Confuse about build condition (%bcond_with/out)

    Quote Originally Posted by arvidjaar View Post
    Was it question to me?


    I suspect you misunderstand what %bcond macros do and how to use them, but as you neither describe what you are trying to achieve nor show any real code used to implement your requirement there is not much to say.
    I have this python-tifffile package https://build.opensuse.org/package/s...ython-tifffile

    python-tifffile depend on the following packages for testing only.

    Code:
    Requires:       python-cmapfile
    Requires:       python-czifile
    Requires:       python-imagecodecs
    Requires:       python-lfdfiles
    Requires:       python-oiffile
    Requires:       python-roifile
    However, those packages (czifile, imagecodecs, etc) depend on python-tifffile to be able to build.
    So my understanding is that, I have to build python-tifffile without testing it (and without czifile, imagecodecs, etc).
    Then proceed to build czifile, imagecodecs, etc which depend on tifffile.
    After czifile, imagecodecs, etc build, I have to re-enable testing for tifffile.

    What I think is to use %bcond_with tests (on tifffile spec file) to allow tifffile to build without test and its testing dependencies.
    Then once the czifile, imagecodecs, etc builds, change it to %bcond_without tests to build tifffile with tests.

    Does bcond allow me to do this?

  6. #6
    Join Date
    Sep 2012
    Posts
    5,924

    Default Re: Confuse about build condition (%bcond_with/out)

    Quote Originally Posted by andythe_great View Post
    python-tifffile depend on the following packages for testing only.
    I still do not understand what "for testing only" means. Do you mean %check section in spec file? This section is empty in your spec.

  7. #7
    Join Date
    Oct 2018
    Location
    Atlantis
    Posts
    191

    Default Re: Confuse about build condition (%bcond_with/out)

    Quote Originally Posted by arvidjaar View Post
    I still do not understand what "for testing only" means. Do you mean %check section in spec file? This section is empty in your spec.
    Yes, I meant %check section.
    Testing need network connection, now that I think about it, since testing cannot be done on OBS anyway.
    I will just remove

    Code:
    BuildRequires:  %{python_module cmapfile}
    BuildRequires:  %{python_module czifile}
    BuildRequires:  %{python_module imagecodecs}
    BuildRequires:  %{python_module lfdfiles}
    BuildRequires:  %{python_module oiffile}
    BuildRequires:  %{python_module roifile}
    and %bcond
    Leaving only,

    Code:
    Requires:       python-cmapfile
    Requires:       python-czifile
    Requires:       python-imagecodecs
    Requires:       python-lfdfiles
    Requires:       python-oiffile
    Requires:       python-roifile
    Would that be acceptable?

  8. #8
    Join Date
    Oct 2018
    Location
    Atlantis
    Posts
    191

    Default Re: Confuse about build condition (%bcond_with/out)

    Hi,
    To explain what's going on. tifffile want imagecodecs, czifile, cmapfile, oiffile, lfdfiles, and roifile for testing. imagecodecs, czifile, cmapfile, oiffile, lfdfiles, and roifile depend on tifffile to build.


    But the test for tifffile required network connection, therefore I disable the test.


    I have removed imagecodecs, czifile, cmapfile, oiffile, lfdfiles, and roifile on BuildRequires: section of tifffile to allow tifffile itself to build first.


    Since tifffile still need imagecodecs, czifile, cmapfile, oiffile, lfdfiles, and roifile for testing which can be done locally, I have put it into Requires: section only


    Is this ok?

  9. #9
    Join Date
    Oct 2018
    Location
    Atlantis
    Posts
    191

    Default [Closed] Re: Confuse about build condition (%bcond_with/out)

    I found out that those deps are not necessary.
    It build normally now.

    closing

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •