1
0
forked from ALHP/ALHP.GO

fixed some multi-march issues

This commit is contained in:
2021-11-29 13:29:43 +01:00
parent 6ec9e8c623
commit 24f275877c
2 changed files with 6 additions and 6 deletions

10
main.go
View File

@@ -143,8 +143,8 @@ func (b *BuildManager) buildWorker(id int, march string) {
log.Warningf("[%s/%s/%s] Build failed (%d)", pkg.FullRepo, pkg.Pkgbase, pkg.Version, cmd.ProcessState.ExitCode())
check(os.MkdirAll(filepath.Join(conf.Basedir.Repo, "logs"), 0755))
check(os.WriteFile(filepath.Join(conf.Basedir.Repo, "logs", pkg.Pkgbase+".log"), out.Bytes(), 0644))
check(os.MkdirAll(filepath.Join(conf.Basedir.Repo, logDir, march), 0755))
check(os.WriteFile(filepath.Join(conf.Basedir.Repo, logDir, march, pkg.Pkgbase+".log"), out.Bytes(), 0644))
pkg.DbPackage.Update().SetStatus(dbpackage.StatusFailed).ClearSkipReason().SetBuildTimeStart(start).SetBuildTimeEnd(time.Now().UTC()).SetHash(pkg.Hash).ExecX(context.Background())
@@ -194,8 +194,8 @@ func (b *BuildManager) buildWorker(id int, march string) {
}
}
if _, err := os.Stat(filepath.Join(conf.Basedir.Repo, "logs", pkg.Pkgbase+".log")); err == nil {
check(os.Remove(filepath.Join(conf.Basedir.Repo, "logs", pkg.Pkgbase+".log")))
if _, err := os.Stat(filepath.Join(conf.Basedir.Repo, logDir, march, pkg.Pkgbase+".log")); err == nil {
check(os.Remove(filepath.Join(conf.Basedir.Repo, logDir, march, pkg.Pkgbase+".log")))
}
if pkg.DbPackage.Lto != dbpackage.LtoDisabled && pkg.DbPackage.Lto != dbpackage.LtoAutoDisabled {
@@ -407,7 +407,7 @@ func (b *BuildManager) htmlWorker() {
}
if pkg.Status == dbpackage.StatusFailed {
addPkg.Log = fmt.Sprintf("logs/%s.log", pkg.Pkgbase)
addPkg.Log = fmt.Sprintf("%s/%s/%s.log", logDir, pkg.March, pkg.Pkgbase)
}
switch pkg.Lto {

View File

@@ -732,7 +732,7 @@ func (p *BuildPackage) findPkgFiles() error {
}
func (p *BuildPackage) toDbPackage(create bool) {
dbPkg, err := db.DbPackage.Query().Where(dbpackage.Pkgbase(p.Pkgbase)).Only(context.Background())
dbPkg, err := db.DbPackage.Query().Where(dbpackage.And(dbpackage.Pkgbase(p.Pkgbase), dbpackage.March(p.March))).Only(context.Background())
if err != nil && create {
dbPkg = db.DbPackage.Create().SetPkgbase(p.Pkgbase).SetMarch(p.March).SetPackages(packages2slice(p.Srcinfo.Packages)).SetRepository(p.Repo).SaveX(context.Background())
}