lang, gapi: Work around a copy bug in the deploy
It seems when we had a files/ dir that we added to our deploy, it would get copied into /files/files/whatever instead of /files/whatever where it should be. Hopefully this works around the issue forever.
This commit is contained in:
@@ -58,6 +58,8 @@ func CopyStringToFs(fs engine.Fs, str, dst string) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// CopyDirToFs copies a dir from src path on the local fs to a dst path on fs.
|
// CopyDirToFs copies a dir from src path on the local fs to a dst path on fs.
|
||||||
|
// FIXME: I'm not sure this does the logical thing when the dst path is a dir.
|
||||||
|
// FIXME: We've got a workaround for this inside of the lang CLI GAPI.
|
||||||
func CopyDirToFs(fs engine.Fs, src, dst string) error {
|
func CopyDirToFs(fs engine.Fs, src, dst string) error {
|
||||||
return util.CopyDiskToFs(fs, src, dst, false)
|
return util.CopyDiskToFs(fs, src, dst, false)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -340,6 +340,15 @@ func (obj *GAPI) Cli(cliInfo *gapi.CliInfo) (*gapi.Deploy, error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if strings.HasSuffix(src, "/") { // it's a dir
|
if strings.HasSuffix(src, "/") { // it's a dir
|
||||||
|
// FIXME: I think fixing CopyDirToFs might be better...
|
||||||
|
if dst != "/" { // XXX: hack, don't nest the copy badly!
|
||||||
|
out, err := util.RemovePathSuffix(dst)
|
||||||
|
if err != nil {
|
||||||
|
// possible programming error
|
||||||
|
return nil, errwrap.Wrapf(err, "malformed dst dir path: `%s`", dst)
|
||||||
|
}
|
||||||
|
dst = out
|
||||||
|
}
|
||||||
// TODO: add more tests to this (it is actually CopyFs)
|
// TODO: add more tests to this (it is actually CopyFs)
|
||||||
if err := gapi.CopyDirToFs(fs, src, dst); err != nil {
|
if err := gapi.CopyDirToFs(fs, src, dst); err != nil {
|
||||||
return nil, errwrap.Wrapf(err, "can't copy dir from `%s` to `%s`", src, dst)
|
return nil, errwrap.Wrapf(err, "can't copy dir from `%s` to `%s`", src, dst)
|
||||||
|
|||||||
Reference in New Issue
Block a user