Skip to content

Instantly share code, notes, and snippets.

@kwk
Last active January 4, 2022 13:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kwk/259ad2f15ae4a7dc0d7987e5886d1922 to your computer and use it in GitHub Desktop.
Save kwk/259ad2f15ae4a7dc0d7987e5886d1922 to your computer and use it in GitHub Desktop.
Copr changelog entry with link to package build
Name: foo
Version: 1.0.0
Release: 1
Summary: foo
License: GPL
%description
some desc
%changelog
* Tue Jan 04 2022 LLVM snapshot build
- Snapshot build of version 1.0.0
Name: foo
Version: 1.0.0
Release: 1
Summary: foo
License: GPL
%description
some desc
# Check if we're building with copr
%if 0%{?copr_projectname:1}
# Remove the .copr prefix that is added here infront the build ID
# see https://pagure.io/copr/copr/blob/main/f/rpmbuild/mock.cfg.j2#_22-25
%global copr_build_id %{lua: print(string.sub(rpm.expand("%buildtag"), 6))}
%global llvm_snapshot_build_link https://copr.fedorainfracloud.org/coprs/build/%{copr_build_id}/
%endif
# This prints a multiline string for the changelog entry
%{lua: function _llvm_snapshot_changelog_entry()
print("* ")
print(os.date("%a %b %d %Y"))
print(" LLVM snapshot build\n")
print("- Snapshot build of version ")
print(rpm.expand("%version"))
print("\n\n")
if rpm.isdefined("llvm_snapshot_build_link") then
print(" (")
print(rpm.expand("%llvm_snapshot_build_link"))
print(")")
end
end}
%global llvm_snapshot_changelog_entry %{lua: _llvm_snapshot_changelog_entry()}
# ...
%changelog
%{?llvm_snapshot_changelog_entry}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment