Fixups after renaming debian -> deb. #21

This commit is contained in:
Andrey Smirnov
2014-04-07 21:19:38 +04:00
parent fd662c9275
commit ff045f9a48
50 changed files with 123 additions and 123 deletions
+2 -2
View File
@@ -1,6 +1,6 @@
GOVERSION=$(shell go version | awk '{print $$3;}') GOVERSION=$(shell go version | awk '{print $$3;}')
PACKAGES=database debian files http utils PACKAGES=database deb files http utils
ALL_PACKAGES=aptly cmd console database debian files http utils ALL_PACKAGES=aptly cmd console database deb files http utils
BINPATH=$(abspath ./_vendor/bin) BINPATH=$(abspath ./_vendor/bin)
GOM_ENVIRONMENT=-test GOM_ENVIRONMENT=-test
PYTHON?=python PYTHON?=python
+2 -2
View File
@@ -4,7 +4,7 @@ package cmd
import ( import (
"fmt" "fmt"
"github.com/smira/aptly/aptly" "github.com/smira/aptly/aptly"
"github.com/smira/aptly/debian" "github.com/smira/aptly/deb"
"github.com/smira/commander" "github.com/smira/commander"
"github.com/smira/flag" "github.com/smira/flag"
"os" "os"
@@ -12,7 +12,7 @@ import (
) )
// ListPackagesRefList shows list of packages in PackageRefList // ListPackagesRefList shows list of packages in PackageRefList
func ListPackagesRefList(reflist *debian.PackageRefList) (err error) { func ListPackagesRefList(reflist *deb.PackageRefList) (err error) {
fmt.Printf("Packages:\n") fmt.Printf("Packages:\n")
if reflist == nil { if reflist == nil {
+8 -8
View File
@@ -5,7 +5,7 @@ import (
"github.com/smira/aptly/aptly" "github.com/smira/aptly/aptly"
"github.com/smira/aptly/console" "github.com/smira/aptly/console"
"github.com/smira/aptly/database" "github.com/smira/aptly/database"
"github.com/smira/aptly/debian" "github.com/smira/aptly/deb"
"github.com/smira/aptly/files" "github.com/smira/aptly/files"
"github.com/smira/aptly/http" "github.com/smira/aptly/http"
"github.com/smira/aptly/utils" "github.com/smira/aptly/utils"
@@ -28,7 +28,7 @@ type AptlyContext struct {
database database.Storage database database.Storage
packagePool aptly.PackagePool packagePool aptly.PackagePool
publishedStorage aptly.PublishedStorage publishedStorage aptly.PublishedStorage
collectionFactory *debian.CollectionFactory collectionFactory *deb.CollectionFactory
dependencyOptions int dependencyOptions int
architecturesList []string architecturesList []string
// Debug features // Debug features
@@ -91,16 +91,16 @@ func (context *AptlyContext) DependencyOptions() int {
if context.dependencyOptions == -1 { if context.dependencyOptions == -1 {
context.dependencyOptions = 0 context.dependencyOptions = 0
if context.Config().DepFollowSuggests || context.flags.Lookup("dep-follow-suggests").Value.Get().(bool) { if context.Config().DepFollowSuggests || context.flags.Lookup("dep-follow-suggests").Value.Get().(bool) {
context.dependencyOptions |= debian.DepFollowSuggests context.dependencyOptions |= deb.DepFollowSuggests
} }
if context.Config().DepFollowRecommends || context.flags.Lookup("dep-follow-recommends").Value.Get().(bool) { if context.Config().DepFollowRecommends || context.flags.Lookup("dep-follow-recommends").Value.Get().(bool) {
context.dependencyOptions |= debian.DepFollowRecommends context.dependencyOptions |= deb.DepFollowRecommends
} }
if context.Config().DepFollowAllVariants || context.flags.Lookup("dep-follow-all-variants").Value.Get().(bool) { if context.Config().DepFollowAllVariants || context.flags.Lookup("dep-follow-all-variants").Value.Get().(bool) {
context.dependencyOptions |= debian.DepFollowAllVariants context.dependencyOptions |= deb.DepFollowAllVariants
} }
if context.Config().DepFollowSource || context.flags.Lookup("dep-follow-source").Value.Get().(bool) { if context.Config().DepFollowSource || context.flags.Lookup("dep-follow-source").Value.Get().(bool) {
context.dependencyOptions |= debian.DepFollowSource context.dependencyOptions |= deb.DepFollowSource
} }
} }
@@ -153,13 +153,13 @@ func (context *AptlyContext) Database() (database.Storage, error) {
return context.database, nil return context.database, nil
} }
func (context *AptlyContext) CollectionFactory() *debian.CollectionFactory { func (context *AptlyContext) CollectionFactory() *deb.CollectionFactory {
if context.collectionFactory == nil { if context.collectionFactory == nil {
db, err := context.Database() db, err := context.Database()
if err != nil { if err != nil {
Fatal(err) Fatal(err)
} }
context.collectionFactory = debian.NewCollectionFactory(db) context.collectionFactory = deb.NewCollectionFactory(db)
} }
return context.collectionFactory return context.collectionFactory
+5 -5
View File
@@ -2,7 +2,7 @@ package cmd
import ( import (
"fmt" "fmt"
"github.com/smira/aptly/debian" "github.com/smira/aptly/deb"
"github.com/smira/aptly/utils" "github.com/smira/aptly/utils"
"github.com/smira/commander" "github.com/smira/commander"
"sort" "sort"
@@ -18,10 +18,10 @@ func aptlyDbCleanup(cmd *commander.Command, args []string) error {
} }
// collect information about references packages... // collect information about references packages...
existingPackageRefs := debian.NewPackageRefList() existingPackageRefs := deb.NewPackageRefList()
context.Progress().Printf("Loading mirrors, local repos and snapshots...\n") context.Progress().Printf("Loading mirrors, local repos and snapshots...\n")
err = context.CollectionFactory().RemoteRepoCollection().ForEach(func(repo *debian.RemoteRepo) error { err = context.CollectionFactory().RemoteRepoCollection().ForEach(func(repo *deb.RemoteRepo) error {
err := context.CollectionFactory().RemoteRepoCollection().LoadComplete(repo) err := context.CollectionFactory().RemoteRepoCollection().LoadComplete(repo)
if err != nil { if err != nil {
return err return err
@@ -35,7 +35,7 @@ func aptlyDbCleanup(cmd *commander.Command, args []string) error {
return err return err
} }
err = context.CollectionFactory().LocalRepoCollection().ForEach(func(repo *debian.LocalRepo) error { err = context.CollectionFactory().LocalRepoCollection().ForEach(func(repo *deb.LocalRepo) error {
err := context.CollectionFactory().LocalRepoCollection().LoadComplete(repo) err := context.CollectionFactory().LocalRepoCollection().LoadComplete(repo)
if err != nil { if err != nil {
return err return err
@@ -49,7 +49,7 @@ func aptlyDbCleanup(cmd *commander.Command, args []string) error {
return err return err
} }
err = context.CollectionFactory().SnapshotCollection().ForEach(func(snapshot *debian.Snapshot) error { err = context.CollectionFactory().SnapshotCollection().ForEach(func(snapshot *deb.Snapshot) error {
err := context.CollectionFactory().SnapshotCollection().LoadComplete(snapshot) err := context.CollectionFactory().SnapshotCollection().LoadComplete(snapshot)
if err != nil { if err != nil {
return err return err
+6 -6
View File
@@ -4,7 +4,7 @@ import (
"bytes" "bytes"
"code.google.com/p/gographviz" "code.google.com/p/gographviz"
"fmt" "fmt"
"github.com/smira/aptly/debian" "github.com/smira/aptly/deb"
"github.com/smira/commander" "github.com/smira/commander"
"io" "io"
"io/ioutil" "io/ioutil"
@@ -28,7 +28,7 @@ func aptlyGraph(cmd *commander.Command, args []string) error {
fmt.Printf("Loading mirrors...\n") fmt.Printf("Loading mirrors...\n")
err = context.CollectionFactory().RemoteRepoCollection().ForEach(func(repo *debian.RemoteRepo) error { err = context.CollectionFactory().RemoteRepoCollection().ForEach(func(repo *deb.RemoteRepo) error {
err := context.CollectionFactory().RemoteRepoCollection().LoadComplete(repo) err := context.CollectionFactory().RemoteRepoCollection().LoadComplete(repo)
if err != nil { if err != nil {
return err return err
@@ -52,7 +52,7 @@ func aptlyGraph(cmd *commander.Command, args []string) error {
fmt.Printf("Loading local repos...\n") fmt.Printf("Loading local repos...\n")
err = context.CollectionFactory().LocalRepoCollection().ForEach(func(repo *debian.LocalRepo) error { err = context.CollectionFactory().LocalRepoCollection().ForEach(func(repo *deb.LocalRepo) error {
err := context.CollectionFactory().LocalRepoCollection().LoadComplete(repo) err := context.CollectionFactory().LocalRepoCollection().LoadComplete(repo)
if err != nil { if err != nil {
return err return err
@@ -75,12 +75,12 @@ func aptlyGraph(cmd *commander.Command, args []string) error {
fmt.Printf("Loading snapshots...\n") fmt.Printf("Loading snapshots...\n")
context.CollectionFactory().SnapshotCollection().ForEach(func(snapshot *debian.Snapshot) error { context.CollectionFactory().SnapshotCollection().ForEach(func(snapshot *deb.Snapshot) error {
existingNodes[snapshot.UUID] = true existingNodes[snapshot.UUID] = true
return nil return nil
}) })
err = context.CollectionFactory().SnapshotCollection().ForEach(func(snapshot *debian.Snapshot) error { err = context.CollectionFactory().SnapshotCollection().ForEach(func(snapshot *deb.Snapshot) error {
err := context.CollectionFactory().SnapshotCollection().LoadComplete(snapshot) err := context.CollectionFactory().SnapshotCollection().LoadComplete(snapshot)
if err != nil { if err != nil {
return err return err
@@ -115,7 +115,7 @@ func aptlyGraph(cmd *commander.Command, args []string) error {
fmt.Printf("Loading published repos...\n") fmt.Printf("Loading published repos...\n")
context.CollectionFactory().PublishedRepoCollection().ForEach(func(repo *debian.PublishedRepo) error { context.CollectionFactory().PublishedRepoCollection().ForEach(func(repo *deb.PublishedRepo) error {
graph.AddNode("aptly", graphvizEscape(repo.UUID), map[string]string{ graph.AddNode("aptly", graphvizEscape(repo.UUID), map[string]string{
"shape": "Mrecord", "shape": "Mrecord",
"style": "filled", "style": "filled",
+3 -3
View File
@@ -2,7 +2,7 @@ package cmd
import ( import (
"fmt" "fmt"
"github.com/smira/aptly/debian" "github.com/smira/aptly/deb"
"github.com/smira/commander" "github.com/smira/commander"
"github.com/smira/flag" "github.com/smira/flag"
"strings" "strings"
@@ -24,7 +24,7 @@ func aptlyMirrorCreate(cmd *commander.Command, args []string) error {
mirrorName = args[0] mirrorName = args[0]
if len(args) == 2 { if len(args) == 2 {
archiveURL, distribution, components, err = debian.ParsePPA(args[1], context.Config()) archiveURL, distribution, components, err = deb.ParsePPA(args[1], context.Config())
if err != nil { if err != nil {
return err return err
} }
@@ -32,7 +32,7 @@ func aptlyMirrorCreate(cmd *commander.Command, args []string) error {
archiveURL, distribution, components = args[1], args[2], args[3:] archiveURL, distribution, components = args[1], args[2], args[3:]
} }
repo, err := debian.NewRemoteRepo(mirrorName, archiveURL, distribution, components, context.ArchitecturesList(), downloadSources) repo, err := deb.NewRemoteRepo(mirrorName, archiveURL, distribution, components, context.ArchitecturesList(), downloadSources)
if err != nil { if err != nil {
return fmt.Errorf("unable to create mirror: %s", err) return fmt.Errorf("unable to create mirror: %s", err)
} }
+2 -2
View File
@@ -2,7 +2,7 @@ package cmd
import ( import (
"fmt" "fmt"
"github.com/smira/aptly/debian" "github.com/smira/aptly/deb"
"github.com/smira/commander" "github.com/smira/commander"
"sort" "sort"
) )
@@ -18,7 +18,7 @@ func aptlyMirrorList(cmd *commander.Command, args []string) error {
fmt.Printf("List of mirrors:\n") fmt.Printf("List of mirrors:\n")
repos := make([]string, context.CollectionFactory().RemoteRepoCollection().Len()) repos := make([]string, context.CollectionFactory().RemoteRepoCollection().Len())
i := 0 i := 0
context.CollectionFactory().RemoteRepoCollection().ForEach(func(repo *debian.RemoteRepo) error { context.CollectionFactory().RemoteRepoCollection().ForEach(func(repo *deb.RemoteRepo) error {
repos[i] = repo.String() repos[i] = repo.String()
i++ i++
return nil return nil
+2 -2
View File
@@ -2,7 +2,7 @@ package cmd
import ( import (
"fmt" "fmt"
"github.com/smira/aptly/debian" "github.com/smira/aptly/deb"
"github.com/smira/commander" "github.com/smira/commander"
"sort" "sort"
) )
@@ -21,7 +21,7 @@ func aptlyPublishList(cmd *commander.Command, args []string) error {
published := make([]string, 0, context.CollectionFactory().PublishedRepoCollection().Len()) published := make([]string, 0, context.CollectionFactory().PublishedRepoCollection().Len())
err = context.CollectionFactory().PublishedRepoCollection().ForEach(func(repo *debian.PublishedRepo) error { err = context.CollectionFactory().PublishedRepoCollection().ForEach(func(repo *deb.PublishedRepo) error {
err := context.CollectionFactory().PublishedRepoCollection().LoadComplete(repo, context.CollectionFactory()) err := context.CollectionFactory().PublishedRepoCollection().LoadComplete(repo, context.CollectionFactory())
if err != nil { if err != nil {
return err return err
+2 -2
View File
@@ -2,7 +2,7 @@ package cmd
import ( import (
"fmt" "fmt"
"github.com/smira/aptly/debian" "github.com/smira/aptly/deb"
"github.com/smira/aptly/utils" "github.com/smira/aptly/utils"
"github.com/smira/commander" "github.com/smira/commander"
"github.com/smira/flag" "github.com/smira/flag"
@@ -63,7 +63,7 @@ func aptlyPublishSnapshotOrRepo(cmd *commander.Command, args []string) error {
component := context.flags.Lookup("component").Value.String() component := context.flags.Lookup("component").Value.String()
distribution := context.flags.Lookup("distribution").Value.String() distribution := context.flags.Lookup("distribution").Value.String()
published, err := debian.NewPublishedRepo(prefix, distribution, component, context.ArchitecturesList(), source, context.CollectionFactory()) published, err := deb.NewPublishedRepo(prefix, distribution, component, context.ArchitecturesList(), source, context.CollectionFactory())
if err != nil { if err != nil {
return fmt.Errorf("unable to publish: %s", err) return fmt.Errorf("unable to publish: %s", err)
} }
+11 -11
View File
@@ -2,7 +2,7 @@ package cmd
import ( import (
"fmt" "fmt"
"github.com/smira/aptly/debian" "github.com/smira/aptly/deb"
"github.com/smira/aptly/utils" "github.com/smira/aptly/utils"
"github.com/smira/commander" "github.com/smira/commander"
"github.com/smira/flag" "github.com/smira/flag"
@@ -35,7 +35,7 @@ func aptlyRepoAdd(cmd *commander.Command, args []string) error {
context.Progress().Printf("Loading packages...\n") context.Progress().Printf("Loading packages...\n")
list, err := debian.NewPackageListFromRefList(repo.RefList(), context.CollectionFactory().PackageCollection(), context.Progress()) list, err := deb.NewPackageListFromRefList(repo.RefList(), context.CollectionFactory().PackageCollection(), context.Progress())
if err != nil { if err != nil {
return fmt.Errorf("unable to load packages: %s", err) return fmt.Errorf("unable to load packages: %s", err)
} }
@@ -78,25 +78,25 @@ func aptlyRepoAdd(cmd *commander.Command, args []string) error {
for _, file := range packageFiles { for _, file := range packageFiles {
var ( var (
stanza debian.Stanza stanza deb.Stanza
p *debian.Package p *deb.Package
) )
candidateProcessedFiles := []string{} candidateProcessedFiles := []string{}
isSourcePackage := strings.HasSuffix(file, ".dsc") isSourcePackage := strings.HasSuffix(file, ".dsc")
if isSourcePackage { if isSourcePackage {
stanza, err = debian.GetControlFileFromDsc(file, verifier) stanza, err = deb.GetControlFileFromDsc(file, verifier)
if err == nil { if err == nil {
stanza["Package"] = stanza["Source"] stanza["Package"] = stanza["Source"]
delete(stanza, "Source") delete(stanza, "Source")
p, err = debian.NewSourcePackageFromControlFile(stanza) p, err = deb.NewSourcePackageFromControlFile(stanza)
} }
} else { } else {
stanza, err = debian.GetControlFileFromDeb(file) stanza, err = deb.GetControlFileFromDeb(file)
p = debian.NewPackageFromControlFile(stanza) p = deb.NewPackageFromControlFile(stanza)
} }
if err != nil { if err != nil {
context.Progress().ColoredPrintf("@y[!]@| @!Unable to read file %s: %s@|", file, err) context.Progress().ColoredPrintf("@y[!]@| @!Unable to read file %s: %s@|", file, err)
@@ -110,9 +110,9 @@ func aptlyRepoAdd(cmd *commander.Command, args []string) error {
} }
if isSourcePackage { if isSourcePackage {
p.UpdateFiles(append(p.Files(), debian.PackageFile{Filename: filepath.Base(file), Checksums: checksums})) p.UpdateFiles(append(p.Files(), deb.PackageFile{Filename: filepath.Base(file), Checksums: checksums}))
} else { } else {
p.UpdateFiles([]debian.PackageFile{debian.PackageFile{Filename: filepath.Base(file), Checksums: checksums}}) p.UpdateFiles([]deb.PackageFile{deb.PackageFile{Filename: filepath.Base(file), Checksums: checksums}})
} }
err = context.PackagePool().Import(file, checksums.MD5) err = context.PackagePool().Import(file, checksums.MD5)
@@ -158,7 +158,7 @@ func aptlyRepoAdd(cmd *commander.Command, args []string) error {
processedFiles = append(processedFiles, candidateProcessedFiles...) processedFiles = append(processedFiles, candidateProcessedFiles...)
} }
repo.UpdateRefList(debian.NewPackageRefListFromPackageList(list)) repo.UpdateRefList(deb.NewPackageRefListFromPackageList(list))
err = context.CollectionFactory().LocalRepoCollection().Update(repo) err = context.CollectionFactory().LocalRepoCollection().Update(repo)
if err != nil { if err != nil {
+2 -2
View File
@@ -2,7 +2,7 @@ package cmd
import ( import (
"fmt" "fmt"
"github.com/smira/aptly/debian" "github.com/smira/aptly/deb"
"github.com/smira/commander" "github.com/smira/commander"
"github.com/smira/flag" "github.com/smira/flag"
) )
@@ -14,7 +14,7 @@ func aptlyRepoCreate(cmd *commander.Command, args []string) error {
return err return err
} }
repo := debian.NewLocalRepo(args[0], context.flags.Lookup("comment").Value.String()) repo := deb.NewLocalRepo(args[0], context.flags.Lookup("comment").Value.String())
repo.DefaultDistribution = context.flags.Lookup("distribution").Value.String() repo.DefaultDistribution = context.flags.Lookup("distribution").Value.String()
repo.DefaultComponent = context.flags.Lookup("component").Value.String() repo.DefaultComponent = context.flags.Lookup("component").Value.String()
+2 -2
View File
@@ -2,7 +2,7 @@ package cmd
import ( import (
"fmt" "fmt"
"github.com/smira/aptly/debian" "github.com/smira/aptly/deb"
"github.com/smira/commander" "github.com/smira/commander"
"sort" "sort"
) )
@@ -18,7 +18,7 @@ func aptlyRepoList(cmd *commander.Command, args []string) error {
fmt.Printf("List of mirrors:\n") fmt.Printf("List of mirrors:\n")
repos := make([]string, context.CollectionFactory().LocalRepoCollection().Len()) repos := make([]string, context.CollectionFactory().LocalRepoCollection().Len())
i := 0 i := 0
context.CollectionFactory().LocalRepoCollection().ForEach(func(repo *debian.LocalRepo) error { context.CollectionFactory().LocalRepoCollection().ForEach(func(repo *deb.LocalRepo) error {
err := context.CollectionFactory().LocalRepoCollection().LoadComplete(repo) err := context.CollectionFactory().LocalRepoCollection().LoadComplete(repo)
if err != nil { if err != nil {
return err return err
+9 -9
View File
@@ -2,7 +2,7 @@ package cmd
import ( import (
"fmt" "fmt"
"github.com/smira/aptly/debian" "github.com/smira/aptly/deb"
"github.com/smira/commander" "github.com/smira/commander"
"github.com/smira/flag" "github.com/smira/flag"
"sort" "sort"
@@ -28,8 +28,8 @@ func aptlyRepoMoveCopyImport(cmd *commander.Command, args []string) error {
} }
var ( var (
srcRefList *debian.PackageRefList srcRefList *deb.PackageRefList
srcRepo *debian.LocalRepo srcRepo *deb.LocalRepo
) )
if command == "copy" || command == "move" { if command == "copy" || command == "move" {
@@ -49,7 +49,7 @@ func aptlyRepoMoveCopyImport(cmd *commander.Command, args []string) error {
srcRefList = srcRepo.RefList() srcRefList = srcRepo.RefList()
} else if command == "import" { } else if command == "import" {
var srcRemoteRepo *debian.RemoteRepo var srcRemoteRepo *deb.RemoteRepo
srcRemoteRepo, err = context.CollectionFactory().RemoteRepoCollection().ByName(args[0]) srcRemoteRepo, err = context.CollectionFactory().RemoteRepoCollection().ByName(args[0])
if err != nil { if err != nil {
@@ -72,12 +72,12 @@ func aptlyRepoMoveCopyImport(cmd *commander.Command, args []string) error {
context.Progress().Printf("Loading packages...\n") context.Progress().Printf("Loading packages...\n")
dstList, err := debian.NewPackageListFromRefList(dstRepo.RefList(), context.CollectionFactory().PackageCollection(), context.Progress()) dstList, err := deb.NewPackageListFromRefList(dstRepo.RefList(), context.CollectionFactory().PackageCollection(), context.Progress())
if err != nil { if err != nil {
return fmt.Errorf("unable to load packages: %s", err) return fmt.Errorf("unable to load packages: %s", err)
} }
srcList, err := debian.NewPackageListFromRefList(srcRefList, context.CollectionFactory().PackageCollection(), context.Progress()) srcList, err := deb.NewPackageListFromRefList(srcRefList, context.CollectionFactory().PackageCollection(), context.Progress())
if err != nil { if err != nil {
return fmt.Errorf("unable to load packages: %s", err) return fmt.Errorf("unable to load packages: %s", err)
} }
@@ -120,7 +120,7 @@ func aptlyRepoMoveCopyImport(cmd *commander.Command, args []string) error {
verb = "imported" verb = "imported"
} }
err = toProcess.ForEach(func(p *debian.Package) error { err = toProcess.ForEach(func(p *deb.Package) error {
err = dstList.Add(p) err = dstList.Add(p)
if err != nil { if err != nil {
return err return err
@@ -139,7 +139,7 @@ func aptlyRepoMoveCopyImport(cmd *commander.Command, args []string) error {
if context.flags.Lookup("dry-run").Value.Get().(bool) { if context.flags.Lookup("dry-run").Value.Get().(bool) {
context.Progress().Printf("\nChanges not saved, as dry run has been requested.\n") context.Progress().Printf("\nChanges not saved, as dry run has been requested.\n")
} else { } else {
dstRepo.UpdateRefList(debian.NewPackageRefListFromPackageList(dstList)) dstRepo.UpdateRefList(deb.NewPackageRefListFromPackageList(dstList))
err = context.CollectionFactory().LocalRepoCollection().Update(dstRepo) err = context.CollectionFactory().LocalRepoCollection().Update(dstRepo)
if err != nil { if err != nil {
@@ -147,7 +147,7 @@ func aptlyRepoMoveCopyImport(cmd *commander.Command, args []string) error {
} }
if command == "move" { if command == "move" {
srcRepo.UpdateRefList(debian.NewPackageRefListFromPackageList(srcList)) srcRepo.UpdateRefList(deb.NewPackageRefListFromPackageList(srcList))
err = context.CollectionFactory().LocalRepoCollection().Update(srcRepo) err = context.CollectionFactory().LocalRepoCollection().Update(srcRepo)
if err != nil { if err != nil {
+4 -4
View File
@@ -2,7 +2,7 @@ package cmd
import ( import (
"fmt" "fmt"
"github.com/smira/aptly/debian" "github.com/smira/aptly/deb"
"github.com/smira/commander" "github.com/smira/commander"
"github.com/smira/flag" "github.com/smira/flag"
) )
@@ -28,7 +28,7 @@ func aptlyRepoRemove(cmd *commander.Command, args []string) error {
context.Progress().Printf("Loading packages...\n") context.Progress().Printf("Loading packages...\n")
list, err := debian.NewPackageListFromRefList(repo.RefList(), context.CollectionFactory().PackageCollection(), context.Progress()) list, err := deb.NewPackageListFromRefList(repo.RefList(), context.CollectionFactory().PackageCollection(), context.Progress())
if err != nil { if err != nil {
return fmt.Errorf("unable to load packages: %s", err) return fmt.Errorf("unable to load packages: %s", err)
} }
@@ -39,7 +39,7 @@ func aptlyRepoRemove(cmd *commander.Command, args []string) error {
return fmt.Errorf("unable to remove: %s", err) return fmt.Errorf("unable to remove: %s", err)
} }
toRemove.ForEach(func(p *debian.Package) error { toRemove.ForEach(func(p *deb.Package) error {
list.Remove(p) list.Remove(p)
context.Progress().ColoredPrintf("@r[-]@| %s removed", p) context.Progress().ColoredPrintf("@r[-]@| %s removed", p)
return nil return nil
@@ -48,7 +48,7 @@ func aptlyRepoRemove(cmd *commander.Command, args []string) error {
if context.flags.Lookup("dry-run").Value.Get().(bool) { if context.flags.Lookup("dry-run").Value.Get().(bool) {
context.Progress().Printf("\nChanges not saved, as dry run has been requested.\n") context.Progress().Printf("\nChanges not saved, as dry run has been requested.\n")
} else { } else {
repo.UpdateRefList(debian.NewPackageRefListFromPackageList(list)) repo.UpdateRefList(deb.NewPackageRefListFromPackageList(list))
err = context.CollectionFactory().LocalRepoCollection().Update(repo) err = context.CollectionFactory().LocalRepoCollection().Update(repo)
if err != nil { if err != nil {
+3 -3
View File
@@ -2,7 +2,7 @@ package cmd
import ( import (
"fmt" "fmt"
"github.com/smira/aptly/debian" "github.com/smira/aptly/deb"
"github.com/smira/aptly/utils" "github.com/smira/aptly/utils"
"github.com/smira/commander" "github.com/smira/commander"
"github.com/smira/flag" "github.com/smira/flag"
@@ -38,9 +38,9 @@ func aptlyServe(cmd *commander.Command, args []string) error {
fmt.Printf("Serving published repositories, recommended apt sources list:\n\n") fmt.Printf("Serving published repositories, recommended apt sources list:\n\n")
sources := make(sort.StringSlice, 0, context.CollectionFactory().PublishedRepoCollection().Len()) sources := make(sort.StringSlice, 0, context.CollectionFactory().PublishedRepoCollection().Len())
published := make(map[string]*debian.PublishedRepo, context.CollectionFactory().PublishedRepoCollection().Len()) published := make(map[string]*deb.PublishedRepo, context.CollectionFactory().PublishedRepoCollection().Len())
err = context.CollectionFactory().PublishedRepoCollection().ForEach(func(repo *debian.PublishedRepo) error { err = context.CollectionFactory().PublishedRepoCollection().ForEach(func(repo *deb.PublishedRepo) error {
err := context.CollectionFactory().PublishedRepoCollection().LoadComplete(repo, context.CollectionFactory()) err := context.CollectionFactory().PublishedRepoCollection().LoadComplete(repo, context.CollectionFactory())
if err != nil { if err != nil {
return err return err
+8 -8
View File
@@ -2,19 +2,19 @@ package cmd
import ( import (
"fmt" "fmt"
"github.com/smira/aptly/debian" "github.com/smira/aptly/deb"
"github.com/smira/commander" "github.com/smira/commander"
) )
func aptlySnapshotCreate(cmd *commander.Command, args []string) error { func aptlySnapshotCreate(cmd *commander.Command, args []string) error {
var ( var (
err error err error
snapshot *debian.Snapshot snapshot *deb.Snapshot
) )
if len(args) == 4 && args[1] == "from" && args[2] == "mirror" { if len(args) == 4 && args[1] == "from" && args[2] == "mirror" {
// aptly snapshot create snap from mirror mirror // aptly snapshot create snap from mirror mirror
var repo *debian.RemoteRepo var repo *deb.RemoteRepo
repoName, snapshotName := args[3], args[0] repoName, snapshotName := args[3], args[0]
@@ -28,13 +28,13 @@ func aptlySnapshotCreate(cmd *commander.Command, args []string) error {
return fmt.Errorf("unable to create snapshot: %s", err) return fmt.Errorf("unable to create snapshot: %s", err)
} }
snapshot, err = debian.NewSnapshotFromRepository(snapshotName, repo) snapshot, err = deb.NewSnapshotFromRepository(snapshotName, repo)
if err != nil { if err != nil {
return fmt.Errorf("unable to create snapshot: %s", err) return fmt.Errorf("unable to create snapshot: %s", err)
} }
} else if len(args) == 4 && args[1] == "from" && args[2] == "repo" { } else if len(args) == 4 && args[1] == "from" && args[2] == "repo" {
// aptly snapshot create snap from repo repo // aptly snapshot create snap from repo repo
var repo *debian.LocalRepo var repo *deb.LocalRepo
localRepoName, snapshotName := args[3], args[0] localRepoName, snapshotName := args[3], args[0]
@@ -48,7 +48,7 @@ func aptlySnapshotCreate(cmd *commander.Command, args []string) error {
return fmt.Errorf("unable to create snapshot: %s", err) return fmt.Errorf("unable to create snapshot: %s", err)
} }
snapshot, err = debian.NewSnapshotFromLocalRepo(snapshotName, repo) snapshot, err = deb.NewSnapshotFromLocalRepo(snapshotName, repo)
if err != nil { if err != nil {
return fmt.Errorf("unable to create snapshot: %s", err) return fmt.Errorf("unable to create snapshot: %s", err)
} }
@@ -56,9 +56,9 @@ func aptlySnapshotCreate(cmd *commander.Command, args []string) error {
// aptly snapshot create snap empty // aptly snapshot create snap empty
snapshotName := args[0] snapshotName := args[0]
packageList := debian.NewPackageList() packageList := deb.NewPackageList()
snapshot = debian.NewSnapshotFromPackageList(snapshotName, nil, packageList, "Created as empty") snapshot = deb.NewSnapshotFromPackageList(snapshotName, nil, packageList, "Created as empty")
} else { } else {
cmd.Usage() cmd.Usage()
return err return err
+2 -2
View File
@@ -2,7 +2,7 @@ package cmd
import ( import (
"fmt" "fmt"
"github.com/smira/aptly/debian" "github.com/smira/aptly/deb"
"github.com/smira/commander" "github.com/smira/commander"
"sort" "sort"
) )
@@ -20,7 +20,7 @@ func aptlySnapshotList(cmd *commander.Command, args []string) error {
snapshots := make([]string, context.CollectionFactory().SnapshotCollection().Len()) snapshots := make([]string, context.CollectionFactory().SnapshotCollection().Len())
i := 0 i := 0
context.CollectionFactory().SnapshotCollection().ForEach(func(snapshot *debian.Snapshot) error { context.CollectionFactory().SnapshotCollection().ForEach(func(snapshot *deb.Snapshot) error {
snapshots[i] = snapshot.String() snapshots[i] = snapshot.String()
i++ i++
return nil return nil
+3 -3
View File
@@ -2,7 +2,7 @@ package cmd
import ( import (
"fmt" "fmt"
"github.com/smira/aptly/debian" "github.com/smira/aptly/deb"
"github.com/smira/commander" "github.com/smira/commander"
"strings" "strings"
) )
@@ -14,7 +14,7 @@ func aptlySnapshotMerge(cmd *commander.Command, args []string) error {
return err return err
} }
sources := make([]*debian.Snapshot, len(args)-1) sources := make([]*deb.Snapshot, len(args)-1)
for i := 0; i < len(args)-1; i++ { for i := 0; i < len(args)-1; i++ {
sources[i], err = context.CollectionFactory().SnapshotCollection().ByName(args[i+1]) sources[i], err = context.CollectionFactory().SnapshotCollection().ByName(args[i+1])
@@ -40,7 +40,7 @@ func aptlySnapshotMerge(cmd *commander.Command, args []string) error {
} }
// Create <destination> snapshot // Create <destination> snapshot
destination := debian.NewSnapshotFromRefList(args[0], sources, result, destination := deb.NewSnapshotFromRefList(args[0], sources, result,
fmt.Sprintf("Merged from sources: %s", strings.Join(sourceDescription, ", "))) fmt.Sprintf("Merged from sources: %s", strings.Join(sourceDescription, ", ")))
err = context.CollectionFactory().SnapshotCollection().Add(destination) err = context.CollectionFactory().SnapshotCollection().Add(destination)
+11 -11
View File
@@ -2,7 +2,7 @@ package cmd
import ( import (
"fmt" "fmt"
"github.com/smira/aptly/debian" "github.com/smira/aptly/deb"
"github.com/smira/commander" "github.com/smira/commander"
"github.com/smira/flag" "github.com/smira/flag"
"sort" "sort"
@@ -46,12 +46,12 @@ func aptlySnapshotPull(cmd *commander.Command, args []string) error {
// Convert snapshot to package list // Convert snapshot to package list
context.Progress().Printf("Loading packages (%d)...\n", snapshot.RefList().Len()+source.RefList().Len()) context.Progress().Printf("Loading packages (%d)...\n", snapshot.RefList().Len()+source.RefList().Len())
packageList, err := debian.NewPackageListFromRefList(snapshot.RefList(), context.CollectionFactory().PackageCollection(), context.Progress()) packageList, err := deb.NewPackageListFromRefList(snapshot.RefList(), context.CollectionFactory().PackageCollection(), context.Progress())
if err != nil { if err != nil {
return fmt.Errorf("unable to load packages: %s", err) return fmt.Errorf("unable to load packages: %s", err)
} }
sourcePackageList, err := debian.NewPackageListFromRefList(source.RefList(), context.CollectionFactory().PackageCollection(), context.Progress()) sourcePackageList, err := deb.NewPackageListFromRefList(source.RefList(), context.CollectionFactory().PackageCollection(), context.Progress())
if err != nil { if err != nil {
return fmt.Errorf("unable to load packages: %s", err) return fmt.Errorf("unable to load packages: %s", err)
} }
@@ -76,9 +76,9 @@ func aptlySnapshotPull(cmd *commander.Command, args []string) error {
} }
// Initial dependencies out of arguments // Initial dependencies out of arguments
initialDependencies := make([]debian.Dependency, len(args)-3) initialDependencies := make([]deb.Dependency, len(args)-3)
for i, arg := range args[3:] { for i, arg := range args[3:] {
initialDependencies[i], err = debian.ParseDependency(arg) initialDependencies[i], err = deb.ParseDependency(arg)
if err != nil { if err != nil {
return fmt.Errorf("unable to parse argument: %s", err) return fmt.Errorf("unable to parse argument: %s", err)
} }
@@ -86,7 +86,7 @@ func aptlySnapshotPull(cmd *commander.Command, args []string) error {
// Perform pull // Perform pull
for _, arch := range architecturesList { for _, arch := range architecturesList {
dependencies := make([]debian.Dependency, len(initialDependencies), 128) dependencies := make([]deb.Dependency, len(initialDependencies), 128)
for i := range dependencies { for i := range dependencies {
dependencies[i] = initialDependencies[i] dependencies[i] = initialDependencies[i]
dependencies[i].Architecture = arch dependencies[i].Architecture = arch
@@ -105,10 +105,10 @@ func aptlySnapshotPull(cmd *commander.Command, args []string) error {
if !noRemove { if !noRemove {
// Remove all packages with the same name and architecture // Remove all packages with the same name and architecture
for p := packageList.Search(debian.Dependency{Architecture: pkg.Architecture, Pkg: pkg.Name}); p != nil; { for p := packageList.Search(deb.Dependency{Architecture: pkg.Architecture, Pkg: pkg.Name}); p != nil; {
packageList.Remove(p) packageList.Remove(p)
context.Progress().ColoredPrintf("@r[-]@| %s removed", p) context.Progress().ColoredPrintf("@r[-]@| %s removed", p)
p = packageList.Search(debian.Dependency{Architecture: pkg.Architecture, Pkg: pkg.Name}) p = packageList.Search(deb.Dependency{Architecture: pkg.Architecture, Pkg: pkg.Name})
} }
} }
@@ -121,10 +121,10 @@ func aptlySnapshotPull(cmd *commander.Command, args []string) error {
} }
// Find missing dependencies for single added package // Find missing dependencies for single added package
pL := debian.NewPackageList() pL := deb.NewPackageList()
pL.Add(pkg) pL.Add(pkg)
var missing []debian.Dependency var missing []deb.Dependency
missing, err = pL.VerifyDependencies(context.DependencyOptions(), []string{arch}, packageList, nil) missing, err = pL.VerifyDependencies(context.DependencyOptions(), []string{arch}, packageList, nil)
if err != nil { if err != nil {
context.Progress().ColoredPrintf("@y[!]@| @!Error while verifying dependencies for pkg %s: %s@|", pkg, err) context.Progress().ColoredPrintf("@y[!]@| @!Error while verifying dependencies for pkg %s: %s@|", pkg, err)
@@ -151,7 +151,7 @@ func aptlySnapshotPull(cmd *commander.Command, args []string) error {
context.Progress().Printf("\nNot creating snapshot, as dry run was requested.\n") context.Progress().Printf("\nNot creating snapshot, as dry run was requested.\n")
} else { } else {
// Create <destination> snapshot // Create <destination> snapshot
destination := debian.NewSnapshotFromPackageList(args[2], []*debian.Snapshot{snapshot, source}, packageList, destination := deb.NewSnapshotFromPackageList(args[2], []*deb.Snapshot{snapshot, source}, packageList,
fmt.Sprintf("Pulled into '%s' with '%s' as source, pull request was: '%s'", snapshot.Name, source.Name, strings.Join(args[3:], " "))) fmt.Sprintf("Pulled into '%s' with '%s' as source, pull request was: '%s'", snapshot.Name, source.Name, strings.Join(args[3:], " ")))
err = context.CollectionFactory().SnapshotCollection().Add(destination) err = context.CollectionFactory().SnapshotCollection().Add(destination)
+6 -6
View File
@@ -2,7 +2,7 @@ package cmd
import ( import (
"fmt" "fmt"
"github.com/smira/aptly/debian" "github.com/smira/aptly/deb"
"github.com/smira/commander" "github.com/smira/commander"
"sort" "sort"
) )
@@ -14,7 +14,7 @@ func aptlySnapshotVerify(cmd *commander.Command, args []string) error {
return err return err
} }
snapshots := make([]*debian.Snapshot, len(args)) snapshots := make([]*deb.Snapshot, len(args))
for i := range snapshots { for i := range snapshots {
snapshots[i], err = context.CollectionFactory().SnapshotCollection().ByName(args[i]) snapshots[i], err = context.CollectionFactory().SnapshotCollection().ByName(args[i])
if err != nil { if err != nil {
@@ -29,20 +29,20 @@ func aptlySnapshotVerify(cmd *commander.Command, args []string) error {
context.Progress().Printf("Loading packages...\n") context.Progress().Printf("Loading packages...\n")
packageList, err := debian.NewPackageListFromRefList(snapshots[0].RefList(), context.CollectionFactory().PackageCollection(), context.Progress()) packageList, err := deb.NewPackageListFromRefList(snapshots[0].RefList(), context.CollectionFactory().PackageCollection(), context.Progress())
if err != nil { if err != nil {
fmt.Errorf("unable to load packages: %s", err) fmt.Errorf("unable to load packages: %s", err)
} }
sourcePackageList := debian.NewPackageList() sourcePackageList := deb.NewPackageList()
err = sourcePackageList.Append(packageList) err = sourcePackageList.Append(packageList)
if err != nil { if err != nil {
fmt.Errorf("unable to merge sources: %s", err) fmt.Errorf("unable to merge sources: %s", err)
} }
var pL *debian.PackageList var pL *deb.PackageList
for i := 1; i < len(snapshots); i++ { for i := 1; i < len(snapshots); i++ {
pL, err = debian.NewPackageListFromRefList(snapshots[i].RefList(), context.CollectionFactory().PackageCollection(), context.Progress()) pL, err = deb.NewPackageListFromRefList(snapshots[i].RefList(), context.CollectionFactory().PackageCollection(), context.Progress())
if err != nil { if err != nil {
fmt.Errorf("unable to load packages: %s", err) fmt.Errorf("unable to load packages: %s", err)
} }
+1 -1
View File
@@ -1,4 +1,4 @@
package debian package deb
import ( import (
"github.com/smira/aptly/database" "github.com/smira/aptly/database"
+1 -1
View File
@@ -1,4 +1,4 @@
package debian package deb
import ( import (
"archive/tar" "archive/tar"
+1 -1
View File
@@ -1,4 +1,4 @@
package debian package deb
import ( import (
"github.com/smira/aptly/utils" "github.com/smira/aptly/utils"
+1 -1
View File
@@ -1,2 +1,2 @@
// Package debian implements Debian-specific repository handling // Package debian implements Debian-specific repository handling
package debian package deb
+1 -1
View File
@@ -1,4 +1,4 @@
package debian package deb
import ( import (
. "launchpad.net/gocheck" . "launchpad.net/gocheck"
+1 -1
View File
@@ -1,4 +1,4 @@
package debian package deb
import ( import (
"bufio" "bufio"
+1 -1
View File
@@ -1,4 +1,4 @@
package debian package deb
import ( import (
"bufio" "bufio"
+1 -1
View File
@@ -1,4 +1,4 @@
package debian package deb
import ( import (
"fmt" "fmt"
+1 -1
View File
@@ -1,4 +1,4 @@
package debian package deb
import ( import (
"errors" "errors"
+1 -1
View File
@@ -1,4 +1,4 @@
package debian package deb
import ( import (
"bytes" "bytes"
+1 -1
View File
@@ -1,4 +1,4 @@
package debian package deb
import ( import (
"errors" "errors"
+1 -1
View File
@@ -1,4 +1,4 @@
package debian package deb
import ( import (
"fmt" "fmt"
+1 -1
View File
@@ -1,4 +1,4 @@
package debian package deb
import ( import (
"bytes" "bytes"
+1 -1
View File
@@ -1,4 +1,4 @@
package debian package deb
import ( import (
"github.com/smira/aptly/database" "github.com/smira/aptly/database"
+1 -1
View File
@@ -1,4 +1,4 @@
package debian package deb
import ( import (
"strings" "strings"
+1 -1
View File
@@ -1,4 +1,4 @@
package debian package deb
import ( import (
"encoding/binary" "encoding/binary"
+1 -1
View File
@@ -1,4 +1,4 @@
package debian package deb
import ( import (
"github.com/smira/aptly/files" "github.com/smira/aptly/files"
+1 -1
View File
@@ -1,4 +1,4 @@
package debian package deb
import ( import (
"bytes" "bytes"
+1 -1
View File
@@ -1,4 +1,4 @@
package debian package deb
import ( import (
"fmt" "fmt"
+1 -1
View File
@@ -1,4 +1,4 @@
package debian package deb
import ( import (
"github.com/smira/aptly/utils" "github.com/smira/aptly/utils"
+1 -1
View File
@@ -1,4 +1,4 @@
package debian package deb
import ( import (
"bufio" "bufio"
+1 -1
View File
@@ -1,4 +1,4 @@
package debian package deb
import ( import (
"errors" "errors"
+1 -1
View File
@@ -1,4 +1,4 @@
package debian package deb
import ( import (
"bytes" "bytes"
+1 -1
View File
@@ -1,4 +1,4 @@
package debian package deb
import ( import (
"errors" "errors"
+1 -1
View File
@@ -1,4 +1,4 @@
package debian package deb
import ( import (
"bytes" "bytes"
+1 -1
View File
@@ -1,4 +1,4 @@
package debian package deb
import ( import (
"errors" "errors"
+1 -1
View File
@@ -1,4 +1,4 @@
package debian package deb
import ( import (
"bytes" "bytes"
+1 -1
View File
@@ -1,4 +1,4 @@
package debian package deb
import ( import (
"errors" "errors"
+1 -1
View File
@@ -1,4 +1,4 @@
package debian package deb
import ( import (
"fmt" "fmt"
+1 -1
View File
@@ -1,4 +1,4 @@
package debian package deb
import ( import (
. "launchpad.net/gocheck" . "launchpad.net/gocheck"