forked from ALHP/ALHP.GO
fixed some problems reported by golint and ineffassign
This commit is contained in:
6
main.go
6
main.go
@@ -51,10 +51,9 @@ func (b *BuildManager) buildWorker(id int, march string) {
|
|||||||
if b.exit {
|
if b.exit {
|
||||||
log.Infof("Worker %s/%d exited...", march, id)
|
log.Infof("Worker %s/%d exited...", march, id)
|
||||||
return
|
return
|
||||||
} else {
|
|
||||||
b.buildWG.Add(1)
|
|
||||||
b.parseWG.Done()
|
|
||||||
}
|
}
|
||||||
|
b.buildWG.Add(1)
|
||||||
|
b.parseWG.Done()
|
||||||
|
|
||||||
rand.Seed(time.Now().UnixNano())
|
rand.Seed(time.Now().UnixNano())
|
||||||
time.Sleep(time.Duration(rand.Float32()*60) * time.Second)
|
time.Sleep(time.Duration(rand.Float32()*60) * time.Second)
|
||||||
@@ -552,6 +551,7 @@ func (b *BuildManager) htmlWorker() {
|
|||||||
check(err)
|
check(err)
|
||||||
|
|
||||||
f, err := os.OpenFile(filepath.Join(conf.Basedir.Repo, "packages.html"), os.O_WRONLY|os.O_CREATE|os.O_TRUNC, 0644)
|
f, err := os.OpenFile(filepath.Join(conf.Basedir.Repo, "packages.html"), os.O_WRONLY|os.O_CREATE|os.O_TRUNC, 0644)
|
||||||
|
check(err)
|
||||||
check(statusTpl.Execute(f, gen))
|
check(statusTpl.Execute(f, gen))
|
||||||
check(f.Close())
|
check(f.Close())
|
||||||
|
|
||||||
|
9
utils.go
9
utils.go
@@ -468,6 +468,9 @@ func movePackagesLive(fullRepo string) error {
|
|||||||
log.Warningf("[MOVE] Existing debug infos for %s, skipping: %s", forPackage, filepath.Join(conf.Basedir.Debug, march, filepath.Base(file)))
|
log.Warningf("[MOVE] Existing debug infos for %s, skipping: %s", forPackage, filepath.Join(conf.Basedir.Debug, march, filepath.Base(file)))
|
||||||
} else {
|
} else {
|
||||||
err = os.Rename(file, filepath.Join(conf.Basedir.Debug, march, filepath.Base(file)))
|
err = os.Rename(file, filepath.Join(conf.Basedir.Debug, march, filepath.Base(file)))
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
_ = os.Remove(file + ".sig")
|
_ = os.Remove(file + ".sig")
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
@@ -540,9 +543,8 @@ func (p *BuildPackage) importKeys() error {
|
|||||||
func constructVersion(pkgver string, pkgrel string, epoch string) string {
|
func constructVersion(pkgver string, pkgrel string, epoch string) string {
|
||||||
if epoch == "" {
|
if epoch == "" {
|
||||||
return pkgver + "-" + pkgrel
|
return pkgver + "-" + pkgrel
|
||||||
} else {
|
|
||||||
return epoch + ":" + pkgver + "-" + pkgrel
|
|
||||||
}
|
}
|
||||||
|
return epoch + ":" + pkgver + "-" + pkgrel
|
||||||
}
|
}
|
||||||
|
|
||||||
func initALPM(root string, dbpath string) (*alpm.Handle, error) {
|
func initALPM(root string, dbpath string) (*alpm.Handle, error) {
|
||||||
@@ -705,9 +707,8 @@ func isPkgFailed(pkg *BuildPackage) bool {
|
|||||||
|
|
||||||
if alpm.VerCmp(pkg.DbPackage.Version, pkg.Version) < 0 {
|
if alpm.VerCmp(pkg.DbPackage.Version, pkg.Version) < 0 {
|
||||||
return false
|
return false
|
||||||
} else {
|
|
||||||
return pkg.DbPackage.Status == dbpackage.StatusFailed
|
|
||||||
}
|
}
|
||||||
|
return pkg.DbPackage.Status == dbpackage.StatusFailed
|
||||||
}
|
}
|
||||||
|
|
||||||
func (p *BuildPackage) genSrcinfo() error {
|
func (p *BuildPackage) genSrcinfo() error {
|
||||||
|
Reference in New Issue
Block a user