Skip to content

patch level guessed incorrectly? #4241

Open

Description

Actual Behavior

When supplying a patch (produced by git format-patch) that creates a new file, it appears that conda-build (3.21.4) guesses the patch level incorrectly, resulting in the file being created in the wrong directory.

In the following example, I am applying two patches:

  • config.patch that modifies an existing file at the top-level of the package
  • cmake.patch that creates a new file at the top-level

As shown in the build log, the first is applied with -Np1 and the second is applied with -Np0.

Applying patch: /home/conda/recipe_root/config.patch
Applying patch: /home/conda/recipe_root/config.patch with args:
['-Np1', '-i', '/tmp/tmpjghs1w3l/config.patch.native', '--binary']
checking file config.mk
patching file config.mk
Applying patch: /home/conda/recipe_root/cmake.patch
Patch level ambiguous, selecting least deep
Applying patch: /home/conda/recipe_root/cmake.patch with args:
['-Np0', '-i', '/tmp/tmpm1422urg/cmake.patch.native', '--binary']

In the end, the build fails because CMakeLists.txt was not created in the expected place.

Expected Behavior

I would expect both patches to be applied with -p1.

Steps to Reproduce

Try supplying a patch that creates a new file.

Output of conda info
     active environment : base
    active env location : /opt/conda
            shell level : 1
       user config file : /home/conda/.condarc
 populated config files : /home/conda/.condarc
          conda version : 4.10.1
    conda-build version : 3.21.4
         python version : 3.8.10.final.0
       virtual packages : __linux=5.8.0=0
                          __glibc=2.12=0
                          __unix=0=0
                          __archspec=1=x86_64
       base environment : /opt/conda  (writable)
      conda av data dir : /opt/conda/etc/conda
  conda av metadata url : https://repo.anaconda.com/pkgs/main
           channel URLs : https://conda.anaconda.org/conda-forge/linux-64
                          https://conda.anaconda.org/conda-forge/noarch
                          https://repo.anaconda.com/pkgs/main/linux-64
                          https://repo.anaconda.com/pkgs/main/noarch
                          https://repo.anaconda.com/pkgs/r/linux-64
                          https://repo.anaconda.com/pkgs/r/noarch
          package cache : /opt/conda/pkgs
                          /home/conda/.conda/pkgs
       envs directories : /opt/conda/envs
                          /home/conda/.conda/envs
               platform : linux-64
             user-agent : conda/4.10.1 requests/2.25.1 CPython/3.8.10 Linux/5.8.0-1033-azure centos/6.10 glibc/2.12
                UID:GID : 1001:1001
             netrc file : None
           offline mode : False

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    stale[bot] marked as stale due to inactivitystale::recovered[bot] recovered after being marked as stale

    Type

    No type

    Projects

    • Status

      🏗️ In Progress

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions