Skip to content

Unhandled exception when re-applying patchfiles overlay #12869

Closed

Description

@hashemmm96

Describe the bug
"meson subprojects packagefiles --apply" throws exception when running on a subprojects dir with mixed git and file wraps. Occurs when the subprojects are already downloaded, e.g. when re-applying the patchfiles.

To Reproduce
Purge subprojects, re-download them, and try to apply packagefiles patches. Need at least one git wrap and one file wrap.

Here is the file structure.

(.venv) hashem@yoda ~/rover (chore/add-fff !%) » tree subprojects
subprojects
├── check.wrap
├── fff.wrap
└── packagefiles
    └── fff
        └── meson.build

2 directories, 3 files

check.wrap is brought in using meson wrap install check, while the fff wrap and its build file are local.

(.venv) hashem@yoda ~/rover (chore/add-fff !%) » 'cat' subprojects/fff.wrap
[wrap-git]
url = https://github.com/meekrosoft/fff.git
revision = 5111c61e1ef7848e3afd3550044a8cf4405f4199
depth = 1
patch_directory = fff

[provide]
fff = fff_dep
(.venv) hashem@yoda ~/rover (chore/add-fff !%) » 'cat' subprojects/check.wrap
[wrap-file]
directory = check-0.15.2
source_url = https://github.com/libcheck/check/archive/0.15.2.tar.gz
source_filename = check-0.15.2.tar.gz
source_hash = 998d355294bb94072f40584272cf4424571c396c631620ce463f6ea97aa67d2e
patch_filename = check_0.15.2-4_patch.zip
patch_url = https://wrapdb.mesonbuild.com/v2/check_0.15.2-4/get_patch
patch_hash = 3e998eb0c475613e890c9e006420fb6da5dcee27aa2ba3f331f9253648691743
source_fallback_url = https://github.com/mesonbuild/wrapdb/releases/download/check_0.15.2-4/check-0.15.2.tar.gz
wrapdb_version = 0.15.2-4

[provide]
check = check_dep

Here's the meson.build overlay file.

(.venv) hashem@yoda ~/rover (chore/add-fff !%) » 'cat' subprojects/packagefiles/fff/meson.build
project(
  'fff',
  'c',
  version: '5111c61e1ef7848e3afd3550044a8cf4405f4199',
)

fff_inc = include_directories('.')

fff_dep = declare_dependency(include_directories: fff_inc)

And here's the command sequence to reproduce:

(.venv) hashem@yoda ~/rover (chore/add-fff !%) » meson subprojects purge --confirm
(.venv) hashem@yoda ~/rover (chore/add-fff !%) » meson subprojects download
Downloading check source from https://github.com/libcheck/check/archive/0.15.2.tar.gz
Initialized empty Git repository in /home/hashem/rover/subprojects/fff/.git/
remote: Enumerating objects: 86, done.
remote: Counting objects: 100% (86/86), done.
remote: Compressing objects: 100% (81/81), done.
remote: Total 86 (delta 4), reused 64 (delta 3), pack-reused 0
Unpacking objects: 100% (86/86), 47.91 KiB | 1.29 MiB/s, done.
From https://github.com/meekrosoft/fff
 * branch            5111c61e1ef7848e3afd3550044a8cf4405f4199 -> FETCH_HEAD
HEAD is now at 5111c61 Add GTest with FetchContent (#120)
Download fff...
  -> done
Downloading check patch from https://wrapdb.mesonbuild.com/v2/check_0.15.2-4/get_patch
Download check...
  -> done
(.venv) hashem@yoda ~/rover (chore/add-fff !%) » meson subprojects packagefiles --apply
Re-applying patchfiles overlay for fff...
Traceback (most recent call last):
  File "/home/hashem/rover/.venv/lib/python3.10/site-packages/mesonbuild/mesonmain.py", line 194, in run
    return options.run_func(options)
  File "/home/hashem/rover/.venv/lib/python3.10/site-packages/mesonbuild/msubprojects.py", line 754, in run
    results = loop.run_until_complete(asyncio.gather(*tasks))
  File "/usr/lib/python3.10/asyncio/base_events.py", line 649, in run_until_complete
    return future.result()
  File "/usr/lib/python3.10/concurrent/futures/thread.py", line 58, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/hashem/rover/.venv/lib/python3.10/site-packages/mesonbuild/msubprojects.py", line 133, in run
    result = self.run_method()
  File "/home/hashem/rover/.venv/lib/python3.10/site-packages/mesonbuild/msubprojects.py", line 606, in packagefiles
    self.wrap_resolver.apply_patch()
  File "/home/hashem/rover/.venv/lib/python3.10/site-packages/mesonbuild/wrap/wrap.py", line 799, in apply_patch
    path = self.get_file_internal('patch')
  File "/home/hashem/rover/.venv/lib/python3.10/site-packages/mesonbuild/wrap/wrap.py", line 779, in get_file_internal
    mlog.log('Using', mlog.bold(self.packagename), what, 'from cache.')
AttributeError: 'Resolver' object has no attribute 'packagename'

ERROR: Unhandled python exception

    This is a Meson bug and should be reported!

Expected behavior
Reapplying patchfiles should succeed without throwing exception.

System parameters

(.venv) hashem@yoda ~/rover (main) » meson --version                                                                                  2 ↵
1.3.2
(.venv) hashem@yoda ~/rover (main) » python --version
Python 3.10.12

Activity

  1. added a commit that references this issue on Feb 16, 2024
    f417154
  2. dcbaker commented on Feb 16, 2024

    @dcbaker
    Member

    @hashemmm96, can you see if #12872 fixes your issue? I wrote it by inspection, so it's possible it doesn't fix the issue completely

  3. hashemmm96 commented on Feb 16, 2024

    @hashemmm96
    Author

    @dcbaker It fixes the issue!

  4. dcbaker commented on Feb 16, 2024

    @dcbaker
    Member

    Awesome, thanks for confirming!

  5. added a commit that references this issue on Feb 22, 2024
    39e1bf1
  6. added a commit that references this issue on Jun 4, 2024
    cfb7bb7
  7. added a commit that references this issue on May 1, 2025
    377417f
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions