refactor(nixery): Extract layering logic into separate package
This will be required for making a standalone, Nixery-style image builder function usable from Nix. Change-Id: I5e36348bd4c32d249d56f6628cd046916691319f Reviewed-on: https://cl.tvl.fyi/c/depot/+/5601 Tested-by: BuildkiteCI Reviewed-by: sterni <sternenseemann@systemli.org>
This commit is contained in:
parent
d60feb21e8
commit
796ff086be
4 changed files with 25 additions and 21 deletions
|
|
@ -26,6 +26,7 @@ import (
|
|||
|
||||
"github.com/google/nixery/builder"
|
||||
"github.com/google/nixery/config"
|
||||
"github.com/google/nixery/layers"
|
||||
"github.com/google/nixery/logs"
|
||||
mf "github.com/google/nixery/manifest"
|
||||
"github.com/google/nixery/storage"
|
||||
|
|
@ -52,7 +53,7 @@ var (
|
|||
|
||||
// Downloads the popularity information for the package set from the
|
||||
// URL specified in Nixery's configuration.
|
||||
func downloadPopularity(url string) (builder.Popularity, error) {
|
||||
func downloadPopularity(url string) (layers.Popularity, error) {
|
||||
resp, err := http.Get(url)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
|
|
@ -67,7 +68,7 @@ func downloadPopularity(url string) (builder.Popularity, error) {
|
|||
return nil, err
|
||||
}
|
||||
|
||||
var pop builder.Popularity
|
||||
var pop layers.Popularity
|
||||
err = json.Unmarshal(j, &pop)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
|
|
@ -246,7 +247,7 @@ func main() {
|
|||
log.WithError(err).Fatal("failed to instantiate build cache")
|
||||
}
|
||||
|
||||
var pop builder.Popularity
|
||||
var pop layers.Popularity
|
||||
if cfg.PopUrl != "" {
|
||||
pop, err = downloadPopularity(cfg.PopUrl)
|
||||
if err != nil {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue