engine: resources, lang: Set resource fields more accurately

There were some bugs about setting resource fields that were structs
with various fields. This makes things more strict and correct. Now we
check for duplicate field names earlier (duplicates due to identical
aliases) and we also don't try and set private fields, or incorrectly
set partial structs.

Most interestingly, this also cleans up all of the resources and ensures
that each one has nicer docs and a clear struct tag for fields that we
want to use in mcl. These are mandatory now, and if you're missing the
tag, then we will ignore the field.
This commit is contained in:
James Shubin
2023-08-23 00:52:21 -04:00
parent b8d87e2d5a
commit c1850e0e20
24 changed files with 394 additions and 212 deletions

View File

@@ -56,10 +56,25 @@ type PkgRes struct {
init *engine.Init
State string `yaml:"state"` // state: installed, uninstalled, newest, <version>
AllowUntrusted bool `yaml:"allowuntrusted"` // allow untrusted packages to be installed?
AllowNonFree bool `yaml:"allownonfree"` // allow nonfree packages to be found?
AllowUnsupported bool `yaml:"allowunsupported"` // allow unsupported packages to be found?
// State determines if we want to install or uninstall the package, and
// what version we want to pin if any. Valid values include: installed,
// uninstalled, newest, and `version`, where you just put the raw
// version string desired.
State string `lang:"state" yaml:"state"`
// AllowUntrusted specifies if we want to allow untrusted packages to be
// installed. Please see the PackageKit documentation for more
// information.
AllowUntrusted bool `lang:"allowuntrusted" yaml:"allowuntrusted"`
// AllowNonFree specifies if we want to allow nonfree packages to be
// found? Please see the PackageKit documentation for more information.
AllowNonFree bool `lang:"allownonfree" yaml:"allownonfree"`
// AllowUnsupported specifies if we want to unsupported packages to be
// found? Please see the PackageKit documentation for more information.
AllowUnsupported bool `lang:"allowunsupported" yaml:"allowunsupported"`
//bus *packagekit.Conn // pk bus connection
fileList []string // FIXME: update if pkg changes
}