mirror of
https://github.com/linuxkit/linuxkit.git
synced 2025-07-21 01:59:07 +00:00
linuxkit pkg: add --dev
to force local org and hash
$USER and "dev" respectively. Signed-off-by: Ian Campbell <ijc@docker.com>
This commit is contained in:
parent
3ebd621f29
commit
c3a150d5f7
@ -5,6 +5,7 @@ import (
|
|||||||
"fmt"
|
"fmt"
|
||||||
"gopkg.in/yaml.v2"
|
"gopkg.in/yaml.v2"
|
||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
|
"os"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
"strings"
|
"strings"
|
||||||
)
|
)
|
||||||
@ -68,12 +69,13 @@ func NewFromCLI(fs *flag.FlagSet, args ...string) (Pkg, error) {
|
|||||||
|
|
||||||
// Other arguments
|
// Other arguments
|
||||||
var buildYML, hash, hashCommit, hashPath string
|
var buildYML, hash, hashCommit, hashPath string
|
||||||
var dirty bool
|
var dirty, devMode bool
|
||||||
fs.StringVar(&buildYML, "build-yml", "build.yml", "Override the name of the yml file")
|
fs.StringVar(&buildYML, "build-yml", "build.yml", "Override the name of the yml file")
|
||||||
fs.StringVar(&hash, "hash", "", "Override the image hash (default is to query git for the package's tree-sh)")
|
fs.StringVar(&hash, "hash", "", "Override the image hash (default is to query git for the package's tree-sh)")
|
||||||
fs.StringVar(&hashCommit, "hash-commit", "HEAD", "Override the git commit to use for the hash")
|
fs.StringVar(&hashCommit, "hash-commit", "HEAD", "Override the git commit to use for the hash")
|
||||||
fs.StringVar(&hashPath, "hash-path", "", "Override the directory to use for the image hash, must be a parent of the package dir (default is to use the package dir)")
|
fs.StringVar(&hashPath, "hash-path", "", "Override the directory to use for the image hash, must be a parent of the package dir (default is to use the package dir)")
|
||||||
fs.BoolVar(&dirty, "force-dirty", false, "Force the pkg to be considered dirty")
|
fs.BoolVar(&dirty, "force-dirty", false, "Force the pkg to be considered dirty")
|
||||||
|
fs.BoolVar(&devMode, "dev", false, "Force org and hash to $USER and \"dev\" respectively")
|
||||||
|
|
||||||
fs.Parse(args)
|
fs.Parse(args)
|
||||||
|
|
||||||
@ -90,6 +92,16 @@ func NewFromCLI(fs *flag.FlagSet, args ...string) (Pkg, error) {
|
|||||||
return Pkg{}, err
|
return Pkg{}, err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if devMode {
|
||||||
|
// If --org is also used then this will be overwritten
|
||||||
|
// by argOrg when we iterate over the provided options
|
||||||
|
// in the fs.Visit block below.
|
||||||
|
pi.Org = os.Getenv("USER")
|
||||||
|
if hash == "" {
|
||||||
|
hash = "dev"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if hashPath == "" {
|
if hashPath == "" {
|
||||||
hashPath = pkgPath
|
hashPath = pkgPath
|
||||||
} else {
|
} else {
|
||||||
|
Loading…
Reference in New Issue
Block a user