From bb6a516a5a775288402c8a81e061105c207c4fb9 Mon Sep 17 00:00:00 2001 From: Matthew Johnson Date: Wed, 23 May 2018 14:27:56 -0700 Subject: [PATCH] mixin: track last version correctly Instead of blindly subtracting 10 from the current version and expecting that to be the old version... ACTUALLY USE LAST_VER! Also correctly set the builder versions before the build. Signed-off-by: Matthew Johnson --- mixin/build.go | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/mixin/build.go b/mixin/build.go index 4e38871..a5f3469 100644 --- a/mixin/build.go +++ b/mixin/build.go @@ -114,7 +114,6 @@ func buildMix(prepNeeded bool) error { return err } mixVer := ver * 1000 - oldMix := filepath.Join(mixWS, fmt.Sprintf("update/www/%d", mixVer-10)) b, err := builder.NewFromConfig(filepath.Join(mixWS, "builder.conf")) if err != nil { _ = os.Remove(mixFlagFile) @@ -122,6 +121,9 @@ func buildMix(prepNeeded bool) error { } b.NumBundleWorkers = runtime.NumCPU() b.NumFullfileWorkers = runtime.NumCPU() + b.UpstreamVer = fmt.Sprint(ver) + b.MixVer = fmt.Sprint(mixVer) + b.MixVerUint32 = uint32(mixVer) err = os.Chdir(mixWS) if err != nil { @@ -143,11 +145,14 @@ func buildMix(prepNeeded bool) error { } } + var oldMix string if lastVer != 0 { - // older version mix exists, make the mix clean (pre-merge) before building + oldMix = filepath.Join(mixWS, "update/www", fmt.Sprint(lastVer)) + // older version mix exists, make the mix clean (pre-merge) + // before building _ = os.Rename(filepath.Join(oldMix, "Manifest.MoM"), filepath.Join(oldMix, "FullManifest.MoM")) - _ = os.Rename(filepath.Join(oldMix, fmt.Sprintf("Manifest.MoM.%d", mixVer-10)), + _ = os.Rename(filepath.Join(oldMix, fmt.Sprintf("Manifest.MoM.%d", lastVer)), filepath.Join(oldMix, "Manifest.MoM")) } err = buildBundles(b) @@ -160,9 +165,9 @@ func buildMix(prepNeeded bool) error { _ = os.Remove(mixFlagFile) return err } - if lastVer != 0 { + if oldMix != "" { _ = os.Rename(filepath.Join(oldMix, "Manifest.MoM"), - filepath.Join(oldMix, fmt.Sprintf("Manifest.MoM.%d", mixVer-10))) + filepath.Join(oldMix, fmt.Sprintf("Manifest.MoM.%d", lastVer))) _ = os.Rename(filepath.Join(oldMix, "FullManifest.MoM"), filepath.Join(oldMix, "Manifest.MoM")) }