| OLD | NEW |
| 1 // Copyright 2016 The LUCI Authors. All rights reserved. | 1 // Copyright 2016 The LUCI Authors. All rights reserved. |
| 2 // Use of this source code is governed under the Apache License, Version 2.0 | 2 // Use of this source code is governed under the Apache License, Version 2.0 |
| 3 // that can be found in the LICENSE file. | 3 // that can be found in the LICENSE file. |
| 4 | 4 |
| 5 package main | 5 package main |
| 6 | 6 |
| 7 import ( | 7 import ( |
| 8 "crypto/sha256" | 8 "crypto/sha256" |
| 9 "encoding/hex" | 9 "encoding/hex" |
| 10 "fmt" | 10 "fmt" |
| 11 "net/url" | 11 "net/url" |
| 12 "os" | 12 "os" |
| 13 "path/filepath" | 13 "path/filepath" |
| 14 "sort" | 14 "sort" |
| 15 "strconv" | 15 "strconv" |
| 16 "strings" | 16 "strings" |
| 17 | 17 |
| 18 "github.com/luci/luci-go/common/cli" | 18 "github.com/luci/luci-go/common/cli" |
| 19 "github.com/luci/luci-go/common/errors" | 19 "github.com/luci/luci-go/common/errors" |
| 20 log "github.com/luci/luci-go/common/logging" | 20 log "github.com/luci/luci-go/common/logging" |
| 21 "github.com/luci/luci-go/deploytool/api/deploy" | 21 "github.com/luci/luci-go/deploytool/api/deploy" |
| 22 "github.com/luci/luci-go/deploytool/managedfs" | 22 "github.com/luci/luci-go/deploytool/managedfs" |
| 23 | 23 |
| 24 "github.com/maruel/subcommands" | 24 "github.com/maruel/subcommands" |
| 25 ) | 25 ) |
| 26 | 26 |
| 27 // deployToolCfg is the name of the source-root deployment configuration file. | 27 // deployToolCfg is the name of the source-root deployment configuration file. |
| 28 const ( | 28 const ( |
| 29 // deployToolCfg is the name of the source-root deploytool configuration
file. | 29 // deployToolCfg is the name of the source-root deploytool configuration
file. |
| 30 » deployToolCfg = ".luci-deploytool.cfg" | 30 » deployToolCfg = "luci-deploy.cfg" |
| 31 | 31 |
| 32 // checkoutsSubdir is the name of the checkouts directory underneath the | 32 // checkoutsSubdir is the name of the checkouts directory underneath the |
| 33 // working directory. | 33 // working directory. |
| 34 checkoutsSubdir = "checkouts" | 34 checkoutsSubdir = "checkouts" |
| 35 // frozenCheckoutName is the name in the checkout directory of the froze
n | 35 // frozenCheckoutName is the name in the checkout directory of the froze
n |
| 36 // checkout file. | 36 // checkout file. |
| 37 frozenCheckoutName = "checkout.frozen.cfg" | 37 frozenCheckoutName = "checkout.frozen.cfg" |
| 38 | 38 |
| 39 // gitMajorVersionSize it the number of characters from the Git revision
hash | 39 // gitMajorVersionSize it the number of characters from the Git revision
hash |
| 40 // to use for its major version. | 40 // to use for its major version. |
| (...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 138 | 138 |
| 139 // If we're overriding sources, and this source is overr
idden, then apply | 139 // If we're overriding sources, and this source is overr
idden, then apply |
| 140 // this and add the overriding source to the registry as
well. | 140 // this and add the overriding source to the registry as
well. |
| 141 // | 141 // |
| 142 // We will still keep the original source in the registr
y so it doesn't | 142 // We will still keep the original source in the registr
y so it doesn't |
| 143 // get deleted during cleanup. | 143 // get deleted during cleanup. |
| 144 if applyOverrides { | 144 if applyOverrides { |
| 145 if override, ok := l.userSourceOverrides[sc.over
rideURL]; ok { | 145 if override, ok := l.userSourceOverrides[sc.over
rideURL]; ok { |
| 146 log.Infof(w, "Applying user repository o
verride: [%+v] => [%+v]", sc.Source, override) | 146 log.Infof(w, "Applying user repository o
verride: [%+v] => [%+v]", sc.Source, override) |
| 147 | 147 |
| 148 // Any local overrides cause the source
group to be considered |
| 149 // tainted. |
| 148 sc.FrozenLayout_Source.Source = override | 150 sc.FrozenLayout_Source.Source = override |
| 151 sc.FrozenLayout_Source.Source.Tainted =
true |
| 152 |
| 149 if err := sc.addRegistryRepos(®); err
!= nil { | 153 if err := sc.addRegistryRepos(®); err
!= nil { |
| 150 return errors.Annotate(err).Reas
on("failed to add (overridden) [%(sourceCheckout)s] to registry"). | 154 return errors.Annotate(err).Reas
on("failed to add (overridden) [%(sourceCheckout)s] to registry"). |
| 151 D("sourceCheckout", sc).
Err() | 155 D("sourceCheckout", sc).
Err() |
| 152 } | 156 } |
| 153 } | 157 } |
| 154 } | 158 } |
| 155 | 159 |
| 156 groupSrcs[i] = &sc | 160 groupSrcs[i] = &sc |
| 157 scs = append(scs, &sc) | 161 scs = append(scs, &sc) |
| 158 } | 162 } |
| (...skipping 507 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 666 return errors.Annotate(err).Reason("failed to st
at SourceInitResult [%(resultPath)s]"). | 670 return errors.Annotate(err).Reason("failed to st
at SourceInitResult [%(resultPath)s]"). |
| 667 D("resultPath", resultPath).Err() | 671 D("resultPath", resultPath).Err() |
| 668 } | 672 } |
| 669 }) | 673 }) |
| 670 return &r, err | 674 return &r, err |
| 671 | 675 |
| 672 default: | 676 default: |
| 673 return nil, errors.Reason("unknown source init type %(type)T").D
("type", t).Err() | 677 return nil, errors.Reason("unknown source init type %(type)T").D
("type", t).Err() |
| 674 } | 678 } |
| 675 } | 679 } |
| OLD | NEW |