From d220f4e3f283cef86342e9575e1930759017fc02 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Mart=C3=AD?= Date: Sun, 19 Jul 2015 14:59:41 -0700 Subject: [PATCH] Link apks to the repo they come from --- cmd/fdroidcl/install.go | 2 +- index.go | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/cmd/fdroidcl/install.go b/cmd/fdroidcl/install.go index fb07995..9197d82 100644 --- a/cmd/fdroidcl/install.go +++ b/cmd/fdroidcl/install.go @@ -27,7 +27,7 @@ func runInstall(args []string) { paths := make([]string, len(apps)) for i, app := range apps { apk := app.CurApk - url := fmt.Sprintf("%s/%s", repoURL, apk.ApkName) + url := fmt.Sprintf("%s/%s", apk.Repo.URL, apk.ApkName) path := apkPath(apk.ApkName) if err := downloadEtag(url, path, apk.Hash.Data); err != nil { log.Fatalf("Could not download '%s': %v", app.ID, err) diff --git a/index.go b/index.go index a8eeb5f..43dcde8 100644 --- a/index.go +++ b/index.go @@ -69,6 +69,7 @@ type Apk struct { Perms CommaList `xml:"permissions"` Feats CommaList `xml:"features"` Hash HexHash `xml:"hash"` + Repo *Repo } func (app *App) TextDesc(w io.Writer) { @@ -186,6 +187,10 @@ func LoadIndexXml(r io.Reader) (*Index, error) { for i := range index.Apps { app := &index.Apps[i] sort.Sort(apkList(app.Apks)) + for j := range app.Apks { + apk := &app.Apks[j] + apk.Repo = &index.Repo + } app.calcCurApk() } return &index, nil