MCPcopy Index your code
hub / github.com/aptly-dev/aptly / CollectChangesFiles

Function CollectChangesFiles

deb/changes.go:251–289  ·  view source on GitHub ↗

CollectChangesFiles walks filesystem collecting all .changes files

(locations []string, reporter aptly.ResultReporter)

Source from the content-addressed store, hash-verified

249
250// CollectChangesFiles walks filesystem collecting all .changes files
251func CollectChangesFiles(locations []string, reporter aptly.ResultReporter) (changesFiles, failedFiles []string) {
252 changesFilesLock := &sync.Mutex{}
253
254 for _, location := range locations {
255 info, err2 := os.Stat(location)
256 if err2 != nil {
257 reporter.Warning("Unable to process %s: %s", location, err2)
258 failedFiles = append(failedFiles, location)
259 continue
260 }
261 if info.IsDir() {
262 err2 = walker.Walk(location, func(path string, info os.FileInfo) error {
263 if info.IsDir() {
264 return nil
265 }
266
267 if strings.HasSuffix(info.Name(), ".changes") {
268 changesFilesLock.Lock()
269 defer changesFilesLock.Unlock()
270 changesFiles = append(changesFiles, path)
271 }
272
273 return nil
274 })
275
276 if err2 != nil {
277 reporter.Warning("Unable to process %s: %s", location, err2)
278 failedFiles = append(failedFiles, location)
279 continue
280 }
281 } else if strings.HasSuffix(info.Name(), ".changes") {
282 changesFiles = append(changesFiles, location)
283 }
284 }
285
286 sort.Strings(changesFiles)
287
288 return
289}
290
291// ImportChangesFiles imports referenced files in changes files into local repository
292func ImportChangesFiles(changesFiles []string, reporter aptly.ResultReporter, acceptUnsigned, ignoreSignatures, forceReplace, noRemoveFiles bool,

Calls 3

StatMethod · 0.65
WarningMethod · 0.65
StringsMethod · 0.45