mirror of
https://github.com/aptly-dev/aptly.git
synced 2026-07-27 13:57:46 +00:00
Allow definition of custom Suite
This commit is contained in:
committed by
Andrey Smirnov
parent
bde6e6bda4
commit
ae61cbb4c0
@@ -46,6 +46,7 @@ Example:
|
|||||||
cmd.Flag.String("notautomatic", "", "set value for NotAutomatic field")
|
cmd.Flag.String("notautomatic", "", "set value for NotAutomatic field")
|
||||||
cmd.Flag.String("butautomaticupgrades", "", "set value for ButAutomaticUpgrades field")
|
cmd.Flag.String("butautomaticupgrades", "", "set value for ButAutomaticUpgrades field")
|
||||||
cmd.Flag.String("label", "", "label to publish")
|
cmd.Flag.String("label", "", "label to publish")
|
||||||
|
cmd.Flag.String("suite", "", "suite to publish (defaults to distribution)")
|
||||||
cmd.Flag.Bool("force-overwrite", false, "overwrite files in package pool in case of mismatch")
|
cmd.Flag.Bool("force-overwrite", false, "overwrite files in package pool in case of mismatch")
|
||||||
cmd.Flag.Bool("acquire-by-hash", false, "provide index files by hash")
|
cmd.Flag.Bool("acquire-by-hash", false, "provide index files by hash")
|
||||||
|
|
||||||
|
|||||||
@@ -130,6 +130,7 @@ func aptlyPublishSnapshotOrRepo(cmd *commander.Command, args []string) error {
|
|||||||
published.ButAutomaticUpgrades = butAutomaticUpgrades
|
published.ButAutomaticUpgrades = butAutomaticUpgrades
|
||||||
}
|
}
|
||||||
published.Label = context.Flags().Lookup("label").Value.String()
|
published.Label = context.Flags().Lookup("label").Value.String()
|
||||||
|
published.Suite = context.Flags().Lookup("suite").Value.String()
|
||||||
|
|
||||||
published.SkipContents = context.Config().SkipContentsPublishing
|
published.SkipContents = context.Config().SkipContentsPublishing
|
||||||
|
|
||||||
@@ -230,6 +231,7 @@ Example:
|
|||||||
cmd.Flag.String("notautomatic", "", "overwrite value for NotAutomatic field")
|
cmd.Flag.String("notautomatic", "", "overwrite value for NotAutomatic field")
|
||||||
cmd.Flag.String("butautomaticupgrades", "", "overwrite value for ButAutomaticUpgrades field")
|
cmd.Flag.String("butautomaticupgrades", "", "overwrite value for ButAutomaticUpgrades field")
|
||||||
cmd.Flag.String("label", "", "label to publish")
|
cmd.Flag.String("label", "", "label to publish")
|
||||||
|
cmd.Flag.String("suite", "", "suite to publish (defaults to distribution)")
|
||||||
cmd.Flag.Bool("force-overwrite", false, "overwrite files in package pool in case of mismatch")
|
cmd.Flag.Bool("force-overwrite", false, "overwrite files in package pool in case of mismatch")
|
||||||
cmd.Flag.Bool("acquire-by-hash", false, "provide index files by hash")
|
cmd.Flag.Bool("acquire-by-hash", false, "provide index files by hash")
|
||||||
|
|
||||||
|
|||||||
+16
-1
@@ -44,6 +44,7 @@ type PublishedRepo struct {
|
|||||||
NotAutomatic string
|
NotAutomatic string
|
||||||
ButAutomaticUpgrades string
|
ButAutomaticUpgrades string
|
||||||
Label string
|
Label string
|
||||||
|
Suite string
|
||||||
// Architectures is a list of all architectures published
|
// Architectures is a list of all architectures published
|
||||||
Architectures []string
|
Architectures []string
|
||||||
// SourceKind is "local"/"repo"
|
// SourceKind is "local"/"repo"
|
||||||
@@ -308,6 +309,7 @@ func (p *PublishedRepo) MarshalJSON() ([]byte, error) {
|
|||||||
"Distribution": p.Distribution,
|
"Distribution": p.Distribution,
|
||||||
"Label": p.Label,
|
"Label": p.Label,
|
||||||
"Origin": p.Origin,
|
"Origin": p.Origin,
|
||||||
|
"Suite": p.Suite,
|
||||||
"NotAutomatic": p.NotAutomatic,
|
"NotAutomatic": p.NotAutomatic,
|
||||||
"ButAutomaticUpgrades": p.ButAutomaticUpgrades,
|
"ButAutomaticUpgrades": p.ButAutomaticUpgrades,
|
||||||
"Prefix": p.Prefix,
|
"Prefix": p.Prefix,
|
||||||
@@ -357,6 +359,10 @@ func (p *PublishedRepo) String() string {
|
|||||||
extras = append(extras, fmt.Sprintf("label: %s", p.Label))
|
extras = append(extras, fmt.Sprintf("label: %s", p.Label))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if p.Suite != "" {
|
||||||
|
extras = append(extras, fmt.Sprintf("suite: %s", p.Suite))
|
||||||
|
}
|
||||||
|
|
||||||
extra = strings.Join(extras, ", ")
|
extra = strings.Join(extras, ", ")
|
||||||
|
|
||||||
if extra != "" {
|
if extra != "" {
|
||||||
@@ -485,6 +491,14 @@ func (p *PublishedRepo) GetLabel() string {
|
|||||||
return p.Label
|
return p.Label
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// GetSuite returns default or manual Suite:
|
||||||
|
func (p *PublishedRepo) GetSuite() string {
|
||||||
|
if p.Suite == "" {
|
||||||
|
return p.Distribution
|
||||||
|
}
|
||||||
|
return p.Suite
|
||||||
|
}
|
||||||
|
|
||||||
// Publish publishes snapshot (repository) contents, links package files, generates Packages & Release files, signs them
|
// Publish publishes snapshot (repository) contents, links package files, generates Packages & Release files, signs them
|
||||||
func (p *PublishedRepo) Publish(packagePool aptly.PackagePool, publishedStorageProvider aptly.PublishedStorageProvider,
|
func (p *PublishedRepo) Publish(packagePool aptly.PackagePool, publishedStorageProvider aptly.PublishedStorageProvider,
|
||||||
collectionFactory *CollectionFactory, signer pgp.Signer, progress aptly.Progress, forceOverwrite bool) error {
|
collectionFactory *CollectionFactory, signer pgp.Signer, progress aptly.Progress, forceOverwrite bool) error {
|
||||||
@@ -707,6 +721,7 @@ func (p *PublishedRepo) Publish(packagePool aptly.PackagePool, publishedStorageP
|
|||||||
release["Component"] = component
|
release["Component"] = component
|
||||||
release["Origin"] = p.GetOrigin()
|
release["Origin"] = p.GetOrigin()
|
||||||
release["Label"] = p.GetLabel()
|
release["Label"] = p.GetLabel()
|
||||||
|
release["Suite"] = p.GetSuite()
|
||||||
if p.AcquireByHash {
|
if p.AcquireByHash {
|
||||||
release["Acquire-By-Hash"] = "yes"
|
release["Acquire-By-Hash"] = "yes"
|
||||||
}
|
}
|
||||||
@@ -763,7 +778,7 @@ func (p *PublishedRepo) Publish(packagePool aptly.PackagePool, publishedStorageP
|
|||||||
release["ButAutomaticUpgrades"] = p.ButAutomaticUpgrades
|
release["ButAutomaticUpgrades"] = p.ButAutomaticUpgrades
|
||||||
}
|
}
|
||||||
release["Label"] = p.GetLabel()
|
release["Label"] = p.GetLabel()
|
||||||
release["Suite"] = p.Distribution
|
release["Suite"] = p.GetSuite()
|
||||||
release["Codename"] = p.Distribution
|
release["Codename"] = p.Distribution
|
||||||
release["Date"] = time.Now().UTC().Format("Mon, 2 Jan 2006 15:04:05 MST")
|
release["Date"] = time.Now().UTC().Format("Mon, 2 Jan 2006 15:04:05 MST")
|
||||||
release["Architectures"] = strings.Join(utils.StrSlicesSubstract(p.Architectures, []string{ArchitectureSource}), " ")
|
release["Architectures"] = strings.Join(utils.StrSlicesSubstract(p.Architectures, []string{ArchitectureSource}), " ")
|
||||||
|
|||||||
Reference in New Issue
Block a user