github.com/anchore/syft@v1.38.2/syft/linux/release.go (about)

     1  package linux
     2  
     3  // Release represents Linux Distribution release information as specified from https://www.freedesktop.org/software/systemd/man/os-release.html
     4  type Release struct {
     5  	PrettyName       string   `cyclonedx:"prettyName"` // A pretty operating system name in a format suitable for presentation to the user.
     6  	Name             string   // identifies the operating system, without a version component, and suitable for presentation to the user.
     7  	ID               string   `cyclonedx:"id"`     // identifies the operating system, excluding any version information and suitable for processing by scripts or usage in generated filenames.
     8  	IDLike           []string `cyclonedx:"idLike"` // list of operating system identifiers in the same syntax as the ID= setting. It should list identifiers of operating systems that are closely related to the local operating system in regards to packaging and programming interfaces.
     9  	Version          string   // identifies the operating system version, excluding any OS name information, possibly including a release code name, and suitable for presentation to the user.
    10  	VersionID        string   `cyclonedx:"versionID"` // identifies the operating system version, excluding any OS name information or release code name, and suitable for processing by scripts or usage in generated filenames.
    11  	VersionCodename  string   `cyclonedx:"versionCodename"`
    12  	BuildID          string   `cyclonedx:"buildID"` // A string uniquely identifying the system image originally used as the installation base.
    13  	ImageID          string   `cyclonedx:"imageID"`
    14  	ImageVersion     string   `cyclonedx:"imageVersion"`
    15  	Variant          string   `cyclonedx:"variant"`   // identifies a specific variant or edition of the operating system suitable for presentation to the user.
    16  	VariantID        string   `cyclonedx:"variantID"` // identifies a specific variant or edition of the operating system. This may be interpreted by other packages in order to determine a divergent default configuration.
    17  	HomeURL          string
    18  	SupportURL       string
    19  	BugReportURL     string
    20  	PrivacyPolicyURL string
    21  	CPEName          string // A CPE name for the operating system, in URI binding syntax
    22  	SupportEnd       string // The date at which support for this version of the OS ends.
    23  	ExtendedSupport  bool   `cyclonedx:"extendedSupport"` // indicates there was some evidence of extended support found
    24  }
    25  
    26  func (r *Release) String() string {
    27  	if r == nil {
    28  		return "unknown"
    29  	}
    30  	if r.PrettyName != "" {
    31  		return r.PrettyName
    32  	}
    33  	if r.Name != "" {
    34  		return r.Name
    35  	}
    36  	if r.Version != "" {
    37  		return r.ID + " " + r.Version
    38  	}
    39  	if r.VersionID != "" {
    40  		return r.ID + " " + r.VersionID
    41  	}
    42  
    43  	return r.ID + " " + r.BuildID
    44  }