public inbox for passt-dev@passt.top
 help / color / mirror / code / Atom feed
From: Max Chernoff <git@maxchernoff.ca>
To: Stefano Brivio <sbrivio@redhat.com>, Max Chernoff <git@maxchernoff.ca>
Cc: passt-dev@passt.top, Paul Holzinger <pholzing@redhat.com>
Subject: Re: [PATCH] fedora: Separately restore context for /run/user in %posttrans selinux
Date: Sat, 24 May 2025 01:07:01 -0600	[thread overview]
Message-ID: <81a4ca4a36342affc942486e7adb3b03b20112da.camel@maxchernoff.ca> (raw)
In-Reply-To: <20250523141907.74aff624@elisabeth>

Hi Stefano,

On Fri, 2025-05-23 at 14:19 +0200, Stefano Brivio wrote:
> For one-off builds:
>
> > but I was eventually able to get the following to work:
> >
> >     $ git archive --prefix=passt-$(git rev-parse @)/ @ > ./passt-$(git rev-parse @).tar
> >     $ xz passt-*.tar
> >     $ mv *.tar.xz contrib/fedora/
> >     $ cd contrib/fedora/
> >     $ rpkg local --outdir $(realpath .)
>
> I actually do something like this, but uglier. I didn't think of using
> git-archive:
>
> $ mkdir passt-679cb68455a9ae40cc72233abf218c20527500a6/
> $ cp -Rpd *.c *.h Makefile seccomp.sh passt.1 passt-repair.1 qrap.1 README.md doc/ contrib/ LICENSES/ passt-679cb68455a9ae40cc72233abf218c20527500a6/
> $ tar Jcvf /home/sbrivio/rpmbuild/SOURCES/passt-679cb68455a9ae40cc72233abf218c20527500a6.tar.xz passt-679cb68455a9ae40cc72233abf218c20527500a6/
> $ cd contrib/fedora
> $ rpkg spec
> /tmp/rpkg/passt-1-djdq6cud/passt.spec
> $ rpmbuild -ba /tmp/rpkg/passt-1-djdq6cud/passt.spec

Ah, I've never built an rpm package before, so I figured that I was just
missing something obvious.

> We would need to replace %prep with a simple copy from the current
> directory. I didn't really think this through, but perhaps we could
> make it conditional, like this:
>
> diff --git a/contrib/fedora/passt.spec b/contrib/fedora/passt.spec
> index 745cf01..f1973ee 100644
> --- a/contrib/fedora/passt.spec
> +++ b/contrib/fedora/passt.spec
> @@ -47,7 +47,13 @@ Requires(preun): policycoreutils
>  This package adds SELinux enforcement to passt(1), pasta(1), passt-repair(1).
>
>  %prep
> +%if "%(ls passt.c)" == "passt.c"
> +# Hack for local build from source tree
> +cp -a %(pwd)/* .
> +%else
> +# The usual process with an upstream tarball
>  %setup -q -n passt-%{git_hash}
> +%endif
>
>  %build
>  %set_build_flags

I also needed to add "touch ../passt-%{git_hash}.tar.xz" (which is an
awful hack) for it to work properly:

diff --git a/contrib/fedora/passt.spec b/contrib/fedora/passt.spec
index 5aaf7ac..02dab93 100644
--- a/contrib/fedora/passt.spec
+++ b/contrib/fedora/passt.spec
@@ -47,7 +47,14 @@ Requires(preun): policycoreutils
 This package adds SELinux enforcement to passt(1), pasta(1), passt-repair(1).

 %prep
+%if "%(ls passt.c)" == "passt.c"
+# Hack for local build from source tree
+cp -a %(pwd)/* .
+touch ../passt-%{git_hash}.tar.xz
+%else
+# The usual process with an upstream tarball
 %setup -q -n passt-%{git_hash}
+%endif

 %build
 %set_build_flags

Thanks,
-- Max

      reply	other threads:[~2025-05-24  7:07 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-05-22 21:13 Stefano Brivio
2025-05-23  4:19 ` Max Chernoff
2025-05-23 12:19   ` Stefano Brivio
2025-05-24  7:07     ` Max Chernoff [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=81a4ca4a36342affc942486e7adb3b03b20112da.camel@maxchernoff.ca \
    --to=git@maxchernoff.ca \
    --cc=passt-dev@passt.top \
    --cc=pholzing@redhat.com \
    --cc=sbrivio@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://passt.top/passt

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for IMAP folder(s).