Skip to content

Commit

Permalink
Merge pull request juju#17395 from SimonRichardson/intern-charm-package
Browse files Browse the repository at this point in the history
juju#17395

Interns the juju/charm package so that its dependencys are managed
directly by the juju/juju package. Prior to this change, each major
version of juju required changes to the charm package. Releasing a
new version of the charm package is time consuming and hard to get
right when an older major version has a bug with the assoicated
charm package. Rev'ing the package in the correct way is time
consuming. This should reduce the complexity of juju/juju where the
core charm logic is outsourced to another package.

Concretely the all code now points to the internal/charm package. We
will have to spend time slowly merging bother core/charm and
internal/charm. External clients will probably want access to this,
but we should resist that and expose interfaces for reading charms
and bundles. Complex reading of charms or bundles should be then
interned to the API itself (potentially with visitors or adapters).

Lastly, there is a package of charms that are currently living in
internal/charm/internal/test-charm-repo, those should be moved to
testcharms/charm-repo.

 - [ ] Follow up PR to merge test-charm-repo packages.

## Checklist

<!-- If an item is not applicable, use `~strikethrough~`. -->

- [x] Code style: imports ordered, good names, simple structure, etc
- [x] Comments saying why design decisions were made
- [x] Go unit tests, with comments saying what you're testing

## QA steps

```sh
$ juju bootstrap lxd test
$ juju add-model default
$ juju deploy ubuntu
```


## Links



**Jira card:** JUJU-6012
  • Loading branch information
jujubot authored May 22, 2024
2 parents 095f115 + 3545649 commit 62787e6
Show file tree
Hide file tree
Showing 666 changed files with 21,121 additions and 695 deletions.
2 changes: 1 addition & 1 deletion api/agent/uniter/endpoint.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
package uniter

import (
"github.com/juju/charm/v13"
"github.com/juju/juju/internal/charm"
)

// Endpoint represents one endpoint of a relation. It is just a wrapper
Expand Down
2 changes: 1 addition & 1 deletion api/agent/uniter/relation.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@ package uniter
import (
"context"

"github.com/juju/charm/v13"
"github.com/juju/errors"
"github.com/juju/names/v5"

"github.com/juju/juju/core/life"
"github.com/juju/juju/core/relation"
"github.com/juju/juju/internal/charm"
"github.com/juju/juju/rpc/params"
)

Expand Down
2 changes: 1 addition & 1 deletion api/agent/uniter/relation_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ package uniter_test
import (
"context"

"github.com/juju/charm/v13"
"github.com/juju/names/v5"
jc "github.com/juju/testing/checkers"
gc "gopkg.in/check.v1"
Expand All @@ -15,6 +14,7 @@ import (
basetesting "github.com/juju/juju/api/base/testing"
"github.com/juju/juju/core/life"
"github.com/juju/juju/core/relation"
"github.com/juju/juju/internal/charm"
"github.com/juju/juju/rpc/params"
"github.com/juju/juju/testing"
)
Expand Down
2 changes: 1 addition & 1 deletion api/agent/uniter/relationunit_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ package uniter_test
import (
"context"

"github.com/juju/charm/v13"
"github.com/juju/names/v5"
jc "github.com/juju/testing/checkers"
gc "gopkg.in/check.v1"
Expand All @@ -15,6 +14,7 @@ import (
basetesting "github.com/juju/juju/api/base/testing"
"github.com/juju/juju/core/life"
"github.com/juju/juju/core/watcher/watchertest"
"github.com/juju/juju/internal/charm"
"github.com/juju/juju/rpc/params"
"github.com/juju/juju/testing"
)
Expand Down
2 changes: 1 addition & 1 deletion api/agent/uniter/unit.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import (
"context"
"time"

"github.com/juju/charm/v13"
"github.com/juju/errors"
"github.com/juju/names/v5"

Expand All @@ -20,6 +19,7 @@ import (
"github.com/juju/juju/core/secrets"
"github.com/juju/juju/core/status"
"github.com/juju/juju/core/watcher"
"github.com/juju/juju/internal/charm"
"github.com/juju/juju/rpc/params"
)

Expand Down
2 changes: 1 addition & 1 deletion api/agent/uniter/unit_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import (
"context"
"time"

"github.com/juju/charm/v13"
"github.com/juju/names/v5"
"github.com/juju/testing"
jc "github.com/juju/testing/checkers"
Expand All @@ -19,6 +18,7 @@ import (
"github.com/juju/juju/core/model"
"github.com/juju/juju/core/status"
"github.com/juju/juju/core/watcher/watchertest"
"github.com/juju/juju/internal/charm"
"github.com/juju/juju/rpc/params"
coretesting "github.com/juju/juju/testing"
)
Expand Down
2 changes: 1 addition & 1 deletion api/client/application/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import (
"strings"
"time"

"github.com/juju/charm/v13"
"github.com/juju/collections/set"
"github.com/juju/errors"
"github.com/juju/names/v5"
Expand All @@ -22,6 +21,7 @@ import (
"github.com/juju/juju/core/crossmodel"
"github.com/juju/juju/core/devices"
"github.com/juju/juju/core/instance"
"github.com/juju/juju/internal/charm"
internallogger "github.com/juju/juju/internal/logger"
"github.com/juju/juju/internal/storage"
"github.com/juju/juju/rpc/params"
Expand Down
2 changes: 1 addition & 1 deletion api/client/application/client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import (
stderrors "errors"
"time"

"github.com/juju/charm/v13"
"github.com/juju/errors"
"github.com/juju/names/v5"
jc "github.com/juju/testing/checkers"
Expand All @@ -21,6 +20,7 @@ import (
"github.com/juju/juju/core/constraints"
"github.com/juju/juju/core/crossmodel"
"github.com/juju/juju/core/instance"
"github.com/juju/juju/internal/charm"
"github.com/juju/juju/internal/storage"
jujutesting "github.com/juju/juju/juju/testing"
"github.com/juju/juju/rpc/params"
Expand Down
2 changes: 1 addition & 1 deletion api/client/applicationoffers/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,14 @@ import (
"context"

"github.com/go-macaroon-bakery/macaroon-bakery/v3/bakery"
"github.com/juju/charm/v13"
"github.com/juju/errors"
"github.com/juju/names/v5"

"github.com/juju/juju/api/base"
"github.com/juju/juju/core/crossmodel"
"github.com/juju/juju/core/permission"
"github.com/juju/juju/core/relation"
"github.com/juju/juju/internal/charm"
internallogger "github.com/juju/juju/internal/logger"
"github.com/juju/juju/rpc/params"
)
Expand Down
2 changes: 1 addition & 1 deletion api/client/applicationoffers/client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import (
"time"

"github.com/go-macaroon-bakery/macaroon-bakery/v3/bakery"
"github.com/juju/charm/v13"
"github.com/juju/errors"
"github.com/juju/names/v5"
jc "github.com/juju/testing/checkers"
Expand All @@ -19,6 +18,7 @@ import (
"github.com/juju/juju/api/client/applicationoffers"
apiservererrors "github.com/juju/juju/apiserver/errors"
jujucrossmodel "github.com/juju/juju/core/crossmodel"
"github.com/juju/juju/internal/charm"
jujutesting "github.com/juju/juju/juju/testing"
"github.com/juju/juju/rpc/params"
"github.com/juju/juju/testing"
Expand Down
4 changes: 2 additions & 2 deletions api/client/charms/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@ package charms
import (
"context"

"github.com/juju/charm/v13"
charmresource "github.com/juju/charm/v13/resource"
"github.com/juju/collections/transform"
"github.com/juju/errors"

Expand All @@ -17,6 +15,8 @@ import (
commoncharms "github.com/juju/juju/api/common/charms"
apiservererrors "github.com/juju/juju/apiserver/errors"
corebase "github.com/juju/juju/core/base"
"github.com/juju/juju/internal/charm"
charmresource "github.com/juju/juju/internal/charm/resource"
"github.com/juju/juju/rpc/params"
)

Expand Down
4 changes: 2 additions & 2 deletions api/client/charms/client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@ package charms_test
import (
"os"

"github.com/juju/charm/v13"
charmresource "github.com/juju/charm/v13/resource"
"github.com/juju/errors"
jc "github.com/juju/testing/checkers"
"go.uber.org/mock/gomock"
Expand All @@ -18,6 +16,8 @@ import (
apicharm "github.com/juju/juju/api/common/charm"
"github.com/juju/juju/core/arch"
corebase "github.com/juju/juju/core/base"
"github.com/juju/juju/internal/charm"
charmresource "github.com/juju/juju/internal/charm/resource"
"github.com/juju/juju/rpc/params"
"github.com/juju/juju/testcharms"
coretesting "github.com/juju/juju/testing"
Expand Down
2 changes: 1 addition & 1 deletion api/client/charms/downloader_s3.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@ import (
"fmt"
"io"

"github.com/juju/charm/v13"
"github.com/juju/errors"

"github.com/juju/juju/api/base"
"github.com/juju/juju/internal/charm"
"github.com/juju/juju/internal/downloader"
)

Expand Down
2 changes: 1 addition & 1 deletion api/client/charms/localcharmclient.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,12 @@ import (
"os"
"strings"

"github.com/juju/charm/v13"
"github.com/juju/errors"
"github.com/juju/version/v2"

"github.com/juju/juju/api/base"
"github.com/juju/juju/core/lxdprofile"
"github.com/juju/juju/internal/charm"
jujuversion "github.com/juju/juju/version"
)

Expand Down
2 changes: 1 addition & 1 deletion api/client/charms/localcharmclient_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import (
"net/http"
"regexp"

"github.com/juju/charm/v13"
"github.com/juju/errors"
jc "github.com/juju/testing/checkers"
"github.com/juju/version/v2"
Expand All @@ -19,6 +18,7 @@ import (
basemocks "github.com/juju/juju/api/base/mocks"
"github.com/juju/juju/api/client/charms"
"github.com/juju/juju/api/http/mocks"
"github.com/juju/juju/internal/charm"
"github.com/juju/juju/testcharms"
"github.com/juju/juju/testing"
coretesting "github.com/juju/juju/testing"
Expand Down
2 changes: 1 addition & 1 deletion api/client/payloads/client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
package payloads_test

import (
"github.com/juju/charm/v13"
"github.com/juju/names/v5"
jc "github.com/juju/testing/checkers"
"go.uber.org/mock/gomock"
Expand All @@ -13,6 +12,7 @@ import (
"github.com/juju/juju/api/base/mocks"
"github.com/juju/juju/api/client/payloads"
corepayloads "github.com/juju/juju/core/payloads"
"github.com/juju/juju/internal/charm"
"github.com/juju/juju/rpc/params"
)

Expand Down
2 changes: 1 addition & 1 deletion api/client/payloads/helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@
package payloads

import (
"github.com/juju/charm/v13"
"github.com/juju/errors"
"github.com/juju/names/v5"

"github.com/juju/juju/core/payloads"
"github.com/juju/juju/internal/charm"
"github.com/juju/juju/rpc/params"
)

Expand Down
2 changes: 1 addition & 1 deletion api/client/payloads/helpers_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@
package payloads

import (
"github.com/juju/charm/v13"
"github.com/juju/names/v5"
jc "github.com/juju/testing/checkers"
gc "gopkg.in/check.v1"

"github.com/juju/juju/core/payloads"
"github.com/juju/juju/internal/charm"
"github.com/juju/juju/rpc/params"
)

Expand Down
2 changes: 1 addition & 1 deletion api/client/resources/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import (
"io"
"strings"

charmresource "github.com/juju/charm/v13/resource"
"github.com/juju/errors"
"github.com/juju/names/v5"

Expand All @@ -17,6 +16,7 @@ import (
"github.com/juju/juju/api/http"
apiservererrors "github.com/juju/juju/apiserver/errors"
"github.com/juju/juju/core/resources"
charmresource "github.com/juju/juju/internal/charm/resource"
"github.com/juju/juju/rpc/params"
)

Expand Down
2 changes: 1 addition & 1 deletion api/client/resources/client_upload_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ import (
"strings"
"time"

charmresource "github.com/juju/charm/v13/resource"
"github.com/juju/errors"
jc "github.com/juju/testing/checkers"
"github.com/kr/pretty"
Expand All @@ -26,6 +25,7 @@ import (
corebase "github.com/juju/juju/core/base"
coreresources "github.com/juju/juju/core/resources"
resourcetesting "github.com/juju/juju/core/resources/testing"
charmresource "github.com/juju/juju/internal/charm/resource"
"github.com/juju/juju/internal/uuid"
"github.com/juju/juju/rpc/params"
)
Expand Down
2 changes: 1 addition & 1 deletion api/client/resources/helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@
package resources

import (
charmresource "github.com/juju/charm/v13/resource"
"github.com/juju/errors"
"github.com/juju/names/v5"

apiservererrors "github.com/juju/juju/apiserver/errors"
"github.com/juju/juju/core/resources"
charmresource "github.com/juju/juju/internal/charm/resource"
"github.com/juju/juju/rpc/params"
)

Expand Down
2 changes: 1 addition & 1 deletion api/client/resources/helpers_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import (
"strings"
"time"

charmresource "github.com/juju/charm/v13/resource"
"github.com/juju/errors"
"github.com/juju/names/v5"
"github.com/juju/testing"
Expand All @@ -16,6 +15,7 @@ import (

"github.com/juju/juju/core/resources"
resourcetesting "github.com/juju/juju/core/resources/testing"
charmresource "github.com/juju/juju/internal/charm/resource"
"github.com/juju/juju/rpc/params"
)

Expand Down
2 changes: 1 addition & 1 deletion api/client/resources/upload.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@ import (
"mime"
"net/http"

charmresource "github.com/juju/charm/v13/resource"
"github.com/juju/errors"
"github.com/juju/names/v5"

"github.com/juju/juju/core/resources"
charmresource "github.com/juju/juju/internal/charm/resource"
)

// UploadRequest defines a single upload request.
Expand Down
2 changes: 1 addition & 1 deletion api/common/charm/charmorigin.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@
package charm

import (
"github.com/juju/charm/v13"
"github.com/juju/errors"

corebase "github.com/juju/juju/core/base"
corecharm "github.com/juju/juju/core/charm"
"github.com/juju/juju/internal/charm"
"github.com/juju/juju/rpc/params"
)

Expand Down
2 changes: 1 addition & 1 deletion api/common/charm/charmorigin_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@
package charm_test

import (
"github.com/juju/charm/v13"
gc "gopkg.in/check.v1"

commoncharm "github.com/juju/juju/api/common/charm"
corebase "github.com/juju/juju/core/base"
corecharm "github.com/juju/juju/core/charm"
"github.com/juju/juju/internal/charm"
)

type originSuite struct{}
Expand Down
4 changes: 2 additions & 2 deletions api/common/charms/common.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@ import (
"context"
"fmt"

"github.com/juju/charm/v13"
"github.com/juju/charm/v13/resource"
"github.com/juju/errors"
"github.com/juju/names/v5"
"github.com/juju/version/v2"

"github.com/juju/juju/api/base"
"github.com/juju/juju/internal/charm"
"github.com/juju/juju/internal/charm/resource"
"github.com/juju/juju/rpc/params"
)

Expand Down
Loading

0 comments on commit 62787e6

Please sign in to comment.