forked from ALHP/ALHP.GO
moved some const to utils.go
This commit is contained in:
9
main.go
9
main.go
@@ -28,13 +28,6 @@ import (
|
|||||||
"time"
|
"time"
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
|
||||||
pacmanConf = "/usr/share/devtools/pacman-extra.conf"
|
|
||||||
makepkgConf = "/usr/share/devtools/makepkg-x86_64.conf"
|
|
||||||
logDir = "logs"
|
|
||||||
orgChrootName = "root"
|
|
||||||
)
|
|
||||||
|
|
||||||
var (
|
var (
|
||||||
conf = Conf{}
|
conf = Conf{}
|
||||||
repos []string
|
repos []string
|
||||||
@@ -603,7 +596,7 @@ func main() {
|
|||||||
setupChroot()
|
setupChroot()
|
||||||
syncMarchs()
|
syncMarchs()
|
||||||
|
|
||||||
alpmHandle, err = initALPM(filepath.Join(conf.Basedir.Chroot, "root"), filepath.Join(conf.Basedir.Chroot, "/root/var/lib/pacman"))
|
alpmHandle, err = initALPM(filepath.Join(conf.Basedir.Chroot, pristineChroot), filepath.Join(conf.Basedir.Chroot, pristineChroot, "/var/lib/pacman"))
|
||||||
check(err)
|
check(err)
|
||||||
|
|
||||||
go buildManager.syncWorker()
|
go buildManager.syncWorker()
|
||||||
|
24
utils.go
24
utils.go
@@ -22,13 +22,17 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
SKIPPED = iota
|
SKIPPED = iota
|
||||||
FAILED = iota
|
FAILED = iota
|
||||||
BUILD = iota
|
BUILD = iota
|
||||||
QUEUED = iota
|
QUEUED = iota
|
||||||
BUILDING = iota
|
BUILDING = iota
|
||||||
LATEST = iota
|
LATEST = iota
|
||||||
UNKNOWN = iota
|
UNKNOWN = iota
|
||||||
|
pacmanConf = "/usr/share/devtools/pacman-extra.conf"
|
||||||
|
makepkgConf = "/usr/share/devtools/makepkg-x86_64.conf"
|
||||||
|
logDir = "logs"
|
||||||
|
pristineChroot = "root"
|
||||||
)
|
)
|
||||||
|
|
||||||
type BuildPackage struct {
|
type BuildPackage struct {
|
||||||
@@ -343,9 +347,9 @@ func isPkgFailed(pkg *BuildPackage) bool {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func setupChroot() {
|
func setupChroot() {
|
||||||
if _, err := os.Stat(filepath.Join(conf.Basedir.Chroot, orgChrootName)); err == nil {
|
if _, err := os.Stat(filepath.Join(conf.Basedir.Chroot, pristineChroot)); err == nil {
|
||||||
//goland:noinspection SpellCheckingInspection
|
//goland:noinspection SpellCheckingInspection
|
||||||
cmd := exec.Command("arch-nspawn", filepath.Join(conf.Basedir.Chroot, orgChrootName), "pacman", "-Syuu", "--noconfirm")
|
cmd := exec.Command("arch-nspawn", filepath.Join(conf.Basedir.Chroot, pristineChroot), "pacman", "-Syuu", "--noconfirm")
|
||||||
res, err := cmd.CombinedOutput()
|
res, err := cmd.CombinedOutput()
|
||||||
log.Debug(string(res))
|
log.Debug(string(res))
|
||||||
check(err)
|
check(err)
|
||||||
@@ -353,7 +357,7 @@ func setupChroot() {
|
|||||||
err := os.MkdirAll(conf.Basedir.Chroot, os.ModePerm)
|
err := os.MkdirAll(conf.Basedir.Chroot, os.ModePerm)
|
||||||
check(err)
|
check(err)
|
||||||
|
|
||||||
cmd := exec.Command("mkarchroot", "-C", pacmanConf, filepath.Join(conf.Basedir.Chroot, orgChrootName), "base-devel")
|
cmd := exec.Command("mkarchroot", "-C", pacmanConf, filepath.Join(conf.Basedir.Chroot, pristineChroot), "base-devel")
|
||||||
res, err := cmd.CombinedOutput()
|
res, err := cmd.CombinedOutput()
|
||||||
log.Debug(string(res))
|
log.Debug(string(res))
|
||||||
check(err)
|
check(err)
|
||||||
|
Reference in New Issue
Block a user