1
0
forked from ALHP/ALHP.GO

added lastupdate for downstream mirrors to check

This commit is contained in:
2021-11-13 22:29:46 +01:00
parent de3ca80aab
commit c9a8f88e25
2 changed files with 8 additions and 0 deletions

View File

@@ -412,6 +412,7 @@ func (b *BuildManager) repoWorker(repo string) {
res, err = cmd.CombinedOutput() res, err = cmd.CombinedOutput()
log.Debug(string(res)) log.Debug(string(res))
check(err) check(err)
updateLastUpdated()
b.buildWG.Done() b.buildWG.Done()
case pkg := <-b.repoPurge[repo]: case pkg := <-b.repoPurge[repo]:
if _, err := os.Stat(filepath.Join(conf.Basedir.Repo, pkg.FullRepo, "os", conf.Arch, pkg.FullRepo) + ".db.tar.xz"); err != nil { if _, err := os.Stat(filepath.Join(conf.Basedir.Repo, pkg.FullRepo, "os", conf.Arch, pkg.FullRepo) + ".db.tar.xz"); err != nil {
@@ -448,6 +449,7 @@ func (b *BuildManager) repoWorker(repo string) {
check(os.Remove(file)) check(os.Remove(file))
check(os.Remove(file + ".sig")) check(os.Remove(file + ".sig"))
} }
updateLastUpdated()
b.repoWG.Done() b.repoWG.Done()
} }
} }

View File

@@ -21,6 +21,7 @@ import (
"strconv" "strconv"
"strings" "strings"
"sync" "sync"
"time"
) )
const ( const (
@@ -28,6 +29,7 @@ const (
makepkgConf = "/usr/share/devtools/makepkg-x86_64.conf" makepkgConf = "/usr/share/devtools/makepkg-x86_64.conf"
logDir = "logs" logDir = "logs"
pristineChroot = "root" pristineChroot = "root"
lastUpdate = "lastupdate"
) )
type BuildPackage struct { type BuildPackage struct {
@@ -102,6 +104,10 @@ func check(e error) {
} }
} }
func updateLastUpdated() {
check(os.WriteFile(filepath.Join(conf.Basedir.Repo, lastUpdate), []byte(strconv.FormatInt(time.Now().Unix(), 10)), 0644))
}
func b3sum(filePath string) (string, error) { func b3sum(filePath string) (string, error) {
file, err := os.Open(filePath) file, err := os.Open(filePath)
if err != nil { if err != nil {