Add package refs to mirror state.

This commit is contained in:
Andrey Smirnov
2013-12-19 23:35:54 +04:00
parent f7f4ba1691
commit 7940f5e698
4 changed files with 81 additions and 13 deletions
+10 -2
View File
@@ -12,6 +12,7 @@ import (
"log"
"net/url"
"strings"
"time"
)
// RemoteRepo represents remote (fetchable) Debian repository.
@@ -32,7 +33,11 @@ type RemoteRepo struct {
// List of architectures to fetch, if empty, then fetch all architectures
Architectures []string
// Meta-information about repository
Meta debc.Paragraph
Meta debc.Paragraph
// Last update date
LastDownloadDate time.Time
// "Snapshot" of current list of packages
PackageRefs *PackageRefList
archiveRootURL *url.URL
}
@@ -168,7 +173,7 @@ func (repo *RemoteRepo) Download(d utils.Downloader, db database.Storage, packag
})
// Download all package files
ch := make(chan error, list.Length())
ch := make(chan error, list.Len())
count := 0
list.ForEach(func(p *Package) {
@@ -188,6 +193,9 @@ func (repo *RemoteRepo) Download(d utils.Downloader, db database.Storage, packag
count--
}
repo.LastDownloadDate = time.Now()
repo.PackageRefs = NewPackageRefListFromPackageList(list)
return nil
}