Skip to content

Commit

Permalink
Do not hit the network for some commands
Browse files Browse the repository at this point in the history
Signed-off-by: Tudor Marcu <tudor.marcu@intel.com>
  • Loading branch information
tmarcu committed Jul 6, 2018
1 parent 77aeaad commit c0e7a72
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 7 deletions.
4 changes: 2 additions & 2 deletions bat/lib/mixerlib.bash
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ global_setup() {
}

localize_builder_conf() {
if $(mixer $MIXARGS config set Mixer.LOCAL_RPM_DIR $BATS_TEST_DIRNAME/local-rpms); then
mixer $MIXARGS config set Mixer.LOCAL_REPO_DIR $BATS_TEST_DIRNAME/local-yum
if $(mixer $MIXARGS config set Mixer.LOCAL_RPM_DIR $BATS_TEST_DIRNAME/local-rpms --new-config); then
mixer $MIXARGS config set Mixer.LOCAL_REPO_DIR $BATS_TEST_DIRNAME/local-yum --new-config
else
echo -e "LOCAL_RPM_DIR=$BATS_TEST_DIRNAME/local-rpms\nLOCAL_REPO_DIR=$BATS_TEST_DIRNAME/local-yum" >> $BATS_TEST_DIRNAME/builder.conf
fi
Expand Down
6 changes: 3 additions & 3 deletions builder/builder.go
Original file line number Diff line number Diff line change
Expand Up @@ -2074,9 +2074,9 @@ func (b *Builder) BuildDeltaPacksPreviousVersions(prev, to uint32, printReport b
go func() {
defer wg.Done()
for fromManifest := range versionQueue {
err = swupd.CreateAllDeltas(outputDir, int(fromManifest.Header.Version), int(toManifest.Header.Version), b.NumDeltaWorkers)
if err != nil {
deltaErrors = append(deltaErrors, err)
deltaErr := swupd.CreateAllDeltas(outputDir, int(fromManifest.Header.Version), int(toManifest.Header.Version), b.NumDeltaWorkers)
if deltaErr != nil {
deltaErrors = append(deltaErrors, deltaErr)
}
}
}()
Expand Down
13 changes: 11 additions & 2 deletions mixer/cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,17 @@ var RootCmd = &cobra.Command{
fail(err)
}

networkCheck := true
noNetworkCmds := []string{"list", "edit", "validate", "convert", "set", "repo", "add-rpms"}
// Don't reach out over network for these commands, it's not needed
for _, ignoreCmd := range noNetworkCmds {
if cmdContains(cmd, ignoreCmd) {
networkCheck = false
}
}

// If running natively, check for format missmatch and warn
if builder.Native && b.UpstreamURL != "" {
if networkCheck && builder.Native && b.UpstreamURL != "" {
hostFormat, upstreamFormat, err := b.GetHostAndUpstreamFormats()
if err != nil {
fail(err)
Expand All @@ -88,7 +97,7 @@ var RootCmd = &cobra.Command{
fmt.Println("Warning: The host format and mix upstream format do not match.",
"Mixer may be incompatible with this format; running natively may fail.")
}
} else {
} else if networkCheck {
fmt.Printf("Warning: Using Format=%s from builder.conf for this build.\n", b.Config.Swupd.Format)
}

Expand Down

0 comments on commit c0e7a72

Please sign in to comment.