mirror of
https://github.com/freedomofpress/dangerzone.git
synced 2025-04-28 18:02:38 +02:00
WIP: Fix doit
This commit is contained in:
parent
560f83d7d6
commit
0e79d01ed6
3 changed files with 45 additions and 23 deletions
41
dodo.py
41
dodo.py
|
@ -175,8 +175,7 @@ def task_init_release_dir():
|
||||||
|
|
||||||
return {
|
return {
|
||||||
"actions": [create_release_dir],
|
"actions": [create_release_dir],
|
||||||
"targets": [RELEASE_DIR, RELEASE_DIR / "github", RELEASE_DIR / "tmp"],
|
"clean": [f"rm -rf {RELEASE_DIR}"],
|
||||||
"clean": True,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -199,13 +198,13 @@ def task_download_tessdata():
|
||||||
|
|
||||||
def task_build_image():
|
def task_build_image():
|
||||||
"""Build the container image using ./install/common/build-image.py"""
|
"""Build the container image using ./install/common/build-image.py"""
|
||||||
img_src = "share/container-{VERSION}.tar.gz"
|
img_src = f"share/container-{VERSION}.tar.gz"
|
||||||
img_dst = RELEASE_DIR / "container-{VERSION}.tar.gz" # FIXME: Add arch
|
img_dst = RELEASE_DIR / f"container-{VERSION}.tar.gz" # FIXME: Add arch
|
||||||
|
|
||||||
return {
|
return {
|
||||||
"actions": [
|
"actions": [
|
||||||
"python install/common/build-image.py --use-cache=%(use_cache)s",
|
"python install/common/build-image.py --use-cache=%(use_cache)s --force-tag=%(force_tag)s",
|
||||||
"cp {img_src} {img_dst}",
|
f"cp {img_src} {img_dst}",
|
||||||
],
|
],
|
||||||
"params": [
|
"params": [
|
||||||
{
|
{
|
||||||
|
@ -217,6 +216,15 @@ def task_build_image():
|
||||||
),
|
),
|
||||||
"default": False,
|
"default": False,
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"name": "force_tag",
|
||||||
|
"long": "force-tag",
|
||||||
|
"help": (
|
||||||
|
"Build the image using the specified tag. For reproducibility"
|
||||||
|
" reasons, it's best to not use this flag"
|
||||||
|
),
|
||||||
|
"default": "",
|
||||||
|
},
|
||||||
],
|
],
|
||||||
"file_dep": [
|
"file_dep": [
|
||||||
"Dockerfile",
|
"Dockerfile",
|
||||||
|
@ -226,7 +234,10 @@ def task_build_image():
|
||||||
"install/common/build-image.py",
|
"install/common/build-image.py",
|
||||||
],
|
],
|
||||||
"targets": [img_src, img_dst],
|
"targets": [img_src, img_dst],
|
||||||
"task_dep": ["check_container_runtime"],
|
"task_dep": [
|
||||||
|
"init_release_dir",
|
||||||
|
"check_container_runtime",
|
||||||
|
],
|
||||||
"clean": True,
|
"clean": True,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -242,7 +253,7 @@ def task_macos_build_dmg():
|
||||||
"""Build the macOS app bundle for Dangerzone."""
|
"""Build the macOS app bundle for Dangerzone."""
|
||||||
dz_dir = RELEASE_DIR / "tmp" / "macos"
|
dz_dir = RELEASE_DIR / "tmp" / "macos"
|
||||||
dmg_src = dz_dir / "dist" / "Dangerzone.dmg"
|
dmg_src = dz_dir / "dist" / "Dangerzone.dmg"
|
||||||
dmg_dst = RELEASE_DIR / "Dangerzone-{VERSION}.dmg" # FIXME: Add -arch
|
dmg_dst = RELEASE_DIR / f"Dangerzone-{VERSION}.dmg" # FIXME: Add -arch
|
||||||
|
|
||||||
return {
|
return {
|
||||||
"actions": [
|
"actions": [
|
||||||
|
@ -256,7 +267,6 @@ def task_macos_build_dmg():
|
||||||
],
|
],
|
||||||
"params": [PARAM_APPLE_ID],
|
"params": [PARAM_APPLE_ID],
|
||||||
"file_dep": [
|
"file_dep": [
|
||||||
RELEASE_DIR,
|
|
||||||
"poetry.lock",
|
"poetry.lock",
|
||||||
"install/macos/build.app.py",
|
"install/macos/build.app.py",
|
||||||
*list_files("assets"),
|
*list_files("assets"),
|
||||||
|
@ -264,7 +274,10 @@ def task_macos_build_dmg():
|
||||||
*list_files("dangerzone"),
|
*list_files("dangerzone"),
|
||||||
f"share/container-{VERSION}.tar.gz",
|
f"share/container-{VERSION}.tar.gz",
|
||||||
],
|
],
|
||||||
"task_dep": ["poetry_install"],
|
"task_dep": [
|
||||||
|
"init_release_dir",
|
||||||
|
"poetry_install"
|
||||||
|
],
|
||||||
"targets": [dmg_dst],
|
"targets": [dmg_dst],
|
||||||
"clean": True,
|
"clean": True,
|
||||||
}
|
}
|
||||||
|
@ -318,15 +331,15 @@ def task_debian_deb():
|
||||||
["rm", "-r", dz_dir],
|
["rm", "-r", dz_dir],
|
||||||
],
|
],
|
||||||
"file_dep": [
|
"file_dep": [
|
||||||
RELEASE_DIR,
|
|
||||||
"poetry.lock",
|
"poetry.lock",
|
||||||
"install/linux/build-deb.py",
|
"install/linux/build-deb.py",
|
||||||
*list_files("assets"),
|
*list_files("assets"),
|
||||||
*list_files("share"),
|
*list_files("share"),
|
||||||
*list_files("dangerzone"),
|
*list_files("dangerzone"),
|
||||||
"share/container-{VERSION}.tar.gz",
|
f"share/container-{VERSION}.tar.gz",
|
||||||
],
|
],
|
||||||
"task_dep": [
|
"task_dep": [
|
||||||
|
"init_release_dir",
|
||||||
"debian_env",
|
"debian_env",
|
||||||
],
|
],
|
||||||
"targets": [deb_dst],
|
"targets": [deb_dst],
|
||||||
|
@ -374,15 +387,15 @@ def task_fedora_rpm():
|
||||||
["rm", "-r", dz_dir],
|
["rm", "-r", dz_dir],
|
||||||
],
|
],
|
||||||
"file_dep": [
|
"file_dep": [
|
||||||
RELEASE_DIR,
|
|
||||||
"poetry.lock",
|
"poetry.lock",
|
||||||
"install/linux/build-rpm.py",
|
"install/linux/build-rpm.py",
|
||||||
*list_files("assets"),
|
*list_files("assets"),
|
||||||
*list_files("share"),
|
*list_files("share"),
|
||||||
*list_files("dangerzone"),
|
*list_files("dangerzone"),
|
||||||
"share/container-{VERSION}.tar.gz",
|
f"share/container-{VERSION}.tar.gz",
|
||||||
],
|
],
|
||||||
"task_dep": [
|
"task_dep": [
|
||||||
|
"init_release_dir",
|
||||||
f"fedora_env:{version}",
|
f"fedora_env:{version}",
|
||||||
],
|
],
|
||||||
"targets": rpm_dst,
|
"targets": rpm_dst,
|
||||||
|
|
|
@ -56,19 +56,27 @@ def main():
|
||||||
const=True,
|
const=True,
|
||||||
help="Use the builder's cache to speed up the builds (not suitable for release builds)",
|
help="Use the builder's cache to speed up the builds (not suitable for release builds)",
|
||||||
)
|
)
|
||||||
|
parser.add_argument(
|
||||||
|
"--force-tag",
|
||||||
|
default=None,
|
||||||
|
help="Force tag the image with this tag",
|
||||||
|
)
|
||||||
args = parser.parse_args()
|
args = parser.parse_args()
|
||||||
|
|
||||||
print(f"Building for architecture '{ARCH}'")
|
print(f"Building for architecture '{ARCH}'")
|
||||||
dirty_tag = secrets.token_hex(2)
|
dirty_tag = secrets.token_hex(2)
|
||||||
|
|
||||||
tag = subprocess.check_output(
|
if not args.force_tag:
|
||||||
[
|
tag = subprocess.check_output(
|
||||||
"git",
|
[
|
||||||
"describe",
|
"git",
|
||||||
"--first-parent",
|
"describe",
|
||||||
f"--dirty=-{dirty_tag}"
|
"--first-parent",
|
||||||
],
|
f"--dirty=-{dirty_tag}"
|
||||||
).decode().strip()[1:] # remove the "v" prefix of the tag.
|
],
|
||||||
|
).decode().strip()[1:] # remove the "v" prefix of the tag.
|
||||||
|
else:
|
||||||
|
tag = args.force_tag
|
||||||
image_name_tagged = IMAGE_NAME + ":" + tag
|
image_name_tagged = IMAGE_NAME + ":" + tag
|
||||||
|
|
||||||
print(f"Will tag the container image as '{image_name_tagged}'")
|
print(f"Will tag the container image as '{image_name_tagged}'")
|
||||||
|
|
|
@ -83,8 +83,9 @@ apple_id = "fpf@example.com"
|
||||||
[tool.doit.tasks.macos_codesign]
|
[tool.doit.tasks.macos_codesign]
|
||||||
apple_id = "fpf@example.com"
|
apple_id = "fpf@example.com"
|
||||||
|
|
||||||
[tool.doit.tasks.build_container]
|
[tool.doit.tasks.build_image]
|
||||||
use_cache = false
|
use_cache = false
|
||||||
|
force_tag = ""
|
||||||
|
|
||||||
[build-system]
|
[build-system]
|
||||||
requires = ["poetry-core>=1.2.0"]
|
requires = ["poetry-core>=1.2.0"]
|
||||||
|
|
Loading…
Reference in a new issue