Skip to content

Commit 9e97fd1

Browse files
authored
feat: make component build run check section by default (#434)
1 parent 3415552 commit 9e97fd1

6 files changed

Lines changed: 18 additions & 19 deletions

File tree

internal/app/azldev/cmds/component/build.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ type ComponentBuildOptions struct {
2525
ComponentFilter components.ComponentFilter
2626

2727
ContinueOnError bool
28-
RunChecks bool
28+
NoCheck bool
2929
SourcePackageOnly bool
3030
BuildEnvPolicy BuildEnvPreservePolicy
3131

@@ -69,7 +69,7 @@ func NewBuildCmd() *cobra.Command {
6969
components.AddComponentFilterOptionsToCommand(cmd, &options.ComponentFilter)
7070
cmd.Flags().BoolVarP(&options.ContinueOnError, "continue-on-error", "k", false,
7171
"Continue building when some components fail")
72-
cmd.Flags().BoolVarP(&options.RunChecks, "check", "c", false, "Run package %check tests")
72+
cmd.Flags().BoolVar(&options.NoCheck, "no-check", false, "Skip package %check tests")
7373
cmd.Flags().BoolVar(&options.SourcePackageOnly, "srpm-only", false, "Build SRPM (source RPM) *only*")
7474
cmd.Flags().Var(&options.BuildEnvPolicy, "preserve-buildenv",
7575
fmt.Sprintf("Preserve build environment {%s, %s, %s}",
@@ -194,7 +194,7 @@ func BuildComponent(
194194

195195
results, err = buildComponentUsingBuilder(
196196
env, component, builder, allLocalRepoPaths,
197-
options.SourcePackageOnly, options.RunChecks,
197+
options.SourcePackageOnly, options.NoCheck,
198198
options.LocalRepoWithPublishPath,
199199
)
200200
if err != nil {
@@ -209,7 +209,7 @@ func buildComponentUsingBuilder(
209209
component components.Component,
210210
builder *componentbuilder.Builder,
211211
localRepoPaths []string,
212-
sourcePackageOnly, runChecks bool,
212+
sourcePackageOnly, noCheck bool,
213213
localRepoWithPublishPath string,
214214
) (results ComponentBuildResults, err error) {
215215
// Compose the path to the output dir.
@@ -248,7 +248,7 @@ func buildComponentUsingBuilder(
248248
//
249249

250250
results.RPMPaths, err = builder.BuildBinaryPackage(
251-
env, component, outputSourcePackagePath, localRepoPaths, outputDir, runChecks,
251+
env, component, outputSourcePackagePath, localRepoPaths, outputDir, noCheck,
252252
)
253253
if err != nil {
254254
return results, fmt.Errorf("failed to build RPM for %q: %w", component.GetName(), err)

internal/app/azldev/core/componentbuilder/componentbuilder.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ type ComponentBuilder interface {
3030
BuildBinaryPackage(
3131
ctx context.Context,
3232
component components.Component, sourcePackagePath string, localRepoPaths []string,
33-
outputDir string, runChecks bool,
33+
outputDir string, noCheck bool,
3434
) (packagePaths []string, err error)
3535

3636
// BuildSourcePackage builds a source package for the given component and returns the path to the
@@ -83,9 +83,9 @@ func (b *Builder) BuildSourcePackage(
8383
func (b *Builder) BuildBinaryPackage(
8484
ctx context.Context,
8585
component components.Component, sourcePackagePath string, localRepoPaths []string,
86-
outputDir string, runChecks bool,
86+
outputDir string, noCheck bool,
8787
) (packagePaths []string, err error) { // NOTE: We intentionally name the returns for better self-documentation.
88-
packagePaths, err = b.buildRPM(ctx, component, sourcePackagePath, b.buildEnv, localRepoPaths, outputDir, runChecks)
88+
packagePaths, err = b.buildRPM(ctx, component, sourcePackagePath, b.buildEnv, localRepoPaths, outputDir, noCheck)
8989
if err != nil {
9090
return packagePaths, fmt.Errorf("failed to build binary package for component %#q:\n%w", component.GetName(), err)
9191
}
@@ -203,7 +203,7 @@ func (b *Builder) buildRPM(
203203
ctx context.Context,
204204
component components.Component,
205205
srpmPath string, buildEnv buildenv.RPMAwareBuildEnv, localRepoPaths []string,
206-
outputDir string, runChecks bool,
206+
outputDir string, noCheck bool,
207207
) (outputRPMPaths []string, err error) { // NOTE: We intentionally name the returns for better self-documentation.
208208
var tempRPMDir string
209209

@@ -228,7 +228,7 @@ func (b *Builder) buildRPM(
228228
Defines: map[string]string{},
229229
LocalRepoPaths: localRepoPaths,
230230
},
231-
RunChecks: runChecks,
231+
NoCheck: noCheck,
232232
ForceRebuild: false, // Could be added to config if needed
233233
}
234234

internal/app/azldev/core/componentbuilder/componentbuilder_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@ func TestBuildBinaryPackage(t *testing.T) {
186186
testSRPMPath,
187187
[]string{},
188188
testOutputDir,
189-
false, /*runChecks?*/
189+
false, /*noCheck?*/
190190
)
191191

192192
require.NoError(t, err)

internal/app/azldev/core/componentbuilder/componentbuilder_test/componentbuilder_mocks.go

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

internal/rpm/mock/mock.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -265,7 +265,7 @@ type RPMBuildOptions struct {
265265
CommonBuildOptions
266266

267267
// Binary RPM specific options
268-
RunChecks bool
268+
NoCheck bool
269269
ForceRebuild bool
270270
}
271271

@@ -368,8 +368,8 @@ func (r *Runner) BuildRPM(ctx context.Context, srpmPath, outputDirPath string, o
368368
args = append(args, "--rebuild")
369369
}
370370

371-
// Unless requested to do so, we don't run %check sections.
372-
if !options.RunChecks {
371+
// Unless requested to skip checks, we run them.
372+
if options.NoCheck {
373373
args = append(args, "--nocheck")
374374
}
375375

internal/rpm/mock/mock_test.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,6 @@ func TestBuildRPM(t *testing.T) {
178178
With: []string{withFeature},
179179
Defines: map[string]string{macroName: macroValue},
180180
},
181-
RunChecks: false,
182181
}
183182

184183
err := runner.BuildRPM(ctx, testSRPMPath, testOutputDirPath, mockOptions)

0 commit comments

Comments
 (0)