Пример #1
0
func UpateRuncRev(runcRev string, tags string) error {
	path, _ := upateRev(runcRev, "runc")

	_, err := utils.ExecCmdStr("make", path, "BUILDTAGS="+tags)
	/*cmd := exec.Command("make", "BUILDTAGS="+tags)
	cmd.Stderr = os.Stderr
	//cmd.Stdout = os.Stdout
	cmd.Stdin = os.Stdin
	cmd.Dir = path
	_, err := cmd.Output()*/
	if err != nil {
		log.Fatalf("UpateRuncRev make runc err : %v", err)
	}

	_, err = utils.ExecCmdStr("make", path, "install")
	/*cmd = exec.Command("make", "install")
	cmd.Stderr = os.Stderr
	//cmd.Stdout = os.Stdout
	cmd.Stdin = os.Stdin
	cmd.Dir = path
	_, err = cmd.Output()*/
	if err != nil {
		log.Fatalf("UpateRuncRev make install runc err : %v", err)
	}
	err = setRuncEnv()
	return err
}
Пример #2
0
func cleanCgroup(path string) {
	utils.ExecCmdStr("apt-get", "/", "install", "-y", "cgroup-bin")
	var cmd *exec.Cmd
	cmd = exec.Command("cgdelete", path)
	cmd.Stderr = os.Stderr
	cmd.Stdin = os.Stdin
	outPut, err := cmd.Output()
	if err != nil {
		fmt.Println(string(outPut))
		log.Fatalf("[runtimeValidator] linux resources test : clean cgroup error , %v", err)
	}
}
Пример #3
0
//https://github.com/opencontainers/specs.git
func cloneDeps(path string, repo string) error {
	err := os.MkdirAll(path, os.ModePerm)
	if err != nil {
		log.Fatal("CloneDeps create path err = %v", err)
	}

	cloneString := "https://github.com/opencontainers/" + repo + ".git"

	_, err = utils.ExecCmdStr("git", path, "clone", cloneString)
	/*cmd := exec.Command("git", "clone", cloneString)
	cmd.Stderr = os.Stderr
	//cmd.Stdout = os.Stdout
	cmd.Stdin = os.Stdin
	cmd.Dir = path
	_, err = cmd.Output()*/
	if err != nil {
		log.Fatalf("CloneDeps git clone %v err", cloneString)
	}
	return nil
}
Пример #4
0
func checkout(pPath string, path string, Rev string, repo string) error {
	if !exists(path) {
		err := cloneDeps(pPath, repo)
		if err != nil {
			return err
		}
	}

	_, err := utils.ExecCmdStr("git", path, "checkout", Rev)
	/*
		cmd := exec.Command("git", "checkout", Rev)
		cmd.Stderr = os.Stderr
		//cmd.Stdout = os.Stdout
		cmd.Stdin = os.Stdin
		cmd.Dir = path
		_, err := cmd.Output()*/
	if err != nil {
		return err
	}
	return nil
}