Skip to content

Commit

Permalink
refactoring: some style improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
VitaliyaIoffe committed Dec 13, 2021
1 parent 93b845c commit 6f32691
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 9 deletions.
9 changes: 4 additions & 5 deletions debrepo.py
Original file line number Diff line number Diff line change
Expand Up @@ -521,7 +521,7 @@ def process_index_file(repo_info, path, dist, component, arch, index_type):
elif index_type == 'sources':
index = SourceIndex()
else:
raise(RuntimeError('Unknown index type: ' + index_type))
raise RuntimeError('Unknown index type: ' + index_type)

index.parse_string(repo_info.storage.read_file(path).decode('utf-8'))
if index_type == 'packages':
Expand Down Expand Up @@ -636,7 +636,7 @@ def process_index_units(repo_info, tempdir, index_type, force=False):
expr = r'^.*\.dsc$'
tmp_filename = 'source.dsc'
else:
raise(RuntimeError('Unknown index type: ' + index_type))
raise RuntimeError('Unknown index type: ' + index_type)

mtimes = get_mtimes(index_list)
tmpdir = tempfile.mkdtemp('', 'tmp', tempdir)
Expand Down Expand Up @@ -730,7 +730,7 @@ def update_index_files(repo_info, index_type):
index_filename = 'Sources'
index_list = repo_info.source_index_list
else:
raise(RuntimeError('Unknown index type: ' + index_type))
raise RuntimeError('Unknown index type: ' + index_type)

for key in index_list:
dist, component, arch = key
Expand Down Expand Up @@ -800,8 +800,7 @@ def update_release_files(repo_info, sign):
release['Date'] = creation_date
release['Architectures'] = ' '.join(repo_info.architectures[dist])
release['Components'] = ' '.join(repo_info.components[dist])
release['Description'] = os.getenv('MKREPO_DEB_DESCRIPTION')\
or 'Repo generator'
release['Description'] = os.getenv('MKREPO_DEB_DESCRIPTION') or 'Repo generator'

checksum_lines = collections.defaultdict(list)
checksum_names = {'md5': 'MD5Sum', 'sha1': 'SHA1', 'sha256': 'SHA256'}
Expand Down
11 changes: 7 additions & 4 deletions rpmrepo.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,10 @@ def gpg_sign_string(data, keyname=None, inline=False):


def sign_metadata(repomdfile):
"""Requires a proper ~/.rpmmacros file. See <http://fedoranews.org/tchung/gpg/>"""
"""Requires a proper ~/.rpmmacros file.
See <http://fedoranews.org/tchung/gpg/>
"""
cmd = ["gpg", "--detach-sign", "--armor", "--digest-algo SHA256", repomdfile]
try:
subprocess.check_call(cmd)
Expand Down Expand Up @@ -452,8 +455,8 @@ def dump_primary(primary):
for c in ['epoch', 'ver', 'rel'] if ver[c]])
res += '%s/>\n' % components

res += ' <checksum type="sha256" pkgid="YES">%s</checksum>\n' % \
package['checksum']
res += ' <checksum type="sha256" pkgid="YES">%s</checksum>\n' % (
package['checksum'])

res += ' <summary>%s</summary>\n' % escape(package['summary'] or '')
res += ' <description>%s</description>\n' % escape(
Expand Down Expand Up @@ -545,7 +548,7 @@ def parse_ver_str(ver_str):
epoch = match.group(1)[:-1] if match.group(1) else "0"
ver = match.group(2)
rel = match.group(3)[1:] if match.group(3) else None
return (epoch, ver, rel)
return epoch, ver, rel


def header_to_other(header, sha256):
Expand Down

0 comments on commit 6f32691

Please sign in to comment.