Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Don't run build-prep by default for create-srpm #160

Merged
merged 1 commit into from
Jan 16, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions cmd/build.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,10 @@ var buildCmd = &cobra.Command{
RunE: func(cmd *cobra.Command, args []string) error {
repo, _ := cmd.Flags().GetString("repo")
pkg, _ := cmd.Flags().GetString("package")
skipBuildPrep, _ := cmd.Flags().GetBool("skip-build-prep")
doBuildPrep, _ := cmd.Flags().GetBool("do-build-prep")
noCheck, _ := cmd.Flags().GetBool("nocheck")
extraCreateSrpmArgs := impl.CreateSrpmExtraCmdlineArgs{
SkipBuildPrep: skipBuildPrep,
DoBuildPrep: doBuildPrep,
}
extraMockArgs := impl.MockExtraCmdlineArgs{
NoCheck: noCheck,
Expand All @@ -35,7 +35,9 @@ var buildCmd = &cobra.Command{
func init() {
buildCmd.Flags().StringP("repo", "r", "", "Repository name (OPTIONAL)")
buildCmd.Flags().StringP("package", "p", "", "package name (OPTIONAL)")
buildCmd.Flags().Bool("skip-build-prep", false, "Skips build-prep during createSrpm for cases where build-prep requires dependencies not in container (OPTIONAL)")
buildCmd.Flags().Bool("skip-build-prep", false, "DEPRECATED. No-op")
buildCmd.Flags().MarkHidden("skip-build-prep")
buildCmd.Flags().Bool("do-build-prep", false, "Runs build-prep on the created SRPM to make sure patches apply cleanly (OPTIONAL)")
buildCmd.Flags().Bool("nocheck", false, "Pass --nocheck to rpmbuild (OPTIONAL)")
rootCmd.AddCommand(buildCmd)
}
8 changes: 5 additions & 3 deletions cmd/create_srpm.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@ In situations where multiple SRPMs need to be built in dependency order, the man
RunE: func(cmd *cobra.Command, args []string) error {
repo, _ := cmd.Flags().GetString("repo")
pkg, _ := cmd.Flags().GetString("package")
skipBuildPrep, _ := cmd.Flags().GetBool("skip-build-prep")
doBuildPrep, _ := cmd.Flags().GetBool("do-build-prep")
extraArgs := impl.CreateSrpmExtraCmdlineArgs{
SkipBuildPrep: skipBuildPrep,
DoBuildPrep: doBuildPrep,
}
err := impl.CreateSrpm(repo, pkg, extraArgs, selectExecutor())
return err
Expand All @@ -35,6 +35,8 @@ In situations where multiple SRPMs need to be built in dependency order, the man
func init() {
createSrpmCmd.Flags().StringP("repo", "r", "", "Repository name (OPTIONAL)")
createSrpmCmd.Flags().StringP("package", "p", "", "package name (OPTIONAL)")
createSrpmCmd.Flags().Bool("skip-build-prep", false, "Skips build-prep for cases where build-prep requires dependencies not in container(OPTIONAL)")
createSrpmCmd.Flags().Bool("skip-build-prep", false, "DEPRECATED. No-op")
createSrpmCmd.Flags().MarkHidden("skip-build-prep")
createSrpmCmd.Flags().Bool("do-build-prep", false, "Runs build-prep on the created SRPM to make sure patches apply cleanly (OPTIONAL)")
rootCmd.AddCommand(createSrpmCmd)
}
8 changes: 4 additions & 4 deletions impl/create_srpm.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ type upstreamSrcSpec struct {
type srpmBuilder struct {
pkgSpec *manifest.Package
repo string
skipBuildPrep bool
doBuildPrep bool
errPrefixBase util.ErrPrefix
errPrefix util.ErrPrefix
upstreamSrc []upstreamSrcSpec
Expand All @@ -40,7 +40,7 @@ type srpmBuilder struct {

// CreateSrpmExtraCmdlineArgs is a bundle of extra args for impl.CreateSrpm
type CreateSrpmExtraCmdlineArgs struct {
SkipBuildPrep bool
DoBuildPrep bool
}

func (bldr *srpmBuilder) log(format string, a ...any) {
Expand Down Expand Up @@ -527,7 +527,7 @@ func (bldr *srpmBuilder) runStages() error {
return err
}

if !bldr.skipBuildPrep {
if bldr.doBuildPrep {
bldr.setupStageErrPrefix("build-prep")
if err := bldr.build(true); err != nil {
return err
Expand Down Expand Up @@ -588,7 +588,7 @@ func CreateSrpm(repo string, pkg string, extraArgs CreateSrpmExtraCmdlineArgs, e
bldr := srpmBuilder{
pkgSpec: &pkgSpec,
repo: repo,
skipBuildPrep: extraArgs.SkipBuildPrep,
doBuildPrep: extraArgs.DoBuildPrep,
errPrefixBase: errPrefixBase,
srcConfig: srcConfig,
executor: executor,
Expand Down
2 changes: 1 addition & 1 deletion manifest/manifest.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ type Multilib struct {
// the command name(mock/create-srpm) and the value is a list of extra-options.
//
// Valid options for mock are [ --nocheck ]
// Valid options for create-srpm are [ --skip-build-prep ]
// Valid options for create-srpm are [ --do-build-prep ]
//
// MultiLib specifies MultiLib spec to generate multilib. It's indexed by native-arch (i686/x86_64).
//
Expand Down
2 changes: 1 addition & 1 deletion manifest/testData/sampleManifest1.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ package:
mock:
- "--nocheck"
create-srpm:
- "--skip-build-prep"
- "--do-build-prep"
external-dependencies:
glibc: code.arista.io/eos/eext/glibc
- name: binutils
Expand Down
Loading