Skip to content

Commit 6b56207

Browse files
author
qount25
committed
Merge branch 'master' into deb
2 parents 8de62ed + 57755eb commit 6b56207

File tree

13 files changed

+110
-45
lines changed

13 files changed

+110
-45
lines changed

README.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -166,3 +166,15 @@ docker rmi pgpm:local
166166
docker rmi ghcr.io/postgres-pm/pgpm:latest
167167
```
168168

169+
### Troubleshooting
170+
171+
#### Podman invocations terminate with exit code 137
172+
173+
Make sure your machine has enough RAM. For `podman-machine` you might want to adjust it
174+
with
175+
176+
```shell
177+
podman machine stop
178+
podman machine set -m 16384 # for 16GB
179+
podman machine start
180+
```

exe/pgpm

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,22 @@ module Pgpm
4141
option :path, type: :path, desc: "Override path to the source"
4242
argument :packages, type: :array, required: true, desc: "Package names"
4343

44+
module ExtendedProc
45+
refine Proc do
46+
def and_then(callable)
47+
lambda do |*args|
48+
res1 = call(*args)
49+
res2 = callable.call(*args)
50+
return res1 + res2 if res1.is_a?(Array) && res2.is_a?(Array)
51+
52+
res2
53+
end
54+
end
55+
end
56+
end
57+
58+
using ExtendedProc
59+
4460
# rubocop:disable Metrics/ParameterLists:
4561
def call(packages:, args: nil, os: nil, arch: nil, pgdist: nil, pgver: nil, pkgdir: nil, path: nil)
4662
_ = args
@@ -109,6 +125,10 @@ module Pgpm
109125
os.with_scope do
110126
arch.with_scope do
111127
selected_pgdist.with_scope do
128+
pkgs = pkgs.flat_map do |pkg|
129+
[pkg, *pkg.all_requirements]
130+
end.reject(&:contrib?)
131+
112132
b = pkgs.reduce(nil) do |c, p|
113133
if p.broken?
114134
puts "Can't build a broken package #{p.name}@#{p.version}"
@@ -123,15 +143,14 @@ module Pgpm
123143
end
124144

125145
srpms = b.call
126-
Pgpm::RedHat::Builder.builder(srpms).call
146+
Pgpm::RPM::Builder.builder(srpms).call
127147
end
128148
end
129149
end
130150
else
131151
puts "#{os.name} is not a supported OS at this moment"
132152
exit(1)
133153
end
134-
135154
end
136155

137156
# rubocop:enable Metrics/ParameterLists:

lib/pgpm/contrib/postgres_fdw.rb

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# frozen_string_literal: true
2+
3+
module Pgpm
4+
module Contrib
5+
class PostgresFdw < Pgpm::Package
6+
contrib_package
7+
end
8+
end
9+
end

lib/pgpm/package/dependencies.rb

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,10 @@ def requires
3838
[]
3939
end
4040

41+
def all_requirements
42+
requires.flat_map { |r| [r, *r.all_requirements] }.uniq
43+
end
44+
4145
def c_files_present?
4246
Dir.glob("*.c", base: source).any?
4347
end

lib/pgpm/package/git_hub.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ def sources
1717

1818
def source_url_directory_name
1919
# GitHub strips leading `v` from version tags
20-
commit = version_git_tag.gsub(/^v/, "") || version_git_commit
20+
commit = version_git_tag&.gsub(/^v/, "") || version_git_commit
2121
"#{self.class.github_config.name.split("/").last}-#{commit}"
2222
end
2323
end

lib/pgpm/package/rust.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ def sources
2222

2323
vendor_dir = Dir.mktmpdir("pgpm")
2424

25-
podman_cmd = "run -v #{Pgpm::Cache.directory}:#{Pgpm::Cache.directory} -v #{vendor_dir}:#{vendor_dir} -ti rust"
25+
podman_cmd = "run -v #{Pgpm::Cache.directory}:#{Pgpm::Cache.directory} -v #{vendor_dir}:#{vendor_dir} -i rust"
2626
Podman.run("#{podman_cmd} cargo add --manifest-path #{source}/Cargo.toml --dev cargo-pgrx@#{pgrx_version}")
2727
Podman.run("#{podman_cmd} cargo vendor --versioned-dirs --manifest-path #{source}/Cargo.toml #{vendor_dir}/vendor")
2828
vendored_pgrx_version = Dir.glob("cargo-pgrx-*", base: File.join(vendor_dir, "vendor"))[0].split("-").last

lib/pgpm/podman.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@ module Pgpm
88
module Podman
99
def self.run(command, unhandled_reboot_mitigation: true, print_stdout: true)
1010
result = TTY::Command.new(printer: :null).run("podman #{command}", pty: true) do |out, err|
11-
$stderr.print(out.strip) if print_stdout
12-
warn err
11+
$stderr.print(out) if print_stdout
12+
warn err if err
1313
end
1414

1515
result.out

lib/pgpm/rpm/mock/operation.rb

Lines changed: 8 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -60,32 +60,27 @@ def call
6060
options = @opts.flat_map { |(k, v)| ["--config-opts", "#{k}=#{v}"] }.compact.join(" ")
6161
command = "mock #{options} #{@args.join(" ")}"
6262
map_paths = @paths.map { |p| "-v #{p}:#{p}" }.join(" ")
63-
raise "Failed to execute `#{command}`" unless Podman.run("run -v #{Dir.pwd}:#{Dir.pwd} #{map_paths} --privileged -ti ghcr.io/postgres-pm/pgpm #{command}")
63+
raise "Failed to execute `#{command}`" unless Podman.run("run -v #{Dir.pwd}:#{Dir.pwd} #{map_paths} --privileged -i ghcr.io/postgres-pm/pgpm #{command}")
6464

6565
@cb&.call
6666
end
6767

6868
def chain(op)
6969
raise ArgumentError, "can't chain non-rebuild operations" unless op.args.include?("--rebuild") && @args.include?("--rebuild")
7070

71-
args = @args.clone
72-
args.insert(@args.index("--localrepo") - 1, op.args[op.args.index("--localrepo") - 1])
73-
self.class.new(*args, cb: lambda {
74-
res1 = @cb&.call
75-
res2 = op.cb&.call
76-
return res1 + res2 if res1.is_a?(Array) && res2.is_a?(Array)
77-
78-
res2
79-
})
71+
args.insert(args.index("--localrepo"), *op.args[op.args.index("--recurse") + 1..op.args.index("--localrepo") - 1])
72+
self
8073
end
8174

8275
def and_then(op)
8376
lambda do
8477
res1 = call
8578
res2 = op.call
86-
return res1 + res2 if res1.is_a?(Array) && res2.is_a?(Array)
87-
88-
[res1, res2]
79+
if res1.is_a?(Array) && res2.is_a?(Array)
80+
res1 + res2
81+
else
82+
[res1, res2]
83+
end
8984
end
9085
end
9186
end

lib/pgpm/rpm/spec.rb

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,8 @@ def versionless
2727
License: #{@package.license}
2828
2929
BuildRequires: #{@postgres_distribution.build_time_requirement_packages.join(" ")}
30-
Requires: pgpm-#{@package.name}-#{@postgres_distribution.version}_#{@package.version}
31-
BuildRequires: pgpm-#{@package.name}-#{@postgres_distribution.version}_#{@package.version}
30+
Requires: pgpm-#{@package.name}+#{@package.version}-#{@postgres_distribution.version}
31+
BuildRequires: pgpm-#{@package.name}+#{@package.version}-#{@postgres_distribution.version}
3232
BuildArch: noarch
3333
3434
%description
@@ -65,7 +65,7 @@ def to_s
6565
end
6666

6767
<<~EOF
68-
Name: pgpm-#{@package.name}-#{@postgres_distribution.version}_#{@package.version}
68+
Name: pgpm-#{@package.name}+#{@package.version}-#{@postgres_distribution.version}
6969
Version: 1
7070
Release: 1%{?dist}
7171
Summary: #{@package.summary}
@@ -76,7 +76,7 @@ def to_s
7676
#{@package.build_dependencies.uniq.map { |dep| "BuildRequires: #{dep}" }.join("\n")}
7777
#{@package.dependencies.uniq.map { |dep| "Requires: #{dep}" }.join("\n")}
7878
#{@package.requires.uniq.map do |dep|
79-
req = dep.contrib? ? @postgres_distribution.package_for(dep) : "pgpm-#{dep.name}-#{@postgres_distribution.version}_#{dep.version}"
79+
req = dep.contrib? ? @postgres_distribution.package_for(dep) : "pgpm-#{dep.name}+#{dep.version}-#{@postgres_distribution.version}"
8080
raise "Can't build with a broken dependency #{dep.name}@#{dep.version}" if dep.broken?
8181
8282
"Requires: #{req}#{"\nBuildRequires: #{req}" if dep.contrib?}"

packages/omnigres/extension_discovery.rb

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,9 @@ def initialize(revision: nil, path: nil)
2121
self.class.mutex.synchronize do
2222
git =
2323
if File.directory?(path)
24-
::Git.open(path)
24+
g = ::Git.open(path)
25+
g.pull
26+
g
2527
else
2628
::Git.clone("https://github.com/omnigres/omnigres", path)
2729
end

0 commit comments

Comments
 (0)