New upstream version 1.5.0+ds1

This commit is contained in:
Roland Mas
2023-01-02 14:19:29 +01:00
parent 29e4ea6ec0
commit 5c4f97f88e
324 changed files with 15360 additions and 6668 deletions
+3 -2
View File
@@ -1,10 +1,11 @@
package utils
import (
"compress/gzip"
"io"
"os"
"os/exec"
"github.com/klauspost/pgzip"
)
// CompressFile compresses file specified by source to .gz & .bz2
@@ -19,7 +20,7 @@ func CompressFile(source *os.File, onlyGzip bool) error {
}
defer gzFile.Close()
gzWriter := gzip.NewWriter(gzFile)
gzWriter := pgzip.NewWriter(gzFile)
defer gzWriter.Close()
source.Seek(0, 0)
+21
View File
@@ -11,6 +11,9 @@ type ConfigStructure struct { // nolint: maligned
RootDir string `json:"rootDir"`
DownloadConcurrency int `json:"downloadConcurrency"`
DownloadLimit int64 `json:"downloadSpeedLimit"`
DownloadRetries int `json:"downloadRetries"`
Downloader string `json:"downloader"`
DatabaseOpenAttempts int `json:"databaseOpenAttempts"`
Architectures []string `json:"architectures"`
DepFollowSuggests bool `json:"dependencyFollowSuggests"`
DepFollowRecommends bool `json:"dependencyFollowRecommends"`
@@ -25,9 +28,13 @@ type ConfigStructure struct { // nolint: maligned
PpaDistributorID string `json:"ppaDistributorID"`
PpaCodename string `json:"ppaCodename"`
SkipContentsPublishing bool `json:"skipContentsPublishing"`
SkipBz2Publishing bool `json:"skipBz2Publishing"`
FileSystemPublishRoots map[string]FileSystemPublishRoot `json:"FileSystemPublishEndpoints"`
S3PublishRoots map[string]S3PublishRoot `json:"S3PublishEndpoints"`
SwiftPublishRoots map[string]SwiftPublishRoot `json:"SwiftPublishEndpoints"`
AzurePublishRoots map[string]AzurePublishRoot `json:"AzurePublishEndpoints"`
AsyncAPI bool `json:"AsyncAPI"`
EnableMetricsEndpoint bool `json:"enableMetricsEndpoint"`
}
// FileSystemPublishRoot describes single filesystem publishing entry point
@@ -70,11 +77,22 @@ type SwiftPublishRoot struct {
Container string `json:"container"`
}
// AzurePublishRoot describes single Azure publishing entry point
type AzurePublishRoot struct {
AccountName string `json:"accountName"`
AccountKey string `json:"accountKey"`
Container string `json:"container"`
Prefix string `json:"prefix"`
Endpoint string `json:"endpoint"`
}
// Config is configuration for aptly, shared by all modules
var Config = ConfigStructure{
RootDir: filepath.Join(os.Getenv("HOME"), ".aptly"),
DownloadConcurrency: 4,
DownloadLimit: 0,
Downloader: "default",
DatabaseOpenAttempts: -1,
Architectures: []string{},
DepFollowSuggests: false,
DepFollowRecommends: false,
@@ -90,6 +108,9 @@ var Config = ConfigStructure{
FileSystemPublishRoots: map[string]FileSystemPublishRoot{},
S3PublishRoots: map[string]S3PublishRoot{},
SwiftPublishRoots: map[string]SwiftPublishRoot{},
AzurePublishRoots: map[string]AzurePublishRoot{},
AsyncAPI: false,
EnableMetricsEndpoint: false,
}
// LoadConfig loads configuration from json file
+22 -2
View File
@@ -23,6 +23,7 @@ func (s *ConfigSuite) TestLoadConfig(c *C) {
c.Assert(err, IsNil)
c.Check(s.config.RootDir, Equals, "/opt/aptly/")
c.Check(s.config.DownloadConcurrency, Equals, 33)
c.Check(s.config.DatabaseOpenAttempts, Equals, 33)
}
func (s *ConfigSuite) TestSaveConfig(c *C) {
@@ -30,6 +31,7 @@ func (s *ConfigSuite) TestSaveConfig(c *C) {
s.config.RootDir = "/tmp/aptly"
s.config.DownloadConcurrency = 5
s.config.DatabaseOpenAttempts = 5
s.config.GpgProvider = "gpg"
s.config.FileSystemPublishRoots = map[string]FileSystemPublishRoot{"test": {
@@ -42,6 +44,9 @@ func (s *ConfigSuite) TestSaveConfig(c *C) {
s.config.SwiftPublishRoots = map[string]SwiftPublishRoot{"test": {
Container: "repo"}}
s.config.AzurePublishRoots = map[string]AzurePublishRoot{"test": {
Container: "repo"}}
err := SaveConfig(configname, &s.config)
c.Assert(err, IsNil)
@@ -57,6 +62,9 @@ func (s *ConfigSuite) TestSaveConfig(c *C) {
" \"rootDir\": \"/tmp/aptly\",\n"+
" \"downloadConcurrency\": 5,\n"+
" \"downloadSpeedLimit\": 0,\n"+
" \"downloadRetries\": 0,\n"+
" \"downloader\": \"\",\n"+
" \"databaseOpenAttempts\": 5,\n"+
" \"architectures\": null,\n"+
" \"dependencyFollowSuggests\": false,\n"+
" \"dependencyFollowRecommends\": false,\n"+
@@ -71,6 +79,7 @@ func (s *ConfigSuite) TestSaveConfig(c *C) {
" \"ppaDistributorID\": \"\",\n"+
" \"ppaCodename\": \"\",\n"+
" \"skipContentsPublishing\": false,\n"+
" \"skipBz2Publishing\": false,\n"+
" \"FileSystemPublishEndpoints\": {\n"+
" \"test\": {\n"+
" \"rootDir\": \"/opt/aptly-publish\",\n"+
@@ -110,8 +119,19 @@ func (s *ConfigSuite) TestSaveConfig(c *C) {
" \"prefix\": \"\",\n"+
" \"container\": \"repo\"\n"+
" }\n"+
" }\n"+
" },\n"+
" \"AzurePublishEndpoints\": {\n"+
" \"test\": {\n"+
" \"accountName\": \"\",\n"+
" \"accountKey\": \"\",\n"+
" \"container\": \"repo\",\n"+
" \"prefix\": \"\",\n"+
" \"endpoint\": \"\"\n"+
" }\n"+
" },\n"+
" \"AsyncAPI\": false,\n"+
" \"enableMetricsEndpoint\": false\n"+
"}")
}
const configFile = `{"rootDir": "/opt/aptly/", "downloadConcurrency": 33}`
const configFile = `{"rootDir": "/opt/aptly/", "downloadConcurrency": 33, "databaseOpenAttempts": 33}`