mirror of
https://github.com/clearlinux/mixer-tools.git
synced 2026-10-03 15:29:44 +00:00
Deprecate --new-swupd flag
The new manifest creation implementation has been tested in a dev-ops workflow and is robust enough to remove the old implementation. This patch deprecates and hides the --new-swupd flag and only runs the new implementation. Signed-off-by: Matthew Johnson <matthew.johnson@intel.com>
This commit is contained in:
committed by
Kevin Wells
parent
6005c61228
commit
9a5ce5f94b
+4
-96
@@ -43,10 +43,6 @@ import (
|
||||
// Version of Mixer. Also used by the Makefile for releases.
|
||||
const Version = "4.2.1"
|
||||
|
||||
// UseNewSwupdServer controls whether to use the new implementation of
|
||||
// swupd-server (package swupd) when possible. This is an experimental feature.
|
||||
var UseNewSwupdServer = false
|
||||
|
||||
// Offline controls whether mixer attempts to automatically cache upstream
|
||||
// bundles. In offline mode, all necessary bundles must exist in local-bundles.
|
||||
var Offline = false
|
||||
@@ -1463,45 +1459,9 @@ func (b *Builder) BuildUpdate(prefixflag string, minVersion int, format string,
|
||||
timer := &stopWatch{w: os.Stdout}
|
||||
defer timer.WriteSummary(os.Stdout)
|
||||
|
||||
if UseNewSwupdServer {
|
||||
err = b.buildUpdateWithNewSwupd(timer, b.MixVerUint32, uint32(minVersion), formatUint, skipSigning)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
} else {
|
||||
err = b.buildUpdateWithOldSwupd(timer, prefixflag, minVersion, skipSigning)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
timer.Start("MINIMIZE STORED CHROOTS")
|
||||
// Clean up the bundle chroots as only the full chroot is needed from this point on.
|
||||
if !keepChroots {
|
||||
// Get the set of bundles for which chroots were built
|
||||
var set bundleSet
|
||||
set, err = b.getFullMixBundleSet()
|
||||
if err != nil {
|
||||
return errors.Wrap(err, "Ignored error when cleaning bundle chroots")
|
||||
}
|
||||
// Delete the bundle chroots
|
||||
basedir := filepath.Join(b.Config.Builder.ServerStateDir, "image", b.MixVer)
|
||||
for bundle := range set {
|
||||
err = os.RemoveAll(filepath.Join(basedir, bundle))
|
||||
if err != nil {
|
||||
return errors.Wrap(err, "Ignored error when cleaning bundle chroots")
|
||||
}
|
||||
}
|
||||
} else {
|
||||
// Hardlink the duplicate files ONLY when keeping the bundle chroots.
|
||||
hardlinkcmd := exec.Command("hardlink", "-f", filepath.Join(b.Config.Builder.ServerStateDir, "image", b.MixVer))
|
||||
hardlinkcmd.Stdout = os.Stdout
|
||||
hardlinkcmd.Stderr = os.Stderr
|
||||
err = hardlinkcmd.Run()
|
||||
if err != nil {
|
||||
return errors.Wrapf(err, "couldn't perform hardlink step")
|
||||
}
|
||||
}
|
||||
timer.Stop()
|
||||
err = b.buildUpdateContent(timer, b.MixVerUint32, uint32(minVersion), formatUint, skipSigning)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
// Save upstream information.
|
||||
@@ -1540,7 +1500,7 @@ func (b *Builder) BuildUpdate(prefixflag string, minVersion int, format string,
|
||||
return nil
|
||||
}
|
||||
|
||||
func (b *Builder) buildUpdateWithNewSwupd(timer *stopWatch, mixVersion uint32, minVersion uint32, format uint32, skipSigning bool) error {
|
||||
func (b *Builder) buildUpdateContent(timer *stopWatch, mixVersion uint32, minVersion uint32, format uint32, skipSigning bool) error {
|
||||
var err error
|
||||
|
||||
err = writeMetaFiles(filepath.Join(b.Config.Builder.ServerStateDir, "www", b.MixVer), b.Config.Swupd.Format, Version)
|
||||
@@ -1649,58 +1609,6 @@ func (b *Builder) buildUpdateWithNewSwupd(timer *stopWatch, mixVersion uint32, m
|
||||
return nil
|
||||
}
|
||||
|
||||
func (b *Builder) buildUpdateWithOldSwupd(timer *stopWatch, prefixflag string, minVersion int, skipSigning bool) error {
|
||||
var err error
|
||||
|
||||
// Create update metadata for the mix.
|
||||
timer.Start("CREATE MANIFESTS")
|
||||
updatecmd := exec.Command(prefixflag+"swupd_create_update", "-S", b.Config.Builder.ServerStateDir, "--minversion", strconv.Itoa(minVersion), "-F", b.Config.Swupd.Format, "--osversion", b.MixVer)
|
||||
updatecmd.Stdout = os.Stdout
|
||||
updatecmd.Stderr = os.Stderr
|
||||
err = updatecmd.Run()
|
||||
if err != nil {
|
||||
return errors.Wrapf(err, "failed to create update metadata")
|
||||
}
|
||||
timer.Stop()
|
||||
|
||||
// Sign the Manifest.MoM that was just created.
|
||||
if !skipSigning {
|
||||
err = b.SignManifestMoM()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
fmt.Println("Signed Manifest.MoM")
|
||||
}
|
||||
|
||||
// Create full files.
|
||||
timer.Start("CREATE FULLFILES")
|
||||
fullfilecmd := exec.Command(prefixflag+"swupd_make_fullfiles", "-S", b.Config.Builder.ServerStateDir, b.MixVer)
|
||||
fullfilecmd.Stdout = os.Stdout
|
||||
fullfilecmd.Stderr = os.Stderr
|
||||
err = fullfilecmd.Run()
|
||||
if err != nil {
|
||||
return errors.Wrapf(err, "couldn't create fullfiles")
|
||||
}
|
||||
timer.Stop()
|
||||
|
||||
// Create zero packs.
|
||||
timer.Start("CREATE ZERO PACKS")
|
||||
zeropackArgs := []string{"--to", b.MixVer, "-S", b.Config.Builder.ServerStateDir}
|
||||
if prefixflag != "" {
|
||||
zeropackArgs = append(zeropackArgs, "--repodir", prefixflag)
|
||||
}
|
||||
zeropackcmd := exec.Command("mixer-pack-maker.sh", zeropackArgs...)
|
||||
zeropackcmd.Stdout = os.Stdout
|
||||
zeropackcmd.Stderr = os.Stderr
|
||||
err = zeropackcmd.Run()
|
||||
if err != nil {
|
||||
return errors.Wrapf(err, "couldn't create zero packs")
|
||||
}
|
||||
timer.Stop()
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// BuildImage will now proceed to build the full image with the previously
|
||||
// validated configuration.
|
||||
func (b *Builder) BuildImage(format string, template string) error {
|
||||
|
||||
@@ -187,9 +187,6 @@ var buildDeltaPacksCmd = &cobra.Command{
|
||||
Short: "Build packs used to optimize update between versions",
|
||||
Long: `Build packs used to optimize update between versions
|
||||
|
||||
EXPERIMENTAL: this command only works with --new-swupd. For the
|
||||
current swupd-server implementation use mixer-pack-maker.sh program.
|
||||
|
||||
When a swupd client updates a bundle, it looks for a pack file from
|
||||
its current version to the new version. If not available, the client
|
||||
will download the individual files necessary for the update. If a
|
||||
@@ -221,12 +218,6 @@ var buildDeltaPacksFlags struct {
|
||||
}
|
||||
|
||||
func runBuildDeltaPacks(cmd *cobra.Command, args []string) error {
|
||||
if !builder.UseNewSwupdServer {
|
||||
// TODO: Depending on how long we are going to live with both implementations, it
|
||||
// might be worth making this command call the script when not using new swupd-server.
|
||||
failf("build delta packs is only available with --new-swupd\nUse mixer-pack-maker.sh instead.")
|
||||
}
|
||||
|
||||
fromChanged := cmd.Flags().Changed("from")
|
||||
prevChanged := cmd.Flags().Changed("previous-versions")
|
||||
if fromChanged == prevChanged {
|
||||
|
||||
+4
-1
@@ -141,7 +141,10 @@ func init() {
|
||||
_ = RootCmd.PersistentFlags().MarkHidden("cpu-profile")
|
||||
|
||||
// TODO: Remove this once we migrate to new implementation.
|
||||
RootCmd.PersistentFlags().BoolVar(&builder.UseNewSwupdServer, "new-swupd", false, "EXPERIMENTAL: Use new implementation of swupd-server when possible")
|
||||
unusedBoolFlag := false
|
||||
RootCmd.PersistentFlags().BoolVar(&unusedBoolFlag, "new-swupd", false, "")
|
||||
_ = RootCmd.Flags().MarkHidden("new-swupd")
|
||||
_ = RootCmd.Flags().MarkDeprecated("new-swupd", "new functionality is now the standard behavior, this flag is obsolete and no longer used")
|
||||
|
||||
// TODO: Remove this once we drop the old config format
|
||||
RootCmd.PersistentFlags().BoolVar(&builder.UseNewConfig, "new-config", false, "EXPERIMENTAL: use the new TOML config format")
|
||||
|
||||
+3
-3
@@ -57,20 +57,20 @@ for i in $(seq $1 10 $2); do
|
||||
# increase the number of bundle-workers on larger systems
|
||||
# keep in mind that this is network bound due to dnf installs
|
||||
# of upstream tarballs
|
||||
mixer build bundles --new-swupd --bundle-workers 8
|
||||
mixer build bundles --bundle-workers 8
|
||||
if [[ $? -ne 0 ]]; then
|
||||
echo "failed to build mix bundles"
|
||||
exit 1
|
||||
fi
|
||||
# increase the number of fullfile-workers on larger systems
|
||||
mixer build update --new-swupd --fullfile-workers 8 --min-version $1 --format $3
|
||||
mixer build update --fullfile-workers 8 --min-version $1 --format $3
|
||||
if [[ $? -ne 0 ]]; then
|
||||
echo "failed to build mix update"
|
||||
exit 1
|
||||
fi
|
||||
# increase the number of delta-workers on larger systems
|
||||
# this is memory-bound instead of cpu-bound
|
||||
mixer build delta-packs --previous-versions 1 --new-swupd --delta-workers 4
|
||||
mixer build delta-packs --previous-versions 1 --delta-workers 4
|
||||
if [[ $? -ne 0 ]]; then
|
||||
echo "failed to build delta packs"
|
||||
exit 1
|
||||
|
||||
Reference in New Issue
Block a user