mirror of
https://github.com/aptly-dev/aptly.git
synced 2026-04-20 19:38:39 +00:00
Add support for custom package pool locations
Signed-off-by: Ryan Gonzalez <ryan.gonzalez@collabora.com>
This commit is contained in:
committed by
André Roth
parent
91574b53d9
commit
8e37813129
@@ -361,7 +361,12 @@ func (context *AptlyContext) PackagePool() aptly.PackagePool {
|
||||
defer context.Unlock()
|
||||
|
||||
if context.packagePool == nil {
|
||||
context.packagePool = files.NewPackagePool(context.config().RootDir, !context.config().SkipLegacyPool)
|
||||
poolRoot := context.config().PackagePoolStorage.Path
|
||||
if poolRoot == "" {
|
||||
poolRoot = filepath.Join(context.config().RootDir, "pool")
|
||||
}
|
||||
|
||||
context.packagePool = files.NewPackagePool(poolRoot, !context.config().SkipLegacyPool)
|
||||
}
|
||||
|
||||
return context.packagePool
|
||||
|
||||
@@ -32,8 +32,7 @@ var (
|
||||
|
||||
// NewPackagePool creates new instance of PackagePool which specified root
|
||||
func NewPackagePool(root string, supportLegacyPaths bool) *PackagePool {
|
||||
rootPath := filepath.Join(root, "pool")
|
||||
rootPath, err := filepath.Abs(rootPath)
|
||||
rootPath, err := filepath.Abs(root)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
@@ -43,6 +43,9 @@ Configuration file is stored in JSON format (default values shown below):
|
||||
"gpgDisableVerify": false,
|
||||
"gpgProvider": "gpg",
|
||||
"downloadSourcePackages": false,
|
||||
"packagePoolStorage": {
|
||||
"path": "$ROOTDIR/pool"
|
||||
},
|
||||
"skipLegacyPool": true,
|
||||
"ppaDistributorID": "ubuntu",
|
||||
"ppaCodename": "",
|
||||
@@ -105,7 +108,8 @@ Configuration file is stored in JSON format (default values shown below):
|
||||
Options:
|
||||
|
||||
* `rootDir`:
|
||||
is root of directory storage to store database (`rootDir`/db), downloaded packages (`rootDir`/pool) and
|
||||
is root of directory storage to store database (`rootDir`/db),
|
||||
the default for downloaded packages (`rootDir`/pool) and
|
||||
the default for published repositories (`rootDir`/public)
|
||||
|
||||
* `downloadConcurrency`:
|
||||
@@ -158,6 +162,10 @@ Options:
|
||||
if enabled, all mirrors created would have flag set to download source packages;
|
||||
this setting could be controlled on per-mirror basis with `-with-sources` flag
|
||||
|
||||
* `packagePoolStorage`:
|
||||
is the directory to store downloaded packages into; defaults to the value of
|
||||
`rootDir` followed by `/pool`
|
||||
|
||||
* `skipLegacyPool`:
|
||||
in aptly up to version 1.0.0, package files were stored in internal package pool
|
||||
with MD5-dervied path, since 1.1.0 package pool layout was changed;
|
||||
|
||||
@@ -15,6 +15,7 @@
|
||||
"gpgDisableVerify": false,
|
||||
"gpgProvider": "gpg",
|
||||
"downloadSourcePackages": false,
|
||||
"packagePoolStorage": {},
|
||||
"skipLegacyPool": false,
|
||||
"ppaDistributorID": "ubuntu",
|
||||
"ppaCodename": "",
|
||||
|
||||
@@ -15,6 +15,7 @@
|
||||
"gpgDisableVerify": false,
|
||||
"gpgProvider": "gpg",
|
||||
"downloadSourcePackages": false,
|
||||
"packagePoolStorage": {},
|
||||
"skipLegacyPool": true,
|
||||
"ppaDistributorID": "ubuntu",
|
||||
"ppaCodename": "",
|
||||
|
||||
@@ -24,6 +24,7 @@ type ConfigStructure struct { // nolint: maligned
|
||||
GpgDisableVerify bool `json:"gpgDisableVerify"`
|
||||
GpgProvider string `json:"gpgProvider"`
|
||||
DownloadSourcePackages bool `json:"downloadSourcePackages"`
|
||||
PackagePoolStorage PackagePool `json:"packagePoolStorage"`
|
||||
SkipLegacyPool bool `json:"skipLegacyPool"`
|
||||
PpaDistributorID string `json:"ppaDistributorID"`
|
||||
PpaCodename string `json:"ppaCodename"`
|
||||
@@ -40,6 +41,10 @@ type ConfigStructure struct { // nolint: maligned
|
||||
ServeInAPIMode bool `json:"serveInAPIMode"`
|
||||
}
|
||||
|
||||
type PackagePool struct {
|
||||
Path string `json:"path"`
|
||||
}
|
||||
|
||||
// FileSystemPublishRoot describes single filesystem publishing entry point
|
||||
type FileSystemPublishRoot struct {
|
||||
RootDir string `json:"rootDir"`
|
||||
@@ -106,6 +111,7 @@ var Config = ConfigStructure{
|
||||
GpgDisableSign: false,
|
||||
GpgDisableVerify: false,
|
||||
DownloadSourcePackages: false,
|
||||
PackagePoolStorage: PackagePool{Path: ""},
|
||||
SkipLegacyPool: false,
|
||||
PpaDistributorID: "ubuntu",
|
||||
PpaCodename: "",
|
||||
|
||||
@@ -34,6 +34,8 @@ func (s *ConfigSuite) TestSaveConfig(c *C) {
|
||||
s.config.DatabaseOpenAttempts = 5
|
||||
s.config.GpgProvider = "gpg"
|
||||
|
||||
s.config.PackagePoolStorage.Path = "/tmp/aptly-pool"
|
||||
|
||||
s.config.FileSystemPublishRoots = map[string]FileSystemPublishRoot{"test": {
|
||||
RootDir: "/opt/aptly-publish"}}
|
||||
|
||||
@@ -78,6 +80,9 @@ func (s *ConfigSuite) TestSaveConfig(c *C) {
|
||||
" \"gpgDisableVerify\": false,\n"+
|
||||
" \"gpgProvider\": \"gpg\",\n"+
|
||||
" \"downloadSourcePackages\": false,\n"+
|
||||
" \"packagePoolStorage\": {\n"+
|
||||
" \"path\": \"/tmp/aptly-pool\"\n"+
|
||||
" },\n"+
|
||||
" \"skipLegacyPool\": false,\n"+
|
||||
" \"ppaDistributorID\": \"\",\n"+
|
||||
" \"ppaCodename\": \"\",\n"+
|
||||
|
||||
Reference in New Issue
Block a user