MCPcopy Index your code
hub / github.com/celer-pkg/celer / pkgCacheStoreSkipReason

Method pkgCacheStoreSkipReason

configs/port_install.go:207–236  ·  view source on GitHub ↗

pkgCacheStoreSkipReason returns the reason the artifact pkgcache upload should be skipped after a source build. Empty string means upload is OK.

()

Source from the content-addressed store, hash-verified

205// pkgCacheStoreSkipReason returns the reason the artifact pkgcache upload
206// should be skipped after a source build. Empty string means upload is OK.
207func (p *Port) pkgCacheStoreSkipReason() (string, error) {
208 if p.ctx.Offline() {
209 return "offline mode", nil
210 }
211
212 // Check if source modified.
213 if fileio.PathExists(p.MatchedConfig.PortConfig.RepoDir) {
214 modified, err := git.IsModified(p.MatchedConfig.PortConfig.RepoDir)
215 if err != nil {
216 return "", err
217 }
218 p.sourceModified = modified
219 if p.sourceModified {
220 return "source repo is modified", nil
221 }
222 }
223
224 // Only repos that match the configured source ref can store package cache.
225 if strings.HasSuffix(p.MatchedConfig.PortConfig.Url, ".git") {
226 repoRef := expr.If(p.Package.Checksum != "", p.Package.Checksum, p.Package.Ref)
227 mismatchDetails, err := git.CheckIfRefMatches(p.ctx, p.NameVersion(), p.MatchedConfig.PortConfig.RepoDir, repoRef)
228 if err != nil {
229 return "", fmt.Errorf("failed to check if ref matches for %s -> %w", p.NameVersion(), err)
230 }
231 if mismatchDetails != "" {
232 return mismatchDetails, nil
233 }
234 }
235 return "", nil
236}
237
238func (p Port) Clone() error {
239 // Skip if this port was already cloned in the current cloneAllRepos run.

Callers 1

doInstallFromSourceMethod · 0.95

Calls 6

NameVersionMethod · 0.95
PathExistsFunction · 0.92
IsModifiedFunction · 0.92
IfFunction · 0.92
CheckIfRefMatchesFunction · 0.92
OfflineMethod · 0.65

Tested by

no test coverage detected