Skip to content

Commit

Permalink
Fix bugs. #71
Browse files Browse the repository at this point in the history
  • Loading branch information
smira committed Mar 19, 2015
1 parent 02a82f3 commit c8713aa
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions cmd/repo_include.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (
"fmt"
"github.com/smira/aptly/aptly"
"github.com/smira/aptly/deb"
"github.com/smira/aptly/query"
"github.com/smira/aptly/utils"
"github.com/smira/commander"
"github.com/smira/flag"
Expand Down Expand Up @@ -39,6 +40,19 @@ func aptlyRepoInclude(cmd *commander.Command, args []string) error {
return fmt.Errorf("error parsing -repo template: %s", err)
}

uploaders := (*deb.Uploaders)(nil)
uploadersFile := context.Flags().Lookup("uploaders-file").Value.Get().(string)
if uploadersFile != "" {
uploaders, err = deb.NewUploadersFromFile(uploadersFile)

for i := range uploaders.Rules {
uploaders.Rules[i].CompiledCondition, err = query.Parse(uploaders.Rules[i].Condition)
if err != nil {
return fmt.Errorf("error parsing query %s: %s", uploaders.Rules[i].Condition, err)
}
}
}

reporter := &aptly.ConsoleResultReporter{Progress: context.Progress()}

var changesFiles, failedFiles, processedFiles []string
Expand All @@ -63,6 +77,14 @@ func aptlyRepoInclude(cmd *commander.Command, args []string) error {
continue
}

if uploaders != nil && !uploaders.IsAllowed(changes) {
failedFiles = append(failedFiles, path)
reporter.Warning("changes file is not allowed accoring to uploaders config: %s, keys %#v",
changes.ChangesName, changes.SignatureKeys)
changes.Cleanup()
continue
}

err = changes.Prepare()
if err != nil {
failedFiles = append(failedFiles, path)
Expand Down Expand Up @@ -187,6 +209,7 @@ Example:
cmd.Flag.Var(&keyRingsFlag{}, "keyring", "gpg keyring to use when verifying Release file (could be specified multiple times)")
cmd.Flag.Bool("ignore-signatures", false, "disable verification of .changes file signature")
cmd.Flag.Bool("accept-unsigned", false, "accept unsigned .changes files")
cmd.Flag.String("uploaders-file", "", "path to uploaders.json file")

return cmd
}

0 comments on commit c8713aa

Please sign in to comment.