Skip to content

Commit 1481822

Browse files
committed
Append build architecture to filename (when provided)
The plugin supports building without this meta info (as some AppDirs might not contain any binaries).
1 parent 6c248cf commit 1481822

File tree

2 files changed

+22
-4
lines changed

2 files changed

+22
-4
lines changed

ldnp/deb.py

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,8 +91,16 @@ def create_package(self, out_path: str | os.PathLike):
9191

9292
extension = ".deb"
9393

94-
if not str(out_path).endswith(extension):
95-
out_path = Path(f"{out_path}{extension}")
94+
# remove extension temporarily so we can insert the build architecture (if needed)
95+
out_path = str(out_path).removesuffix(extension)
96+
97+
architecture = self.meta_info.get("architecture")
98+
99+
if architecture:
100+
out_path += f"_{architecture}"
101+
102+
# (re-)add extension which either was lacking all the time or has been removed earlier
103+
out_path += extension
96104

97105
self.copy_appdir_contents()
98106
self.copy_data_to_usr()

ldnp/rpm.py

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -174,10 +174,20 @@ def generate_rpm(self, out_path: str):
174174
shutil.move(built_rpms[0], out_path)
175175

176176
def create_package(self, out_path: str | os.PathLike):
177+
logger.info(f"Creating RPM package called {out_path}")
178+
177179
extension = ".rpm"
178180

179-
if not str(out_path).endswith(extension):
180-
out_path = Path(f"{out_path}{extension}")
181+
# remove extension temporarily so we can insert the build architecture (if needed)
182+
out_path = str(out_path).removesuffix(extension)
183+
184+
build_arch = self.meta_info.get("build_arch")
185+
186+
if build_arch:
187+
out_path += f"_{build_arch}"
188+
189+
# (re-)add extension which either was lacking all the time or has been removed earlier
190+
out_path += extension
181191

182192
self.copy_appdir_contents()
183193
self.copy_data_to_usr()

0 commit comments

Comments
 (0)