publish: persist multidist flag

This commit is contained in:
André Roth
2024-10-07 14:19:22 +02:00
parent 3e7bec5604
commit 861260198a
15 changed files with 310 additions and 55 deletions
+4
View File
@@ -9,6 +9,7 @@
"Codename": "",
"Distribution": "maverick",
"Label": "",
"MultiDist": false,
"NotAutomatic": "",
"Origin": "LP-PPA-gladky-anton-gnuplot",
"Path": "./maverick",
@@ -33,6 +34,7 @@
"Codename": "",
"Distribution": "wheezy",
"Label": "",
"MultiDist": false,
"NotAutomatic": "",
"Origin": "",
"Path": "ppa/smira/wheezy",
@@ -58,6 +60,7 @@
"Codename": "",
"Distribution": "maverick",
"Label": "",
"MultiDist": false,
"NotAutomatic": "",
"Origin": "origin1",
"Path": "ppa/tr1/maverick",
@@ -83,6 +86,7 @@
"Codename": "",
"Distribution": "maverick",
"Label": "label1",
"MultiDist": false,
"NotAutomatic": "",
"Origin": "",
"Path": "ppa/tr2/maverick",
+1
View File
@@ -8,6 +8,7 @@
"Codename": "",
"Distribution": "maverick",
"Label": "",
"MultiDist": false,
"NotAutomatic": "",
"Origin": "LP-PPA-gladky-anton-gnuplot",
"Path": "./maverick",
+1
View File
@@ -8,6 +8,7 @@
"Codename": "",
"Distribution": "maverick",
"Label": "",
"MultiDist": false,
"NotAutomatic": "",
"Origin": "LP-PPA-gladky-anton-gnuplot",
"Path": "ppa/smira/maverick",
@@ -0,0 +1,8 @@
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 prefix "." components main...
Publish for snapshot ./bookworm (origin: LP-PPA-gladky-anton-gnuplot) [amd64, i386] publishes {main: [snap3]: Pulled into 'snap2' with 'snap1' as source, pull request was: 'gnuplot-x11'} has been successfully switched to new snapshot.
@@ -0,0 +1,8 @@
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 prefix "." components main...
Publish for local repo ./bookworm [i386, source] publishes {main: [local-repo]} has been successfully updated.
+29
View File
@@ -581,3 +581,32 @@ class PublishSwitch15Test(BaseTest):
self.check_exists('public/dists/maverick/main/binary-amd64/Packages')
self.check_exists('public/dists/maverick/main/binary-amd64/Packages.gz')
self.check_not_exists('public/dists/maverick/main/binary-amd64/Packages.bz2')
class PublishSwitch16Test(BaseTest):
"""
publish switch: -multi-dist
"""
fixtureDB = True
fixturePool = True
fixtureCmds = [
"aptly snapshot create snap1 from mirror gnuplot-maverick",
"aptly snapshot create snap2 empty",
"aptly snapshot pull -no-deps -architectures=i386,amd64 snap2 snap1 snap3 gnuplot-x11",
"aptly publish snapshot -keyring=${files}/aptly.pub -secret-keyring=${files}/aptly.sec -distribution=bookworm snap1",
]
runCmd = "aptly publish switch -keyring=${files}/aptly.pub -secret-keyring=${files}/aptly.sec -multi-dist bookworm snap3"
gold_processor = BaseTest.expand_environ
def check(self):
super(PublishSwitch16Test, self).check()
self.check_exists('public/dists/bookworm/Release')
self.check_exists('public/dists/bookworm/main/binary-i386/Packages')
self.check_exists('public/dists/bookworm/main/binary-i386/Packages.gz')
self.check_exists('public/dists/bookworm/main/binary-amd64/Packages')
self.check_exists('public/dists/bookworm/main/binary-amd64/Packages.gz')
self.check_exists('public/pool/bookworm/main/g/gnuplot/gnuplot-x11_4.6.1-1~maverick2_amd64.deb')
+25
View File
@@ -462,3 +462,28 @@ class PublishUpdate13Test(BaseTest):
self.check_exists('public/dists/maverick/main/binary-i386/Packages')
self.check_exists('public/dists/maverick/main/binary-i386/Packages.gz')
self.check_not_exists('public/dists/maverick/main/binary-i386/Packages.bz2')
class PublishUpdate14Test(BaseTest):
"""
publish update: -multi-dist
"""
fixtureCmds = [
"aptly repo create local-repo",
"aptly repo add local-repo ${files}/",
"aptly publish repo -keyring=${files}/aptly.pub -distribution=bookworm local-repo",
]
runCmd = "aptly publish update -keyring=${files}/aptly.pub -multi-dist bookworm"
gold_processor = BaseTest.expand_environ
def check(self):
super(PublishUpdate14Test, self).check()
self.check_exists('public/dists/bookworm/InRelease')
self.check_exists('public/dists/bookworm/Release')
self.check_exists('public/dists/bookworm/Release.gpg')
self.check_exists('public/dists/bookworm/main/binary-i386/Packages')
self.check_exists('public/dists/bookworm/main/binary-i386/Packages.gz')
self.check_exists('public/pool/bookworm/main/b/boost-defaults/libboost-program-options-dev_1.49.0.1_i386.deb')
+164
View File
@@ -52,6 +52,7 @@ class PublishAPITestRepo(APITest):
'Path': prefix + '/' + 'wheezy',
'Prefix': prefix,
'SkipContents': False,
'MultiDist': False,
'SourceKind': 'local',
'Sources': [{'Component': 'main', 'Name': repo_name}],
'Storage': '',
@@ -96,6 +97,7 @@ class PublishAPITestRepo(APITest):
'Path': './' + distribution,
'Prefix': ".",
'SkipContents': False,
'MultiDist': False,
'SourceKind': 'local',
'Sources': [{'Component': 'main', 'Name': repo_name}],
'Storage': '',
@@ -122,6 +124,71 @@ class PublishAPITestRepo(APITest):
self.check_in(repo2_expected, all_repos.json())
class PublishAPITestRepoMultiDist(APITest):
"""
Test MultiDist publishing to subdirectory
"""
fixtureGpg = True
def check(self):
repo_name = self.random_name()
self.check_equal(self.post(
"/api/repos", json={"Name": repo_name, "DefaultDistribution": "bookworm"}).status_code, 201)
d = self.random_name()
self.check_equal(self.upload("/api/files/" + d,
"libboost-program-options-dev_1.49.0.1_i386.deb", "pyspi_0.6.1-1.3.dsc",
"pyspi_0.6.1-1.3.diff.gz", "pyspi_0.6.1.orig.tar.gz",
"pyspi-0.6.1-1.3.stripped.dsc").status_code, 200)
task = self.post_task("/api/repos/" + repo_name + "/file/" + d)
self.check_task(task)
# publishing under prefix, default distribution
prefix = self.random_name()
task = self.post_task(
"/api/publish/" + prefix,
json={
"SourceKind": "local",
"MultiDist": True,
"Sources": [{"Name": repo_name}],
"Signing": DefaultSigningOptions,
}
)
self.check_task(task)
repo_expected = {
'AcquireByHash': False,
'Architectures': ['i386', 'source'],
'Codename': '',
'Distribution': 'bookworm',
'Label': '',
'Origin': '',
'NotAutomatic': '',
'ButAutomaticUpgrades': '',
'Path': prefix + '/' + 'bookworm',
'Prefix': prefix,
'SkipContents': False,
'MultiDist': True,
'SourceKind': 'local',
'Sources': [{'Component': 'main', 'Name': repo_name}],
'Storage': '',
'Suite': ''}
all_repos = self.get("/api/publish")
self.check_equal(all_repos.status_code, 200)
self.check_in(repo_expected, all_repos.json())
self.check_exists("public/" + prefix + "/dists/bookworm/Release")
self.check_exists("public/" + prefix +
"/dists/bookworm/main/binary-i386/Packages")
self.check_exists("public/" + prefix +
"/dists/bookworm/main/Contents-i386.gz")
self.check_exists("public/" + prefix +
"/dists/bookworm/main/source/Sources")
self.check_exists(
"public/" + prefix + "/pool/bookworm/main/b/boost-defaults/libboost-program-options-dev_1.49.0.1_i386.deb")
class PublishSnapshotAPITest(APITest):
"""
POST /publish/:prefix (snapshots), GET /publish
@@ -172,6 +239,7 @@ class PublishSnapshotAPITest(APITest):
'Distribution': 'squeeze',
'Label': 'fun',
'Origin': 'earth',
'MultiDist': False,
'NotAutomatic': 'yes',
'ButAutomaticUpgrades': 'yes',
'Path': prefix + '/' + 'squeeze',
@@ -265,6 +333,7 @@ class PublishUpdateAPITestRepo(APITest):
'Path': prefix + '/' + 'wheezy',
'Prefix': prefix,
'SkipContents': False,
'MultiDist': False,
'SourceKind': 'local',
'Sources': [{'Component': 'main', 'Name': repo_name}],
'Storage': '',
@@ -287,6 +356,94 @@ class PublishUpdateAPITestRepo(APITest):
self.check_not_exists("public/" + prefix + "dists/")
class PublishUpdateAPIMultiDist(APITest):
"""
Test MultiDist publishing to subdirectory
"""
fixtureGpg = True
def check(self):
repo_name = self.random_name()
self.check_equal(self.post(
"/api/repos", json={"Name": repo_name, "DefaultDistribution": "bookworm"}).status_code, 201)
d = self.random_name()
self.check_equal(
self.upload("/api/files/" + d,
"pyspi_0.6.1-1.3.dsc",
"pyspi_0.6.1-1.3.diff.gz", "pyspi_0.6.1.orig.tar.gz",
"pyspi-0.6.1-1.3.stripped.dsc").status_code, 200)
task = self.post_task("/api/repos/" + repo_name + "/file/" + d)
self.check_task(task)
prefix = self.random_name()
task = self.post_task(
"/api/publish/" + prefix,
json={
"Architectures": ["i386", "source"],
"SourceKind": "local",
"Sources": [{"Name": repo_name}],
"Signing": DefaultSigningOptions,
}
)
self.check_task(task)
self.check_not_exists(
"public/" + prefix + "/pool/main/b/boost-defaults/libboost-program-options-dev_1.49.0.1_i386.deb")
self.check_exists("public/" + prefix +
"/pool/main/p/pyspi/pyspi-0.6.1-1.3.stripped.dsc")
d = self.random_name()
self.check_equal(self.upload("/api/files/" + d,
"libboost-program-options-dev_1.49.0.1_i386.deb").status_code, 200)
task = self.post_task("/api/repos/" + repo_name + "/file/" + d)
self.check_task(task)
task = self.delete_task("/api/repos/" + repo_name + "/packages/",
json={"PackageRefs": ['Psource pyspi 0.6.1-1.4 f8f1daa806004e89']})
self.check_task(task)
# Update and switch MultiDist on.
task = self.put_task(
"/api/publish/" + prefix + "/bookworm",
json={
"MultiDist": True,
"Signing": DefaultSigningOptions,
}
)
self.check_task(task)
repo_expected = {
'AcquireByHash': False,
'Architectures': ['i386', 'source'],
'Codename': '',
'Distribution': 'bookworm',
'Label': '',
'Origin': '',
'NotAutomatic': '',
'ButAutomaticUpgrades': '',
'Path': prefix + '/' + 'bookworm',
'Prefix': prefix,
'SkipContents': False,
'MultiDist': True,
'SourceKind': 'local',
'Sources': [{'Component': 'main', 'Name': repo_name}],
'Storage': '',
'Suite': ''}
all_repos = self.get("/api/publish")
self.check_equal(all_repos.status_code, 200)
self.check_in(repo_expected, all_repos.json())
self.check_exists(
"public/" + prefix + "/pool/bookworm/main/b/boost-defaults/libboost-program-options-dev_1.49.0.1_i386.deb")
self.check_not_exists(
"public/" + prefix + "/pool/bookworm/main/p/pyspi/pyspi-0.6.1-1.3.stripped.dsc")
task = self.delete_task("/api/publish/" + prefix + "/bookworm")
self.check_task(task)
self.check_not_exists("public/" + prefix + "dists/")
class PublishConcurrentUpdateAPITestRepo(APITest):
"""
PUT /publish/:prefix/:distribution (local repos), DELETE /publish/:prefix/:distribution
@@ -368,6 +525,7 @@ class PublishConcurrentUpdateAPITestRepo(APITest):
'Path': prefix + '/' + 'wheezy',
'Prefix': prefix,
'SkipContents': False,
'MultiDist': False,
'SourceKind': 'local',
'Sources': [{'Component': 'main', 'Name': repo_name}],
'Storage': '',
@@ -465,6 +623,7 @@ class PublishUpdateSkipCleanupAPITestRepo(APITest):
'Path': prefix + '/' + 'wheezy',
'Prefix': prefix,
'SkipContents': False,
'MultiDist': False,
'SourceKind': 'local',
'Sources': [{'Component': 'main', 'Name': repo_name}],
'Storage': '',
@@ -532,6 +691,7 @@ class PublishSwitchAPITestRepo(APITest):
'Path': prefix + '/' + 'wheezy',
'Prefix': prefix,
'SkipContents': False,
'MultiDist': False,
'SourceKind': 'snapshot',
'Sources': [{'Component': 'main', 'Name': snapshot1_name}],
'Storage': '',
@@ -579,6 +739,7 @@ class PublishSwitchAPITestRepo(APITest):
'Path': prefix + '/' + 'wheezy',
'Prefix': prefix,
'SkipContents': True,
'MultiDist': False,
'SourceKind': 'snapshot',
'Sources': [{'Component': 'main', 'Name': snapshot2_name}],
'Storage': '',
@@ -644,6 +805,7 @@ class PublishSwitchAPISkipCleanupTestRepo(APITest):
'Path': prefix + '/' + 'wheezy',
'Prefix': prefix,
'SkipContents': False,
'MultiDist': False,
'SourceKind': 'snapshot',
'Sources': [{'Component': 'main', 'Name': snapshot1_name}],
'Storage': '',
@@ -681,6 +843,7 @@ class PublishSwitchAPISkipCleanupTestRepo(APITest):
'Path': prefix + '/' + 'otherdist',
'Prefix': prefix,
'SkipContents': False,
'MultiDist': False,
'SourceKind': 'snapshot',
'Sources': [{'Component': 'main', 'Name': snapshot1_name}],
'Storage': '',
@@ -723,6 +886,7 @@ class PublishSwitchAPISkipCleanupTestRepo(APITest):
'Path': prefix + '/' + 'wheezy',
'Prefix': prefix,
'SkipContents': True,
'MultiDist': False,
'SourceKind': 'snapshot',
'Sources': [{'Component': 'main', 'Name': snapshot2_name}],
'Storage': '',