Nordix / bomres

Software Bill-of-Material Resolver
Apache License 2.0
7 stars 6 forks source link

Parser for APKBUILD in separate module #70

Closed hans-lammda closed 1 year ago

hans-lammda commented 2 years ago

The file parse_apkbuild.py is the most complex module of the resolver, since it match metadata from Alpines package manager with parsed data from aports APKBUILD manifest.

The link between the package manager and the package could be one of three cases.

cache_index_file = "%s/APKINDEX-%s.json" % (args.cache, apkindex['hash'])

The parse_apkbuild_manifest function should be migrated to separate file, enabling unit testing.

def scan_aports(checkout_dir, apkindex):

parse_apkbuild_manifest(name, repository, filename, repo_hash_dict, apkindex, "package") parse_apkbuild_manifest(name, repository, filename_commit, repo_hash_dict, apkindex, "repo") parse_apkbuild_manifest(name, repository, filename_commit, repo_hash_dict, apkindex, "broken-link-between-aports-and-apkbuild")

hans-lammda commented 1 year ago

apklib.py is now included in parse_apkbuild.py and index.py

The library is possible to invoke separately for testing

python3 apklib.py --checkout /tmp/alpine/checkout/ --src /tmp/alpine/src/ --name prometheus-node-exporter --apkindex /tmp/index.json --output /tmp/a