diff --git a/cmd_mirror.go b/cmd_mirror.go index 750cc0ce..9a320b93 100644 --- a/cmd_mirror.go +++ b/cmd_mirror.go @@ -124,7 +124,9 @@ func aptlyMirrorUpdate(cmd *commander.Command, args []string) error { return fmt.Errorf("unable to update: %s", err) } - err = repo.Download(context.downloader, context.database, context.packageRepository) + packageCollection := debian.NewPackageCollection(context.database) + + err = repo.Download(context.downloader, packageCollection, context.packageRepository) if err != nil { return fmt.Errorf("unable to update: %s", err) } diff --git a/debian/remote.go b/debian/remote.go index aef06ade..513c3939 100644 --- a/debian/remote.go +++ b/debian/remote.go @@ -151,7 +151,7 @@ func (repo *RemoteRepo) Fetch(d utils.Downloader) error { } // Download downloads all repo files -func (repo *RemoteRepo) Download(d utils.Downloader, db database.Storage, packageRepo *Repository) error { +func (repo *RemoteRepo) Download(d utils.Downloader, packageCollection *PackageCollection, packageRepo *Repository) error { list := NewPackageList() // Download and parse all Release files @@ -178,7 +178,7 @@ func (repo *RemoteRepo) Download(d utils.Downloader, db database.Storage, packag // Save package meta information to DB list.ForEach(func(p *Package) { - db.Put(p.Key(), p.Encode()) + packageCollection.Update(p) }) // Download all package files