Merge lp:~ericsnowcurrently/fake-juju/upload-store-charm into lp:~landscape/fake-juju/trunk-old

Proposed by Eric Snow
Status: Merged
Approved by: Eric Snow
Approved revision: 53
Merged at revision: 49
Proposed branch: lp:~ericsnowcurrently/fake-juju/upload-store-charm
Merge into: lp:~landscape/fake-juju/trunk-old
Diff against target: 150 lines (+59/-24)
2 files modified
Makefile (+24/-5)
patches/juju-core_2.0.0.patch (+35/-19)
To merge this branch: bzr merge lp:~ericsnowcurrently/fake-juju/upload-store-charm
Reviewer Review Type Date Requested Status
Simon Poirier (community) Approve
🤖 Landscape Builder test results Approve
Landscape Pending
Review via email: mp+309972@code.launchpad.net

Commit message

Allow charmstore charms to be uploaded via the API.

This patch also includes a new make target.

Description of the change

Allow charmstore charms to be uploaded via the API.

This patch also includes a new make target.

Testing instructions:

make test JUJU_VERSION=2.0.0

To post a comment you must log in.
Revision history for this message
🤖 Landscape Builder (landscape-builder) :
review: Abstain (executing tests)
Revision history for this message
🤖 Landscape Builder (landscape-builder) wrote :

Command: make ci-test
Result: Success
Revno: 52
Branch: lp:~ericsnowcurrently/fake-juju/upload-store-charm
Jenkins: https://ci.lscape.net/job/latch-test-xenial/939/

review: Approve (test results)
53. By Eric Snow

Overwrite the existing symlink in install-dev.

Revision history for this message
🤖 Landscape Builder (landscape-builder) :
review: Abstain (executing tests)
Revision history for this message
🤖 Landscape Builder (landscape-builder) wrote :

Command: make ci-test
Result: Success
Revno: 53
Branch: lp:~ericsnowcurrently/fake-juju/upload-store-charm
Jenkins: https://ci.lscape.net/job/latch-test-xenial/940/

review: Approve (test results)
Revision history for this message
Simon Poirier (simpoir) wrote :

+1 looks as good as my ability to read diffs of diffs

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'Makefile'
2--- Makefile 2016-10-28 18:42:15 +0000
3+++ Makefile 2016-11-03 16:56:22 +0000
4@@ -11,10 +11,13 @@
5 GO_VERSION = 1.6
6 JUJU_TARBALL = juju-core_$(JUJU_VERSION).tar.gz
7 JUJU_PATCH = patches/juju-core_$(JUJU_VERSION).patch
8+GO_PATH = $(JUJU_VERSION)
9+JUJU_SRC = $(GO_PATH)/src
10+JUJU_UNPACKED_CLEAN = $(JUJU_VERSION)/.unpacked-clean
11 INSTALLDIR = $(DESTDIR)/usr/bin
12 INSTALLED = $(INSTALLDIR)/fake-juju-$(JUJU_VERSION)
13
14-$(JUJU_VERSION)/$(JUJU_VERSION): $(JUJU_VERSION)/fake-juju.go
15+$(JUJU_VERSION)/$(JUJU_VERSION): $(JUJU_VERSION)/fake-juju.go $(JUJU_PATCH)
16 case $(JUJU_VERSION) in \
17 1.*) $(MAKE) build-common PATH=$$PATH JUJU_VERSION=$(JUJU_VERSION) ;;\
18 2.*) $(MAKE) build-common PATH=/usr/lib/go-$(GO_VERSION)/bin:$$PATH JUJU_VERSION=$(JUJU_VERSION) ;;\
19@@ -27,15 +30,25 @@
20 esac;\
21 wget https://launchpad.net/$$PROJECT/$(shell (echo $* | cut -f 1 -d - | cut -f 1,2 -d .))/$*/+download/$@
22
23+$(JUJU_UNPACKED_CLEAN): $(JUJU_TARBALL)
24+ mkdir -p $(JUJU_UNPACKED_CLEAN)
25+ tar -C $(JUJU_UNPACKED_CLEAN) --strip=1 -z -xf $(JUJU_TARBALL)
26+
27+.PHONY: update-patch
28+update-patch: $(JUJU_SRC) $(JUJU_UNPACKED_CLEAN)
29+ diff -U 3 -r --no-dereference ./$(JUJU_UNPACKED_CLEAN)/src ./$(JUJU_SRC) > $(JUJU_PATCH); \
30+ echo " -- diff exited with $$? --"
31+ rm -rf $(JUJU_UNPACKED_CLEAN)
32+
33 .PHONY: build
34 build: $(JUJU_VERSION)/$(JUJU_VERSION) py-build
35
36 .PHONY: build-common
37 build-common: $(JUJU_TARBALL) $(JUJU_PATCH)
38- rm -rf $(JUJU_VERSION)/src # Go doesn't play nice with existing files.
39+ rm -rf $(JUJU_SRC) # Go doesn't play nice with existing files.
40 tar -C $(JUJU_VERSION) --strip=1 -z -xf $(JUJU_TARBALL)
41 patch -p0 < $(JUJU_PATCH)
42- cd $(JUJU_VERSION) && GOPATH=$(shell pwd)/$(JUJU_VERSION) PATH=$(PATH) go build
43+ cd $(JUJU_VERSION) && GOPATH=$(shell pwd)/$(GO_PATH) PATH=$(PATH) go build
44
45 .PHONY: install
46 install: $(JUJU_VERSION)/$(JUJU_VERSION) py-install-dev
47@@ -49,7 +62,7 @@
48 .PHONY: clean
49 clean: py-clean
50 rm -f $(JUJU_TARBALL)
51- rm -rf $(JUJU_VERSION)/src
52+ rm -rf $(JUJU_SRC)
53 rm -f $(JUJU_VERSION)/$(JUJU_VERSION)
54 rm -rf _trial_temp
55 rm -f tests/*.pyc
56@@ -74,6 +87,12 @@
57 $(MAKE) build JUJU_VERSION=$$VERSION SKIP_PYTHON_LIB=TRUE; \
58 done
59
60+.PHONY: update-patch
61+update-patch:
62+ for VERSION in $(JUJU_VERSIONS); do \
63+ $(MAKE) update-patch JUJU_VERSION=$$VERSION; \
64+ done
65+
66 .PHONY: build
67 build: $(BUILT_VERSIONS) py-build
68
69@@ -136,7 +155,7 @@
70 .PHONY: py-install-dev
71 py-install-dev:
72 if [ ! "$(SKIP_PYTHON_LIB)" ]; then \
73- ln -snv $(PYTHON_LIB_ROOT)/fakejuju $(PYTHON_INSTALLDIR)/fakejuju; \
74+ ln -snv --backup=existing --suffix .orig $(PYTHON_LIB_ROOT)/fakejuju $(PYTHON_INSTALLDIR)/fakejuju; \
75 fi
76
77 .PHONY: py-clean
78
79=== modified file 'patches/juju-core_2.0.0.patch'
80--- patches/juju-core_2.0.0.patch 2016-10-25 17:18:41 +0000
81+++ patches/juju-core_2.0.0.patch 2016-11-03 16:56:22 +0000
82@@ -1,19 +1,21 @@
83---- 2.0.0/src/github.com/juju/juju/testcharms/charm.go 2016-03-10 13:45:57.000000000 +0100
84-+++ 2.0.0/src/github.com/juju/juju/testcharms/charm.go 2016-03-21 10:46:24.312966629 +0100
85-@@ -17,7 +17,9 @@
86- )
87-
88- // Repo provides access to the test charm repository.
89--var Repo = testing.NewRepo("charm-repo", "quantal")
90-+// XXX fake-juju: avoid crashing because the charm-repo dir is not there
91-+//var Repo = testing.NewRepo("charm-repo", "quantal")
92-+var Repo = &testing.Repo{}
93-
94- // UploadCharm uploads a charm using the given charm store client, and returns
95- // the resulting charm URL and charm.
96---- 2.0.0/src/github.com/juju/juju/provider/dummy/environs.go 2015-07-06 15:01:14.200568258 +0200
97-+++ 2.0.0/src/github.com/juju/juju/provider/dummy/environs.go 2015-07-06 15:18:32.648549661 +0200
98-@@ -633,9 +633,9 @@
99+diff -U 3 -r --no-dereference ./2.0.0/.unpacked-clean/src/github.com/juju/juju/apiserver/charms.go ./2.0.0/src/github.com/juju/juju/apiserver/charms.go
100+--- ./2.0.0/.unpacked-clean/src/github.com/juju/juju/apiserver/charms.go 2016-10-13 14:31:49.000000000 +0000
101++++ ./2.0.0/src/github.com/juju/juju/apiserver/charms.go 2016-11-03 15:55:24.773085965 +0000
102+@@ -284,7 +284,8 @@
103+ if isImporting, err := modelIsImporting(st); err != nil {
104+ return nil, errors.Trace(err)
105+ } else if !isImporting {
106+- return nil, errors.New("cs charms may only be uploaded during model migration import")
107++ // fake-juju allows uploading "charmstore" charms.
108++ //return nil, errors.New("cs charms may only be uploaded during model migration import")
109+ }
110+
111+ // If a revision argument is provided, it takes precedence
112+Only in ./2.0.0/src/github.com/juju/juju/apiserver: charms.go~
113+diff -U 3 -r --no-dereference ./2.0.0/.unpacked-clean/src/github.com/juju/juju/provider/dummy/environs.go ./2.0.0/src/github.com/juju/juju/provider/dummy/environs.go
114+--- ./2.0.0/.unpacked-clean/src/github.com/juju/juju/provider/dummy/environs.go 2016-10-13 14:31:49.000000000 +0000
115++++ ./2.0.0/src/github.com/juju/juju/provider/dummy/environs.go 2016-11-03 13:52:34.827516374 +0000
116+@@ -643,9 +643,9 @@
117
118 // PrecheckInstance is specified in the state.Prechecker interface.
119 func (*environ) PrecheckInstance(series string, cons constraints.Value, placement string) error {
120@@ -26,8 +28,23 @@
121 return nil
122 }
123
124---- 2.0.0/src/github.com/juju/juju/testing/cert.go 2016-03-18 09:25:34 +0000
125-+++ 2.0.0/src/github.com/juju/juju/testing/cert.go 2016-03-18 09:26:04 +0000
126+diff -U 3 -r --no-dereference ./2.0.0/.unpacked-clean/src/github.com/juju/juju/testcharms/charm.go ./2.0.0/src/github.com/juju/juju/testcharms/charm.go
127+--- ./2.0.0/.unpacked-clean/src/github.com/juju/juju/testcharms/charm.go 2016-10-13 14:31:49.000000000 +0000
128++++ ./2.0.0/src/github.com/juju/juju/testcharms/charm.go 2016-11-03 13:52:34.827516374 +0000
129+@@ -17,7 +17,9 @@
130+ )
131+
132+ // Repo provides access to the test charm repository.
133+-var Repo = testing.NewRepo("charm-repo", "quantal")
134++// XXX fake-juju: avoid crashing because the charm-repo dir is not there
135++//var Repo = testing.NewRepo("charm-repo", "quantal")
136++var Repo = &testing.Repo{}
137+
138+ // UploadCharmWithMeta pushes a new charm to the charmstore.
139+ // The uploaded charm takes the supplied charmURL with metadata.yaml and metrics.yaml
140+diff -U 3 -r --no-dereference ./2.0.0/.unpacked-clean/src/github.com/juju/juju/testing/cert.go ./2.0.0/src/github.com/juju/juju/testing/cert.go
141+--- ./2.0.0/.unpacked-clean/src/github.com/juju/juju/testing/cert.go 2016-10-13 14:31:49.000000000 +0000
142++++ ./2.0.0/src/github.com/juju/juju/testing/cert.go 2016-11-03 13:52:34.827516374 +0000
143 @@ -52,7 +52,7 @@
144 }
145
146@@ -46,4 +63,3 @@
147 var hostnames []string
148 srvCert, srvKey, err := cert.NewServer(CACert, CAKey, time.Now().AddDate(10, 0, 0), hostnames)
149 if err != nil {
150-

Subscribers

People subscribed via source and target branches

to all changes: