-
-
Notifications
You must be signed in to change notification settings - Fork 69
Expand file tree
/
Copy pathmeson.py
More file actions
65 lines (57 loc) · 2.49 KB
/
Copy pathmeson.py
File metadata and controls
65 lines (57 loc) · 2.49 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
# SPDX-License-Identifier: Apache-2.0
#
# http://nexb.com and https://github.com/aboutcode-org/scancode.io
# The ScanCode.io software is licensed under the Apache License version 2.0.
# Data generated with ScanCode.io is provided as-is without warranties.
# ScanCode is a trademark of nexB Inc.
#
# You may not use this software except in compliance with the License.
# You may obtain a copy of the License at: http://apache.org/licenses/LICENSE-2.0
# Unless required by applicable law or agreed to in writing, software distributed
# under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
# CONDITIONS OF ANY KIND, either express or implied. See the License for the
# specific language governing permissions and limitations under the License.
#
# Data Generated with ScanCode.io is provided on an "AS IS" BASIS, WITHOUT WARRANTIES
# OR CONDITIONS OF ANY KIND, either express or implied. No content created from
# ScanCode.io should be considered or used as legal advice. Consult an Attorney
# for any legal advice.
#
# ScanCode.io is a free software code scanning tool from nexB Inc. and others.
# Visit https://github.com/aboutcode-org/scancode.io for support and download.
from packageurl import PackageURL
def get_meson_packages(package_name, package_data):
"""
Return a tuple of (base_purl, [versioned_purl_strings]) for a single
Meson WrapDB package entry from ``releases.json``.
The ``package_data`` dict has the structure::
{
"dependency_names": ["dep1", "dep2"],
"versions": ["1.0.0-1", "1.0.0-2", ...]
}
WrapDB versions use a ``-N`` suffix to denote build recipe revisions that
are specific to the WrapDB and do not exist upstream.
"""
base_purl = PackageURL(type="meson", name=package_name)
versions = package_data.get("versions") or []
versioned_purls = [
PackageURL(
type="meson",
name=package_name,
version=str(version),
).to_string()
for version in versions
]
return base_purl, versioned_purls
def mine_meson_packageurls(releases, logger):
"""
Yield ``(base_purl, [versioned_purl_strings])`` tuples from a
Meson WrapDB ``releases.json`` mapping.
"""
for package_name, package_data in releases.items():
if not package_data:
continue
yield get_meson_packages(
package_name=package_name,
package_data=package_data,
)