Ubuntu 패키지와 Windows 설치 파일을 준비함
- 작성자
- 호시노 히나타
- 작성 시각
- 커밋
a569bc9f828cc06d3404717b7d806b732b12b017- 부모
- 3b9b591
변경된 파일 11개
+245-8| @@ -0,0 +1,16 @@ | ||
| 1 | 추가: # Ubuntu Rust 패키지 | |
| 2 | 추가: | |
| 3 | 추가: Ubuntu 26.04 amd64에서 현재 저장소의 실제 앱과 작업자를 빌드합니다. 배포 게시와 서명은 수행하지 않습니다. | |
| 4 | 추가: | |
| 5 | 추가: ```sh | |
| 6 | 추가: python3 packaging/ubuntu/rust/build.py --target-dir tests/ci/package-target --output tests/release-packages/runs/ubuntu | |
| 7 | 추가: sudo dpkg -i tests/release-packages/runs/ubuntu/zipelo_0.1.0~dev1_amd64.deb | |
| 8 | 추가: zipelo /path/to/archive.zip | |
| 9 | 추가: sudo dpkg -r zipelo | |
| 10 | 추가: ``` | |
| 11 | 추가: | |
| 12 | 추가: Rust 1.99.1, dpkg-deb와 desktop-file-validate가 필요합니다. 출력은 새 경로여야 하며 기본은 release 빌드입니다. 개발 검증은 --profile dev를 명시합니다. 앱과 작업자는 같은 커밋에서 빌드하며 BUILD-INFO.json에 커밋과 SHA-256을 기록합니다. | |
| 13 | 추가: | |
| 14 | 추가: sudo로 설치하면 postinst가 SUDO_USER의 ZIP, 7z, TAR.GZ, GZ, TAR 기본 앱을 xdg-mime으로 적용합니다. 기존 기본 앱 선택을 바꿉니다. 다른 패키지 관리자로 설치해 SUDO_USER가 없으면 사용자 설정을 추측하지 않고 연결 후보만 등록합니다. 이 경우 사용자 계정에서 xdg-mime default zipelo.desktop application/zip 등을 실행해야 합니다. 제거는 사용자 MIME 설정을 지우지 않으며 다른 앱을 기본 앱으로 다시 선택할 수 있습니다. | |
| 15 | 추가: | |
| 16 | 추가: 이 패키지의 검사 범위는 Ubuntu 26.04입니다. 다른 Ubuntu 버전과 Windows 실기는 별도 확인이 필요합니다. |
| @@ -0,0 +1,74 @@ | ||
| 1 | 추가: """Rust 앱과 작업자를 Ubuntu amd64 패키지로 생성함.""" | |
| 2 | 추가: | |
| 3 | 추가: import argparse | |
| 4 | 추가: import hashlib | |
| 5 | 추가: import importlib.util | |
| 6 | 추가: import json | |
| 7 | 추가: from pathlib import Path | |
| 8 | 추가: import shutil | |
| 9 | 추가: import subprocess | |
| 10 | 추가: | |
| 11 | 추가: ROOT = Path(__file__).resolve().parents[3] | |
| 12 | 추가: SPEC = importlib.util.spec_from_file_location("windows_build", ROOT / "packaging/windows/rust/build.py") | |
| 13 | 추가: WINDOWS = importlib.util.module_from_spec(SPEC) | |
| 14 | 추가: SPEC.loader.exec_module(WINDOWS) | |
| 15 | 추가: TARGET = "x86_64-unknown-linux-gnu" | |
| 16 | 추가: | |
| 17 | 추가: | |
| 18 | 추가: def build(args): | |
| 19 | 추가: output = Path(args.output).resolve() | |
| 20 | 추가: output.mkdir(parents=True, exist_ok=False) | |
| 21 | 추가: stage = output / "stage" | |
| 22 | 추가: lib = stage / "usr/lib/zipelo" | |
| 23 | 추가: lib.mkdir(parents=True) | |
| 24 | 추가: records = {} | |
| 25 | 추가: for name, manifest, binary, features in ( | |
| 26 | 추가: ("Zipelo", ROOT / "experiments/rust-ui-memory-app/Cargo.toml", "zipelo-ui-memory-app", ("ui",)), | |
| 27 | 추가: ("zipelo-archive-worker", ROOT / "experiments/rust-archive-worker/Cargo.toml", "zipelo-archive-worker", ()), | |
| 28 | 추가: ): | |
| 29 | 추가: source, records[name] = WINDOWS.build_binary(manifest, binary, Path(args.target_dir).resolve(), args.profile, features, TARGET) | |
| 30 | 추가: shutil.copy2(source, lib / name) | |
| 31 | 추가: if (lib / name).read_bytes()[:4] != b"\x7fELF": | |
| 32 | 추가: raise ValueError("Linux 실행 파일이 아님") | |
| 33 | 추가: (lib / "BUILD-INFO.json").write_text(json.dumps({"target": TARGET, "profile": args.profile, "files": records}, indent=4) + "\n") | |
| 34 | 추가: bindir = stage / "usr/bin" | |
| 35 | 추가: bindir.mkdir() | |
| 36 | 추가: (bindir / "zipelo").symlink_to("../lib/zipelo/Zipelo") | |
| 37 | 추가: desktop = stage / "usr/share/applications" | |
| 38 | 추가: desktop.mkdir(parents=True) | |
| 39 | 추가: shutil.copyfile(Path(__file__).with_name("zipelo.desktop"), desktop / "zipelo.desktop") | |
| 40 | 추가: subprocess.run(["desktop-file-validate", str(desktop / "zipelo.desktop")], check=True) | |
| 41 | 추가: docs = stage / "usr/share/doc/zipelo" | |
| 42 | 추가: docs.mkdir(parents=True) | |
| 43 | 추가: shutil.copyfile(ROOT / "LICENSE", docs / "copyright") | |
| 44 | 추가: control = stage / "DEBIAN" | |
| 45 | 추가: control.mkdir() | |
| 46 | 추가: (control / "control").write_text("""Package: zipelo | |
| 47 | 추가: Version: 0.1.0~dev1 | |
| 48 | 추가: Architecture: amd64 | |
| 49 | 추가: Maintainer: Zipelo contributors <[email protected]> | |
| 50 | 추가: Section: utils | |
| 51 | 추가: Priority: optional | |
| 52 | 추가: Depends: libc6 (>= 2.39), libgcc-s1, libx11-6, libxkbcommon0, libwayland-client0, libegl1, libgl1, libfontconfig1, fonts-noto-cjk, xdg-utils, desktop-file-utils | |
| 53 | 추가: Description: Lightweight Rust archive application | |
| 54 | 추가: ZIP, 7z, TAR, GZ and TAR.GZ archive application with a separate worker. | |
| 55 | 추가: """) | |
| 56 | 추가: for script in ("postinst", "postrm"): | |
| 57 | 추가: shutil.copyfile(Path(__file__).with_name(script), control / script) | |
| 58 | 추가: (control / script).chmod(0o755) | |
| 59 | 추가: package = output / "zipelo_0.1.0~dev1_amd64.deb" | |
| 60 | 추가: subprocess.run(["dpkg-deb", "--root-owner-group", "--build", str(stage), str(package)], check=True) | |
| 61 | 추가: print(package) | |
| 62 | 추가: print("SHA-256 " + hashlib.sha256(package.read_bytes()).hexdigest()) | |
| 63 | 추가: | |
| 64 | 추가: | |
| 65 | 추가: def main(): | |
| 66 | 추가: parser = argparse.ArgumentParser(description=__doc__) | |
| 67 | 추가: parser.add_argument("--output", required=True) | |
| 68 | 추가: parser.add_argument("--target-dir", required=True) | |
| 69 | 추가: parser.add_argument("--profile", choices=("dev", "release"), default="release") | |
| 70 | 추가: build(parser.parse_args()) | |
| 71 | 추가: | |
| 72 | 추가: | |
| 73 | 추가: if __name__ == "__main__": | |
| 74 | 추가: main() |
| @@ -0,0 +1,15 @@ | ||
| 1 | 추가: #!/bin/sh | |
| 2 | 추가: set -eu | |
| 3 | 추가: if command -v update-desktop-database >/dev/null 2>&1; then | |
| 4 | 추가: update-desktop-database /usr/share/applications | |
| 5 | 추가: fi | |
| 6 | 추가: if [ "$1" = configure ] && [ -n "${SUDO_USER:-}" ] && [ "$SUDO_USER" != root ]; then | |
| 7 | 추가: account=$(getent passwd "$SUDO_USER") | |
| 8 | 추가: uid=$(printf '%s' "$account" | cut -d: -f3) | |
| 9 | 추가: home_dir=$(printf '%s' "$account" | cut -d: -f6) | |
| 10 | 추가: if [ -n "$uid" ] && [ "$uid" -ge 1000 ] && [ -d "$home_dir" ]; then | |
| 11 | 추가: for mime in application/zip application/x-7z-compressed application/x-compressed-tar application/gzip application/x-tar; do | |
| 12 | 추가: runuser -u "$SUDO_USER" -- env HOME="$home_dir" xdg-mime default zipelo.desktop "$mime" | |
| 13 | 추가: done | |
| 14 | 추가: fi | |
| 15 | 추가: fi |
| @@ -0,0 +1,5 @@ | ||
| 1 | 추가: #!/bin/sh | |
| 2 | 추가: set -eu | |
| 3 | 추가: if command -v update-desktop-database >/dev/null 2>&1; then | |
| 4 | 추가: update-desktop-database /usr/share/applications | |
| 5 | 추가: fi |
| @@ -0,0 +1,10 @@ | ||
| 1 | 추가: [Desktop Entry] | |
| 2 | 추가: Type=Application | |
| 3 | 추가: Name=Zipelo | |
| 4 | 추가: Exec=/usr/bin/zipelo %f | |
| 5 | 추가: TryExec=/usr/bin/zipelo | |
| 6 | 추가: Icon=package-x-generic | |
| 7 | 추가: Terminal=false | |
| 8 | 추가: Categories=Utility;Archiving; | |
| 9 | 추가: MimeType=application/zip;application/x-7z-compressed;application/x-compressed-tar;application/gzip;application/x-tar; | |
| 10 | 추가: StartupNotify=true |
| @@ -27,12 +27,12 @@ Zipelo.exe, zipelo-archive-worker.exe, MIT LICENSE, BUILD-INFO.json과 제거 | ||
| 27 | 27 | 마지막 화면의 [적용]을 누르면 HKCU의 ZipeloDev.Archive ProgID와 RegisteredApplications에 |
| 28 | 28 | .zip, .tar, .gz, .tgz 연결 후보를 등록하고 ms-settings:defaultapps를 엽니다. |
| 29 | 29 | .tar.gz는 마지막 확장자 .gz로 연결됩니다. 기본 앱은 사용자가 Windows 설정에서 직접 선택합니다. |
| 30 | 삭제: JAR, RAR, 7z는 등록하지 않습니다. [마침]만 누르면 연결 후보를 등록하지 않습니다. | |
| 30 | 추가: 7z도 연결 후보에 포함하며 JAR와 RAR는 등록하지 않습니다. [마침]만 누르면 연결 후보를 등록하지 않습니다. | |
| 31 | 31 | 관리자 권한, HKLM, UserChoice 변경을 사용하지 않습니다. |
| 32 | 32 | 제거 시 알려진 앱 파일과 등록 값만 정리하며 폴더 전체를 재귀 삭제하지 않습니다. |
| 33 | 33 | 실행 파일 삭제 실패 시 등록과 제거 프로그램을 보존하여 재시도할 수 있습니다. |
| 34 | 34 | |
| 35 | 삭제: 현재는 개발 검증용입니다. PR62 화면의 실제 작업자 연결, Windows에서의 설치/제거와 설정 실행, | |
| 35 | 추가: 현재 main의 실제 작업자 연결 앱을 포함합니다. Windows에서의 설치/제거와 설정 실행, | |
| 36 | 36 | 지원 형식별 실제 파일 열기, 재설치/권한 실패/잠긴 파일 검증, 포함 의존성의 배포 고지 검토는 남아 있습니다. |
| 37 | 37 | 이번 EXE 생성만으로 해당 항목을 인증하거나 출시하지 않습니다. |
| 38 | 38 | Windows 실행 검증 전에는 README 다운로드 버튼이나 release에 배포하지 않습니다. |
| @@ -25,7 +25,7 @@ def pe_machine(path): | ||
| 25 | 25 | return struct.unpack_from("<H", signature, 4)[0] |
| 26 | 26 | |
| 27 | 27 | |
| 28 | 삭제: def build_binary(manifest, binary, target_dir, profile, features=()): | |
| 28 | 추가: def build_binary(manifest, binary, target_dir, profile, features=(), target=TARGET): | |
| 29 | 29 | manifest = Path(manifest).resolve(strict=True) |
| 30 | 30 | commit = subprocess.check_output( |
| 31 | 31 | ["git", "-C", str(manifest.parent), "rev-parse", "HEAD"], text=True |
| @@ -38,19 +38,20 @@ def build_binary(manifest, binary, target_dir, profile, features=()): | ||
| 38 | 38 | # 작업 복사본 간 mtime 기반 캐시 혼합을 방지함. |
| 39 | 39 | target_dir = target_dir / binary / commit |
| 40 | 40 | command = ["cargo", "+1.99.1", "build", "--locked", "--manifest-path", str(manifest), |
| 41 | 삭제: "--target", TARGET, "--target-dir", str(target_dir), "--profile", profile, | |
| 41 | 추가: "--target", target, "--target-dir", str(target_dir), "--profile", profile, | |
| 42 | 42 | "--bin", binary] |
| 43 | 43 | if features: |
| 44 | 44 | command += ["--features", ",".join(features)] |
| 45 | 45 | environment = dict(os.environ) |
| 46 | 46 | linker = environment.get("CARGO_TARGET_X86_64_PC_WINDOWS_GNU_LINKER") |
| 47 | 47 | linker = linker or shutil.which("x86_64-w64-mingw32-gcc") or shutil.which("x86_64-w64-mingw32-gcc-posix") |
| 48 | 삭제: if not linker or not shutil.which(linker): | |
| 48 | 추가: if target == TARGET and (not linker or not shutil.which(linker)): | |
| 49 | 49 | raise ValueError("MinGW-w64 교차 링커를 찾지 못함") |
| 50 | 삭제: environment["CARGO_TARGET_X86_64_PC_WINDOWS_GNU_LINKER"] = linker | |
| 50 | 추가: if target == TARGET: | |
| 51 | 추가: environment["CARGO_TARGET_X86_64_PC_WINDOWS_GNU_LINKER"] = linker | |
| 51 | 52 | subprocess.run(command, env=environment, check=True) |
| 52 | 삭제: output = target_dir / TARGET / ("debug" if profile == "dev" else profile) / (binary + ".exe") | |
| 53 | 삭제: if pe_machine(output) != 0x8664: | |
| 53 | 추가: output = target_dir / target / ("debug" if profile == "dev" else profile) / (binary + (".exe" if target == TARGET else "")) | |
| 54 | 추가: if target == TARGET and pe_machine(output) != 0x8664: | |
| 54 | 55 | raise ValueError("x64 Windows 실행 파일이 아님") |
| 55 | 56 | current_commit = subprocess.check_output( |
| 56 | 57 | ["git", "-C", str(manifest.parent), "rev-parse", "HEAD"], text=True |
| @@ -181,6 +181,7 @@ Function ApplyAssociations | ||
| 181 | 181 | WriteRegStr HKCU "${APPKEY}\Capabilities" "ApplicationName" "Zipelo 개발판" |
| 182 | 182 | WriteRegStr HKCU "${APPKEY}\Capabilities" "ApplicationDescription" "압축파일 열기와 풀기" |
| 183 | 183 | WriteRegStr HKCU "${APPKEY}\Capabilities\FileAssociations" ".zip" "ZipeloDev.Archive" |
| 184 | 추가: WriteRegStr HKCU "${APPKEY}\Capabilities\FileAssociations" ".7z" "ZipeloDev.Archive" | |
| 184 | 185 | WriteRegStr HKCU "${APPKEY}\Capabilities\FileAssociations" ".tar" "ZipeloDev.Archive" |
| 185 | 186 | WriteRegStr HKCU "${APPKEY}\Capabilities\FileAssociations" ".gz" "ZipeloDev.Archive" |
| 186 | 187 | WriteRegStr HKCU "${APPKEY}\Capabilities\FileAssociations" ".tgz" "ZipeloDev.Archive" |
| @@ -233,6 +234,7 @@ Section "Uninstall" | ||
| 233 | 234 | DeleteRegValue HKCU "Software\RegisteredApplications" "Zipelo 개발판" |
| 234 | 235 | ${EndIf} |
| 235 | 236 | DeleteRegValue HKCU "${APPKEY}\Capabilities\FileAssociations" ".zip" |
| 237 | 추가: DeleteRegValue HKCU "${APPKEY}\Capabilities\FileAssociations" ".7z" | |
| 236 | 238 | DeleteRegValue HKCU "${APPKEY}\Capabilities\FileAssociations" ".tar" |
| 237 | 239 | DeleteRegValue HKCU "${APPKEY}\Capabilities\FileAssociations" ".gz" |
| 238 | 240 | DeleteRegValue HKCU "${APPKEY}\Capabilities\FileAssociations" ".tgz" |
| @@ -0,0 +1 @@ | ||
| 1 | 추가: runs/ |
| @@ -0,0 +1,14 @@ | ||
| 1 | 추가: # 패키지 검증 | |
| 2 | 추가: | |
| 3 | 추가: 저장소의 packaging/windows/rust/build.py와 packaging/ubuntu/rust/build.py로 두 플랫폼의 실제 앱과 작업자를 생성합니다. 기본 profile은 release이며 ui-fixture는 사용하지 않습니다. | |
| 4 | 추가: | |
| 5 | 추가: ```sh | |
| 6 | 추가: python3 tests/ci/run_rust.py local | |
| 7 | 추가: python3 tests/release-packages/ubuntu_smoke.py tests/release-packages/runs/ubuntu-release/zipelo_0.1.0~dev1_amd64.deb | |
| 8 | 추가: ``` | |
| 9 | 추가: | |
| 10 | 추가: Ubuntu 실기 스모크는 이 패키지를 sudo로 설치하고 ZIP, 7z, TAR.GZ의 기본 앱을 확인합니다. 별도 Xvfb 화면에서 공백이 있는 경로의 합성 ZIP을 실제 앱으로 열어 소유 창을 캡처합니다. 종료 후 패키지를 제거하고 기존 MIME 설정을 복원합니다. 설치된 Zipelo나 같은 경로의 기존 파일이 있으면 중단합니다. 시험 중 다른 MIME 설정 변경이 감지되면 덮어쓰지 않고 복원을 보류합니다. | |
| 11 | 추가: | |
| 12 | 추가: sudo 비대화형 권한, Xvfb, xdotool과 ImageMagick import가 필요합니다. 이 검사는 실제 시스템 패키지를 설치하고 사용자 기본 앱을 임시로 바꾸므로 실행 전에 해당 작업의 승인이 필요합니다. 출력은 runs/에 남고 Git에는 포함하지 않습니다. | |
| 13 | 추가: | |
| 14 | 추가: Windows 설치와 설정 화면, 제거의 실기 검증은 이 Linux 시험에 포함되지 않습니다. release 게시와 다운로드 버튼 갱신도 수행하지 않습니다. |
| @@ -0,0 +1,99 @@ | ||
| 1 | 추가: """현재 사용자 설정을 보존하고 실제 패키지 설치와 창 실행을 검증함.""" | |
| 2 | 추가: | |
| 3 | 추가: import argparse | |
| 4 | 추가: import json | |
| 5 | 추가: import os | |
| 6 | 추가: from pathlib import Path | |
| 7 | 추가: import select | |
| 8 | 추가: import subprocess | |
| 9 | 추가: import time | |
| 10 | 추가: import zipfile | |
| 11 | 추가: | |
| 12 | 추가: ROOT = Path(__file__).resolve().parents[2] | |
| 13 | 추가: MIMES = ("application/zip", "application/x-7z-compressed", "application/x-compressed-tar") | |
| 14 | 추가: CONFIGS = (Path.home() / ".config", Path.home() / ".local/share/applications") | |
| 15 | 추가: | |
| 16 | 추가: | |
| 17 | 추가: def configs(): | |
| 18 | 추가: return {p: p.read_bytes() for directory in CONFIGS for p in directory.glob("*mimeapps.list")} | |
| 19 | 추가: | |
| 20 | 추가: | |
| 21 | 추가: def main(): | |
| 22 | 추가: parser = argparse.ArgumentParser(description=__doc__) | |
| 23 | 추가: parser.add_argument("package", type=Path) | |
| 24 | 추가: args = parser.parse_args() | |
| 25 | 추가: package = args.package.resolve(strict=True) | |
| 26 | 추가: runs = ROOT / "tests/release-packages/runs/smoke" | |
| 27 | 추가: runs.mkdir(parents=True, exist_ok=False) | |
| 28 | 추가: assert subprocess.run(["dpkg-query", "-W", "-f=${db:Status-Status}", "zipelo"], | |
| 29 | 추가: capture_output=True).stdout != b"installed", "기존 설치를 보존해야 함" | |
| 30 | 추가: for name in ("/usr/lib/zipelo", "/usr/bin/zipelo", "/usr/share/applications/zipelo.desktop"): | |
| 31 | 추가: assert not Path(name).exists(), "기존 파일이 있어 설치를 중단함" | |
| 32 | 추가: before = configs() | |
| 33 | 추가: after = None | |
| 34 | 추가: app = None | |
| 35 | 추가: display = None | |
| 36 | 추가: installed = False | |
| 37 | 추가: try: | |
| 38 | 추가: subprocess.run(["sudo", "-n", "dpkg", "-i", str(package)], check=True) | |
| 39 | 추가: installed = True | |
| 40 | 추가: after = configs() | |
| 41 | 추가: for mime in MIMES: | |
| 42 | 추가: result = subprocess.check_output(["xdg-mime", "query", "default", mime], text=True).strip() | |
| 43 | 추가: assert result == "zipelo.desktop", f"연결 실패: {mime}" | |
| 44 | 추가: info = json.loads(Path("/usr/lib/zipelo/BUILD-INFO.json").read_text()) | |
| 45 | 추가: assert info["profile"] == "release" | |
| 46 | 추가: archive = runs / "sample archive.zip" | |
| 47 | 추가: with zipfile.ZipFile(archive, "w") as output: | |
| 48 | 추가: output.writestr("example.txt", "Zipelo package verification") | |
| 49 | 추가: display = subprocess.Popen( | |
| 50 | 추가: ["Xvfb", "-displayfd", "1", "-screen", "0", "1280x900x24", "-nolisten", "tcp"], | |
| 51 | 추가: stdout=subprocess.PIPE, stderr=subprocess.DEVNULL) | |
| 52 | 추가: assert select.select([display.stdout], [], [], 15)[0], "Xvfb 준비 실패" | |
| 53 | 추가: number = display.stdout.readline().decode().strip() | |
| 54 | 추가: assert number.isdecimal() | |
| 55 | 추가: env = {**os.environ, "DISPLAY": ":" + number, "WINIT_UNIX_BACKEND": "x11", "XDG_SESSION_TYPE": "x11"} | |
| 56 | 추가: env.pop("WAYLAND_DISPLAY", None) | |
| 57 | 추가: with (runs / "app.stdout").open("wb") as stdout, (runs / "app.stderr").open("wb") as stderr: | |
| 58 | 추가: app = subprocess.Popen(["/usr/bin/zipelo", str(archive)], env=env, stdout=stdout, stderr=stderr) | |
| 59 | 추가: deadline = time.monotonic() + 30 | |
| 60 | 추가: while True: | |
| 61 | 추가: assert app.poll() is None, "설치된 앱이 조기에 종료됨" | |
| 62 | 추가: window = subprocess.run(["xdotool", "search", "--all", "--pid", str(app.pid), "--name", "Zipelo"], | |
| 63 | 추가: env=env, capture_output=True, text=True) | |
| 64 | 추가: if window.returncode == 0: | |
| 65 | 추가: break | |
| 66 | 추가: assert time.monotonic() < deadline, "앱 창 표시 시간 초과" | |
| 67 | 추가: time.sleep(0.2) | |
| 68 | 추가: time.sleep(3) | |
| 69 | 추가: assert app.poll() is None | |
| 70 | 추가: subprocess.run(["import", "-window", window.stdout.splitlines()[0], | |
| 71 | 추가: str(runs / "installed-window.png")], env=env, check=True) | |
| 72 | 추가: print("PASS installed package, ZIP/7z/TAR.GZ defaults and native X11 window") | |
| 73 | 추가: finally: | |
| 74 | 추가: for process in (app, display): | |
| 75 | 추가: if process is not None and process.poll() is None: | |
| 76 | 추가: process.terminate() | |
| 77 | 추가: try: | |
| 78 | 추가: process.wait(timeout=10) | |
| 79 | 추가: except subprocess.TimeoutExpired: | |
| 80 | 추가: process.kill() | |
| 81 | 추가: process.wait() | |
| 82 | 추가: if installed: | |
| 83 | 추가: subprocess.run(["sudo", "-n", "dpkg", "-P", "zipelo"], check=True) | |
| 84 | 추가: current = configs() | |
| 85 | 추가: if after is not None: | |
| 86 | 추가: for path in set(before) | set(after): | |
| 87 | 추가: assert current.get(path) == after.get(path), "시험 중 다른 MIME 설정 변경이 있어 복원을 보류함" | |
| 88 | 추가: if path in before: | |
| 89 | 추가: path.write_bytes(before[path]) | |
| 90 | 추가: elif path.exists(): | |
| 91 | 추가: path.unlink() | |
| 92 | 추가: assert not Path("/usr/bin/zipelo").exists() | |
| 93 | 추가: assert not Path("/usr/lib/zipelo").exists() | |
| 94 | 추가: assert configs() == before, "기존 MIME 설정 복원 실패" | |
| 95 | 추가: print("PASS package removed and previous MIME settings restored") | |
| 96 | 추가: | |
| 97 | 추가: | |
| 98 | 추가: if __name__ == "__main__": | |
| 99 | 추가: main() |