weldr: move projects and modules routes towards lorax parity

lorax-composer returns more information about projects and modules. They are
all meaningless, but we need them for parity.

Fixes #664
This commit is contained in:
Ondřej Budai 2020-06-04 12:13:05 +02:00
parent 604f7c2a55
commit 14a3f2a9d3
2 changed files with 31 additions and 20 deletions

View file

@ -67,13 +67,17 @@ type Package struct {
func (pkg Package) ToPackageBuild() PackageBuild {
// Convert the time to the API time format
return PackageBuild{
Arch: pkg.Arch,
BuildTime: pkg.BuildTime.Format("2006-01-02T15:04:05"),
Epoch: pkg.Epoch,
Release: pkg.Release,
Arch: pkg.Arch,
BuildTime: pkg.BuildTime.Format("2006-01-02T15:04:05"),
Epoch: pkg.Epoch,
Release: pkg.Release,
Changelog: "CHANGELOG_NEEDED", // the same value as lorax-composer puts here
BuildConfigRef: "BUILD_CONFIG_REF", // the same value as lorax-composer puts here
BuildEnvRef: "BUILD_ENV_REF", // the same value as lorax-composer puts here
Source: PackageSource{
License: pkg.License,
Version: pkg.Version,
License: pkg.License,
Version: pkg.Version,
SourceRef: "SOURCE_REF", // the same value as lorax-composer puts here
},
}
}
@ -84,6 +88,7 @@ func (pkg Package) ToPackageInfo() PackageInfo {
Summary: pkg.Summary,
Description: pkg.Description,
Homepage: pkg.URL,
UpstreamVCS: "UPSTREAM_VCS", // the same value as lorax-composer puts here
Builds: []PackageBuild{pkg.ToPackageBuild()},
Dependencies: nil,
}
@ -103,16 +108,22 @@ type PackageSpec struct {
}
type PackageSource struct {
License string `json:"license"`
Version string `json:"version"`
License string `json:"license"`
Version string `json:"version"`
SourceRef string `json:"source_ref"`
Metadata struct{} `json:"metadata"` // it's just an empty struct in lorax-composer
}
type PackageBuild struct {
Arch string `json:"arch"`
BuildTime string `json:"build_time"`
Epoch uint `json:"epoch"`
Release string `json:"release"`
Source PackageSource `json:"source"`
Arch string `json:"arch"`
BuildTime string `json:"build_time"`
Epoch uint `json:"epoch"`
Release string `json:"release"`
Source PackageSource `json:"source"`
Changelog string `json:"changelog"`
BuildConfigRef string `json:"build_config_ref"`
BuildEnvRef string `json:"build_env_ref"`
Metadata struct{} `json:"metadata"` // it's just an empty struct in lorax-composer
}
type PackageInfo struct {