mirror of
https://github.com/aptly-dev/aptly.git
synced 2026-10-15 10:07:24 +00:00
Reduce required usage of LocalPackagePool
Several sections of the code *required* a LocalPackagePool, but they could still perform their operations with a standard PackagePool. Signed-off-by: Ryan Gonzalez <ryan.gonzalez@collabora.com>
This commit is contained in:
1 parent
1ebd37f9ad
commit
19255debb9
3 files changed
+51
-11
No files matched your search
+12
-1
@@ -2,6 +2,8 @@ package cmd
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"strings"
|
||||
"sync"
|
||||
|
||||
@@ -161,7 +163,16 @@ func aptlyMirrorUpdate(cmd *commander.Command, args []string) error {
|
||||
var e error
|
||||
|
||||
// provision download location
|
||||
task.TempDownPath, e = context.PackagePool().(aptly.LocalPackagePool).GenerateTempPath(task.File.Filename)
|
||||
if pp, ok := context.PackagePool().(aptly.LocalPackagePool); ok {
|
||||
task.TempDownPath, e = pp.GenerateTempPath(task.File.Filename)
|
||||
} else {
|
||||
var file *os.File
|
||||
file, e = ioutil.TempFile("", task.File.Filename)
|
||||
if e == nil {
|
||||
task.TempDownPath = file.Name()
|
||||
file.Close()
|
||||
}
|
||||
}
|
||||
if e != nil {
|
||||
pushError(e)
|
||||
continue
|
||||
|
||||
Reference in new issue
Block a user