示例#1
0
文件: tag.go 项目: boldfield/goxc
func tag(tp TaskParams) error {
	vcs := tp.Settings.GetTaskSettingString(TASK_TAG, "vcs")
	prefix := tp.Settings.GetTaskSettingString(TASK_TAG, "prefix")

	if vcs == "git" {
		version := tp.Settings.GetFullVersionName()
		cmd := exec.Command("git")
		args := []string{"tag", prefix + version}
		err := executils.PrepareCmd(cmd, tp.WorkingDirectory, args, []string{}, tp.Settings.IsVerbose())
		if err != nil {
			return err
		}
		return executils.StartAndWait(cmd)
	} else {
		return errors.New("Only 'git' is supported at this stage")
	}

}
示例#2
0
文件: xc.go 项目: boldfield/goxc
func validatePlatToolchainPackageVersion(dest platforms.Platform, goroot string, verbose bool) error {
	platPkgFileRuntime := filepath.Join(goroot, "pkg", dest.Os+"_"+dest.Arch, "runtime.a")
	nr, err := os.Open(platPkgFileRuntime)
	if err != nil {
		log.Printf("Could not validate toolchain version: %v", err)
	}
	tr, err := ar.NewReader(nr)
	if err != nil {
		log.Printf("Could not validate toolchain version: %v", err)
	}
	for {
		h, err := tr.Next()
		if err != nil {
			if err == io.EOF {
				log.Printf("Could not validate toolchain version: %v", err)
				return nil
			}
			log.Printf("Could not validate toolchain version: %v", err)
			return err
		}
		//log.Printf("Header: %+v", h)
		if h.Name == "__.PKGDEF" {
			firstLine, err := tr.NextString(50)
			if err != nil {
				log.Printf("failed to read first line of PKGDEF: %v", err)
				return nil
			}
			//log.Printf("pkgdef first part: '%s'", firstLine)
			expectedPrefix := "go object " + dest.Os + " " + dest.Arch + " "
			if !strings.HasPrefix(firstLine, expectedPrefix) {
				log.Printf("first line of __.PKGDEF does not match expected pattern: %v", expectedPrefix)
				return nil
			}
			parts := strings.Split(firstLine, " ")
			compiledVersion := parts[4]
			//runtimeVersion := runtime.Version()
			//log.Printf("Runtime version: %s", runtimeVersion)
			cmdPath := filepath.Join(goroot, "bin", "go")
			cmd := exec.Command(cmdPath)
			args := []string{"version"}
			err = executils.PrepareCmd(cmd, ".", args, []string{}, false)
			if err != nil {
				log.Printf("`go version` failed: %v", err)
				return nil
			}
			goVersionOutput, err := cmd.Output()
			if err != nil {
				log.Printf("`go version` failed: %v", err)
				return nil
			}
			//log.Printf("output: %s", string(out))
			goVersionOutputParts := strings.Split(string(goVersionOutput), " ")
			goVersion := goVersionOutputParts[2]
			if compiledVersion != goVersion {
				return errors.New("static library version '" + compiledVersion + "' does NOT match `go version` '" + goVersion + "'!")
			}
			if verbose {
				log.Printf("Toolchain version '%s' verified against 'go %s' for %v", compiledVersion, goVersion, dest)
			}
			return nil
		}
	}
}