Skip to content

Commit

Permalink
Remove unused function
Browse files Browse the repository at this point in the history
  • Loading branch information
lucklove committed Mar 5, 2021
1 parent cce04ed commit 9a01e4a
Show file tree
Hide file tree
Showing 6 changed files with 5 additions and 50 deletions.
35 changes: 0 additions & 35 deletions cmd/mirror.go
Original file line number Diff line number Diff line change
Expand Up @@ -489,41 +489,6 @@ func newMirrorPublishCmd() *cobra.Command {
return cmd
}

func doPublish(
component, version, entry, desc string,
publishInfo *model.PublishInfo,
hashes map[string]string, length int64,
standalone, hidden bool,
privPath, goos, goarch string,
flagSet set.StringSet,
) error {
env := environment.GlobalEnv()
m, err := env.V1Repository().FetchComponentManifest(component, true)
if err != nil {
if errors.Cause(err) == repository.ErrUnknownComponent {
fmt.Printf("Creating component %s\n", component)
publishInfo.Stand = &standalone
publishInfo.Hide = &hidden
} else {
return err
}
} else if flagSet.Exist("standalone") || flagSet.Exist("hide") {
fmt.Println("This is not a new component, --standalone and --hide flag will be omitted")
}

m = repository.UpdateManifestForPublish(m, component, version, entry, goos, goarch, desc, v1manifest.FileHash{
Hashes: hashes,
Length: uint(length),
})

manifest, err := sign(privPath, m)
if err != nil {
return err
}

return env.V1Repository().Mirror().Publish(manifest, publishInfo)
}

func validatePlatform(goos, goarch string) error {
// Only support any/any, don't support linux/any, any/amd64 .etc.
if goos == "any" && goarch == "any" {
Expand Down
1 change: 1 addition & 0 deletions components/playground/instance/proc_attr_default.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.
//
//go:build !linux
// +build !linux

package instance
Expand Down
1 change: 1 addition & 0 deletions components/playground/instance/proc_attr_linux.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.
//
//go:build linux
// +build linux

package instance
Expand Down
1 change: 1 addition & 0 deletions pkg/cluster/embed/pkged.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 0 additions & 13 deletions pkg/environment/env.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ import (
"github.com/pingcap/errors"
"github.com/pingcap/tiup/pkg/localdata"
"github.com/pingcap/tiup/pkg/repository"
"github.com/pingcap/tiup/pkg/repository/v0manifest"
"github.com/pingcap/tiup/pkg/repository/v1manifest"
pkgver "github.com/pingcap/tiup/pkg/repository/version"
"github.com/pingcap/tiup/pkg/verbose"
Expand Down Expand Up @@ -301,18 +300,6 @@ func (env *Environment) DownloadComponentIfMissing(component string, ver pkgver.
return ver, nil
}

// latestManifest returns the latest v0 component manifest and refresh the local cache
func (env *Environment) latestManifest() (*v0manifest.ComponentManifest, error) {
manifest, err := env.repo.Manifest()
if err != nil {
return nil, err
}
if err := env.profile.SaveManifest(manifest); err != nil {
return nil, err
}
return manifest, err
}

// GetComponentInstalledVersion return the installed version of component.
func (env *Environment) GetComponentInstalledVersion(component string, version pkgver.Version) (pkgver.Version, error) {
return env.profile.GetComponentInstalledVersion(component, version)
Expand Down
4 changes: 2 additions & 2 deletions pkg/repository/clone_mirror.go
Original file line number Diff line number Diff line change
Expand Up @@ -304,8 +304,8 @@ func cloneComponents(repo *V1Repository,
continue
}
}
if _, err := repo.FetchComponentManifest(name, false); err != nil || versionItem.Yanked {
// The component or the version is yanked, skip download binary
if _, err := repo.FetchComponentManifest(name, false); err != nil || versionItem.Yanked {
// The component or the version is yanked, skip download binary
continue
}
if err := download(targetDir, tmpDir, repo, &versionItem); err != nil {
Expand Down

0 comments on commit 9a01e4a

Please sign in to comment.