mirror of
https://github.com/freedomofpress/dangerzone.git
synced 2025-04-28 18:02:38 +02:00
Add a --distro option to build-deb.py
Add an optional --distro argument to build-deb.py, to specify the Debian version in the package name, which currently is "1". This option may prove useful when publishing packages to freedomofpress/apt-tools-prod, where packages from different distros with the same names but different contents are not accepted.
This commit is contained in:
parent
b49d6de6bd
commit
c26326450b
1 changed files with 40 additions and 4 deletions
|
@ -1,5 +1,7 @@
|
||||||
#!/usr/bin/env python3
|
#!/usr/bin/env python3
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
|
import argparse
|
||||||
import inspect
|
import inspect
|
||||||
import os
|
import os
|
||||||
import shutil
|
import shutil
|
||||||
|
@ -21,6 +23,22 @@ def run(cmd):
|
||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
|
parser = argparse.ArgumentParser(
|
||||||
|
prog=sys.argv[0],
|
||||||
|
description="Dev script for building Dangerzone debs",
|
||||||
|
)
|
||||||
|
# FIXME: The name of the distro is important, as it can help users who are upgrading
|
||||||
|
# from a distro version to another. If we *do* need to provide a name at some point,
|
||||||
|
# here's a suggestion on how we should tackle naming:
|
||||||
|
#
|
||||||
|
# https://github.com/freedomofpress/dangerzone/pull/322#issuecomment-1428665162
|
||||||
|
parser.add_argument(
|
||||||
|
"--distro",
|
||||||
|
required=False,
|
||||||
|
help="The name of the Debian-based distro",
|
||||||
|
)
|
||||||
|
args = parser.parse_args()
|
||||||
|
|
||||||
dist_path = os.path.join(root, "dist")
|
dist_path = os.path.join(root, "dist")
|
||||||
deb_dist_path = os.path.join(root, "deb_dist")
|
deb_dist_path = os.path.join(root, "deb_dist")
|
||||||
|
|
||||||
|
@ -31,13 +49,31 @@ def main():
|
||||||
shutil.rmtree(deb_dist_path)
|
shutil.rmtree(deb_dist_path)
|
||||||
|
|
||||||
print("* Building DEB package")
|
print("* Building DEB package")
|
||||||
# This command also builds the Debian source package, and then creates the DEB
|
# NOTE: This command first builds the Debian source package, and then creates the
|
||||||
# package, meaning that we don't need to run `sdist_dsc` as well.
|
# final DEB package. We could simply call `bdist_deb`, which performs `sdist_dsc`
|
||||||
run(["python3", "setup.py", "--command-packages=stdeb.command", "bdist_deb"])
|
# implicitly, but we wouldn't be able to pass the Debian version argument. Because
|
||||||
|
# we do this in a single invocation though, there's no performance cost.
|
||||||
|
if args.distro is None:
|
||||||
|
deb_ver_args = ()
|
||||||
|
deb_ver = "1"
|
||||||
|
else:
|
||||||
|
deb_ver_args = ("--debian-version", args.distro)
|
||||||
|
deb_ver = args.distro
|
||||||
|
|
||||||
|
run(
|
||||||
|
[
|
||||||
|
"python3",
|
||||||
|
"setup.py",
|
||||||
|
"--command-packages=stdeb.command",
|
||||||
|
"sdist_dsc",
|
||||||
|
*deb_ver_args,
|
||||||
|
"bdist_deb",
|
||||||
|
]
|
||||||
|
)
|
||||||
|
|
||||||
print("")
|
print("")
|
||||||
print("* To install run:")
|
print("* To install run:")
|
||||||
print("sudo dpkg -i deb_dist/dangerzone_{}-1_all.deb".format(version))
|
print(f"sudo dpkg -i deb_dist/dangerzone_{version}-{deb_ver}_all.deb")
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
|
|
Loading…
Reference in a new issue