Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#679: added *.buildinfo file to processedFile list (will be removed) #682

Merged
merged 3 commits into from
Nov 30, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion api/repos.go
Original file line number Diff line number Diff line change
Expand Up @@ -301,6 +301,7 @@ func apiReposPackageFromDir(c *gin.Context) {
var (
sources []string
packageFiles, failedFiles []string
otherFiles []string
processedFiles, failedFiles2 []string
reporter = &aptly.RecordingResultReporter{
Warnings: []string{},
Expand All @@ -316,7 +317,7 @@ func apiReposPackageFromDir(c *gin.Context) {
sources = []string{filepath.Join(context.UploadPath(), c.Params.ByName("dir"), c.Params.ByName("file"))}
}

packageFiles, failedFiles = deb.CollectPackageFiles(sources, reporter)
packageFiles, otherFiles, failedFiles = deb.CollectPackageFiles(sources, reporter)

list, err = deb.NewPackageListFromRefList(repo.RefList(), context.CollectionFactory().PackageCollection(), nil)
if err != nil {
Expand All @@ -328,6 +329,8 @@ func apiReposPackageFromDir(c *gin.Context) {
context.CollectionFactory().PackageCollection(), reporter, nil, context.CollectionFactory().ChecksumCollection())
failedFiles = append(failedFiles, failedFiles2...)

processedFiles = append(processedFiles, otherFiles...)

if err != nil {
c.AbortWithError(500, fmt.Errorf("unable to import package files: %s", err))
return
Expand Down
6 changes: 4 additions & 2 deletions cmd/repo_add.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,9 @@ func aptlyRepoAdd(cmd *commander.Command, args []string) error {

forceReplace := context.Flags().Lookup("force-replace").Value.Get().(bool)

var packageFiles, failedFiles []string
var packageFiles, otherFiles, failedFiles []string

packageFiles, failedFiles = deb.CollectPackageFiles(args[1:], &aptly.ConsoleResultReporter{Progress: context.Progress()})
packageFiles, otherFiles, failedFiles = deb.CollectPackageFiles(args[1:], &aptly.ConsoleResultReporter{Progress: context.Progress()})

var processedFiles, failedFiles2 []string

Expand All @@ -55,6 +55,8 @@ func aptlyRepoAdd(cmd *commander.Command, args []string) error {
return fmt.Errorf("unable to import package files: %s", err)
}

processedFiles = append(processedFiles, otherFiles...)

repo.UpdateRefList(deb.NewPackageRefListFromPackageList(list))

err = context.CollectionFactory().LocalRepoCollection().Update(repo)
Expand Down
6 changes: 5 additions & 1 deletion cmd/repo_include.go
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ func aptlyRepoInclude(cmd *commander.Command, args []string) error {
return fmt.Errorf("unable to load packages: %s", err)
}

packageFiles, _ := deb.CollectPackageFiles([]string{changes.TempDir}, reporter)
packageFiles, otherFiles, _ := deb.CollectPackageFiles([]string{changes.TempDir}, reporter)

var restriction deb.PackageQuery

Expand Down Expand Up @@ -179,6 +179,10 @@ func aptlyRepoInclude(cmd *commander.Command, args []string) error {
processedFiles = append(processedFiles, filepath.Join(changes.BasePath, filepath.Base(file)))
}

for _, file := range otherFiles {
processedFiles = append(processedFiles, filepath.Join(changes.BasePath, filepath.Base(file)))
}

processedFiles = append(processedFiles, path)
}

Expand Down
6 changes: 5 additions & 1 deletion deb/import.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import (
)

// CollectPackageFiles walks filesystem collecting all candidates for package files
func CollectPackageFiles(locations []string, reporter aptly.ResultReporter) (packageFiles, failedFiles []string) {
func CollectPackageFiles(locations []string, reporter aptly.ResultReporter) (packageFiles, otherFiles, failedFiles []string) {
for _, location := range locations {
info, err2 := os.Stat(location)
if err2 != nil {
Expand All @@ -32,6 +32,8 @@ func CollectPackageFiles(locations []string, reporter aptly.ResultReporter) (pac
if strings.HasSuffix(info.Name(), ".deb") || strings.HasSuffix(info.Name(), ".udeb") ||
strings.HasSuffix(info.Name(), ".dsc") || strings.HasSuffix(info.Name(), ".ddeb") {
packageFiles = append(packageFiles, path)
} else if strings.HasSuffix(info.Name(), ".buildinfo") {
otherFiles = append(otherFiles, path)
}

return nil
Expand All @@ -46,6 +48,8 @@ func CollectPackageFiles(locations []string, reporter aptly.ResultReporter) (pac
if strings.HasSuffix(info.Name(), ".deb") || strings.HasSuffix(info.Name(), ".udeb") ||
strings.HasSuffix(info.Name(), ".dsc") || strings.HasSuffix(info.Name(), ".ddeb") {
packageFiles = append(packageFiles, location)
} else if strings.HasSuffix(info.Name(), ".buildinfo") {
otherFiles = append(otherFiles, location)
} else {
reporter.Warning("Unknown file extension: %s", location)
failedFiles = append(failedFiles, location)
Expand Down