Skip to content

Copy fedora changes#25

Merged
bluca merged 13 commits intosystemd:mainfrom
keszybz:copy-fedora-changes
Jan 26, 2022
Merged

Copy fedora changes#25
bluca merged 13 commits intosystemd:mainfrom
keszybz:copy-fedora-changes

Conversation

@keszybz
Copy link
Copy Markdown
Member

@keszybz keszybz commented Jan 25, 2022

This PR contains the changes that were done in the meantime in Fedora dist-git.
I retained the original commits because I think the history behind each decision might
be useful in the future, when we're trying to figure out how we arrived at this half-broken
mess.

This way %undefine _package_note_file is a good way to opt-out of the
feature. The other macros wouldn't work without %_package_note_file anyway.

Cherry-picked from https://src.fedoraproject.org/rpms/package-notes/c/fb5900700e5d58851b3258eb7de3e895485821e2
The idea was that we can avoid unnecessary work if the macro is called more than
once. But in hindsight this might be risky: let's instead minimize the number of
places where the macros is called, but always overwrite the file so that we
don't end up with a stale version from a previous build.

Cherry-picked from https://src.fedoraproject.org/rpms/package-notes/c/1acac701a662914ecf1542df853bed6b7b58d228
When subpackages are used, and have different Version fields, we end up with
the version of the last subpackage in %version. But RPM_PACKAGE_VERSION is
set early, and seems to have the right version.

Fixes rhbz#2043143.

Cherry-picked from https://src.fedoraproject.org/rpms/package-notes/c/04c3c7d71655f29b8a0d87eda008866277eb84db
IIUC, the normal %ifarch syntax cannot be used, because the definition
needs to be inline. The best I could find is %_target_cpu, which seems to be
set to "noarch" for noarch builds.

Cherry-picked from https://src.fedoraproject.org/rpms/package-notes/c/d32fe6caa279fd13066f78fa2439fae503e9b90c
Thanks to this the file is (in the common case) created in the unpacked
build directory, and not one level up. I.e.
/builddir/build/BUILD/lirc-0.10.0/.package_note-lirc-0.10.0-34.fc36.x86_64
instead of /builddir/build/BUILD/.package_note-lirc-0.10.0-34.fc36.x86_64.ld.
This is nicer esp. for 'fedpkg local' builds, where the dist-git directory is
used as the build dir.

When there are multiple %setup calls, the *last* extracted directory
becomes %{buildsubdir}. This might be confusing, but it shouldn't cause
problems for this use.

Suggested in https://bugzilla.redhat.com/show_bug.cgi?id=2043092#c21.

Cherry-picked from https://src.fedoraproject.org/rpms/package-notes/c/b7381d643d018ac490a95e8ef802821880c6e8ee
…ribute

READONLY is supported in ld.bfd from binutils >= 2.38, though the
patch was backported in rawhide. It is also unsupported by ld.gold,
so let's make it easy to skip it, since things will also work without
it, just a tiny bit worse.

Loosely based on https://src.fedoraproject.org/rpms/package-notes/c/87708e909b2f2e2c234b3b90565acbee3fc1eb8d
%_package_note_linker != "bfd" disables note insertion, so that it also works
as another opt-out mechanism. Maybe we can improve support in the future.

From https://bugzilla.redhat.com/show_bug.cgi?id=2043178#c26:

  It turns out that gold does something wrong with sections.
  When we add the new section, it shifts existing sections (and even gets one section less than before):
  │ -  Entry point address:               0x500
  │ +  Entry point address:               0x50
  │    Start of program headers:          64 (bytes into file)
  │ -  Start of section headers:          6328 (bytes into file)
  │ +  Start of section headers:          8344 (bytes into file)
  │    Flags:                             0x0
  │    Size of this header:               64 (bytes)
  │    Size of program headers:           56 (bytes)
  │ -  Number of program headers:         9
  │ +  Number of program headers:         8
  │    Size of section headers:           64 (bytes)
  │ -  Number of section headers:         36
  │ -  Section header string table index: 35
  │ +  Number of section headers:         38
  │ +  Section header string table index: 37

  There's a bug open to add INSERT AFTER [https://sourceware.org/bugzilla/show_bug.cgi?id=15373],
  but it's 8 years old.

  Opting out seems to be the best we can do for now.

I also noticed that gold support -dT, only lld doesn't, so the conditional is
adjusted accordingly.

Cherry-picked from https://src.fedoraproject.org/rpms/package-notes/c/2ee6aa07f8b94e48d24e329d1e0b0b270f4f12e3
Per https://bugzilla.redhat.com/show_bug.cgi?id=2043178#c27.

(cherry picked from commit d26d18e6f420cacba669ae1cf6ac911187c47dc4)
ld.bfd says "/usr/bin/ld: EOF in comment"
@mrc0mmand
Copy link
Copy Markdown
Member

The CI fail should be fixed by #26 (not sure why it didn't come up earlier).

Comment thread rpm/macros.package-notes-srpm Outdated
@keszybz keszybz force-pushed the copy-fedora-changes branch from 66245d3 to 465e1c1 Compare January 26, 2022 09:09
@bluca bluca merged commit 92a7283 into systemd:main Jan 26, 2022
@keszybz keszybz deleted the copy-fedora-changes branch January 26, 2022 14:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

3 participants