diff options
| -rw-r--r-- | mesonbuild/backend/backends.py | 6 | ||||
| -rw-r--r-- | mesonbuild/build.py | 9 | ||||
| -rw-r--r-- | test cases/common/42 subproject/meson.build | 3 | ||||
| -rw-r--r-- | test cases/common/42 subproject/test.json | 1 |
4 files changed, 14 insertions, 5 deletions
diff --git a/mesonbuild/backend/backends.py b/mesonbuild/backend/backends.py index feb002e54..a960537a8 100644 --- a/mesonbuild/backend/backends.py +++ b/mesonbuild/backend/backends.py @@ -1354,9 +1354,9 @@ class Backend: d.data.append(InstallDataBase(ifilename, ofilename, out_name, None, '', tag='devel', data_type='depmf')) for m in self.build.dep_manifest.values(): - for ifilename, name in m.license_files: - ofilename = os.path.join(odirname, name.relative_name()) - out_name = os.path.join(out_dir, name.relative_name()) + for ifilename, name in m.license_mapping(): + ofilename = os.path.join(odirname, name) + out_name = os.path.join(out_dir, name) d.data.append(InstallDataBase(ifilename, ofilename, out_name, None, m.subproject, tag='devel', data_type='depmf')) diff --git a/mesonbuild/build.py b/mesonbuild/build.py index a883c3b28..6e233a382 100644 --- a/mesonbuild/build.py +++ b/mesonbuild/build.py @@ -223,11 +223,18 @@ class DepManifest: license_files: T.List[T.Tuple[str, File]] subproject: str + def license_mapping(self) -> T.List[T.Tuple[str, str]]: + ret = [] + for ifilename, name in self.license_files: + fname = os.path.join(*(x for x in pathlib.PurePath(os.path.normpath(name.fname)).parts if x != '..')) + ret.append((ifilename, os.path.join(name.subdir, fname))) + return ret + def to_json(self) -> T.Dict[str, T.Union[str, T.List[str]]]: return { 'version': self.version, 'license': self.license, - 'license_files': [l[1].relative_name() for l in self.license_files], + 'license_files': [l[1] for l in self.license_mapping()], } diff --git a/test cases/common/42 subproject/meson.build b/test cases/common/42 subproject/meson.build index c2c0122f1..bc24adbcc 100644 --- a/test cases/common/42 subproject/meson.build +++ b/test cases/common/42 subproject/meson.build @@ -1,7 +1,8 @@ project('subproj user', 'c', version : '2.3.4', license : 'mylicense', - license_files: 'mylicense.txt', + # also grab the meson license to test monorepo support + license_files: ['mylicense.txt', '../../../COPYING'], ) assert(meson.project_name() == 'subproj user', 'Incorrect project name') diff --git a/test cases/common/42 subproject/test.json b/test cases/common/42 subproject/test.json index 949cb79fa..e469052f4 100644 --- a/test cases/common/42 subproject/test.json +++ b/test cases/common/42 subproject/test.json @@ -4,6 +4,7 @@ {"type": "pdb", "file": "usr/bin/user"}, {"type": "file", "file": "usr/share/sublib/sublib.depmf"}, {"type": "file", "file": "usr/share/sublib/mylicense.txt"}, + {"type": "file", "file": "usr/share/sublib/COPYING"}, {"type": "file", "file": "usr/share/sublib/subprojects/sublib/sublicense1.txt"}, {"type": "file", "file": "usr/share/sublib/subprojects/sublib/sublicense2.txt"} ] |
