mirror of
https://github.com/aptly-dev/aptly.git
synced 2026-01-12 03:21:33 +00:00
Allow publishing of empty snapshots and local repos. #55
This commit is contained in:
@@ -44,6 +44,10 @@ func aptlyPublishSnapshotOrRepo(cmd *commander.Command, args []string) error {
|
||||
|
||||
source = snapshot
|
||||
message = fmt.Sprintf("Snapshot %s", snapshot.Name)
|
||||
|
||||
if snapshot.NumPackages() == 0 {
|
||||
context.Progress().Printf("Warning: publishing from empty source, architectures list should be complete, it can't be changed after publishing (use -architectures flag)\n")
|
||||
}
|
||||
} else if cmd.Name() == "repo" {
|
||||
var localRepo *deb.LocalRepo
|
||||
localRepo, err = context.CollectionFactory().LocalRepoCollection().ByName(name)
|
||||
@@ -58,6 +62,10 @@ func aptlyPublishSnapshotOrRepo(cmd *commander.Command, args []string) error {
|
||||
|
||||
source = localRepo
|
||||
message = fmt.Sprintf("Local repo %s", localRepo.Name)
|
||||
|
||||
if localRepo.NumPackages() == 0 {
|
||||
context.Progress().Printf("Warning: publishing from empty source, architectures list should be complete, it can't be changed after publishing (use -architectures flag)\n")
|
||||
}
|
||||
} else {
|
||||
panic("unknown command")
|
||||
}
|
||||
|
||||
@@ -282,10 +282,6 @@ func (p *PublishedRepo) Publish(packagePool aptly.PackagePool, publishedStorage
|
||||
return fmt.Errorf("unable to load packages: %s", err)
|
||||
}
|
||||
|
||||
if list.Len() == 0 {
|
||||
return fmt.Errorf("source is empty")
|
||||
}
|
||||
|
||||
if !p.rePublishing {
|
||||
if len(p.Architectures) == 0 {
|
||||
p.Architectures = list.Architectures(true)
|
||||
|
||||
@@ -1,2 +1,3 @@
|
||||
Warning: publishing from empty source, architectures list should be complete, it can't be changed after publishing (use -architectures flag)
|
||||
Loading packages...
|
||||
ERROR: unable to publish: source is empty
|
||||
ERROR: unable to publish: unable to figure out list of architectures, please supply explicit list
|
||||
|
||||
14
system/t06_publish/PublishRepo16Test_gold
Normal file
14
system/t06_publish/PublishRepo16Test_gold
Normal file
@@ -0,0 +1,14 @@
|
||||
Warning: publishing from empty source, architectures list should be complete, it can't be changed after publishing (use -architectures flag)
|
||||
Loading packages...
|
||||
Generating metadata files and linking package files...
|
||||
Signing file '${HOME}/.aptly/public/dists/maverick/Release' with gpg, please enter your passphrase when prompted:
|
||||
Clearsigning file '${HOME}/.aptly/public/dists/maverick/Release' with gpg, please enter your passphrase when prompted:
|
||||
|
||||
Local repo local-repo has been successfully published.
|
||||
Please setup your webserver to serve directory '/Users/smira/.aptly/public' with autoindexing.
|
||||
Now you can add following line to apt sources:
|
||||
deb http://your-server/ maverick main
|
||||
deb-src http://your-server/ maverick main
|
||||
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.
|
||||
@@ -1,2 +1,3 @@
|
||||
Warning: publishing from empty source, architectures list should be complete, it can't be changed after publishing (use -architectures flag)
|
||||
Loading packages...
|
||||
ERROR: unable to publish: source is empty
|
||||
ERROR: unable to publish: unable to figure out list of architectures, please supply explicit list
|
||||
|
||||
13
system/t06_publish/PublishSnapshot25Test_gold
Normal file
13
system/t06_publish/PublishSnapshot25Test_gold
Normal file
@@ -0,0 +1,13 @@
|
||||
Warning: publishing from empty source, architectures list should be complete, it can't be changed after publishing (use -architectures flag)
|
||||
Loading packages...
|
||||
Generating metadata files and linking package files...
|
||||
Signing file '${HOME}/.aptly/public/dists/maverick/Release' with gpg, please enter your passphrase when prompted:
|
||||
Clearsigning file '${HOME}/.aptly/public/dists/maverick/Release' with gpg, please enter your passphrase when prompted:
|
||||
|
||||
Snapshot snap25 has been successfully published.
|
||||
Please setup your webserver to serve directory '/Users/smira/.aptly/public' with autoindexing.
|
||||
Now you can add following line to apt sources:
|
||||
deb http://your-server/ maverick main
|
||||
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.
|
||||
@@ -298,7 +298,7 @@ class PublishRepo12Test(BaseTest):
|
||||
|
||||
class PublishRepo13Test(BaseTest):
|
||||
"""
|
||||
publish repo: empty repo is not publishable
|
||||
publish repo: empty repo is not publishable w/o architectures list
|
||||
"""
|
||||
fixtureDB = True
|
||||
fixtureCmds = [
|
||||
@@ -356,3 +356,29 @@ class PublishRepo15Test(BaseTest):
|
||||
|
||||
# verify contents except of sums
|
||||
self.check_file_contents('public/dists/maverick/Release', 'release', match_prepare=strip_processor)
|
||||
|
||||
|
||||
class PublishRepo16Test(BaseTest):
|
||||
"""
|
||||
publish repo: empty repo is publishable with architectures list
|
||||
"""
|
||||
fixtureDB = True
|
||||
fixtureCmds = [
|
||||
"aptly repo create local-repo",
|
||||
]
|
||||
runCmd = "aptly publish repo -keyring=${files}/aptly.pub -secret-keyring=${files}/aptly.sec -architectures=source,i386 --distribution=maverick local-repo"
|
||||
gold_processor = BaseTest.expand_environ
|
||||
|
||||
def check(self):
|
||||
super(PublishRepo16Test, self).check()
|
||||
|
||||
self.check_exists('public/dists/maverick/InRelease')
|
||||
self.check_exists('public/dists/maverick/Release')
|
||||
self.check_exists('public/dists/maverick/Release.gpg')
|
||||
|
||||
self.check_exists('public/dists/maverick/main/binary-i386/Packages')
|
||||
self.check_exists('public/dists/maverick/main/binary-i386/Packages.gz')
|
||||
self.check_exists('public/dists/maverick/main/binary-i386/Packages.bz2')
|
||||
self.check_exists('public/dists/maverick/main/source/Sources')
|
||||
self.check_exists('public/dists/maverick/main/source/Sources.gz')
|
||||
self.check_exists('public/dists/maverick/main/source/Sources.bz2')
|
||||
|
||||
@@ -322,7 +322,7 @@ class PublishSnapshot13Test(BaseTest):
|
||||
|
||||
class PublishSnapshot14Test(BaseTest):
|
||||
"""
|
||||
publish snapshot: empty snapshot is not publishable
|
||||
publish snapshot: empty snapshot is not publishable w/o architectures list
|
||||
"""
|
||||
fixtureDB = True
|
||||
fixtureCmds = [
|
||||
@@ -575,3 +575,29 @@ class PublishSnapshot24Test(BaseTest):
|
||||
|
||||
# verify contents except of sums
|
||||
self.check_file_contents('public/dists/squeeze/Release', 'release', match_prepare=strip_processor)
|
||||
|
||||
|
||||
class PublishSnapshot25Test(BaseTest):
|
||||
"""
|
||||
publish snapshot: empty snapshot is publishable with architectures list
|
||||
"""
|
||||
fixtureDB = True
|
||||
fixtureCmds = [
|
||||
"aptly snapshot create snap25 empty",
|
||||
]
|
||||
runCmd = "aptly publish snapshot -architectures=amd64 --distribution=maverick -keyring=${files}/aptly.pub -secret-keyring=${files}/aptly.sec snap25"
|
||||
gold_processor = BaseTest.expand_environ
|
||||
|
||||
def check(self):
|
||||
super(PublishSnapshot25Test, self).check()
|
||||
|
||||
self.check_exists('public/dists/maverick/InRelease')
|
||||
self.check_exists('public/dists/maverick/Release')
|
||||
self.check_exists('public/dists/maverick/Release.gpg')
|
||||
|
||||
self.check_not_exists('public/dists/maverick/main/binary-i386/Packages')
|
||||
self.check_not_exists('public/dists/maverick/main/binary-i386/Packages.gz')
|
||||
self.check_not_exists('public/dists/maverick/main/binary-i386/Packages.bz2')
|
||||
self.check_exists('public/dists/maverick/main/binary-amd64/Packages')
|
||||
self.check_exists('public/dists/maverick/main/binary-amd64/Packages.gz')
|
||||
self.check_exists('public/dists/maverick/main/binary-amd64/Packages.bz2')
|
||||
|
||||
Reference in New Issue
Block a user