Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
pmbootstrap
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
postmarketOS
pmbootstrap
Merge requests
!2425
pmb.parse.apkindex: Introduce proper typing
Code
Review changes
Check out branch
Download
Patches
Plain diff
Merged
pmb.parse.apkindex: Introduce proper typing
newbyte/apkindex-fixes
into
master
Overview
3
Commits
6
Pipelines
9
Changes
1
Merged
Newbyte
requested to merge
newbyte/apkindex-fixes
into
master
5 months ago
Overview
3
Commits
6
Pipelines
9
Changes
1
Expand
And adjust other code. See individual commits.
Closes
#2455 (closed)
Edited
5 months ago
by
Newbyte
0
0
Merge request reports
Viewing commit
566b43ed
Prev
Next
Show latest version
1 file
+
44
−
0
Inline
Compare changes
Side-by-side
Inline
Show whitespace changes
Show one file at a time
Verified
566b43ed
pmb.core.package_metadata: Introduce (MR 2425)
· 566b43ed
Newbyte
authored
5 months ago
pmb/core/package_metadata.py
0 → 100644
+
44
−
0
Options
# Copyright 2024 Stefan Hansson
# SPDX-License-Identifier: GPL-3.0-or-later
from
dataclasses
import
dataclass
from
typing
import
Any
import
pmb.build._package
from
pmb.core.apkindex_block
import
ApkindexBlock
from
pmb.core.context
import
get_context
@dataclass
class
PackageMetadata
:
# This can't be list[Arch] because it can have values like "noarch" and "!armhf"
arch
:
list
[
str
]
depends
:
list
[
str
]
pkgname
:
str
provides
:
list
[
str
]
version
:
str
@staticmethod
def
from_apkindex_block
(
apkindex_block
:
ApkindexBlock
)
->
"
PackageMetadata
"
:
return
PackageMetadata
(
arch
=
[
str
(
apkindex_block
.
arch
)],
depends
=
apkindex_block
.
depends
or
[],
pkgname
=
apkindex_block
.
pkgname
,
provides
=
apkindex_block
.
provides
,
version
=
apkindex_block
.
version
,
)
@staticmethod
def
from_pmaport
(
pmaport
:
dict
[
str
,
Any
])
->
"
PackageMetadata
"
:
pmaport_arches
=
pmaport
[
"
arch
"
]
pmaport_depends
=
pmb
.
build
.
_package
.
get_depends
(
get_context
(),
pmaport
)
pmaport_pkgname
=
pmaport
[
"
pkgname
"
]
pmaport_provides
=
pmaport
[
"
provides
"
]
pmaport_version
=
pmaport
[
"
pkgver
"
]
+
"
-r
"
+
pmaport
[
"
pkgrel
"
]
return
PackageMetadata
(
arch
=
pmaport_arches
,
depends
=
pmaport_depends
or
[],
pkgname
=
pmaport_pkgname
,
provides
=
pmaport_provides
,
version
=
pmaport_version
,
)
Loading