Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@ Changelog
Next release
--------------

- Use the standard ``apk`` Package URL type for Alpine packages, their
dependencies, and source packages. Match Alpine package file references with
resource paths on Windows.
https://github.com/aboutcode-org/scancode-toolkit/issues/4964

- Fix the optional ``licenses`` extra dependency typo to install
``licensedcode-data``.
https://github.com/aboutcode-org/scancode-toolkit/pull/5056
Expand Down
14 changes: 6 additions & 8 deletions src/packagedcode/alpine.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
from functools import partial
from datetime import datetime
from os import path
from pathlib import Path

import attr
from license_expression import LicenseSymbolLike
Expand All @@ -37,7 +36,7 @@ class AlpineApkArchiveHandler(models.DatafileHandler):
datasource_id = 'alpine_apk_archive'
path_patterns = ('*.apk',)
filetypes = ('gzip compressed data',)
default_package_type = 'alpine'
default_package_type = 'apk'
description = 'Alpine Linux .apk package archive'
documentation_url = 'https://wiki.alpinelinux.org/wiki/Alpine_package_format'

Expand All @@ -61,7 +60,7 @@ class AlpineInstalledDatabaseHandler(models.DatafileHandler):
datasource_id = 'alpine_installed_db'
datasource_type = 'sys'
path_patterns = ('*lib/apk/db/installed',)
default_package_type = 'alpine'
default_package_type = 'apk'
description = 'Alpine Linux installed package database'

@classmethod
Expand Down Expand Up @@ -91,10 +90,9 @@ def assemble(cls, package_data, resource, codebase, package_adder):

cls.populate_license_fields(package)

root_path = Path(root_resource.path)
# a file ref extends from the root of the filesystem
file_references_by_path = {
str(root_path / ref.path): ref
posixpath.join(root_resource.path, ref.path): ref
for ref in package.file_references
}

Expand Down Expand Up @@ -132,7 +130,7 @@ def assemble(cls, package_data, resource, codebase, package_adder):
class AlpineApkbuildHandler(models.DatafileHandler):
datasource_id = 'alpine_apkbuild'
path_patterns = ('*APKBUILD',)
default_package_type = 'alpine'
default_package_type = 'apk'
description = 'Alpine Linux APKBUILD package script'
documentation_url = 'https://wiki.alpinelinux.org/wiki/APKBUILD_Reference'

Expand Down Expand Up @@ -1033,7 +1031,7 @@ def D_dependencies_handler(value, dependencies=None, **kwargs):

requirement = operator + ver

purl = PackageURL(type='alpine', name=name, version=version).to_string()
purl = PackageURL(type='apk', name=name, version=version).to_string()

# that the only scope we have for now
scope = 'depend'
Expand All @@ -1057,7 +1055,7 @@ def o_source_package_handler(value, version=None, **kwargs):
Return a source_packages list of Package URLs
"""
# the version value will be that of the current package
origin = PackageURL(type='alpine', name=value, version=version).to_string()
origin = PackageURL(type='apk', name=value, version=version).to_string()
return {'source_packages': [origin]}


Expand Down
Loading
Loading