From b6c74101d72621b6137907962e19c3be7c3b675d Mon Sep 17 00:00:00 2001 From: Benjamin Gilbert Date: Mon, 15 Feb 2021 14:19:21 -0500 Subject: [PATCH] plume: rename -B/--board to -A/--arch and update variable names "board" is a ChromeOS/Container Linux remnant. --- docs/mantle/plume.md | 4 ++-- mantle/cmd/plume/fcos.go | 2 +- mantle/cmd/plume/fedora.go | 26 +++++++++++++------------- mantle/cmd/plume/prerelease.go | 12 ++++++------ mantle/cmd/plume/types.go | 8 ++++---- 5 files changed, 26 insertions(+), 26 deletions(-) diff --git a/docs/mantle/plume.md b/docs/mantle/plume.md index 12459b3b44..391b79ce00 100644 --- a/docs/mantle/plume.md +++ b/docs/mantle/plume.md @@ -171,7 +171,7 @@ Here is an example of doing a Fedora Cloud pre-release with plume: --version 30 \ --timestamp 20190819 \ --respin 0 \ - --board x86_64 \ + --arch x86_64 \ --compose-id Fedora-Cloud-30-20190819.0 \ --image-type Cloud-Base \ --debug @@ -186,7 +186,7 @@ Here is an example of doing a Fedora Cloud release with plume: --version 30 \ --timestamp 20190819 \ --respin 0 \ - --board x86_64 \ + --arch x86_64 \ --compose-id Fedora-Cloud-30-20190819.0 \ --image-type Cloud-Base \ --debug diff --git a/mantle/cmd/plume/fcos.go b/mantle/cmd/plume/fcos.go index ce9cb283c1..3365eff608 100644 --- a/mantle/cmd/plume/fcos.go +++ b/mantle/cmd/plume/fcos.go @@ -24,7 +24,7 @@ var ( specProfile string specPolicy string specCommitId string - specBoard string + specArch string specChannel string specVersion string ) diff --git a/mantle/cmd/plume/fedora.go b/mantle/cmd/plume/fedora.go index 1af920a2b3..63bdaba2ca 100644 --- a/mantle/cmd/plume/fedora.go +++ b/mantle/cmd/plume/fedora.go @@ -26,7 +26,7 @@ var ( specRespin string specImageType string specTimestamp string - awsFedoraBoards = []string{ + awsFedoraArches = []string{ "x86_64", "aarch64", } @@ -77,7 +77,7 @@ var ( fedoraSpecs = map[string]channelSpec{ "rawhide": channelSpec{ BaseURL: "https://koji.fedoraproject.org/compose/rawhide", - Boards: awsFedoraBoards, + Arches: awsFedoraArches, AWS: awsSpec{ BaseName: "Fedora", BaseDescription: "Fedora Cloud Base AMI", @@ -87,7 +87,7 @@ var ( }, "branched": channelSpec{ BaseURL: "https://koji.fedoraproject.org/compose/branched", - Boards: awsFedoraBoards, + Arches: awsFedoraArches, AWS: awsSpec{ BaseName: "Fedora", BaseDescription: "Fedora Cloud Base AMI", @@ -97,7 +97,7 @@ var ( }, "updates": channelSpec{ BaseURL: "https://koji.fedoraproject.org/compose/updates", - Boards: awsFedoraBoards, + Arches: awsFedoraArches, AWS: awsSpec{ BaseName: "Fedora", BaseDescription: "Fedora Cloud Base AMI", @@ -107,7 +107,7 @@ var ( }, "cloud": channelSpec{ BaseURL: "https://koji.fedoraproject.org/compose/cloud", - Boards: awsFedoraBoards, + Arches: awsFedoraArches, AWS: awsSpec{ BaseName: "Fedora", BaseDescription: "Fedora Cloud Base AMI", @@ -136,8 +136,8 @@ func ChannelFedoraSpec() (channelSpec, error) { if specVersion == "" { plog.Fatal("--version is required") } - if len(specBoard) == 0 || specBoard == "amd64-usr" { - specBoard = "x86_64" + if specArch == "" { + specArch = "x86_64" } spec, ok := fedoraSpecs[specChannel] @@ -148,15 +148,15 @@ func ChannelFedoraSpec() (channelSpec, error) { if specEnv == "dev" { spec.AWS.Partitions = awsFedoraDevAccountPartitions } - boardOk := false - for _, board := range spec.Boards { - if specBoard == board { - boardOk = true + archOk := false + for _, arch := range spec.Arches { + if specArch == arch { + archOk = true break } } - if !boardOk { - plog.Fatalf("Unknown board %q for channel %q", specBoard, specChannel) + if !archOk { + plog.Fatalf("Unknown arch %q for channel %q", specArch, specChannel) } return spec, nil diff --git a/mantle/cmd/plume/prerelease.go b/mantle/cmd/plume/prerelease.go index fa164a5b0e..799ad62ac0 100644 --- a/mantle/cmd/plume/prerelease.go +++ b/mantle/cmd/plume/prerelease.go @@ -37,6 +37,7 @@ import ( "github.com/coreos/mantle/platform/api/azure" "github.com/coreos/mantle/sdk" "github.com/coreos/mantle/storage" + "github.com/coreos/mantle/system" "github.com/coreos/mantle/util" ) @@ -91,8 +92,7 @@ type imageInfo struct { // Common switches between Fedora Cloud and Fedora CoreOS func AddSpecFlags(flags *pflag.FlagSet) { - board := sdk.DefaultBoard() - flags.StringVarP(&specBoard, "board", "B", board, "target board") + flags.StringVarP(&specArch, "arch", "A", system.RpmArch(), "target arch") flags.StringVarP(&specChannel, "channel", "C", "testing", "target channel") if err := flags.MarkDeprecated("channel", "use --stream instead"); err != nil { panic(err) @@ -190,7 +190,7 @@ func getFedoraImageFile(client *http.Client, spec *channelSpec, src *storage.Buc return imagePath, nil } - rawxzURI, err := url.Parse(fmt.Sprintf("%v/%v/compose/%v/%v/images/%v", spec.BaseURL, specComposeID, getImageTypeURI(), specBoard, fileName)) + rawxzURI, err := url.Parse(fmt.Sprintf("%v/%v/compose/%v/%v/images/%v", spec.BaseURL, specComposeID, getImageTypeURI(), specArch, fileName)) if err != nil { return "", err } @@ -368,7 +368,7 @@ func getSpecAWSImageMetadata(spec *channelSpec) (map[string]string, error) { Timestamp: specTimestamp, Respin: specRespin, ImageType: specImageType, - Arch: specBoard, + Arch: specArch, } t := template.Must(template.New("filename").Parse(imageFileName)) buffer := &bytes.Buffer{} @@ -423,7 +423,7 @@ func awsUploadToPartition(spec *channelSpec, part *awsPartitionSpec, imagePath s var s3ObjectPath string switch selectedDistro { case "fedora": - s3ObjectPath = fmt.Sprintf("%s/%s/%s", specBoard, specVersion, strings.TrimSuffix(imageFileName, filepath.Ext(imageFileName))) + s3ObjectPath = fmt.Sprintf("%s/%s/%s", specArch, specVersion, strings.TrimSuffix(imageFileName, filepath.Ext(imageFileName))) } s3ObjectURL := fmt.Sprintf("s3://%s/%s", part.Bucket, s3ObjectPath) @@ -475,7 +475,7 @@ func awsUploadToPartition(spec *channelSpec, part *awsPartitionSpec, imagePath s "Version": specVersion, "ComposeID": specComposeID, "Date": specTimestamp, - "Arch": specBoard, + "Arch": specArch, }) if err != nil { return nil, fmt.Errorf("couldn't tag images: %v", err) diff --git a/mantle/cmd/plume/types.go b/mantle/cmd/plume/types.go index c503ec50f4..9af2721cd9 100644 --- a/mantle/cmd/plume/types.go +++ b/mantle/cmd/plume/types.go @@ -17,8 +17,8 @@ package main type storageSpec struct { BaseURL string Title string // Replace the bucket name in index page titles - NamedPath string // Copy to $BaseURL/$Board/$NamedPath - VersionPath bool // Copy to $BaseURL/$Board/$Version + NamedPath string // Copy to $BaseURL/$Arch/$NamedPath + VersionPath bool // Copy to $BaseURL/$Arch/$Version DirectoryHTML bool IndexHTML bool } @@ -71,8 +71,8 @@ type awsSpec struct { } type channelSpec struct { - BaseURL string // Copy from $BaseURL/$Board/$Version - Boards []string + BaseURL string // Copy from $BaseURL/$Arch/$Version + Arches []string Destinations []storageSpec GCE gceSpec Azure azureSpec