debian-forge-composer/vendor/github.com/osbuild/images/internal/common/constants.go
Achilleas Koutsou 0e4a9e586f split: replace internal packages with images library
Remove all the internal package that are now in the
github.com/osbuild/images package and vendor it.

A new function in internal/blueprint/ converts from an osbuild-composer
blueprint to an images blueprint.  This is necessary for keeping the
blueprint implementation in both packages.  In the future, the images
package will change the blueprint (and most likely rename it) and it
will only be part of the osbuild-composer internals and interface.  The
Convert() function will be responsible for converting the blueprint into
the new configuration object.
2023-07-10 21:11:19 +02:00

38 lines
1.1 KiB
Go

package common
import "fmt"
const (
KiloByte = 1000 // kB
KibiByte = 1024 // KiB
MegaByte = 1000 * 1000 // MB
MebiByte = 1024 * 1024 // MiB
GigaByte = 1000 * 1000 * 1000 // GB
GibiByte = 1024 * 1024 * 1024 // GiB
TeraByte = 1000 * 1000 * 1000 * 1000 // TB
TebiByte = 1024 * 1024 * 1024 * 1024 // TiB
)
// These constants are set during buildtime using additional
// compiler flags. Not all of them are necessarily defined
// because RPMs can be build from a tarball and spec file without
// being in a git repository. On the other hand when building
// composer inside of a container, there is no RPM layer so in
// that case the RPM version doesn't exist at all.
var (
// Git revision from which this code was built
GitRev = "undefined"
// RPM Version
RpmVersion = "undefined"
)
func BuildVersion() string {
if GitRev != "undefined" {
return fmt.Sprintf("git-rev:%s", GitRev)
} else if RpmVersion != "undefined" {
return fmt.Sprintf("NEVRA:%s", RpmVersion)
} else {
return "devel"
}
}