Skip to content

Commit 8eb2766

Browse files
author
qount25
committed
Fix: better way to handle custom configure, build and install steps in deb rules + timescaledb package custom configure/install steps
1 parent 8d0c175 commit 8eb2766

File tree

3 files changed

+29
-31
lines changed

3 files changed

+29
-31
lines changed

lib/pgpm/deb/spec.rb

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,16 @@ def arch
5353
end
5454
end
5555

56+
def cmds_if_not_empty(cmds, else_echo)
57+
if cmds.nil? || cmds.empty?
58+
return "\techo \"#{else_echo}\""
59+
else
60+
cmds.map! { |c| c.to_s }
61+
cmds.map! { |c| c.gsub("$", "$$") }
62+
return cmds.join("\t")
63+
end
64+
end
65+
5666
end
5767
end
5868
end

lib/pgpm/deb/templates/rules.erb

Lines changed: 15 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -9,44 +9,32 @@ export PGPM_INSTALL_ROOT = "$(CURDIR)/debian/<%= deb_pkg_name(pkg_type) %>"
99

1010
<% if pkg_type == :versioned %>
1111
%:
12-
echo " --> % rules target"
12+
dh $@
13+
14+
override_dh_auto_configure:
15+
echo " --> configuring"
16+
<%= cmds_if_not_empty self.package.configure_steps, '...nothing to configure' %>
1317

14-
build:
15-
echo " --> build target"
16-
<%= self.package.build_steps.join("\n\t").gsub('$', '$$') %>
18+
override_dh_auto_build:
19+
echo " --> building"
20+
<%= cmds_if_not_empty self.package.build_steps, '...nothing to build' %>
1721

18-
install: build
19-
mkdir -p $$PGPM_INSTALL_ROOT
20-
echo " --> install target"
21-
<%= self.package.install_steps.join("\n\t").gsub('$', '$$') %>
22+
override_dh_auto_install:
23+
echo " --> installing"
24+
dh_auto_install
25+
<%= cmds_if_not_empty self.package.install_steps, '...no custom install steps' %>
2226
chmod +x "$$DEB_BUILDDIR/prepare_artifacts.sh"
2327
find $$PGPM_INSTALL_ROOT -type f | sort - | sed 's|^$$PGPM_INSTALL_ROOT||' > .pgpm_before | sort
2428
./prepare_artifacts.sh
2529

26-
build-arch:
27-
echo " --> build-arch"
28-
29-
build-indep:
30-
echo " --> build-indep"
31-
32-
binary: install
33-
echo " --> binary"
34-
35-
binary-arch:
36-
echo " --> binary-arch"
37-
38-
binary-indep:
39-
echo " --> binary-indep"
40-
41-
clean:
42-
echo " --> clean"
43-
4430
<% else %>
4531
%:
4632
dh $@
4733

48-
install:
34+
override_dh_auto_install:
35+
dh_auto_install
4936
echo " --> INSTALL"
5037
chmod +x "$$DEB_BUILDDIR/install_default_control.sh"
5138
./install_default_control.sh
39+
5240
<% end %>

packages/timescale/timescaledb.rb

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -42,17 +42,17 @@ def configure_steps
4242
case Pgpm::OS.in_scope.class.name
4343
when "debian", "ubuntu"
4444
["dh_auto_configure -- -DCMAKE_BUILD_TYPE=\"Release\""]
45-
when "rocky+epel-9", "redhat", "fedora"
46-
[]
45+
else
46+
super
4747
end
4848
end
4949

5050
def install_steps
5151
case Pgpm::OS.in_scope.class.name
52-
when "debian", "ubuntu"
53-
[]
5452
when "rocky+epel-9", "redhat", "fedora"
5553
["DESTDIR=$PGPM_INSTALL_ROOT cmake --build build --target install"]
54+
else
55+
super
5656
end
5757
end
5858

0 commit comments

Comments
 (0)