Compare commits

...

2 Commits

2 changed files with 19 additions and 4 deletions

17
main.go
View File

@@ -62,7 +62,7 @@ func (b *BuildManager) buildWorker(id int) {
dbPkg := getDbPackage(pkg)
dbLock.Lock()
dbPkg.Update().SetStatus(BUILDING).SetSkipReason("").SaveX(context.Background())
dbPkg.Update().SetStatus(BUILDING).SetBuildTime(time.Now().UTC()).SetSkipReason("").SaveX(context.Background())
dbLock.Unlock()
err := importKeys(pkg)
@@ -178,7 +178,7 @@ func (b *BuildManager) buildWorker(id int) {
dbPkg = getDbPackage(pkg)
dbLock.Lock()
dbPkg.Update().SetStatus(BUILD).SetBuildTime(time.Now()).SetBuildDuration(uint64(time.Now().Sub(start).Milliseconds())).SaveX(context.Background())
dbPkg.Update().SetStatus(BUILD).SetBuildDuration(uint64(time.Now().Sub(start).Milliseconds())).SaveX(context.Background())
dbLock.Unlock()
log.Infof("[%s/%s] Build successful (%s)", pkg.FullRepo, pkg.Pkgbase, time.Now().Sub(start))
@@ -269,7 +269,18 @@ func (b *BuildManager) parseWorker() {
isLatest, local, syncVersion, err := isMirrorLatest(alpmHandle, pkg)
if err != nil {
log.Warningf("[%s/%s] Problem solving dependencies: %v", pkg.FullRepo, info.Pkgbase, err)
switch err.(type) {
default:
log.Warningf("[%s/%s] Problem solving dependencies: %v", pkg.FullRepo, info.Pkgbase, err)
case MultiplePKGBUILDError:
log.Debugf("Skipped %s: Multiple PKGBUILDs for dependency found: %v", info.Pkgbase, err)
dbLock.Lock()
dbPkg = dbPkg.Update().SetStatus(SKIPPED).SetSkipReason("multiple PKGBUILD for dep. found").SaveX(context.Background())
dbLock.Unlock()
b.repoPurge[pkg.FullRepo] <- pkg
b.parseWG.Done()
continue
}
}
dbLock.Lock()

View File

@@ -87,6 +87,10 @@ type Conf struct {
type Globs []string
type MultiplePKGBUILDError struct {
error
}
func check(e error) {
if e != nil {
panic(e)
@@ -283,7 +287,7 @@ func getSVN2GITVersion(pkg *BuildPackage) (string, error) {
}
if len(fPkgbuilds) > 1 {
return "", fmt.Errorf("%s: multiple PKGBUILD found: %s", pkg.Pkgbase, fPkgbuilds)
return "", MultiplePKGBUILDError{fmt.Errorf("%s: multiple PKGBUILD found: %s", pkg.Pkgbase, fPkgbuilds)}
} else if len(fPkgbuilds) == 0 {
return "", fmt.Errorf("%s: no matching PKGBUILD found (searched: %s, canidates: %s)", pkg.Pkgbase, filepath.Join(conf.Basedir.Upstream, "**/"+pkg.Pkgbase+"/repos/*/PKGBUILD"), pkgBuilds)
}