Browse Source

Link apks to the repo they come from

pull/8/head
Daniel Martí 11 years ago
parent
commit
d220f4e3f2
  1. 2
      cmd/fdroidcl/install.go
  2. 5
      index.go

2
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)

5
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

Loading…
Cancel
Save