-
-
Notifications
You must be signed in to change notification settings - Fork 34
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
Generate Spec Files for COPR on Release Publish #406
Conversation
The CI failure is unrelated and can be ignored |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we should also generate spec files and commit them with the last released version (0.5.6).
After the template changes and with version 0.5.6, the package builds successfully for me locally.
.github/workflows/trigger-copr.yaml
Outdated
on: | ||
pull_request: | ||
types: | ||
- closed | ||
|
||
jobs: | ||
trigger-copr: | ||
if: github.event.pull_request.merged == true | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Check PR Labels | ||
id: check-labels | ||
run: | | ||
labels=$(jq -r '.pull_request.labels[].name' <<< "${{ toJson(github.event) }}") | ||
echo "Labels on this PR: $labels" | ||
if echo "$labels" | grep -q "copr-update"; then | ||
echo "Label 'copr-update' found." | ||
echo "::set-output name=trigger::true" | ||
else | ||
echo "Label 'copr-update' not found. Exiting." | ||
echo "::set-output name=trigger::false" | ||
exit 0 | ||
fi |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Instead of a PR label check via bash, it should be possible to trigger the PR based on the spec files being changed: https://docs.github.com/en/actions/writing-workflows/choosing-when-your-workflow-runs/events-that-trigger-workflows#running-your-pull_request-workflow-based-on-files-changed-in-a-pull-request
.github/workflows/generate-spec.yaml
Outdated
@@ -0,0 +1,62 @@ | |||
name: Generate Fedora Spec for COPR |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IMO both the workflow and the script should be named generate-fedora-spec
%defattr(-,root,root,-) | ||
%license LICENSE | ||
%doc README.md | ||
/usr/bin/$RECIPE_NAME |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This needs to list all the installed files:
/usr/bin/$RECIPE_NAME
/usr/lib/systemd/system/${RECIPE_NAME}d.service
/usr/share/applications/io.github.$RECIPE_NAME-linux.desktop
/usr/share/icons/hicolor/scalable/apps/io.github.$RECIPE_NAME-linux.svg
/usr/share/pixmaps/io.github.$RECIPE_NAME-linux.png
/usr/bin/$RECIPE_NAME | ||
|
||
%changelog | ||
* $(date +"%a %b %d %Y") - $MAINTAINER - $GH_RELEASE_NAME - $GH_RELEASE_TAG |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It probably doesn't matter in github workflows, but I've had to change this to LC_ALL=c date +"%a %b %d %Y"
, otherwise the changelog is generated with localized dates and RPM can't process them
pkg/bin/generate_spec.sh
Outdated
|
||
%install | ||
rm -rf %{buildroot} | ||
make install DESTDIR=%{buildroot} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This has to be make install PREFIX=/usr DESTDIR=%{buildroot}
, otherwise it installs into /usr/local
pkg/bin/generate_spec.sh
Outdated
$PKG_DESCRIPTION | ||
|
||
%prep | ||
%setup -q |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've had to change this to %setup -q -n LACT-%{version}
since the name of the source tarball doesn't match the folder inside it
I think everything should be fixed up, thanks for the quick feedback! Please lmk if you think of anything else that needs to be updated. I still haven't heard from @KyleGospo about the COPR pkg maintainer stuff, but this at least gets everything in place. Once this is merged, if you wanna set up a COPR account in the interim and set up the repo and packages (one package for each of |
I've pushed a few small changes to your branch, and now copr builds successfully from your fork: https://copr.fedorainfracloud.org/coprs/ilyaz/LACT/ |
As discussed in this issue about a fedora 41 release, this PR adds a bash script to generate a COPR compliant RPM spec from the existing pkger recipe files. This should (hopefully) make the burden of maintaining a COPR a lot less painful and not require you to manually edit three spec files on every release in addition to the recipe files.
Notable changes or new code:
pkg/bin/generate_spec.sh
yq
to extract a bunch of metadata about builds from your existing pkger filefedora
orfedora*
targets require.github/workflows/generate-spec.yaml
copr-update
label to the PR.github/workflows/trigger-copr.yaml
copr-update
label, hit the webhook url configured in repo secrets atCOPR_WEBHOOK_URL
This doesn't complete the entire integration to get a COPR build running, but it at least gets very close. AFAIK once the spec files are being reliably generated with accurate values for the build deps, etc, then we need to do some steps in COPR:
pkg/fedora-spec/lact
)COPR_WEBHOOK_URL
secret in your repo@KyleGospo also mentioned that he may be able to do some of the above steps for us, because he has fedora pkger status which I think means he can config these to go into an official repo? idk enough about COPR or the internals of that to say.
Anyway, let me know if I need to update anything here!