mirror of
https://github.com/aptly-dev/aptly.git
synced 2026-06-04 05:10:40 +00:00
Fixes for refactoring to cmd.
This commit is contained in:
@@ -36,7 +36,6 @@ func RootCommand() *commander.Command {
|
||||
UsageLine: os.Args[0],
|
||||
Short: "Debian repository management tool",
|
||||
Long: `
|
||||
}
|
||||
aptly is a tool to create partial and full mirrors of remote
|
||||
repositories, filter them, merge, upgrade individual packages,
|
||||
take snapshots and publish them back as Debian repositories.`,
|
||||
|
||||
+8
-3
@@ -25,6 +25,7 @@ var context struct {
|
||||
architecturesList []string
|
||||
}
|
||||
|
||||
// InitContext initializes context with default settings
|
||||
func InitContext(cmd *commander.Command) error {
|
||||
var err error
|
||||
|
||||
@@ -50,19 +51,23 @@ func InitContext(cmd *commander.Command) error {
|
||||
|
||||
context.progress = console.NewProgress()
|
||||
context.progress.Start()
|
||||
defer context.progress.Shutdown()
|
||||
|
||||
context.downloader = http.NewDownloader(utils.Config.DownloadConcurrency, context.progress)
|
||||
defer context.downloader.Shutdown()
|
||||
|
||||
context.database, err = database.OpenDB(filepath.Join(utils.Config.RootDir, "db"))
|
||||
if err != nil {
|
||||
return fmt.Errorf("can't open database: %s", err)
|
||||
}
|
||||
defer context.database.Close()
|
||||
|
||||
context.packagePool = files.NewPackagePool(utils.Config.RootDir)
|
||||
context.publishedStorage = files.NewPublishedStorage(utils.Config.RootDir)
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// ShutdownContext shuts context down
|
||||
func ShutdownContext() {
|
||||
context.database.Close()
|
||||
context.downloader.Shutdown()
|
||||
context.progress.Shutdown()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user