Skip to content

Commit 13fc8f5

Browse files
committed
fix(packaging): update fpm version from 1.15.1 to 1.17.0
Signed-off-by: Alexandre Rulleau <[email protected]>
1 parent 4a26042 commit 13fc8f5

2 files changed

Lines changed: 81 additions & 2 deletions

File tree

dockerfiles/packaging/fpm_packaging/Dockerfile

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,12 @@ RUN (cd tar-1.35 && FORCE_UNSAFE_CONFIGURE=1 ./configure --prefix=/usr && make i
1414

1515
FROM base as final
1616
ADD fpm_apk_pax_header.patch /tmp
17-
RUN sudo gem install fpm -v 1.15.1
18-
RUN (cd /usr/local/lib/ruby/gems/3.3.0/gems/fpm-1.15.1; patch -p 1 < /tmp/fpm_apk_pax_header.patch ) && rm -f /tmp/fpm_apk_pax_header.patch
17+
ADD fpm_apk_alpine323.patch /tmp
18+
RUN sudo gem install fpm -v 1.17.0
19+
RUN (cd /usr/local/lib/ruby/gems/3.3.0/gems/fpm-1.17.0 && \
20+
patch -p1 < /tmp/fpm_apk_pax_header.patch && \
21+
patch -p0 < /tmp/fpm_apk_alpine323.patch) && \
22+
rm -f /tmp/fpm_apk_pax_header.patch /tmp/fpm_apk_alpine323.patch
1923

2024
COPY --from=compile-tar /usr/bin/tar /usr/bin/tar
2125

Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
--- lib/fpm/package/apk.rb.original 2026-01-05 14:10:00.000000000 +0000
2+
+++ lib/fpm/package/apk.rb 2026-01-05 14:10:00.000000000 +0000
3+
@@ -91,6 +91,19 @@
4+
# data tar.
5+
tar_path(staging_path(""), datatar_path)
6+
7+
+ # Add PAX headers with file checksums
8+
+ hash_datatar(datatar_path)
9+
+
10+
+ # Calculate datahash (SHA256 of gzipped data.tar) - required for Alpine 3.23+
11+
+ require "zlib"
12+
+ temp_gz = datatar_path + ".gz~"
13+
+ Zlib::GzipWriter.open(temp_gz) do |gz|
14+
+ gz.mtime = 0 # Reproducible gzip
15+
+ open(datatar_path, "rb") { |f| gz.write(f.read(4096)) until f.eof? }
16+
+ end
17+
+ @datahash = calculate_file_sha256(temp_gz)
18+
+ File.unlink(temp_gz)
19+
+
20+
# control tar.
21+
begin
22+
write_pkginfo(control_path)
23+
@@ -107,7 +120,7 @@
24+
cut_tar_record(controltar_path)
25+
26+
# calculate/rewrite sha1 hashes for data tar
27+
- hash_datatar(datatar_path)
28+
+ # hash_datatar(datatar_path) # Already done before datahash calculation
29+
30+
# concatenate the two into the final apk
31+
concat_zip_tars(controltar_path, datatar_path, output_path)
32+
@@ -117,8 +130,16 @@
33+
logger.warn("It's recommended that your package be installed with '--allow-untrusted'")
34+
end
35+
36+
+
37+
+ def calculate_file_sha256(file_path)
38+
+ digest = Digest::SHA256.new
39+
+ File.open(file_path, 'rb') { |f| digest.update(f.read) }
40+
+ digest.hexdigest
41+
+ end
42+
+
43+
def write_pkginfo(base_path)
44+
45+
+
46+
pkginfo = ""
47+
48+
pkginfo << "# Generated by fpm\n"
49+
@@ -129,6 +150,10 @@
50+
pkginfo << "url = #{url()}\n"
51+
pkginfo << "size = 102400\n" # totally magic, not sure what it's used for.
52+
53+
+
54+
+ if @datahash
55+
+ pkginfo << "datahash = #{@datahash}\n"
56+
+ end
57+
# write depends lines
58+
for dependency in dependencies()
59+
pkginfo << "depend = #{dependency}\n"
60+
@@ -300,6 +325,7 @@
61+
62+
# zip each path separately
63+
Zlib::GzipWriter.open(temp_apath) do |target_writer|
64+
+ target_writer.mtime = 0 # Reproducible gzip
65+
open(apath, "rb") do |file|
66+
until(file.eof?())
67+
target_writer.write(file.read(4096))
68+
@@ -308,6 +334,7 @@
69+
end
70+
71+
Zlib::GzipWriter.open(temp_bpath) do |target_writer|
72+
+ target_writer.mtime = 0 # Reproducible gzip
73+
open(bpath, "rb") do |file|
74+
until(file.eof?())
75+
target_writer.write(file.read(4096))

0 commit comments

Comments
 (0)