commit e9f74ed432c9535b0100845aa16bada73fea5875
parent a5d56d1eb501ba877b95ecbf846914db5b42b1a3
Author: parazyd <parazyd@dyne.org>
Date: Tue, 11 Jul 2017 14:29:44 +0200
implement proper rewriting of Release headers
this fixes a bug where we don't have to care about upstream due to
developer laziness and improper handling of Release files from Devuan's
origin/repository generator
Diffstat:
2 files changed, 61 insertions(+), 22 deletions(-)
diff --git a/lib/config.def.py b/lib/config.def.py
@@ -9,7 +9,7 @@ from hashlib import md5, sha1, sha256
cpunm = 4 # number of cpus you want to use for multiprocessing
logdir = './log'
spooldir = './spool'
-gpgdir= './gnupg'
+gpgdir = './gnupg'
signingkey = 'CA608125'
signrelease = True
mergedir = './merged-volatile'
@@ -85,17 +85,49 @@ aliases = {
}
release_aliases = {
- 'ascii': 'testing',
- 'ascii-backports': 'testing-backports',
- 'ascii-proposed-updates': 'testing-proposed-updates',
- 'ascii-security': 'testing-security',
- 'ascii-updates': 'testing-updates',
+ 'ascii': {
+ 'Suite': 'testing',
+ 'Codename': 'ascii',
+ 'Version': '2.0',
+ },
+ 'ascii-backports': {
+ 'Suite': 'testing-backports',
+ 'Codename': 'ascii-backports',
+ },
+ 'ascii-proposed-updates': {
+ 'Suite': 'testing-proposed-updates',
+ 'Codename': 'ascii-proposed-updates',
+ },
+ 'ascii-security': {
+ 'Suite': 'testing-security',
+ 'Codename': 'ascii-security',
+ },
+ 'ascii-updates': {
+ 'Suite': 'testing-updates',
+ 'Codename': 'ascii-updates',
+ },
- 'jessie': 'stable',
- 'jessie-backports': 'stable-backports',
- 'jessie-proposed-updates': 'stable-proposed-updates',
- 'jessie-security': 'stable-security',
- 'jessie-updates': 'stable-updates',
+ 'jessie': {
+ 'Suite': 'stable',
+ 'Codename': 'jessie',
+ 'Version': '1.0',
+ },
+ 'jessie-backports': {
+ 'Suite': 'stable-backports',
+ 'Codename': 'jessie-backports',
+ },
+ 'jessie-proposed-updates': {
+ 'Suite': 'stable-proposed-updates',
+ 'Codename': 'jessie-proposed-updates'
+ },
+ 'jessie-security': {
+ 'Suite': 'stable-security',
+ 'Codename': 'jessie-security',
+ },
+ 'jessie-updates': {
+ 'Suite': 'stable-updates',
+ 'Codename': 'jessie-updates',
+ }
}
categories = ['main', 'contrib', 'non-free']
diff --git a/lib/release.py b/lib/release.py
@@ -13,10 +13,25 @@ from lib.config import (checksums, distrolabel, gpgdir, release_aliases,
from lib.parse import parse_release_head
-def write_release(oldrel, newrel, filelist, r, sign=True):
+def rewrite_release_head(headers):
+ """
+ Rewrites the necessary headers in a Release file
+ Used to override needed values defined in config.release_aliases
+ """
+ if headers['Suite'] in release_aliases:
+ headers['Label'] = distrolabel
+ suitename = headers['Suite']
+ for var in release_aliases[suitename]:
+ headers[var] = release_aliases[suitename][var]
+
+ return headers
+
+
+def write_release(oldrel, newrel, filelist, r, sign=True, rewrite=True):
"""
Generates a valid Release file
if sign=False: do not use gnupg to sign the file
+ if rewrite=True: rewrite the Release headers as defined in the config
Arguments taken: oldrel, newrel, filelist, r
* location of the old Release file (used to take metadata)
@@ -38,16 +53,8 @@ def write_release(oldrel, newrel, filelist, r, sign=True):
rel_cont['Date'] = prettyt1
# rel_cont['Valid-Until'] = prettyt2
- # rewrite Suite to allow for being on stable/testing rather than
- # jessie/ascii/...
- if rel_cont['Suite'] in release_aliases:
- if rel_cont['Suite'] == 'ascii':
- rel_cont['Version'] = '2.0'
- elif rel_cont['Suite'] == 'jessie':
- rel_cont['Version'] = '1.0'
- rel_cont['Label'] = distrolabel
- rel_cont['Codename'] = rel_cont['Suite']
- rel_cont['Suite'] = release_aliases[rel_cont['Suite']]
+ if rewrite:
+ rel_cont = rewrite_release_head(rel_cont)
for k in release_keys:
if k in rel_cont: