Skip to content

Commit 0c64c21

Browse files
authored
Refactor internals into an exportable package (canonical#226)
This change guides Pebble towards an internal structure that enables us to create specific Pebble-based applications that implement custom commands and add functionality that is not relevant to the upstream Pebble repository. However, we don't want to create a full-blown fork of Pebble and have the maintenance burden of having to port changes from upstream to every fork; for this reason, this change does two things: 1. Rename the internal package to internals so that it can be imported by well-known Pebble-based applications. 2. Refactor all CLI functionality from the main package to the internals/cli package, so that other Pebble-based applications can import this package without having to reimplement this functionality. Such Pebble-based applications will be developed in close proximity to Pebble itself, and this change is not a promise to support internal packages of Pebble externally. Only those privileged cases are honored. This change does not intend to be exhaustive and instead aims to serve as the groundwork for achieving the described goal.
1 parent 9cbb38d commit 0c64c21

File tree

222 files changed

+909
-878
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

222 files changed

+909
-878
lines changed

.github/workflows/tests.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,12 +45,12 @@ jobs:
4545

4646
- name: Test
4747
run: |
48-
go test -c ./internal/daemon
48+
go test -c ./internals/daemon
4949
PEBBLE_TEST_USER=runner PEBBLE_TEST_GROUP=runner sudo -E ./daemon.test -check.v -check.f ^execSuite\.TestUserGroup$
5050
PEBBLE_TEST_USER=runner PEBBLE_TEST_GROUP=runner sudo -E ./daemon.test -check.v -check.f ^execSuite\.TestUserIDGroupID$
5151
PEBBLE_TEST_USER=runner PEBBLE_TEST_GROUP=runner sudo -E ./daemon.test -check.v -check.f ^filesSuite\.TestWriteUserGroupReal$
5252
PEBBLE_TEST_USER=runner PEBBLE_TEST_GROUP=runner sudo -E ./daemon.test -check.v -check.f ^filesSuite\.TestMakeDirsUserGroupReal$
53-
go test -c ./internal/overlord/servstate/
53+
go test -c ./internals/overlord/servstate/
5454
PEBBLE_TEST_USER=runner PEBBLE_TEST_GROUP=runner sudo -E ./servstate.test -check.v -check.f ^S.TestUserGroup$
5555
5656
format:

client/client.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ import (
3131

3232
"github.com/gorilla/websocket"
3333

34-
"github.com/canonical/pebble/internal/wsutil"
34+
"github.com/canonical/pebble/internals/wsutil"
3535
)
3636

3737
// SocketNotFoundError is the error type returned when the client fails

client/exec.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ import (
2323
"io/ioutil"
2424
"time"
2525

26-
"github.com/canonical/pebble/internal/wsutil"
26+
"github.com/canonical/pebble/internals/wsutil"
2727
)
2828

2929
type ExecOptions struct {

0 commit comments

Comments
 (0)