Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Building DEB packages with podman & pbuilder #8

Merged
merged 45 commits into from
Mar 29, 2025
Merged

Conversation

qount25
Copy link

@qount25 qount25 commented Mar 2, 2025

Nice things:

  1. Podman containers and temporary files are removed after the build is completed.
  2. Podman containers created for each build have unique names, so if something fails, it is clear from the name what time the container has been created and it's left running for us to attach and see what happened.
  3. All minimal dependencies are installed inside the container already, almost nothing is pulled, therefore...
  4. The build is very fast. Takes maybe 30 second to complete.

Gotchas:

  1. Downloads large (6Gb) Podman image from quay.io (but only once!). The image can probably be shrinked, but at the moment, it is what it is.
  2. Lots of stuff is hard-coded -- for example architecture (amd64).
  3. Uses a more declarative API as compared to being more of a DSL-like. This makes it very clear what the steps are (you only need to look at lib/pgpm/deb/builder.rb#build() to get the full picture.
  4. Errors you see during the build are fakeroot related, but do not affect the build. I had to use fakeroot pbuilder, because SELinux would not allow me to mount /dev/* in a rootless container.
  5. Currently works only for building extensions with no extra-dependencies (however, it's merely a matter of adding appropriate info into each particular package file -- this needs to be discussed).

@@ -0,0 +1,48 @@
Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some of this information should be extractable from the package.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure what you mean. This line looks like some XML schema definition that should always be the same. No?

@qount25 qount25 force-pushed the deb branch 3 times, most recently from 56f8b9a to 59d72f8 Compare March 8, 2025 06:36
Copy link
Contributor

@yrashk yrashk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you also please rebase?

when "debian", "ubuntu"
[
"build-essential",
"postgresql-#{postgres_major_version}",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Postgres dependencies are added in the RPM spec / DEB control preparation based on Distribution's methods.

Copy link
Contributor

@yrashk yrashk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some more comments. Also, there is a minor conflict to be resolved again (sorry!)

super
end

def install_steps
return [Pgpm::Commands::Make.new("install", "DESTDIR=$PGPM_BUILDROOT", "PG_CONFIG=$PG_CONFIG")] if makefile_present?

case Pgpm::OS.in_scope.class.name
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And speaking of special-casing and the case I expanded on when it comes to configuring – this is the same issue – and an opportunity – to unify the procedure.

when "debian", "ubuntu"
return []
when "rocky+epel-9", "redhat", "fedora"
return [Pgpm::Commands::Make.new("PG_CONFIG=$PG_CONFIG")] if makefile_present?
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And speaking of special-casing and the case I expanded on when it comes to configuring – this is the same issue – and an opportunity – to unify the procedure.

@qount25 qount25 changed the title WIP: building DEB packages with podman & pbuilder Building DEB packages with podman & pbuilder Mar 29, 2025
@yrashk yrashk merged commit bbea903 into postgres-pm:master Mar 29, 2025
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants