generate Packages.gz event if --no-dput is given (#59604)

This commit is contained in:
Frédéric Péters 2021-12-12 16:02:36 +01:00
parent 26d0ce3d3a
commit d4debeef85
1 changed files with 32 additions and 31 deletions

View File

@ -353,7 +353,7 @@ def build_project(dist, arch, project, package, new):
touch(source_build)
def send_packages(dist, arch, project, package, last_tag):
def send_packages(dist, arch, project, package, last_tag, dput=True):
stamp_file = os.path.join(
project['lock_path'],
'%s_%s_%s_%s_%s.upload'
@ -376,33 +376,37 @@ def send_packages(dist, arch, project, package, last_tag):
'apt-ftparchive packages . | gzip > Packages.gz', cwd=pbuilder_project_result, shell=True
)
print("+ Sending package...")
os.chdir(pbuilder_project_result)
call(
"dput -u %s %s_%s_%s.changes"
% (package['repository'], package['source_name'], package['version'].split(':', 1)[-1], arch)
)
if dput:
print("+ Sending package...")
os.chdir(pbuilder_project_result)
call(
"dput -u %s %s_%s_%s.changes"
% (package['repository'], package['source_name'], package['version'].split(':', 1)[-1], arch)
)
print("+ Updating repository ...")
call('ssh root@%s "/etc/cron.hourly/process-incoming"' % settings.REPOSITORY_URL)
old_version = tuple(int(d) for d in last_tag.split('.'))
new_version = tuple(int(d) for d in project['current_tag'].split('.'))
if new_version > old_version and project['current_tag'] == project['version']:
print("New tag detected : %s" % project['current_tag'])
if package['source_name'] in settings.MANUAL_TESTING_REPOSITORIES:
package_repos = settings.MANUAL_TESTING_REPOSITORIES[package['source_name']]
else:
package_repos = settings.DEFAULT_TESTING_REPOSITORIES
packages = package['names'] + [package['source_name']]
packages = " ".join(packages)
if dist in package_repos and package['copy_in_testing']:
for repo in package_repos[dist]:
print("+ Copy %s packages to %s repository (%s)" % (package['source_name'], repo, dist))
call(
'ssh root@%s "/usr/bin/reprepro -b /var/vhosts/deb.entrouvert.org copy %s %s %s"'
% (settings.REPOSITORY_URL, repo, package['repository'], packages)
)
call('ssh root@%s /usr/local/bin/update-deb-repo-html' % settings.REPOSITORY_URL)
print("+ Updating repository ...")
call('ssh root@%s "/etc/cron.hourly/process-incoming"' % settings.REPOSITORY_URL)
old_version = tuple(int(d) for d in last_tag.split('.'))
new_version = tuple(int(d) for d in project['current_tag'].split('.'))
if new_version > old_version and project['current_tag'] == project['version']:
print("New tag detected : %s" % project['current_tag'])
if package['source_name'] in settings.MANUAL_TESTING_REPOSITORIES:
package_repos = settings.MANUAL_TESTING_REPOSITORIES[package['source_name']]
else:
package_repos = settings.DEFAULT_TESTING_REPOSITORIES
packages = package['names'] + [package['source_name']]
packages = " ".join(packages)
if dist in package_repos and package['copy_in_testing']:
for repo in package_repos[dist]:
print("+ Copy %s packages to %s repository (%s)" % (package['source_name'], repo, dist))
call(
'ssh root@%s "/usr/bin/reprepro -b /var/vhosts/deb.entrouvert.org copy %s %s %s"'
% (settings.REPOSITORY_URL, repo, package['repository'], packages)
)
call('ssh root@%s /usr/local/bin/update-deb-repo-html' % settings.REPOSITORY_URL)
else:
print("+ Package not sent to repository (--no-dput used).")
return
open(stamp_file, 'w').close()
@ -552,10 +556,7 @@ def main():
if package:
for arch in options.architectures:
build_project(dist, arch, project, package, new)
if options.dput:
send_packages(dist, arch, project, package, last_tag)
else:
print("+ Package not sent to repository (--no-dput used).")
send_packages(dist, arch, project, package, last_tag, dput=options.dput)
print("+ Add a build file to lock new build for %s" % dist)
touch(
os.path.join(