Merge lp:~natefinch/juju-core/fix-win-bootstrap into lp:~go-bot/juju-core/trunk

Proposed by Nate Finch
Status: Merged
Approved by: Nate Finch
Approved revision: no longer in the source branch.
Merged at revision: 1995
Proposed branch: lp:~natefinch/juju-core/fix-win-bootstrap
Merge into: lp:~go-bot/juju-core/trunk
Diff against target: 624 lines (+366/-52) (has conflicts)
14 files modified
charm/repo.go (+2/-1)
cmd/plugins/juju-metadata/validateimagemetadata_test.go (+38/-0)
environs/configstore/disk.go (+1/-1)
environs/filestorage/filestorage.go (+1/-1)
environs/sync/sync.go (+10/-0)
environs/sync/sync_test.go (+26/-1)
environs/tools/simplestreams_test.go (+113/-0)
provider/maas/instance_test.go (+93/-45)
utils/file_unix.go (+15/-0)
utils/file_windows.go (+35/-0)
utils/fslock/fslock.go (+2/-2)
utils/trivial.go (+1/-1)
utils/zfile_windows.go (+25/-0)
version/version.go (+4/-0)
Text conflict in cmd/plugins/juju-metadata/validateimagemetadata_test.go
Text conflict in environs/sync/sync_test.go
Text conflict in environs/tools/simplestreams_test.go
Text conflict in provider/maas/instance_test.go
Text conflict in version/version.go
To merge this branch: bzr merge lp:~natefinch/juju-core/fix-win-bootstrap
Reviewer Review Type Date Requested Status
Juju Engineering Pending
Review via email: mp+191688@code.launchpad.net

Commit message

merge windows fix back to trunk

To post a comment you must log in.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'charm/repo.go'
--- charm/repo.go 2013-07-09 10:32:23 +0000
+++ charm/repo.go 2013-10-17 18:24:24 +0000
@@ -17,6 +17,7 @@
17 "strings"17 "strings"
1818
19 "launchpad.net/juju-core/log"19 "launchpad.net/juju-core/log"
20 "launchpad.net/juju-core/utils"
20)21)
2122
22// CacheDir stores the charm cache directory path.23// CacheDir stores the charm cache directory path.
@@ -257,7 +258,7 @@
257 os.Remove(dlPath)258 os.Remove(dlPath)
258 return nil, err259 return nil, err
259 }260 }
260 if err := os.Rename(dlPath, path); err != nil {261 if err := utils.ReplaceFile(dlPath, path); err != nil {
261 return nil, err262 return nil, err
262 }263 }
263 }264 }
264265
=== modified file 'cmd/plugins/juju-metadata/validateimagemetadata_test.go'
--- cmd/plugins/juju-metadata/validateimagemetadata_test.go 2013-10-17 05:37:00 +0000
+++ cmd/plugins/juju-metadata/validateimagemetadata_test.go 2013-10-17 18:24:24 +0000
@@ -19,9 +19,14 @@
19)19)
2020
21type ValidateImageMetadataSuite struct {21type ValidateImageMetadataSuite struct {
22<<<<<<< TREE
22 testbase.LoggingSuite23 testbase.LoggingSuite
23 home *coretesting.FakeHome24 home *coretesting.FakeHome
24 metadataDir string25 metadataDir string
26=======
27 testbase.LoggingSuite
28 home *coretesting.FakeHome
29>>>>>>> MERGE-SOURCE
25}30}
2631
27var _ = gc.Suite(&ValidateImageMetadataSuite{})32var _ = gc.Suite(&ValidateImageMetadataSuite{})
@@ -89,6 +94,10 @@
89environments:94environments:
90 ec2:95 ec2:
91 type: ec296 type: ec2
97<<<<<<< TREE
98=======
99 control-bucket: foo
100>>>>>>> MERGE-SOURCE
92 default-series: precise101 default-series: precise
93 region: us-east-1102 region: us-east-1
94103
@@ -102,11 +111,22 @@
102`111`
103112
104func (s *ValidateImageMetadataSuite) SetUpTest(c *gc.C) {113func (s *ValidateImageMetadataSuite) SetUpTest(c *gc.C) {
114<<<<<<< TREE
105 s.LoggingSuite.SetUpTest(c)115 s.LoggingSuite.SetUpTest(c)
106 s.metadataDir = c.MkDir()116 s.metadataDir = c.MkDir()
117=======
118 s.LoggingSuite.SetUpTest(c)
119>>>>>>> MERGE-SOURCE
107 s.home = coretesting.MakeFakeHome(c, metadataTestEnvConfig)120 s.home = coretesting.MakeFakeHome(c, metadataTestEnvConfig)
121<<<<<<< TREE
108 s.PatchEnvironment("AWS_ACCESS_KEY_ID", "access")122 s.PatchEnvironment("AWS_ACCESS_KEY_ID", "access")
109 s.PatchEnvironment("AWS_SECRET_ACCESS_KEY", "secret")123 s.PatchEnvironment("AWS_SECRET_ACCESS_KEY", "secret")
124=======
125 restore := testbase.PatchEnvironment("AWS_ACCESS_KEY_ID", "access")
126 s.AddCleanup(func(*gc.C) { restore() })
127 restore = testbase.PatchEnvironment("AWS_SECRET_ACCESS_KEY", "secret")
128 s.AddCleanup(func(*gc.C) { restore() })
129>>>>>>> MERGE-SOURCE
110}130}
111131
112func (s *ValidateImageMetadataSuite) TearDownTest(c *gc.C) {132func (s *ValidateImageMetadataSuite) TearDownTest(c *gc.C) {
@@ -135,6 +155,7 @@
135 c.Check(strippedOut, gc.Matches, `matching image ids for region "us-east-1":.*`)155 c.Check(strippedOut, gc.Matches, `matching image ids for region "us-east-1":.*`)
136}156}
137157
158<<<<<<< TREE
138func (s *ValidateImageMetadataSuite) TestEc2LocalMetadataUsingIncompleteEnvironment(c *gc.C) {159func (s *ValidateImageMetadataSuite) TestEc2LocalMetadataUsingIncompleteEnvironment(c *gc.C) {
139 testbase.PatchEnvironment("AWS_ACCESS_KEY_ID", "")160 testbase.PatchEnvironment("AWS_ACCESS_KEY_ID", "")
140 testbase.PatchEnvironment("AWS_SECRET_ACCESS_KEY", "")161 testbase.PatchEnvironment("AWS_SECRET_ACCESS_KEY", "")
@@ -151,6 +172,23 @@
151 c.Check(strippedOut, gc.Matches, `error: environment has no access-key or secret-key`)172 c.Check(strippedOut, gc.Matches, `error: environment has no access-key or secret-key`)
152}173}
153174
175=======
176func (s *ValidateImageMetadataSuite) TestEc2LocalMetadataUsingIncompleteEnvironment(c *gc.C) {
177 testbase.PatchEnvironment("AWS_ACCESS_KEY_ID", "")
178 testbase.PatchEnvironment("AWS_SECRET_ACCESS_KEY", "")
179 s.setupEc2LocalMetadata(c, "us-east-1")
180 ctx := coretesting.Context(c)
181 metadataDir := config.JujuHomePath("")
182 code := cmd.Main(
183 &ValidateImageMetadataCommand{}, ctx, []string{"-e", "ec2", "-d", metadataDir},
184 )
185 c.Assert(code, gc.Equals, 1)
186 errOut := ctx.Stderr.(*bytes.Buffer).String()
187 strippedOut := strings.Replace(errOut, "\n", "", -1)
188 c.Check(strippedOut, gc.Matches, `error: environment has no access-key or secret-key`)
189}
190
191>>>>>>> MERGE-SOURCE
154func (s *ValidateImageMetadataSuite) TestEc2LocalMetadataWithManualParams(c *gc.C) {192func (s *ValidateImageMetadataSuite) TestEc2LocalMetadataWithManualParams(c *gc.C) {
155 s.setupEc2LocalMetadata(c, "us-west-1")193 s.setupEc2LocalMetadata(c, "us-west-1")
156 ctx := coretesting.Context(c)194 ctx := coretesting.Context(c)
157195
=== modified file 'environs/configstore/disk.go'
--- environs/configstore/disk.go 2013-10-02 15:39:37 +0000
+++ environs/configstore/disk.go 2013-10-17 18:24:24 +0000
@@ -199,7 +199,7 @@
199 if err != nil {199 if err != nil {
200 return fmt.Errorf("cannot write temporary file: %v", err)200 return fmt.Errorf("cannot write temporary file: %v", err)
201 }201 }
202 if err := os.Rename(tmpFile.Name(), info.path); err != nil {202 if err := utils.ReplaceFile(tmpFile.Name(), info.path); err != nil {
203 os.Remove(tmpFile.Name())203 os.Remove(tmpFile.Name())
204 return fmt.Errorf("cannot rename new environment info file: %v", err)204 return fmt.Errorf("cannot rename new environment info file: %v", err)
205 }205 }
206206
=== modified file 'environs/filestorage/filestorage.go'
--- environs/filestorage/filestorage.go 2013-09-20 04:41:12 +0000
+++ environs/filestorage/filestorage.go 2013-10-17 18:24:24 +0000
@@ -151,7 +151,7 @@
151 os.Remove(file.Name())151 os.Remove(file.Name())
152 return err152 return err
153 }153 }
154 return os.Rename(file.Name(), fullpath)154 return utils.ReplaceFile(file.Name(), fullpath)
155}155}
156156
157func (f *fileStorageWriter) Remove(name string) error {157func (f *fileStorageWriter) Remove(name string) error {
158158
=== modified file 'environs/imagemetadata/simplestreams.go'
=== modified file 'environs/imagemetadata/simplestreams_test.go'
=== modified file 'environs/simplestreams/simplestreams.go'
=== modified file 'environs/sync/sync.go'
--- environs/sync/sync.go 2013-10-16 05:26:30 +0000
+++ environs/sync/sync.go 2013-10-17 18:24:24 +0000
@@ -174,6 +174,16 @@
174 sha256hash.Write(buf.Bytes())174 sha256hash.Write(buf.Bytes())
175 tool.SHA256 = fmt.Sprintf("%x", sha256hash.Sum(nil))175 tool.SHA256 = fmt.Sprintf("%x", sha256hash.Sum(nil))
176 tool.Size = nBytes176 tool.Size = nBytes
177
178 // TODO(wallyworld) - 2013-10-09 bug=1237130
179 // This is a 1.16 only hack to allow upgrades from 1.14 to work.
180 // Remove once 1.16 is released.
181 legacyBuf := bytes.NewBuffer(buf.Bytes())
182 legacyName := "tools/juju-" + tool.Version.String() + ".tgz"
183 err = dest.Put(legacyName, legacyBuf, nBytes)
184 if err != nil {
185 return fmt.Errorf("writing tools to legacy location: %v", err)
186 }
177 return dest.Put(toolsName, buf, nBytes)187 return dest.Put(toolsName, buf, nBytes)
178}188}
179189
180190
=== modified file 'environs/sync/sync_test.go'
--- environs/sync/sync_test.go 2013-10-10 11:40:54 +0000
+++ environs/sync/sync_test.go 2013-10-17 18:24:24 +0000
@@ -182,11 +182,36 @@
182 s.targetEnv, test.ctx.MajorVersion, test.ctx.MinorVersion, coretools.Filter{}, envtools.DoNotAllowRetry)182 s.targetEnv, test.ctx.MajorVersion, test.ctx.MinorVersion, coretools.Filter{}, envtools.DoNotAllowRetry)
183 c.Assert(err, gc.IsNil)183 c.Assert(err, gc.IsNil)
184 assertToolsList(c, targetTools, test.tools)184 assertToolsList(c, targetTools, test.tools)
185 assertNoUnexpectedTools(c, s.targetEnv.Storage())185<<<<<<< TREE
186 assertNoUnexpectedTools(c, s.targetEnv.Storage())
187=======
188
189 // TODO(wallyworld) - 2013-10-09 bug=1237130
190 // This is a 1.16 only hack to allow upgrades from 1.14 to work.
191 // Remove once 1.16 is released.
192 assertLegacyTools(c, s.targetEnv.Storage(), test.tools)
193
194 assertNoUnexpectedTools(c, s.targetEnv.Storage())
195>>>>>>> MERGE-SOURCE
186 }()196 }()
187 }197 }
188}198}
189199
200func assertLegacyTools(c *gc.C, stor storage.StorageReader, expected []version.Binary) {
201 files, err := stor.List("tools/juju-")
202 c.Assert(err, gc.IsNil)
203 c.Assert(len(files), gc.Equals, len(expected))
204 for _, vers := range expected {
205 filename := "tools/juju-" + vers.String() + ".tgz"
206 r, err := stor.Get(filename)
207 c.Check(err, gc.IsNil)
208 defer r.Close()
209 data, err := ioutil.ReadAll(r)
210 c.Check(err, gc.IsNil)
211 c.Check(string(data), gc.Equals, vers.String())
212 }
213}
214
190var (215var (
191 v100p64 = version.MustParseBinary("1.0.0-precise-amd64")216 v100p64 = version.MustParseBinary("1.0.0-precise-amd64")
192 v100q64 = version.MustParseBinary("1.0.0-quantal-amd64")217 v100q64 = version.MustParseBinary("1.0.0-quantal-amd64")
193218
=== modified file 'environs/tools/simplestreams.go'
=== modified file 'environs/tools/simplestreams_test.go'
--- environs/tools/simplestreams_test.go 2013-10-16 05:26:30 +0000
+++ environs/tools/simplestreams_test.go 2013-10-17 18:24:24 +0000
@@ -7,8 +7,13 @@
7 "bytes"7 "bytes"
8 "flag"8 "flag"
9 "fmt"9 "fmt"
10<<<<<<< TREE
10 "io"11 "io"
11 "net/http"12 "net/http"
13=======
14 "net/http"
15 "path/filepath"
16>>>>>>> MERGE-SOURCE
12 "reflect"17 "reflect"
13 "strings"18 "strings"
14 "testing"19 "testing"
@@ -477,6 +482,7 @@
477 c.Assert(item, gc.FitsTypeOf, &tools.ToolsMetadata{})482 c.Assert(item, gc.FitsTypeOf, &tools.ToolsMetadata{})
478 c.Assert(item.(*tools.ToolsMetadata).Size, gc.Equals, int64(9223372036854775807))483 c.Assert(item.(*tools.ToolsMetadata).Size, gc.Equals, int64(9223372036854775807))
479}484}
485<<<<<<< TREE
480486
481type metadataHelperSuite struct {487type metadataHelperSuite struct {
482 testbase.LoggingSuite488 testbase.LoggingSuite
@@ -795,3 +801,110 @@
795 "format": "products:1.0"801 "format": "products:1.0"
796}802}
797`803`
804=======
805
806type signedSuite struct {
807 origKey string
808}
809
810var testRoundTripper *jujutest.ProxyRoundTripper
811
812func init() {
813 testRoundTripper = &jujutest.ProxyRoundTripper{}
814 simplestreams.RegisterProtocol("signedtest", testRoundTripper)
815}
816
817func (s *signedSuite) SetUpSuite(c *gc.C) {
818 var imageData = map[string]string{
819 "/unsigned/streams/v1/index.json": unsignedIndex,
820 "/unsigned/streams/v1/tools_metadata.json": unsignedProduct,
821 }
822
823 // Set up some signed data from the unsigned data.
824 // Overwrite the product path to use the sjson suffix.
825 rawUnsignedIndex := strings.Replace(
826 unsignedIndex, "streams/v1/tools_metadata.json", "streams/v1/tools_metadata.sjson", -1)
827 r := bytes.NewReader([]byte(rawUnsignedIndex))
828 signedData, err := simplestreams.Encode(
829 r, sstesting.SignedMetadataPrivateKey, sstesting.PrivateKeyPassphrase)
830 c.Assert(err, gc.IsNil)
831 imageData["/signed/streams/v1/index.sjson"] = string(signedData)
832
833 // Replace the tools path in the unsigned data with a different one so we can test that the right
834 // tools path is used.
835 rawUnsignedProduct := strings.Replace(
836 unsignedProduct, "juju-1.13.0", "juju-1.13.1", -1)
837 r = bytes.NewReader([]byte(rawUnsignedProduct))
838 signedData, err = simplestreams.Encode(
839 r, sstesting.SignedMetadataPrivateKey, sstesting.PrivateKeyPassphrase)
840 c.Assert(err, gc.IsNil)
841 imageData["/signed/streams/v1/tools_metadata.sjson"] = string(signedData)
842 testRoundTripper.Sub = jujutest.NewCannedRoundTripper(
843 imageData, map[string]int{"signedtest://unauth": http.StatusUnauthorized})
844 s.origKey = tools.SetSigningPublicKey(sstesting.SignedMetadataPublicKey)
845}
846
847func (s *signedSuite) TearDownSuite(c *gc.C) {
848 testRoundTripper.Sub = nil
849 tools.SetSigningPublicKey(s.origKey)
850}
851
852func (s *signedSuite) TestSignedToolsMetadata(c *gc.C) {
853 signedSource := simplestreams.NewURLDataSource("signedtest://host/signed", simplestreams.VerifySSLHostnames)
854 toolsConstraint := tools.NewVersionedToolsConstraint("1.13.0", simplestreams.LookupParams{
855 CloudSpec: simplestreams.CloudSpec{"us-east-1", "https://ec2.us-east-1.amazonaws.com"},
856 Series: []string{"precise"},
857 Arches: []string{"amd64"},
858 })
859 toolsMetadata, err := tools.Fetch(
860 []simplestreams.DataSource{signedSource}, simplestreams.DefaultIndexPath, toolsConstraint, true)
861 c.Assert(err, gc.IsNil)
862 c.Assert(len(toolsMetadata), gc.Equals, 1)
863 c.Assert(toolsMetadata[0].Path, gc.Equals, "tools/releases/20130806/juju-1.13.1-precise-amd64.tgz")
864}
865
866var unsignedIndex = `
867{
868 "index": {
869 "com.ubuntu.juju:released:tools": {
870 "updated": "Mon, 05 Aug 2013 11:07:04 +0000",
871 "datatype": "content-download",
872 "format": "products:1.0",
873 "products": [
874 "com.ubuntu.juju:12.04:amd64"
875 ],
876 "path": "streams/v1/tools_metadata.json"
877 }
878 },
879 "updated": "Wed, 01 May 2013 13:31:26 +0000",
880 "format": "index:1.0"
881}
882`
883var unsignedProduct = `
884{
885 "updated": "Wed, 01 May 2013 13:31:26 +0000",
886 "content_id": "com.ubuntu.cloud:released:aws",
887 "datatype": "content-download",
888 "products": {
889 "com.ubuntu.juju:12.04:amd64": {
890 "arch": "amd64",
891 "release": "precise",
892 "versions": {
893 "20130806": {
894 "items": {
895 "1130preciseamd64": {
896 "version": "1.13.0",
897 "size": 2973595,
898 "path": "tools/releases/20130806/juju-1.13.0-precise-amd64.tgz",
899 "ftype": "tar.gz",
900 "sha256": "447aeb6a934a5eaec4f703eda4ef2dde"
901 }
902 }
903 }
904 }
905 }
906 },
907 "format": "products:1.0"
908}
909`
910>>>>>>> MERGE-SOURCE
798911
=== modified file 'provider/maas/instance_test.go'
--- provider/maas/instance_test.go 2013-10-15 16:16:59 +0000
+++ provider/maas/instance_test.go 2013-10-17 18:24:24 +0000
@@ -95,49 +95,97 @@
9595
96 addr, err := inst.Addresses()96 addr, err := inst.Addresses()
9797
98 c.Assert(err, gc.IsNil)98<<<<<<< TREE
99 c.Check(addr, gc.DeepEquals, expected)99 c.Assert(err, gc.IsNil)
100}100 c.Check(addr, gc.DeepEquals, expected)
101101}
102func (s *instanceTest) TestAddressesMissing(c *gc.C) {102
103 // Older MAAS versions do not have ip_addresses returned, for these103func (s *instanceTest) TestAddressesMissing(c *gc.C) {
104 // just the DNS name should be returned without error.104 // Older MAAS versions do not have ip_addresses returned, for these
105 jsonValue := `{105 // just the DNS name should be returned without error.
106 "hostname": "testing.invalid",106 jsonValue := `{
107 "system_id": "system_id"107 "hostname": "testing.invalid",
108 }`108 "system_id": "system_id"
109 obj := s.testMAASObject.TestServer.NewNode(jsonValue)109 }`
110 inst := maasInstance{&obj, s.makeEnviron()}110 obj := s.testMAASObject.TestServer.NewNode(jsonValue)
111111 inst := maasInstance{&obj, s.makeEnviron()}
112 addr, err := inst.Addresses()112
113 c.Assert(err, gc.IsNil)113 addr, err := inst.Addresses()
114 c.Check(addr, gc.DeepEquals, []instance.Address{114 c.Assert(err, gc.IsNil)
115 {Value: "testing.invalid", Type: instance.HostName, NetworkScope: instance.NetworkPublic},115 c.Check(addr, gc.DeepEquals, []instance.Address{
116 })116 {Value: "testing.invalid", Type: instance.HostName, NetworkScope: instance.NetworkPublic},
117}117 })
118118}
119func (s *instanceTest) TestAddressesInvalid(c *gc.C) {119
120 jsonValue := `{120func (s *instanceTest) TestAddressesInvalid(c *gc.C) {
121 "hostname": "testing.invalid",121 jsonValue := `{
122 "system_id": "system_id",122 "hostname": "testing.invalid",
123 "ip_addresses": "incompatible"123 "system_id": "system_id",
124 }`124 "ip_addresses": "incompatible"
125 obj := s.testMAASObject.TestServer.NewNode(jsonValue)125 }`
126 inst := maasInstance{&obj, s.makeEnviron()}126 obj := s.testMAASObject.TestServer.NewNode(jsonValue)
127127 inst := maasInstance{&obj, s.makeEnviron()}
128 _, err := inst.Addresses()128
129 c.Assert(err, gc.NotNil)129 _, err := inst.Addresses()
130}130 c.Assert(err, gc.NotNil)
131131}
132func (s *instanceTest) TestAddressesInvalidContents(c *gc.C) {132
133 jsonValue := `{133func (s *instanceTest) TestAddressesInvalidContents(c *gc.C) {
134 "hostname": "testing.invalid",134 jsonValue := `{
135 "system_id": "system_id",135 "hostname": "testing.invalid",
136 "ip_addresses": [42]136 "system_id": "system_id",
137 }`137 "ip_addresses": [42]
138 obj := s.testMAASObject.TestServer.NewNode(jsonValue)138 }`
139 inst := maasInstance{&obj, s.makeEnviron()}139 obj := s.testMAASObject.TestServer.NewNode(jsonValue)
140140 inst := maasInstance{&obj, s.makeEnviron()}
141 _, err := inst.Addresses()141
142 c.Assert(err, gc.NotNil)142 _, err := inst.Addresses()
143 c.Assert(err, gc.NotNil)
144=======
145 c.Assert(err, gc.IsNil)
146 c.Check(addr, gc.DeepEquals, expected)
147}
148
149func (s *instanceTest) TestAddressesMissing(c *gc.C) {
150 // Older MAAS versions do not have ip_addresses returned, for these
151 // just the DNS name should be returned without error.
152 jsonValue := `{
153 "hostname": "testing.invalid",
154 "system_id": "system_id"
155 }`
156 obj := s.testMAASObject.TestServer.NewNode(jsonValue)
157 inst := maasInstance{&obj, s.environ}
158
159 addr, err := inst.Addresses()
160 c.Assert(err, gc.IsNil)
161 c.Check(addr, gc.DeepEquals, []instance.Address{
162 {Value: "testing.invalid", Type: instance.HostName, NetworkScope: instance.NetworkPublic},
163 })
164}
165
166func (s *instanceTest) TestAddressesInvalid(c *gc.C) {
167 jsonValue := `{
168 "hostname": "testing.invalid",
169 "system_id": "system_id",
170 "ip_addresses": "incompatible"
171 }`
172 obj := s.testMAASObject.TestServer.NewNode(jsonValue)
173 inst := maasInstance{&obj, s.environ}
174
175 _, err := inst.Addresses()
176 c.Assert(err, gc.NotNil)
177}
178
179func (s *instanceTest) TestAddressesInvalidContents(c *gc.C) {
180 jsonValue := `{
181 "hostname": "testing.invalid",
182 "system_id": "system_id",
183 "ip_addresses": [42]
184 }`
185 obj := s.testMAASObject.TestServer.NewNode(jsonValue)
186 inst := maasInstance{&obj, s.environ}
187
188 _, err := inst.Addresses()
189 c.Assert(err, gc.NotNil)
190>>>>>>> MERGE-SOURCE
143}191}
144192
=== modified file 'provider/openstack/provider.go'
=== added file 'utils/file_unix.go'
--- utils/file_unix.go 1970-01-01 00:00:00 +0000
+++ utils/file_unix.go 2013-10-17 18:24:24 +0000
@@ -0,0 +1,15 @@
1// Copyright 2013 Canonical Ltd.
2// Licensed under the AGPLv3, see LICENCE file for details.
3// +build !windows
4
5package utils
6
7import (
8 "os"
9)
10
11// Replace atomically replaces the destination file or directory with the source.
12// The errors that are returned are identical to those returned by os.Rename.
13func ReplaceFile(source, destination string) error {
14 return os.Rename(source, destination)
15}
016
=== added file 'utils/file_windows.go'
--- utils/file_windows.go 1970-01-01 00:00:00 +0000
+++ utils/file_windows.go 2013-10-17 18:24:24 +0000
@@ -0,0 +1,35 @@
1// Copyright 2013 Canonical Ltd.
2// Licensed under the AGPLv3, see LICENCE file for details.
3
4package utils
5
6import (
7 "os"
8 "syscall"
9)
10
11const (
12 movefile_replace_existing = 0x1
13 movefile_write_through = 0x8
14)
15
16//sys moveFileEx(lpExistingFileName *uint16, lpNewFileName *uint16, dwFlags uint32) (err error) = MoveFileExW
17
18// ReplaceFile atomically replaces the destination file or directory with the source.
19// The errors that are returned are identical to those returned by os.Rename.
20func ReplaceFile(source, destination string) error {
21 src, err := syscall.UTF16PtrFromString(source)
22 if err != nil {
23 return &os.LinkError{"replace", source, destination, err}
24 }
25 dest, err := syscall.UTF16PtrFromString(destination)
26 if err != nil {
27 return &os.LinkError{"replace", source, destination, err}
28 }
29
30 // see http://msdn.microsoft.com/en-us/library/windows/desktop/aa365240(v=vs.85).aspx
31 if err := moveFileEx(src, dest, movefile_replace_existing|movefile_write_through); err != nil {
32 return &os.LinkError{"replace", source, destination, err}
33 }
34 return nil
35}
036
=== modified file 'utils/fslock/fslock.go'
--- utils/fslock/fslock.go 2013-08-02 12:37:43 +0000
+++ utils/fslock/fslock.go 2013-10-17 18:24:24 +0000
@@ -113,7 +113,7 @@
113 }113 }
114 }114 }
115 // Now move the temp directory to the lock directory.115 // Now move the temp directory to the lock directory.
116 err = os.Rename(tempDirName, lock.lockDir())116 err = utils.ReplaceFile(tempDirName, lock.lockDir())
117 if err != nil {117 if err != nil {
118 // Any error on rename means we failed.118 // Any error on rename means we failed.
119 // Beaten to it, clean up temporary directory.119 // Beaten to it, clean up temporary directory.
@@ -200,7 +200,7 @@
200 tempLockName := fmt.Sprintf(".%s.%x", lock.name, lock.nonce)200 tempLockName := fmt.Sprintf(".%s.%x", lock.name, lock.nonce)
201 tempDirName := path.Join(lock.parent, tempLockName)201 tempDirName := path.Join(lock.parent, tempLockName)
202 // Now move the lock directory to the temp directory to release the lock.202 // Now move the lock directory to the temp directory to release the lock.
203 if err := os.Rename(lock.lockDir(), tempDirName); err != nil {203 if err := utils.ReplaceFile(lock.lockDir(), tempDirName); err != nil {
204 return err204 return err
205 }205 }
206 // And now cleanup.206 // And now cleanup.
207207
=== modified file 'utils/trivial.go'
--- utils/trivial.go 2013-07-09 10:32:23 +0000
+++ utils/trivial.go 2013-10-17 18:24:24 +0000
@@ -32,7 +32,7 @@
32 if _, err = f.Write(data); err != nil {32 if _, err = f.Write(data); err != nil {
33 return err33 return err
34 }34 }
35 return os.Rename(prep, path)35 return ReplaceFile(prep, path)
36}36}
3737
38// ReadYaml unmarshals the yaml contained in the file at path into obj. See38// ReadYaml unmarshals the yaml contained in the file at path into obj. See
3939
=== added file 'utils/zfile_windows.go'
--- utils/zfile_windows.go 1970-01-01 00:00:00 +0000
+++ utils/zfile_windows.go 2013-10-17 18:24:24 +0000
@@ -0,0 +1,25 @@
1// mksyscall_windows.pl -l32 file_windows.go
2// MACHINE GENERATED BY THE COMMAND ABOVE; DO NOT EDIT
3
4package utils
5
6import "unsafe"
7import "syscall"
8
9var (
10 modkernel32 = syscall.NewLazyDLL("kernel32.dll")
11
12 procMoveFileExW = modkernel32.NewProc("MoveFileExW")
13)
14
15func moveFileEx(lpExistingFileName *uint16, lpNewFileName *uint16, dwFlags uint32) (err error) {
16 r1, _, e1 := syscall.Syscall(procMoveFileExW.Addr(), 3, uintptr(unsafe.Pointer(lpExistingFileName)), uintptr(unsafe.Pointer(lpNewFileName)), uintptr(dwFlags))
17 if r1 == 0 {
18 if e1 != 0 {
19 err = error(e1)
20 } else {
21 err = syscall.EINVAL
22 }
23 }
24 return
25}
026
=== modified file 'version/version.go'
--- version/version.go 2013-10-10 11:40:54 +0000
+++ version/version.go 2013-10-17 18:24:24 +0000
@@ -22,7 +22,11 @@
22// The presence and format of this constant is very important.22// The presence and format of this constant is very important.
23// The debian/rules build recipe uses this value for the version23// The debian/rules build recipe uses this value for the version
24// number of the release package.24// number of the release package.
25<<<<<<< TREE
25const version = "1.17.0"26const version = "1.17.0"
27=======
28const version = "1.16.0"
29>>>>>>> MERGE-SOURCE
2630
27// Current gives the current version of the system. If the file31// Current gives the current version of the system. If the file
28// "FORCE-VERSION" is present in the same directory as the running32// "FORCE-VERSION" is present in the same directory as the running

Subscribers

People subscribed via source and target branches

to status/vote changes: