From e28dc5927ee14076b7d5d2f174201a68ca08564b Mon Sep 17 00:00:00 2001 From: gfdgd_xi <3025613752@qq.com> Date: Tue, 7 May 2024 22:03:56 +0800 Subject: [PATCH] =?UTF-8?q?=E8=B0=83=E6=95=B4=E6=89=93=E5=8C=85=E5=99=A8?= =?UTF-8?q?=E5=8C=85=E5=90=8D=E8=AF=86=E5=88=AB=E6=9C=BA=E5=88=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ShellList/turn-all-to-amd64-arm64-deb.py | 26 ++++++++++++++++++++++++ deepin-wine-easy-packager.py | 16 ++++++++++++++- 2 files changed, 41 insertions(+), 1 deletion(-) create mode 100755 ShellList/turn-all-to-amd64-arm64-deb.py diff --git a/ShellList/turn-all-to-amd64-arm64-deb.py b/ShellList/turn-all-to-amd64-arm64-deb.py new file mode 100755 index 0000000..b4d5e75 --- /dev/null +++ b/ShellList/turn-all-to-amd64-arm64-deb.py @@ -0,0 +1,26 @@ +#!/usr/bin/env python3 +import os +import sys + +def ReadTXT(path): + with open(path, "r") as file: + thing = file.read() + return thing + +def WriteTXT(path, data): + with open(path, "w") as file: + file.write(data) + +debList = sys.argv[1:] +for i in debList: + # 解包 + os.system("rm -rf /tmp/change-old-to-new") + os.system(f"dpkg -x '{i}' /tmp/change-old-to-new") + os.system(f"dpkg -e '{i}' /tmp/change-old-to-new/DEBIAN") + info = ReadTXT("/tmp/change-old-to-new/DEBIAN/control").replace(": all", ": amd64") + WriteTXT("/tmp/change-old-to-new/DEBIAN/control", info) + os.system(f"dpkg-deb -Z xz -z 0 -b /tmp/change-old-to-new '{os.path.basename(i).replace('_all', '_amd64')}'") + info = ReadTXT("/tmp/change-old-to-new/DEBIAN/control").replace(": amd64", ": arm64") + WriteTXT("/tmp/change-old-to-new/DEBIAN/control", info) + os.system(f"dpkg-deb -Z xz -z 0 -b /tmp/change-old-to-new '{os.path.basename(i).replace('_all', '_arm64')}'") + # 检查是否能正常安装 diff --git a/deepin-wine-easy-packager.py b/deepin-wine-easy-packager.py index 9b17ad7..11367e1 100755 --- a/deepin-wine-easy-packager.py +++ b/deepin-wine-easy-packager.py @@ -501,7 +501,21 @@ class RunThread(QtCore.QThread): if len(k[1]) < miniLenge: rightLnk = k miniLenge = len(rightLnk[1]) - debPackageName = "com." + xpinyin.Pinyin().get_pinyin(os.path.splitext(os.path.basename(rightLnk[0]))[0].replace(" ", "")).lower().replace("--", "-").replace(" ", "").replace("_", "-").replace("-", ".") + ".spark" + replacePackageMap = { + " ": "", + "--": "-", + "_": "-", + "-": ".", + "(": "", + ")": "", + "&": "", + "*": "", + "..": "." + } + pkgNameTemp = xpinyin.Pinyin().get_pinyin(os.path.splitext(os.path.basename(rightLnk[0]))[0].replace(" ", "")).lower() + for i in replacePackageMap.keys(): + pkgNameTemp = pkgNameTemp.replace(i, replacePackageMap[i]) + debPackageName = "com." + pkgNameTemp + ".spark" programIconPath = f"/opt/apps/{debPackageName}/entries/icons/hicolor/scalable/apps/{debPackageName}.png" bottlePackagePath = f"{debBuildPath}/opt/apps/{debPackageName}/files/files.7z" self.RunCommand(f"mkdir -pv '{debBuildPath}/opt/apps/{debPackageName}/entries/icons/hicolor/scalable/apps/'")