mirror of
https://github.com/freedomofpress/dangerzone.git
synced 2025-04-28 18:02:38 +02:00
WIP: Everything works
This commit is contained in:
parent
f55607eb63
commit
0cfa86bf58
1 changed files with 50 additions and 47 deletions
97
dodo.py
97
dodo.py
|
@ -31,13 +31,15 @@ PARAM_APPLE_ID = {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
def list_files(path):
|
def list_files(path, recursive=False):
|
||||||
filepaths = []
|
filepaths = []
|
||||||
for root, _, files in os.walk(path):
|
for root, _, files in os.walk(path):
|
||||||
for f in files:
|
for f in files:
|
||||||
if f.endswith(".pyc"):
|
if f.endswith(".pyc"):
|
||||||
continue
|
continue
|
||||||
filepaths.append(Path(root) / f)
|
filepaths.append(Path(root) / f)
|
||||||
|
if not recursive:
|
||||||
|
break
|
||||||
return filepaths
|
return filepaths
|
||||||
|
|
||||||
|
|
||||||
|
@ -76,7 +78,7 @@ def task_clean_container_runtime():
|
||||||
return {
|
return {
|
||||||
"actions": None,
|
"actions": None,
|
||||||
"clean": [
|
"clean": [
|
||||||
[CONTAINER_RUNTIME, "system", "prune", "-f"],
|
[CONTAINER_RUNTIME, "system", "prune", "-a", "-f"],
|
||||||
],
|
],
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -260,13 +262,14 @@ def task_macos_build_dmg():
|
||||||
"poetry.lock",
|
"poetry.lock",
|
||||||
"install/macos/build-app.py",
|
"install/macos/build-app.py",
|
||||||
*list_files("assets"),
|
*list_files("assets"),
|
||||||
*list_files("share"),
|
*list_files("share", recursive=True),
|
||||||
*list_files("dangerzone"),
|
*list_files("dangerzone", recursive=True),
|
||||||
f"share/container-{VERSION}.tar.gz",
|
f"share/container-{VERSION}.tar.gz",
|
||||||
],
|
],
|
||||||
"task_dep": [
|
"task_dep": [
|
||||||
"init_release_dir",
|
"init_release_dir",
|
||||||
"poetry_install"
|
"poetry_install",
|
||||||
|
"download_tessdata",
|
||||||
],
|
],
|
||||||
"targets": [dmg_dst],
|
"targets": [dmg_dst],
|
||||||
"clean": True,
|
"clean": True,
|
||||||
|
@ -326,7 +329,7 @@ def task_debian_deb():
|
||||||
"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", recursive=True),
|
||||||
f"share/container-{VERSION}.tar.gz",
|
f"share/container-{VERSION}.tar.gz",
|
||||||
],
|
],
|
||||||
"task_dep": [
|
"task_dep": [
|
||||||
|
@ -373,8 +376,8 @@ def task_fedora_rpm():
|
||||||
"name": version + qubes_ident,
|
"name": version + qubes_ident,
|
||||||
"actions": [
|
"actions": [
|
||||||
(copy_dz_dir, [".", dz_dir]),
|
(copy_dz_dir, [".", dz_dir]),
|
||||||
#cmd_build_linux_pkg("fedora", version, cwd=dz_dir, qubes=qubes),
|
cmd_build_linux_pkg("fedora", version, cwd=dz_dir, qubes=qubes),
|
||||||
#["cp", *rpm_src, RELEASE_DIR],
|
["cp", *rpm_src, RELEASE_DIR],
|
||||||
["rm", "-rf", dz_dir],
|
["rm", "-rf", dz_dir],
|
||||||
],
|
],
|
||||||
"file_dep": [
|
"file_dep": [
|
||||||
|
@ -382,7 +385,7 @@ def task_fedora_rpm():
|
||||||
"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", recursive=True),
|
||||||
f"share/container-{VERSION}.tar.gz",
|
f"share/container-{VERSION}.tar.gz",
|
||||||
],
|
],
|
||||||
"task_dep": [
|
"task_dep": [
|
||||||
|
@ -394,41 +397,41 @@ def task_fedora_rpm():
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
def copy_files(dz_dir, apt_dir, src, bookworm_deb, other_debs):
|
#def copy_files(dz_dir, apt_dir, src, bookworm_deb, other_debs):
|
||||||
# Delete previous Dangerzone files.
|
# # Delete previous Dangerzone files.
|
||||||
old_files = dz_dir.rglob("dangerzone_*j")
|
# old_files = dz_dir.rglob("dangerzone_*j")
|
||||||
for f in old_files:
|
# for f in old_files:
|
||||||
f.unlink()
|
# f.unlink()
|
||||||
|
#
|
||||||
# Delete DB entries.
|
# # Delete DB entries.
|
||||||
shutil.rmtree(apt_dir / "db")
|
# shutil.rmtree(apt_dir / "db")
|
||||||
shutil.rmtree(apt_dir / "public" / "dists")
|
# shutil.rmtree(apt_dir / "public" / "dists")
|
||||||
shutil.rmtree(apt_dir / "public" / "pool")
|
# shutil.rmtree(apt_dir / "public" / "pool")
|
||||||
|
#
|
||||||
# Copy .deb to bookworm folder.
|
# # Copy .deb to bookworm folder.
|
||||||
shutil.copy2(src, bookworm_deb)
|
# shutil.copy2(src, bookworm_deb)
|
||||||
|
#
|
||||||
# Create the necessary symlinks
|
# # Create the necessary symlinks
|
||||||
for deb in other_debs:
|
# for deb in other_debs:
|
||||||
deb.symlink_to(f"../bookworm/{deb_name}")
|
# deb.symlink_to(f"../bookworm/{deb_name}")
|
||||||
|
#
|
||||||
|
#
|
||||||
@task_params([{
|
#@task_params([{
|
||||||
"name": "apt_tools_prod_dir",
|
# "name": "apt_tools_prod_dir",
|
||||||
"default": "~/release/apt-tools-prod"
|
# "default": "~/release/apt-tools-prod"
|
||||||
}])
|
#}])
|
||||||
def task_apt_tools_prod_prep(apt_tools_prod_dir):
|
#def task_apt_tools_prod_prep(apt_tools_prod_dir):
|
||||||
apt_dir = Path(apt_tools_prod_dir).expanduser()
|
# apt_dir = Path(apt_tools_prod_dir).expanduser()
|
||||||
dz_dir = apt_dir / "dangerzone"
|
# dz_dir = apt_dir / "dangerzone"
|
||||||
|
#
|
||||||
src = task_debian_deb()["targets"][0]
|
# src = task_debian_deb()["targets"][0]
|
||||||
deb_name = src.name
|
# deb_name = src.name
|
||||||
bookworm_deb = dz_dir / "bookworm" / deb_name
|
# bookworm_deb = dz_dir / "bookworm" / deb_name
|
||||||
other_debs = [dz_dir / version / deb_name for version in DEBIAN_VERSIONS]
|
# other_debs = [dz_dir / version / deb_name for version in DEBIAN_VERSIONS]
|
||||||
|
#
|
||||||
return {
|
# return {
|
||||||
"actions": [(copy_files, [dz_dir, apt_dir, src, bookworm_deb, other_debs])],
|
# "actions": [(copy_files, [dz_dir, apt_dir, src, bookworm_deb, other_debs])],
|
||||||
"file_dep": [src],
|
# "file_dep": [src],
|
||||||
"targets": [bookworm_deb, *other_debs],
|
# "targets": [bookworm_deb, *other_debs],
|
||||||
"clean": True,
|
# "clean": True,
|
||||||
}
|
# }
|
||||||
|
|
Loading…
Reference in a new issue