Skip to content

Commit

Permalink
Introduce charm.v5-unstable.
Browse files Browse the repository at this point in the history
This mechanical branch updates the charm package to the
v5-unstable version. The legacy charm store code is
adjusted as required.
This is a preparatory work for the migration to the new
charm store API v4.
  • Loading branch information
frankban committed Mar 25, 2015
1 parent 6ff013c commit e40c8c6
Show file tree
Hide file tree
Showing 159 changed files with 241 additions and 215 deletions.
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ Updating dependencies
---------------------

If you update a repo that juju depends on, you will need to recreate
`depdencies.tsv`:
`dependencies.tsv`:

```shell
$ godeps -t $(go list github.com/juju/juju/...) > dependencies.tsv
Expand Down
2 changes: 1 addition & 1 deletion api/action/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ package action

import (
"github.com/juju/errors"
"gopkg.in/juju/charm.v4"
"gopkg.in/juju/charm.v5-unstable"

"github.com/juju/juju/api/base"
"github.com/juju/juju/apiserver/params"
Expand Down
2 changes: 1 addition & 1 deletion api/action/client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (
"github.com/juju/names"
jc "github.com/juju/testing/checkers"
gc "gopkg.in/check.v1"
"gopkg.in/juju/charm.v4"
"gopkg.in/juju/charm.v5-unstable"

"github.com/juju/juju/api/action"
"github.com/juju/juju/apiserver/params"
Expand Down
2 changes: 1 addition & 1 deletion api/charmrevisionupdater/updater_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (
jc "github.com/juju/testing/checkers"
"github.com/juju/utils"
gc "gopkg.in/check.v1"
"gopkg.in/juju/charm.v4"
"gopkg.in/juju/charm.v5-unstable"

"github.com/juju/juju/api/charmrevisionupdater"
"github.com/juju/juju/apiserver/charmrevisionupdater/testing"
Expand Down
2 changes: 1 addition & 1 deletion api/charms/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ package charms

import (
"github.com/juju/errors"
"gopkg.in/juju/charm.v4"
"gopkg.in/juju/charm.v5-unstable"

"github.com/juju/juju/api/base"
"github.com/juju/juju/apiserver/params"
Expand Down
2 changes: 1 addition & 1 deletion api/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import (
"github.com/juju/loggo"
"github.com/juju/names"
"github.com/juju/utils"
"gopkg.in/juju/charm.v4"
"gopkg.in/juju/charm.v5-unstable"

"github.com/juju/juju/api/base"
"github.com/juju/juju/apiserver/params"
Expand Down
2 changes: 1 addition & 1 deletion api/client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import (
"github.com/juju/names"
jc "github.com/juju/testing/checkers"
gc "gopkg.in/check.v1"
"gopkg.in/juju/charm.v4"
"gopkg.in/juju/charm.v5-unstable"

"github.com/juju/juju/api"
"github.com/juju/juju/apiserver/params"
Expand Down
2 changes: 1 addition & 1 deletion api/uniter/charm.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import (
"net/url"

"github.com/juju/errors"
"gopkg.in/juju/charm.v4"
"gopkg.in/juju/charm.v5-unstable"

"github.com/juju/juju/apiserver/params"
)
Expand Down
2 changes: 1 addition & 1 deletion api/uniter/endpoint.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
package uniter

import (
"gopkg.in/juju/charm.v4"
"gopkg.in/juju/charm.v5-unstable"
)

// Endpoint represents one endpoint of a relation. It is just a wrapper
Expand Down
2 changes: 1 addition & 1 deletion api/uniter/relation_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (
"github.com/juju/names"
jc "github.com/juju/testing/checkers"
gc "gopkg.in/check.v1"
"gopkg.in/juju/charm.v4"
"gopkg.in/juju/charm.v5-unstable"

"github.com/juju/juju/api/uniter"
"github.com/juju/juju/apiserver/params"
Expand Down
2 changes: 1 addition & 1 deletion api/uniter/relationunit_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (
"github.com/juju/names"
jc "github.com/juju/testing/checkers"
gc "gopkg.in/check.v1"
"gopkg.in/juju/charm.v4"
"gopkg.in/juju/charm.v5-unstable"

"github.com/juju/juju/api/uniter"
"github.com/juju/juju/apiserver/params"
Expand Down
2 changes: 1 addition & 1 deletion api/uniter/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (
"fmt"

"github.com/juju/names"
"gopkg.in/juju/charm.v4"
"gopkg.in/juju/charm.v5-unstable"

"github.com/juju/juju/api/common"
"github.com/juju/juju/api/watcher"
Expand Down
2 changes: 1 addition & 1 deletion api/uniter/unit.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import (

"github.com/juju/errors"
"github.com/juju/names"
"gopkg.in/juju/charm.v4"
"gopkg.in/juju/charm.v5-unstable"

"github.com/juju/juju/api/common"
"github.com/juju/juju/api/watcher"
Expand Down
2 changes: 1 addition & 1 deletion api/uniter/unit_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import (
"github.com/juju/names"
jc "github.com/juju/testing/checkers"
gc "gopkg.in/check.v1"
"gopkg.in/juju/charm.v4"
"gopkg.in/juju/charm.v5-unstable"

"github.com/juju/juju/api/base"
"github.com/juju/juju/api/uniter"
Expand Down
2 changes: 1 addition & 1 deletion api/uniter/uniter.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import (

"github.com/juju/errors"
"github.com/juju/names"
"gopkg.in/juju/charm.v4"
"gopkg.in/juju/charm.v5-unstable"

"github.com/juju/juju/api/base"
"github.com/juju/juju/api/common"
Expand Down
2 changes: 1 addition & 1 deletion apiserver/action/action_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import (
"github.com/juju/names"
jc "github.com/juju/testing/checkers"
gc "gopkg.in/check.v1"
"gopkg.in/juju/charm.v4"
"gopkg.in/juju/charm.v5-unstable"

"github.com/juju/juju/apiserver/action"
"github.com/juju/juju/apiserver/common"
Expand Down
15 changes: 11 additions & 4 deletions apiserver/charmrevisionupdater/testing/suite.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,21 @@ import (

jc "github.com/juju/testing/checkers"
gc "gopkg.in/check.v1"
"gopkg.in/juju/charm.v4"
charmtesting "gopkg.in/juju/charm.v4/testing"
"gopkg.in/juju/charm.v5-unstable"
"gopkg.in/juju/charm.v5-unstable/charmrepo"
charmtesting "gopkg.in/juju/charm.v5-unstable/testing"
"gopkg.in/juju/charmstore.v4"

jujutesting "github.com/juju/juju/juju/testing"
"github.com/juju/juju/state"
"github.com/juju/juju/testcharms"
)

// TODO frankban: this is done so that transitive testing dependencies are
// included in the dependency file by godeps. We will use charmstore.NewServer
// soon, but for the time being, this allows godeps to work properly.
var _ = charmstore.NewServer

// CharmSuite provides infrastructure to set up and perform tests associated
// with charm versioning. A mock charm store is created using some known charms
// used for testing.
Expand Down Expand Up @@ -43,8 +50,8 @@ func (s *CharmSuite) TearDownSuite(c *gc.C) {
}

func (s *CharmSuite) SetUpTest(c *gc.C) {
s.jcSuite.PatchValue(&charm.CacheDir, c.MkDir())
s.jcSuite.PatchValue(&charm.Store, &charm.CharmStore{BaseURL: s.Server.Address()})
s.jcSuite.PatchValue(&charmrepo.CacheDir, c.MkDir())
s.jcSuite.PatchValue(&charmrepo.LegacyStore, &charmrepo.LegacyCharmStore{BaseURL: s.Server.Address()})
s.Server.Downloads = nil
s.Server.Authorizations = nil
s.Server.Metadata = nil
Expand Down
5 changes: 3 additions & 2 deletions apiserver/charmrevisionupdater/updater.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ package charmrevisionupdater
import (
"github.com/juju/errors"
"github.com/juju/loggo"
"gopkg.in/juju/charm.v4"
"gopkg.in/juju/charm.v5-unstable"
"gopkg.in/juju/charm.v5-unstable/charmrepo"

"github.com/juju/juju/apiserver/common"
"github.com/juju/juju/apiserver/params"
Expand Down Expand Up @@ -109,7 +110,7 @@ func retrieveLatestCharmInfo(deployedCharms map[string]*charm.URL, uuid string)

// Do a bulk call to get the revision info for all charms.
logger.Infof("retrieving revision information for %d charms", len(curls))
store := charm.Store.WithJujuAttrs("environment_uuid=" + uuid)
store := charmrepo.LegacyStore.WithJujuAttrs("environment_uuid=" + uuid)
revInfo, err := store.Latest(curls...)
if err != nil {
err = errors.Annotate(err, "finding charm revision info")
Expand Down
2 changes: 1 addition & 1 deletion apiserver/charmrevisionupdater/updater_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (
"github.com/juju/errors"
jc "github.com/juju/testing/checkers"
gc "gopkg.in/check.v1"
"gopkg.in/juju/charm.v4"
"gopkg.in/juju/charm.v5-unstable"

"github.com/juju/juju/apiserver/charmrevisionupdater"
"github.com/juju/juju/apiserver/charmrevisionupdater/testing"
Expand Down
2 changes: 1 addition & 1 deletion apiserver/charms.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import (

"github.com/juju/errors"
ziputil "github.com/juju/utils/zip"
"gopkg.in/juju/charm.v4"
"gopkg.in/juju/charm.v5-unstable"

"github.com/juju/juju/apiserver/client"
apihttp "github.com/juju/juju/apiserver/http"
Expand Down
5 changes: 3 additions & 2 deletions apiserver/charms/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ package charms
import (
"github.com/juju/errors"
"github.com/juju/utils/set"
"gopkg.in/juju/charm.v4"
"gopkg.in/juju/charm.v5-unstable"
"gopkg.in/juju/charm.v5-unstable/charmrepo"

"github.com/juju/juju/api"
"github.com/juju/juju/apiserver/common"
Expand Down Expand Up @@ -51,7 +52,7 @@ func NewAPI(
}, nil
}

var CharmStore charm.Repository = charm.Store
var CharmStore charmrepo.Interface = charmrepo.LegacyStore

// CharmInfo returns information about the requested charm.
func (a *API) CharmInfo(args params.CharmInfo) (api.CharmInfo, error) {
Expand Down
2 changes: 1 addition & 1 deletion apiserver/charms/client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ package charms_test
import (
jc "github.com/juju/testing/checkers"
gc "gopkg.in/check.v1"
"gopkg.in/juju/charm.v4"
"gopkg.in/juju/charm.v5-unstable"

"github.com/juju/juju/api"
"github.com/juju/juju/apiserver/charms"
Expand Down
2 changes: 1 addition & 1 deletion apiserver/charms/state.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
package charms

import (
"gopkg.in/juju/charm.v4"
"gopkg.in/juju/charm.v5-unstable"

"github.com/juju/juju/state"
)
Expand Down
2 changes: 1 addition & 1 deletion apiserver/charms_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import (
jc "github.com/juju/testing/checkers"
"github.com/juju/utils"
gc "gopkg.in/check.v1"
"gopkg.in/juju/charm.v4"
"gopkg.in/juju/charm.v5-unstable"

apihttp "github.com/juju/juju/apiserver/http"
"github.com/juju/juju/apiserver/params"
Expand Down
7 changes: 4 additions & 3 deletions apiserver/client/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@ import (
"github.com/juju/names"
"github.com/juju/utils"
"github.com/juju/utils/featureflag"
"gopkg.in/juju/charm.v4"
"gopkg.in/juju/charm.v5-unstable"
"gopkg.in/juju/charm.v5-unstable/charmrepo"

"github.com/juju/juju/api"
"github.com/juju/juju/apiserver/common"
Expand Down Expand Up @@ -265,7 +266,7 @@ func (c *Client) ServiceUnexpose(args params.ServiceUnexpose) error {
return svc.ClearExposed()
}

var CharmStore charm.Repository = charm.Store
var CharmStore charmrepo.Interface = charmrepo.LegacyStore

func networkTagsToNames(tags []string) ([]string, error) {
netNames := make([]string, len(tags))
Expand Down Expand Up @@ -1346,7 +1347,7 @@ func (c *Client) ResolveCharms(args params.ResolveCharms) (params.ResolveCharmRe
return results, nil
}

func (c *Client) resolveCharm(ref *charm.Reference, repo charm.Repository) (*charm.URL, error) {
func (c *Client) resolveCharm(ref *charm.Reference, repo charmrepo.Interface) (*charm.URL, error) {
if ref.Schema != "cs" {
return nil, fmt.Errorf("only charm store charm references are supported, with cs: schema")
}
Expand Down
4 changes: 2 additions & 2 deletions apiserver/client/client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ import (
"github.com/juju/utils"
"github.com/juju/utils/featureflag"
gc "gopkg.in/check.v1"
"gopkg.in/juju/charm.v4"
charmtesting "gopkg.in/juju/charm.v4/testing"
"gopkg.in/juju/charm.v5-unstable"
charmtesting "gopkg.in/juju/charm.v5-unstable/testing"
"gopkg.in/mgo.v2"

"github.com/juju/juju/agent"
Expand Down
2 changes: 1 addition & 1 deletion apiserver/client/get.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
package client

import (
"gopkg.in/juju/charm.v4"
"gopkg.in/juju/charm.v5-unstable"

"github.com/juju/juju/apiserver/params"
"github.com/juju/juju/constraints"
Expand Down
2 changes: 1 addition & 1 deletion apiserver/client/get_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import (

jc "github.com/juju/testing/checkers"
gc "gopkg.in/check.v1"
"gopkg.in/juju/charm.v4"
"gopkg.in/juju/charm.v5-unstable"

"github.com/juju/juju/apiserver/params"
"github.com/juju/juju/constraints"
Expand Down
2 changes: 1 addition & 1 deletion apiserver/client/perm_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (
"github.com/juju/names"
jc "github.com/juju/testing/checkers"
gc "gopkg.in/check.v1"
"gopkg.in/juju/charm.v4"
"gopkg.in/juju/charm.v5-unstable"

"github.com/juju/juju/api"
"github.com/juju/juju/apiserver/params"
Expand Down
2 changes: 1 addition & 1 deletion apiserver/client/status.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (

"github.com/juju/errors"
"github.com/juju/utils/set"
"gopkg.in/juju/charm.v4"
"gopkg.in/juju/charm.v5-unstable"

"github.com/juju/juju/api"
"github.com/juju/juju/apiserver/params"
Expand Down
2 changes: 1 addition & 1 deletion apiserver/params/actions.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (
"time"

// TODO(jcw4) per fwereade 2014-11-21 remove this dependency
"gopkg.in/juju/charm.v4"
"gopkg.in/juju/charm.v5-unstable"
)

const (
Expand Down
2 changes: 1 addition & 1 deletion apiserver/params/params.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import (

"github.com/juju/errors"
"github.com/juju/utils/proxy"
"gopkg.in/juju/charm.v4"
"gopkg.in/juju/charm.v5-unstable"

"github.com/juju/juju/constraints"
"github.com/juju/juju/instance"
Expand Down
2 changes: 1 addition & 1 deletion apiserver/params/params_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (

jc "github.com/juju/testing/checkers"
gc "gopkg.in/check.v1"
"gopkg.in/juju/charm.v4"
"gopkg.in/juju/charm.v5-unstable"

"github.com/juju/juju/apiserver/params"
"github.com/juju/juju/constraints"
Expand Down
2 changes: 1 addition & 1 deletion apiserver/uniter/uniter_base.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import (

"github.com/juju/errors"
"github.com/juju/names"
"gopkg.in/juju/charm.v4"
"gopkg.in/juju/charm.v5-unstable"

"github.com/juju/juju/apiserver/common"
leadershipapiserver "github.com/juju/juju/apiserver/leadership"
Expand Down
2 changes: 1 addition & 1 deletion apiserver/uniter/uniter_base_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import (
jc "github.com/juju/testing/checkers"
"github.com/juju/utils"
gc "gopkg.in/check.v1"
"gopkg.in/juju/charm.v4"
"gopkg.in/juju/charm.v5-unstable"

"github.com/juju/juju/apiserver/common"
"github.com/juju/juju/apiserver/params"
Expand Down
2 changes: 1 addition & 1 deletion cmd/juju/action/action.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import (

"github.com/juju/cmd"
"github.com/juju/errors"
"gopkg.in/juju/charm.v4"
"gopkg.in/juju/charm.v5-unstable"

"github.com/juju/juju/api/action"
"github.com/juju/juju/apiserver/params"
Expand Down
2 changes: 1 addition & 1 deletion cmd/juju/action/defined_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import (
"github.com/juju/names"
jc "github.com/juju/testing/checkers"
gc "gopkg.in/check.v1"
"gopkg.in/juju/charm.v4"
"gopkg.in/juju/charm.v5-unstable"
"gopkg.in/yaml.v1"

"github.com/juju/juju/cmd/juju/action"
Expand Down
Loading

0 comments on commit e40c8c6

Please sign in to comment.