OLD | NEW |
1 // Copyright 2013 Canonical Ltd. | 1 // Copyright 2013 Canonical Ltd. |
2 // Licensed under the AGPLv3, see LICENCE file for details. | 2 // Licensed under the AGPLv3, see LICENCE file for details. |
3 | 3 |
4 // The simplestreams package supports locating, parsing, and filtering metadata
in simplestreams format. | 4 // The simplestreams package supports locating, parsing, and filtering metadata
in simplestreams format. |
5 // See http://launchpad.net/simplestreams and in particular the doc/README file
in that project for more information | 5 // See http://launchpad.net/simplestreams and in particular the doc/README file
in that project for more information |
6 // about the file formats. | 6 // about the file formats. |
7 // | 7 // |
8 // Users of this package provide an empty struct and a matching function to be a
ble to query and return a list | 8 // Users of this package provide an empty struct and a matching function to be a
ble to query and return a list |
9 // of typed values for a given criteria. | 9 // of typed values for a given criteria. |
10 package simplestreams | 10 package simplestreams |
11 | 11 |
12 import ( | 12 import ( |
13 "encoding/json" | 13 "encoding/json" |
14 "fmt" | 14 "fmt" |
15 "io/ioutil" | 15 "io/ioutil" |
16 "path" | 16 "path" |
17 "reflect" | 17 "reflect" |
18 "sort" | 18 "sort" |
19 "strings" | 19 "strings" |
20 | 20 |
| 21 "github.com/juju/errors" |
21 "github.com/juju/loggo" | 22 "github.com/juju/loggo" |
22 | 23 |
23 "launchpad.net/juju-core/errors" | |
24 "launchpad.net/juju-core/utils" | 24 "launchpad.net/juju-core/utils" |
25 ) | 25 ) |
26 | 26 |
27 var logger = loggo.GetLogger("juju.environs.simplestreams") | 27 var logger = loggo.GetLogger("juju.environs.simplestreams") |
28 | 28 |
29 type ResolveInfo struct { | 29 type ResolveInfo struct { |
30 Source string `yaml:"source" json:"source"` | 30 Source string `yaml:"source" json:"source"` |
31 Signed bool `yaml:"signed" json:"signed"` | 31 Signed bool `yaml:"signed" json:"signed"` |
32 IndexURL string `yaml:"indexURL" json:"indexURL"` | 32 IndexURL string `yaml:"indexURL" json:"indexURL"` |
33 MirrorURL string `yaml:"mirrorURL,omitempty" json:"mirrorURL,omitempty"` | 33 MirrorURL string `yaml:"mirrorURL,omitempty" json:"mirrorURL,omitempty"` |
(...skipping 899 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
933 // version in YYYYMMDD. | 933 // version in YYYYMMDD. |
934 type byVersionDesc []collectionVersion | 934 type byVersionDesc []collectionVersion |
935 | 935 |
936 func (bv byVersionDesc) Len() int { return len(bv) } | 936 func (bv byVersionDesc) Len() int { return len(bv) } |
937 func (bv byVersionDesc) Swap(i, j int) { | 937 func (bv byVersionDesc) Swap(i, j int) { |
938 bv[i], bv[j] = bv[j], bv[i] | 938 bv[i], bv[j] = bv[j], bv[i] |
939 } | 939 } |
940 func (bv byVersionDesc) Less(i, j int) bool { | 940 func (bv byVersionDesc) Less(i, j int) bool { |
941 return bv[i].version > bv[j].version | 941 return bv[i].version > bv[j].version |
942 } | 942 } |
OLD | NEW |