mirror of
https://github.com/aptly-dev/aptly.git
synced 2026-04-20 19:38:39 +00:00
Merge pull request #1484 from xzhang1/update_label
Support updating label and origin domain of publish
This commit is contained in:
@@ -386,6 +386,10 @@ type publishedRepoUpdateSwitchParams struct {
|
|||||||
SignedBy *string ` json:"SignedBy" example:""`
|
SignedBy *string ` json:"SignedBy" example:""`
|
||||||
// Enable multiple packages with the same filename in different distributions
|
// Enable multiple packages with the same filename in different distributions
|
||||||
MultiDist *bool ` json:"MultiDist" example:"false"`
|
MultiDist *bool ` json:"MultiDist" example:"false"`
|
||||||
|
// Value of Label: field in published repository stanza
|
||||||
|
Label *string ` json:"Label" example:"Debian"`
|
||||||
|
// Value of Origin: field in published repository stanza
|
||||||
|
Origin *string ` json:"Origin" example:"Debian"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// @Summary Update Published Repository
|
// @Summary Update Published Repository
|
||||||
@@ -477,6 +481,14 @@ func apiPublishUpdateSwitch(c *gin.Context) {
|
|||||||
published.MultiDist = *b.MultiDist
|
published.MultiDist = *b.MultiDist
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if b.Label != nil {
|
||||||
|
published.Label = *b.Label
|
||||||
|
}
|
||||||
|
|
||||||
|
if b.Origin != nil {
|
||||||
|
published.Origin = *b.Origin
|
||||||
|
}
|
||||||
|
|
||||||
resources := []string{string(published.Key())}
|
resources := []string{string(published.Key())}
|
||||||
taskName := fmt.Sprintf("Update published %s repository %s/%s", published.SourceKind, published.StoragePrefix(), published.Distribution)
|
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) {
|
maybeRunTaskInBackground(c, taskName, resources, func(out aptly.Progress, _ *task.Detail) (*task.ProcessReturnValue, error) {
|
||||||
@@ -970,6 +982,10 @@ type publishedRepoUpdateParams struct {
|
|||||||
SignedBy *string ` json:"SignedBy" example:""`
|
SignedBy *string ` json:"SignedBy" example:""`
|
||||||
// Enable multiple packages with the same filename in different distributions
|
// Enable multiple packages with the same filename in different distributions
|
||||||
MultiDist *bool ` json:"MultiDist" example:"false"`
|
MultiDist *bool ` json:"MultiDist" example:"false"`
|
||||||
|
// Value of Label: field in published repository stanza
|
||||||
|
Label *string ` json:"Label" example:"Debian"`
|
||||||
|
// Value of Origin: field in published repository stanza
|
||||||
|
Origin *string ` json:"Origin" example:"Debian"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// @Summary Update Published Repository
|
// @Summary Update Published Repository
|
||||||
@@ -1042,6 +1058,14 @@ func apiPublishUpdate(c *gin.Context) {
|
|||||||
published.MultiDist = *b.MultiDist
|
published.MultiDist = *b.MultiDist
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if b.Label != nil {
|
||||||
|
published.Label = *b.Label
|
||||||
|
}
|
||||||
|
|
||||||
|
if b.Origin != nil {
|
||||||
|
published.Origin = *b.Origin
|
||||||
|
}
|
||||||
|
|
||||||
resources := []string{string(published.Key())}
|
resources := []string{string(published.Key())}
|
||||||
taskName := fmt.Sprintf("Update published %s repository %s/%s", published.SourceKind, published.StoragePrefix(), published.Distribution)
|
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) {
|
maybeRunTaskInBackground(c, taskName, resources, func(out aptly.Progress, _ *task.Detail) (*task.ProcessReturnValue, error) {
|
||||||
|
|||||||
@@ -64,6 +64,14 @@ func aptlyPublishUpdate(cmd *commander.Command, args []string) error {
|
|||||||
published.SignedBy = context.Flags().Lookup("signed-by").Value.String()
|
published.SignedBy = context.Flags().Lookup("signed-by").Value.String()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if context.Flags().IsSet("origin") {
|
||||||
|
published.Origin = context.Flags().Lookup("origin").Value.String()
|
||||||
|
}
|
||||||
|
|
||||||
|
if context.Flags().IsSet("label") {
|
||||||
|
published.Label = context.Flags().Lookup("label").Value.String()
|
||||||
|
}
|
||||||
|
|
||||||
if context.Flags().IsSet("multi-dist") {
|
if context.Flags().IsSet("multi-dist") {
|
||||||
published.MultiDist = context.Flags().Lookup("multi-dist").Value.Get().(bool)
|
published.MultiDist = context.Flags().Lookup("multi-dist").Value.Get().(bool)
|
||||||
}
|
}
|
||||||
@@ -132,6 +140,8 @@ Example:
|
|||||||
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("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("skip-cleanup", false, "don't remove unreferenced files in prefix/component")
|
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")
|
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")
|
||||||
|
|
||||||
return cmd
|
return cmd
|
||||||
}
|
}
|
||||||
|
|||||||
9
system/t06_publish/PublishUpdate20Test_gold
Normal file
9
system/t06_publish/PublishUpdate20Test_gold
Normal file
@@ -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 (origin: earth, label: fun) [i386, source] publishes {main: [local-repo]} has been updated successfully.
|
||||||
11
system/t06_publish/PublishUpdate20Test_release
Normal file
11
system/t06_publish/PublishUpdate20Test_release
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
Origin: earth
|
||||||
|
Label: fun
|
||||||
|
Suite: maverick
|
||||||
|
Codename: maverick
|
||||||
|
Architectures: i386
|
||||||
|
Components: main
|
||||||
|
Description: Generated by aptly
|
||||||
|
MD5Sum:
|
||||||
|
SHA1:
|
||||||
|
SHA256:
|
||||||
|
SHA512:
|
||||||
@@ -625,3 +625,25 @@ class PublishUpdate19Test(BaseTest):
|
|||||||
super(PublishUpdate19Test, self).check()
|
super(PublishUpdate19Test, self).check()
|
||||||
|
|
||||||
self.check_file_contents('public/dists/maverick/Release', 'release', match_prepare=strip_processor)
|
self.check_file_contents('public/dists/maverick/Release', 'release', match_prepare=strip_processor)
|
||||||
|
|
||||||
|
|
||||||
|
class PublishUpdate20Test(BaseTest):
|
||||||
|
"""
|
||||||
|
publish update: update label and origin
|
||||||
|
"""
|
||||||
|
fixtureCmds = [
|
||||||
|
"aptly repo create local-repo",
|
||||||
|
"aptly repo add local-repo ${files}/",
|
||||||
|
"aptly publish repo -keyring=${files}/aptly.pub -secret-keyring=${files}/aptly.sec -distribution=maverick -skip-bz2 local-repo",
|
||||||
|
"aptly repo remove local-repo pyspi"
|
||||||
|
]
|
||||||
|
runCmd = "aptly publish update -keyring=${files}/aptly.pub -secret-keyring=${files}/aptly.sec -label=fun -origin=earth maverick"
|
||||||
|
gold_processor = BaseTest.expand_environ
|
||||||
|
|
||||||
|
def check(self):
|
||||||
|
super(PublishUpdate20Test, self).check()
|
||||||
|
|
||||||
|
self.check_exists('public/dists/maverick/InRelease')
|
||||||
|
|
||||||
|
# verify contents except of sums
|
||||||
|
self.check_file_contents('public/dists/maverick/Release', 'release', match_prepare=strip_processor)
|
||||||
|
|||||||
@@ -938,6 +938,8 @@ class PublishSwitchAPITestRepo(APITest):
|
|||||||
"Snapshots": [{"Component": "main", "Name": snapshot2_name}],
|
"Snapshots": [{"Component": "main", "Name": snapshot2_name}],
|
||||||
"Signing": DefaultSigningOptions,
|
"Signing": DefaultSigningOptions,
|
||||||
"SkipContents": True,
|
"SkipContents": True,
|
||||||
|
"Label": "fun",
|
||||||
|
"Origin": "earth",
|
||||||
})
|
})
|
||||||
self.check_task(task)
|
self.check_task(task)
|
||||||
repo_expected = {
|
repo_expected = {
|
||||||
@@ -945,8 +947,8 @@ class PublishSwitchAPITestRepo(APITest):
|
|||||||
'Architectures': ['i386', 'source'],
|
'Architectures': ['i386', 'source'],
|
||||||
'Codename': '',
|
'Codename': '',
|
||||||
'Distribution': 'wheezy',
|
'Distribution': 'wheezy',
|
||||||
'Label': '',
|
'Label': 'fun',
|
||||||
'Origin': '',
|
'Origin': 'earth',
|
||||||
'NotAutomatic': '',
|
'NotAutomatic': '',
|
||||||
'ButAutomaticUpgrades': '',
|
'ButAutomaticUpgrades': '',
|
||||||
'Path': prefix + '/' + 'wheezy',
|
'Path': prefix + '/' + 'wheezy',
|
||||||
@@ -1845,6 +1847,8 @@ class PublishUpdateSourcesAPITestRepo(APITest):
|
|||||||
"Signing": DefaultSigningOptions,
|
"Signing": DefaultSigningOptions,
|
||||||
"SkipBz2": True,
|
"SkipBz2": True,
|
||||||
"SkipContents": True,
|
"SkipContents": True,
|
||||||
|
"Label": "fun",
|
||||||
|
"Origin": "earth",
|
||||||
}
|
}
|
||||||
).status_code, 200)
|
).status_code, 200)
|
||||||
|
|
||||||
@@ -1853,8 +1857,8 @@ class PublishUpdateSourcesAPITestRepo(APITest):
|
|||||||
'Architectures': ['i386', 'source'],
|
'Architectures': ['i386', 'source'],
|
||||||
'Codename': '',
|
'Codename': '',
|
||||||
'Distribution': 'wheezy',
|
'Distribution': 'wheezy',
|
||||||
'Label': '',
|
'Label': 'fun',
|
||||||
'Origin': '',
|
'Origin': 'earth',
|
||||||
'NotAutomatic': '',
|
'NotAutomatic': '',
|
||||||
'ButAutomaticUpgrades': '',
|
'ButAutomaticUpgrades': '',
|
||||||
'Path': prefix + '/' + 'wheezy',
|
'Path': prefix + '/' + 'wheezy',
|
||||||
|
|||||||
Reference in New Issue
Block a user