Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions AUTHORS
Original file line number Diff line number Diff line change
Expand Up @@ -80,3 +80,4 @@ List of contributors, in chronological order:
* Roman Lebedev (https://github.com/LebedevRI)
* Brian Witt (https://github.com/bwitt)
* Ales Bregar (https://github.com/abregar)
* Zhang Xiao (https://github.com/xzhang1)
18 changes: 18 additions & 0 deletions api/publish.go
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,8 @@ type publishedRepoCreateParams struct {
SignedBy *string ` json:"SignedBy" example:""`
// Enable multiple packages with the same filename in different distributions
MultiDist *bool ` json:"MultiDist" example:"false"`
// Version of the release
Version string ` json:"Version" example:""`
}

// @Summary Create Published Repository
Expand Down Expand Up @@ -361,6 +363,10 @@ func apiPublishRepoOrSnapshot(c *gin.Context) {
published.SignedBy = *b.SignedBy
}

if b.Version != "" {
published.Version = b.Version
}

duplicate := collection.CheckDuplicate(published)
if duplicate != nil {
_ = collectionFactory.PublishedRepoCollection().LoadComplete(duplicate, collectionFactory)
Expand Down Expand Up @@ -404,6 +410,8 @@ type publishedRepoUpdateSwitchParams struct {
Label *string ` json:"Label" example:"Debian"`
// Value of Origin: field in published repository stanza
Origin *string ` json:"Origin" example:"Debian"`
// Version of the release: Optional
Version *string ` json:"Version" example:"13.3"`
}

// @Summary Update Published Repository
Expand Down Expand Up @@ -503,6 +511,10 @@ func apiPublishUpdateSwitch(c *gin.Context) {
published.Origin = *b.Origin
}

if b.Version != nil {
published.Version = *b.Version
}

resources := []string{string(published.Key())}
taskName := fmt.Sprintf("Update published %s repository %s/%s", published.SourceKind, published.StoragePrefix(), published.Distribution)
maybeRunTaskInBackground(c, taskName, resources, func(out aptly.Progress, _ *task.Detail) (*task.ProcessReturnValue, error) {
Expand Down Expand Up @@ -1000,6 +1012,8 @@ type publishedRepoUpdateParams struct {
Label *string ` json:"Label" example:"Debian"`
// Value of Origin: field in published repository stanza
Origin *string ` json:"Origin" example:"Debian"`
// Version of the release: Optional
Version *string ` json:"Version" example:"13.3"`
}

// @Summary Update Published Repository
Expand Down Expand Up @@ -1080,6 +1094,10 @@ func apiPublishUpdate(c *gin.Context) {
published.Origin = *b.Origin
}

if b.Version != nil {
published.Version = *b.Version
}

resources := []string{string(published.Key())}
taskName := fmt.Sprintf("Update published %s repository %s/%s", published.SourceKind, published.StoragePrefix(), published.Distribution)
maybeRunTaskInBackground(c, taskName, resources, func(out aptly.Progress, _ *task.Detail) (*task.ProcessReturnValue, error) {
Expand Down
1 change: 1 addition & 0 deletions cmd/publish_repo.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ Example:
cmd.Flag.Bool("acquire-by-hash", false, "provide index files by hash")
cmd.Flag.String("signed-by", "", "an optional field containing a comma separated list of OpenPGP key fingerprints to be used for validating the next Release file")
cmd.Flag.Bool("multi-dist", false, "enable multiple packages with the same filename in different distributions")
cmd.Flag.String("version", "", "version of the release")

return cmd
}
5 changes: 5 additions & 0 deletions cmd/publish_snapshot.go
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,10 @@ func aptlyPublishSnapshotOrRepo(cmd *commander.Command, args []string) error {
published.MultiDist = context.Flags().Lookup("multi-dist").Value.Get().(bool)
}

if context.Flags().IsSet("version") {
published.Version = context.Flags().Lookup("version").Value.String()
}

duplicate := collectionFactory.PublishedRepoCollection().CheckDuplicate(published)
if duplicate != nil {
_ = collectionFactory.PublishedRepoCollection().LoadComplete(duplicate, collectionFactory)
Expand Down Expand Up @@ -252,6 +256,7 @@ Example:
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.String("signed-by", "", "an optional field containing a comma separated list of OpenPGP key fingerprints to be used for validating the next Release file")
cmd.Flag.String("version", "", "version of the release")
cmd.Flag.Bool("multi-dist", false, "enable multiple packages with the same filename in different distributions")

return cmd
Expand Down
5 changes: 5 additions & 0 deletions cmd/publish_switch.go
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,10 @@ func aptlyPublishSwitch(cmd *commander.Command, args []string) error {
published.SignedBy = context.Flags().Lookup("signed-by").Value.String()
}

if context.Flags().IsSet("version") {
published.Version = context.Flags().Lookup("version").Value.String()
}

if context.Flags().IsSet("multi-dist") {
published.MultiDist = context.Flags().Lookup("multi-dist").Value.Get().(bool)
}
Expand Down Expand Up @@ -167,6 +171,7 @@ This command would switch published repository (with one component) named ppa/wh
cmd.Flag.String("component", "", "component names to update (for multi-component publishing, separate components with commas)")
cmd.Flag.Bool("force-overwrite", false, "overwrite files in package pool in case of mismatch")
cmd.Flag.String("signed-by", "", "an optional field containing a comma separated list of OpenPGP key fingerprints to be used for validating the next Release file")
cmd.Flag.String("version", "", "version of the release")
cmd.Flag.Bool("skip-cleanup", false, "don't remove unreferenced files in prefix/component")
cmd.Flag.Bool("multi-dist", false, "enable multiple packages with the same filename in different distributions")

Expand Down
5 changes: 5 additions & 0 deletions cmd/publish_update.go
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,10 @@ func aptlyPublishUpdate(cmd *commander.Command, args []string) error {
published.MultiDist = context.Flags().Lookup("multi-dist").Value.Get().(bool)
}

if context.Flags().IsSet("version") {
published.Version = context.Flags().Lookup("version").Value.String()
}

err = published.Publish(context.PackagePool(), context, collectionFactory, signer, context.Progress(), forceOverwrite, context.SkelPath())
if err != nil {
return fmt.Errorf("unable to publish: %s", err)
Expand Down Expand Up @@ -142,6 +146,7 @@ Example:
cmd.Flag.Bool("multi-dist", false, "enable multiple packages with the same filename in different distributions")
cmd.Flag.String("origin", "", "overwrite origin name to publish")
cmd.Flag.String("label", "", "overwrite label to publish")
cmd.Flag.String("version", "", "version of the release")

return cmd
}
8 changes: 8 additions & 0 deletions deb/publish.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ type PublishedRepo struct {
Label string
Suite string
Codename string
Version string
// Architectures is a list of all architectures published
Architectures []string
// SourceKind is "local"/"repo"
Expand Down Expand Up @@ -525,6 +526,7 @@ func (p *PublishedRepo) MarshalJSON() ([]byte, error) {
"Origin": p.Origin,
"Suite": p.Suite,
"Codename": p.Codename,
"Version": p.Version,
"NotAutomatic": p.NotAutomatic,
"ButAutomaticUpgrades": p.ButAutomaticUpgrades,
"Prefix": p.Prefix,
Expand Down Expand Up @@ -1079,6 +1081,9 @@ func (p *PublishedRepo) Publish(packagePool aptly.PackagePool, publishedStorageP
if p.SignedBy != "" {
release["Signed-By"] = p.SignedBy
}
if p.Version != "" {
release["Version"] = p.Version
}

var bufWriter *bufio.Writer
bufWriter, err = indexes.ReleaseIndex(component, arch, udeb).BufWriter()
Expand Down Expand Up @@ -1151,6 +1156,9 @@ func (p *PublishedRepo) Publish(packagePool aptly.PackagePool, publishedStorageP
// Let's use a century as a "forever" value.
release["Valid-Until"] = date_now.AddDate(100, 0, 0).Format(datetime_format)
}
if p.Version != "" {
release["Version"] = p.Version
}
release["Description"] = " Generated by aptly\n"
release["MD5Sum"] = ""
release["SHA1"] = ""
Expand Down
12 changes: 12 additions & 0 deletions man/aptly.1
Original file line number Diff line number Diff line change
Expand Up @@ -1569,6 +1569,10 @@ Options:
set value for Signed-By field
.
.TP
\-\fBversion\fR
version of the release
.
.TP
\-\fBacquire\-by\-hash\fR
provide index files by hash
.
Expand Down Expand Up @@ -1714,6 +1718,10 @@ Options:
set value for Signed-By field
.
.TP
\-\fBversion\fR
version of the release
.
.TP
\-\fBacquire\-by\-hash\fR
provide index files by hash
.
Expand Down Expand Up @@ -2187,6 +2195,10 @@ Options:
set value for Signed-By field
.
.TP
\-\fBversion\fR
version of the release
.
.TP
\-\fBbatch\fR
run GPG with detached tty
.
Expand Down
12 changes: 8 additions & 4 deletions system/t06_publish/PublishList5Test_gold
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@
}
],
"Storage": "",
"Suite": ""
"Suite": "",
"Version": ""
},
{
"AcquireByHash": false,
Expand All @@ -50,7 +51,8 @@
}
],
"Storage": "",
"Suite": ""
"Suite": "",
"Version": ""
},
{
"AcquireByHash": false,
Expand All @@ -77,7 +79,8 @@
}
],
"Storage": "",
"Suite": ""
"Suite": "",
"Version": ""
},
{
"AcquireByHash": false,
Expand All @@ -104,6 +107,7 @@
}
],
"Storage": "",
"Suite": ""
"Suite": "",
"Version": ""
}
]
14 changes: 14 additions & 0 deletions system/t06_publish/PublishRepo36Test_gold
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
Loading packages...
Generating metadata files and linking package files...
Finalizing metadata files...
Signing file 'Release' with gpg, please enter your passphrase when prompted:
Clearsigning file 'Release' with gpg, please enter your passphrase when prompted:

Local repo local-repo has been successfully published.
Please setup your webserver to serve directory '${HOME}/.aptly/public' with autoindexing.
Now you can add following line to apt sources:
deb http://your-server/ maverick contrib
deb-src http://your-server/ maverick contrib
Don't forget to add your GPG key to apt with apt-key.

You can also use `aptly serve` to publish your repositories over HTTP quickly.
12 changes: 12 additions & 0 deletions system/t06_publish/PublishRepo36Test_release
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
Origin: . maverick
Label: label36
Suite: maverick
Version: 13.3
Codename: maverick
Architectures: i386
Components: contrib
Description: Generated by aptly
MD5Sum:
SHA1:
SHA256:
SHA512:
3 changes: 2 additions & 1 deletion system/t06_publish/PublishShow3Test_gold
Original file line number Diff line number Diff line change
Expand Up @@ -23,5 +23,6 @@
}
],
"Storage": "",
"Suite": ""
"Suite": "",
"Version": ""
}
3 changes: 2 additions & 1 deletion system/t06_publish/PublishShow4Test_gold
Original file line number Diff line number Diff line change
Expand Up @@ -23,5 +23,6 @@
}
],
"Storage": "",
"Suite": ""
"Suite": "",
"Version": ""
}
1 change: 1 addition & 0 deletions system/t06_publish/PublishSnapshot24Test_release
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
Origin: aptly24
Label: . squeeze
Suite: squeeze
Version: 13.3
Codename: squeeze
NotAutomatic: yes
ButAutomaticUpgrades: yes
Expand Down
1 change: 1 addition & 0 deletions system/t06_publish/PublishSwitch17Test_release
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
Origin: LP-PPA-gladky-anton-gnuplot
Label: . maverick
Suite: maverick
Version: 13.3
Codename: maverick
Signed-By: a,string
Architectures: amd64 i386
Expand Down
1 change: 1 addition & 0 deletions system/t06_publish/PublishUpdate20Test_release
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
Origin: earth
Label: fun
Suite: maverick
Version: 13.3
Codename: maverick
Architectures: i386
Components: main
Expand Down
9 changes: 9 additions & 0 deletions system/t06_publish/PublishUpdate21Test_gold
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
Loading packages...
Generating metadata files and linking package files...
Finalizing metadata files...
Signing file 'Release' with gpg, please enter your passphrase when prompted:
Clearsigning file 'Release' with gpg, please enter your passphrase when prompted:
Cleaning up published repository ./maverick...
Cleaning up component 'main'...

Published local repository ./maverick [i386, source] publishes {main: [local-repo]} has been updated successfully.
11 changes: 11 additions & 0 deletions system/t06_publish/PublishUpdate21Test_release
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
Origin: . maverick
Label: . maverick
Suite: maverick
Codename: maverick
Architectures: i386
Components: main
Description: Generated by aptly
MD5Sum:
SHA1:
SHA256:
SHA512:
19 changes: 19 additions & 0 deletions system/t06_publish/repo.py
Original file line number Diff line number Diff line change
Expand Up @@ -970,3 +970,22 @@ def check(self):
# verify contents except of sums
self.check_file_contents(
'public/dists/maverick/Release', 'release', match_prepare=strip_processor)


class PublishRepo36Test(BaseTest):
"""
publish repo: custom version
"""
fixtureCmds = [
"aptly repo create local-repo",
"aptly repo add local-repo ${files}",
]
runCmd = "aptly publish repo -keyring=${files}/aptly.pub -secret-keyring=${files}/aptly.sec -distribution=maverick -component=contrib -label=label36 -version=13.3 local-repo"
gold_processor = BaseTest.expand_environ

def check(self):
super(PublishRepo36Test, self).check()

# verify contents except of sums
self.check_file_contents(
'public/dists/maverick/Release', 'release', match_prepare=strip_processor)
4 changes: 2 additions & 2 deletions system/t06_publish/snapshot.py
Original file line number Diff line number Diff line change
Expand Up @@ -690,15 +690,15 @@ class PublishSnapshot23Test(BaseTest):

class PublishSnapshot24Test(BaseTest):
"""
publish snapshot: custom origin, notautomatic and butautomaticupgrades
publish snapshot: custom origin, version, notautomatic and butautomaticupgrades
"""
fixtureDB = True
fixturePool = True
fixtureCmds = [
"aptly snapshot create snap24 from mirror gnuplot-maverick",
]
sortOutput = True
runCmd = "aptly publish snapshot -keyring=${files}/aptly.pub -secret-keyring=${files}/aptly.sec -distribution=squeeze -origin=aptly24 -notautomatic=yes -butautomaticupgrades=yes snap24"
runCmd = "aptly publish snapshot -keyring=${files}/aptly.pub -secret-keyring=${files}/aptly.sec -distribution=squeeze -origin=aptly24 -version=13.3 -notautomatic=yes -butautomaticupgrades=yes snap24"
gold_processor = BaseTest.expand_environ

def check(self):
Expand Down
4 changes: 2 additions & 2 deletions system/t06_publish/switch.py
Original file line number Diff line number Diff line change
Expand Up @@ -607,7 +607,7 @@ def check(self):

class PublishSwitch17Test(BaseTest):
"""
publish switch: signed-by
publish switch: signed-by, version
"""
fixtureDB = True
fixturePool = True
Expand All @@ -616,7 +616,7 @@ class PublishSwitch17Test(BaseTest):
"aptly snapshot create snap2 from mirror gnuplot-maverick",
"aptly publish snapshot -keyring=${files}/aptly.pub -secret-keyring=${files}/aptly.sec -distribution=maverick snap1",
]
runCmd = "aptly publish switch -keyring=${files}/aptly.pub -secret-keyring=${files}/aptly.sec -signed-by=a,string maverick snap2"
runCmd = "aptly publish switch -keyring=${files}/aptly.pub -secret-keyring=${files}/aptly.sec -signed-by=a,string -version=13.3 maverick snap2"
gold_processor = BaseTest.expand_environ

def check(self):
Expand Down
Loading
Loading