示例#1
0
文件: mirror.go 项目: pacur/pacur
func (m *Mirror) createPacman() (err error) {
	outDir := filepath.Join(m.Root, "pacman")

	err = utils.MkdirAll(outDir)
	if err != nil {
		return
	}

	err = utils.RsyncExt(m.Root, outDir, ".pkg.tar.xz")
	if err != nil {
		return
	}

	if m.Signing {
		err = signing.SignPacman(outDir)
		if err != nil {
			return
		}
	}

	pkgs, err := utils.FindExt(outDir, ".pkg.tar.xz")
	for _, pkg := range pkgs {
		err = utils.Exec(outDir, "repo-add",
			fmt.Sprintf("%s.db.tar.gz", m.Name), pkg)
		if err != nil {
			return
		}
	}

	return
}
示例#2
0
文件: project.go 项目: pacur/pacur
func (p *RedhatProject) Prep() (err error) {
	buildDir, err := p.getBuildDir()
	if err != nil {
		return
	}

	keyPath := filepath.Join(p.Path, "..", "sign.key")
	exists, err := utils.Exists(keyPath)
	if err != nil {
		return
	}

	if exists {
		err = utils.CopyFile("", keyPath, buildDir, true)
		if err != nil {
			return
		}
	}

	err = utils.RsyncExt(p.Path, buildDir, ".rpm")
	if err != nil {
		return
	}

	return
}