Skip to content

Commit 57b124d

Browse files
Build one deb package for Ubuntu 22 and 24, include shas for deb and AppImage (#29)
1 parent dc57e15 commit 57b124d

File tree

3 files changed

+24
-38
lines changed

3 files changed

+24
-38
lines changed

build-scripts/build.py

Lines changed: 24 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -520,16 +520,23 @@ class LinuxDebResources:
520520
npm_packages: NpmBuildOutput
521521

522522

523+
@dataclass
524+
class DebBuildOutput:
525+
deb_path: pathlib.Path
526+
sha_path: pathlib.Path
527+
528+
523529
def build_linux_deb(
524530
resources: LinuxDebResources,
525531
control_path: pathlib.Path,
526532
deb_suffix: str,
527533
release: bool,
528-
) -> pathlib.Path:
534+
) -> DebBuildOutput:
529535
"""
530-
Builds a deb using the control file given by `control_path`. Returns the path to the built deb.
536+
Builds a deb using the control file given by `control_path`.
537+
The deb will be named using the format: `f"{LINUX_PACKAGE_NAME}{deb_suffix}.deb"`
531538
532-
The deb will be named using the format: `f"{LINUX_PACKAGE_NAME}_{deb_suffix}.deb"`
539+
This is kept generic in the case that we require different control files per Debian distribution.
533540
"""
534541
info("Packaging deb bundle for control file:", control_path)
535542

@@ -587,11 +594,12 @@ def replace_text(file: pathlib.Path, old: str, new: str):
587594
dpkg_deb_args.append("-z0")
588595
run_cmd([*dpkg_deb_args, bundle_dir], cwd=bundles_dir)
589596

590-
linux_package_path = BUILD_DIR / f"{LINUX_PACKAGE_NAME}_{deb_suffix}.deb"
591-
info("Moving built deb to", linux_package_path)
592-
(bundles_dir / f"{bundle_dir}.deb").rename(linux_package_path)
593-
run_cmd(["dpkg-deb", "--info", linux_package_path])
594-
return linux_package_path
597+
deb_path = BUILD_DIR / f"{LINUX_PACKAGE_NAME}{deb_suffix}.deb"
598+
info("Moving built deb to", deb_path)
599+
(bundles_dir / f"{bundle_dir}.deb").rename(deb_path)
600+
run_cmd(["dpkg-deb", "--info", deb_path])
601+
sha_path = generate_sha(deb_path)
602+
return DebBuildOutput(deb_path=deb_path, sha_path=sha_path)
595603

596604

597605
def build_linux_full(
@@ -677,16 +685,10 @@ def copy_extension(extension_uuid, extension_dir_name):
677685
modern_extension_dir_path=modern_extension_dir_path,
678686
npm_packages=npm_packages,
679687
)
680-
ubuntu22_deb_path = build_linux_deb(
681-
resources=deb_resources,
682-
control_path=pathlib.Path("bundle/deb/control_ubuntu22_deb10-12"),
683-
deb_suffix="ubuntu22_deb10-12",
684-
release=release,
685-
)
686-
ubuntu24_deb_path = build_linux_deb(
688+
deb_output = build_linux_deb(
687689
resources=deb_resources,
688-
control_path=pathlib.Path("bundle/deb/control_ubuntu24_deb13"),
689-
deb_suffix="ubuntu24_deb13",
690+
control_path=pathlib.Path("bundle/deb/control"),
691+
deb_suffix="",
690692
release=release,
691693
)
692694

@@ -699,18 +701,18 @@ def copy_extension(extension_uuid, extension_dir_name):
699701
pathlib.Path(f"{bundle_grandparent_path}/appimage/{bundle_name}.AppImage"),
700702
appimage_path,
701703
)
704+
generate_sha(appimage_path)
702705

703706
signer = load_gpg_signer()
704707
if signer:
705708
info("Signing AppImage")
706709
signatures = signer.sign_file(appimage_path)
707710
run_cmd(["gpg", "--verify", signatures[0], appimage_path], env=signer.gpg_env())
708711

709-
for deb_path in [ubuntu22_deb_path, ubuntu24_deb_path]:
710-
info("Signing deb:", deb_path)
711-
run_cmd(["dpkg-sig", "-k", signer.gpg_id, "-s", "builder", deb_path], env=signer.gpg_env())
712-
run_cmd(["dpkg-sig", "-l", deb_path], env=signer.gpg_env())
713-
run_cmd(["gpg", "--verify", deb_path], env=signer.gpg_env())
712+
info("Signing deb:", deb_output.deb_path)
713+
run_cmd(["dpkg-sig", "-k", signer.gpg_id, "-s", "builder", deb_output.deb_path], env=signer.gpg_env())
714+
run_cmd(["dpkg-sig", "-l", deb_output.deb_path], env=signer.gpg_env())
715+
run_cmd(["gpg", "--verify", deb_output.deb_path], env=signer.gpg_env())
714716

715717
signer.clean()
716718

bundle/deb/control_ubuntu22_deb10-12

Lines changed: 0 additions & 8 deletions
This file was deleted.

bundle/deb/control_ubuntu24_deb13

Lines changed: 0 additions & 8 deletions
This file was deleted.

0 commit comments

Comments
 (0)