diff --git a/cmd/rpmtree.go b/cmd/rpmtree.go index 40583cd..80f676a 100644 --- a/cmd/rpmtree.go +++ b/cmd/rpmtree.go @@ -1,7 +1,7 @@ package main import ( - "errors" + "fmt" "os" "github.com/bazelbuild/buildtools/build" @@ -137,10 +137,6 @@ func NewRpmTreeCmd() *cobra.Command { Short: "Writes a rpmtree rule and its rpmdependencies to bazel files", Args: cobra.MinimumNArgs(1), RunE: func(cmd *cobra.Command, required []string) error { - if rpmtreeopts.toMacro != "" && rpmtreeopts.lockfile != "" { - return errors.New("Must provide at most one of --lockfile --to-macro") - } - repos, err := repo.LoadRepoFiles(rpmtreeopts.repofiles) if err != nil { return err @@ -173,9 +169,12 @@ func NewRpmTreeCmd() *cobra.Command { } var handler Handler + var configname string + if rpmtreeopts.toMacro != "" { handler, err = NewMacroHandler(rpmtreeopts.toMacro) } else if rpmtreeopts.lockfile != "" { + configname = rpmtreeopts.configname handler, err = NewLockFileHandler( rpmtreeopts.configname, rpmtreeopts.lockfile, @@ -198,7 +197,7 @@ func NewRpmTreeCmd() *cobra.Command { return err } - bazel.AddTree(rpmtreeopts.name, rpmtreeopts.configname, build, install, rpmtreeopts.arch, rpmtreeopts.public) + bazel.AddTree(rpmtreeopts.name, configname, build, install, rpmtreeopts.arch, rpmtreeopts.public) handler.PruneRPMs(build) logrus.Info("Writing bazel files.")