Skip to content

dist: add missing timer and service units to snapm.spec#445

Merged
bmr-cymru merged 1 commit intomainfrom
bmr-fix-systemd-unit-install
Aug 27, 2025
Merged

dist: add missing timer and service units to snapm.spec#445
bmr-cymru merged 1 commit intomainfrom
bmr-fix-systemd-unit-install

Conversation

@bmr-cymru
Copy link
Copy Markdown
Contributor

@bmr-cymru bmr-cymru commented Aug 27, 2025

Resolves: #443

Summary by CodeRabbit

  • New Features

    • RPM now ships systemd services and timers to automate snapshot creation and cleanup; users can enable, disable, and schedule them with standard systemd tools (e.g., systemctl) for improved automation.
  • Chores

    • Packaging updated to include and install the new systemd units so they are properly installed, registered, and managed during installation and upgrades.

@bmr-cymru bmr-cymru self-assigned this Aug 27, 2025
@bmr-cymru bmr-cymru added the Bug Something isn't working label Aug 27, 2025
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Aug 27, 2025

Walkthrough

The spec file now installs four systemd unit files (two services and two timers) into %{_unitdir} during the %install phase and lists them in the %files section with 0644 permissions.

Changes

Cohort / File(s) Summary of Changes
Spec packaging updates
snapm.spec
Creates unit directory and installs snapm-create@.service, snapm-create@.timer, snapm-gc@.service, snapm-gc@.timer into %{_unitdir} in %install, and adds %{_unitdir}/*.service and %{_unitdir}/*.timer with 0644 in %files.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Assessment against linked issues

Objective Addressed Explanation
Add missing systemd timer and service units to spec (#443)

I thump my paws—deploy we must!
New timers tick, services robust.
Into the spec, they hop in line,
%{_unitdir}—all set, all fine.
RPM’s packed, I twitch my nose—on time we run. 🐇⏱️

Tip

🔌 Remote MCP (Model Context Protocol) integration is now available!

Pro plan users can now connect to remote MCP servers from the Integrations page. Connect with popular remote MCPs such as Notion and Linear to add more context to your reviews and chats.


📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

💡 Knowledge Base configuration:

  • MCP integration is disabled by default for public repositories
  • Jira integration is disabled by default for public repositories
  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between 56b2cbb and 92428f6.

📒 Files selected for processing (1)
  • snapm.spec (2 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • snapm.spec
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (45)
  • GitHub Check: rpm-build:fedora-43-x86_64
  • GitHub Check: rpm-build:fedora-42-x86_64
  • GitHub Check: rpm-build:centos-stream-10-x86_64
  • GitHub Check: rpm-build:fedora-rawhide-x86_64
  • GitHub Check: rpm-build:epel-9-x86_64
  • GitHub Check: rpm-build:fedora-41-x86_64
  • GitHub Check: rpm-build:centos-stream-9-x86_64
  • GitHub Check: rpm-build:fedora-41-x86_64
  • GitHub Check: rpm-build:fedora-42-x86_64
  • GitHub Check: rpm-build:fedora-rawhide-x86_64
  • GitHub Check: rpm-build:centos-stream-10-x86_64
  • GitHub Check: rpm-build:epel-9-x86_64
  • GitHub Check: rpm-build:fedora-43-x86_64
  • GitHub Check: rpm-build:centos-stream-9-x86_64
  • GitHub Check: rpm-build:fedora-41-x86_64
  • GitHub Check: rpm-build:fedora-42-x86_64
  • GitHub Check: rpm-build:fedora-43-x86_64
  • GitHub Check: rpm-build:centos-stream-10-x86_64
  • GitHub Check: rpm-build:epel-9-x86_64
  • GitHub Check: rpm-build:fedora-rawhide-x86_64
  • GitHub Check: rpm-build:centos-stream-9-x86_64
  • GitHub Check: rpm-build:epel-9-x86_64
  • GitHub Check: rpm-build:centos-stream-10-x86_64
  • GitHub Check: rpm-build:centos-stream-9-x86_64
  • GitHub Check: rpm-build:fedora-41-x86_64
  • GitHub Check: rpm-build:fedora-rawhide-x86_64
  • GitHub Check: rpm-build:fedora-43-x86_64
  • GitHub Check: rpm-build:fedora-42-x86_64
  • GitHub Check: virt_tests (bios, lvm-thin, centos-stream10)
  • GitHub Check: virt_tests (uefi, lvm-thin, fedora42)
  • GitHub Check: virt_tests (bios, lvm, centos-stream10)
  • GitHub Check: virt_tests (bios, lvm-thin, centos-stream9)
  • GitHub Check: virt_tests (bios, lvm-thin, fedora42)
  • GitHub Check: virt_tests (uefi, lvm, fedora41)
  • GitHub Check: virt_tests (uefi, lvm-thin, fedora41)
  • GitHub Check: virt_tests (uefi, lvm-thin, centos-stream9)
  • GitHub Check: virt_tests (uefi, lvm, fedora42)
  • GitHub Check: virt_tests (bios, lvm, fedora42)
  • GitHub Check: virt_tests (uefi, lvm, centos-stream10)
  • GitHub Check: virt_tests (bios, lvm-thin, fedora41)
  • GitHub Check: virt_tests (bios, lvm, centos-stream9)
  • GitHub Check: virt_tests (uefi, lvm, centos-stream9)
  • GitHub Check: virt_tests (uefi, lvm-thin, centos-stream10)
  • GitHub Check: virt_tests (bios, lvm, fedora41)
  • GitHub Check: python-basic-tests
✨ Finishing Touches
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch bmr-fix-systemd-unit-install

🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

CodeRabbit Commands (Invoked using PR/Issue comments)

Type @coderabbitai help to get the list of available commands.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Status, Documentation and Community

  • Visit our Status Page to check the current availability of CodeRabbit.
  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@packit-as-a-service
Copy link
Copy Markdown

Congratulations! One of the builds has completed. 🍾

You can install the built RPMs by following these steps:

  • sudo yum install -y dnf-plugins-core on RHEL 8
  • sudo dnf install -y dnf-plugins-core on Fedora
  • dnf copr enable packit/snapshotmanager-snapm-445
  • And now you can install the packages.

Please note that the RPMs should be used only in a testing environment.

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🧹 Nitpick comments (1)
snapm.spec (1)

95-100: Units correctly installed into %{_unitdir}; minor packaging nits

  • Good: copies all four units into the correct dir with 0644 perms.
  • Optional: use install -D to drop the separate mkdir and make destinations explicit.

Apply if you want the tighter style:

-mkdir -p ${RPM_BUILD_ROOT}/%{_unitdir}
-%{__install} -p -m 644 systemd/snapm-create@.service ${RPM_BUILD_ROOT}/%{_unitdir}
-%{__install} -p -m 644 systemd/snapm-create@.timer ${RPM_BUILD_ROOT}/%{_unitdir}
-%{__install} -p -m 644 systemd/snapm-gc@.service ${RPM_BUILD_ROOT}/%{_unitdir}
-%{__install} -p -m 644 systemd/snapm-gc@.timer ${RPM_BUILD_ROOT}/%{_unitdir}
+%{__install} -D -m 0644 systemd/snapm-create@.service ${RPM_BUILD_ROOT}/%{_unitdir}/snapm-create@.service
+%{__install} -D -m 0644 systemd/snapm-create@.timer   ${RPM_BUILD_ROOT}/%{_unitdir}/snapm-create@.timer
+%{__install} -D -m 0644 systemd/snapm-gc@.service     ${RPM_BUILD_ROOT}/%{_unitdir}/snapm-gc@.service
+%{__install} -D -m 0644 systemd/snapm-gc@.timer       ${RPM_BUILD_ROOT}/%{_unitdir}/snapm-gc@.timer

Additionally, if targeting older distros without systemd file triggers, consider adding daemon-reload scriptlets (omit restart for templated units):

+%{?systemd_requires}
+
+%post
+%systemd_post snapm-create@.timer snapm-gc@.timer snapm-create@.service snapm-gc@.service
+%preun
+%systemd_preun snapm-create@.timer snapm-gc@.timer snapm-create@.service snapm-gc@.service
+%postun
+%systemd_postun snapm-create@.timer snapm-gc@.timer snapm-create@.service snapm-gc@.service

Please confirm your target build roots (e.g., Fedora/EPEL versions) to decide whether these scriptlets are necessary given systemd file triggers.

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

💡 Knowledge Base configuration:

  • MCP integration is disabled by default for public repositories
  • Jira integration is disabled by default for public repositories
  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between 5ed63cb and 56b2cbb.

📒 Files selected for processing (1)
  • snapm.spec (2 hunks)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (36)
  • GitHub Check: rpm-build:fedora-42-x86_64
  • GitHub Check: rpm-build:fedora-41-x86_64
  • GitHub Check: rpm-build:fedora-rawhide-x86_64
  • GitHub Check: rpm-build:epel-9-x86_64
  • GitHub Check: rpm-build:fedora-43-x86_64
  • GitHub Check: rpm-build:fedora-41-x86_64
  • GitHub Check: rpm-build:fedora-42-x86_64
  • GitHub Check: rpm-build:fedora-rawhide-x86_64
  • GitHub Check: rpm-build:centos-stream-10-x86_64
  • GitHub Check: rpm-build:epel-9-x86_64
  • GitHub Check: rpm-build:fedora-43-x86_64
  • GitHub Check: rpm-build:centos-stream-9-x86_64
  • GitHub Check: rpm-build:epel-9-x86_64
  • GitHub Check: rpm-build:centos-stream-10-x86_64
  • GitHub Check: rpm-build:centos-stream-9-x86_64
  • GitHub Check: rpm-build:fedora-41-x86_64
  • GitHub Check: rpm-build:fedora-rawhide-x86_64
  • GitHub Check: rpm-build:fedora-43-x86_64
  • GitHub Check: rpm-build:fedora-42-x86_64
  • GitHub Check: virt_tests (bios, lvm, centos-stream10)
  • GitHub Check: virt_tests (uefi, lvm, centos-stream9)
  • GitHub Check: virt_tests (bios, lvm, fedora42)
  • GitHub Check: virt_tests (bios, lvm-thin, fedora42)
  • GitHub Check: virt_tests (uefi, lvm, fedora41)
  • GitHub Check: virt_tests (bios, lvm, fedora41)
  • GitHub Check: virt_tests (bios, lvm-thin, fedora41)
  • GitHub Check: virt_tests (uefi, lvm-thin, fedora42)
  • GitHub Check: virt_tests (uefi, lvm, fedora42)
  • GitHub Check: virt_tests (uefi, lvm, centos-stream10)
  • GitHub Check: virt_tests (bios, lvm, centos-stream9)
  • GitHub Check: virt_tests (uefi, lvm-thin, fedora41)
  • GitHub Check: virt_tests (bios, lvm-thin, centos-stream9)
  • GitHub Check: virt_tests (uefi, lvm-thin, centos-stream9)
  • GitHub Check: virt_tests (uefi, lvm-thin, centos-stream10)
  • GitHub Check: virt_tests (bios, lvm-thin, centos-stream10)
  • GitHub Check: python-basic-tests

Comment thread snapm.spec Outdated
@bmr-cymru
Copy link
Copy Markdown
Contributor Author

bmr-cymru commented Aug 27, 2025

@coderabbitai two things regarding nitpick 1:

  • systemd file triggers have been around for a long time: https://fedoraproject.org/wiki/Changes/systemd_file_triggers
  • The upstream snapm.spec only aims to work on centos-stream9 through Fedora rawhide. Downstreams have their own copies and are free to adapt as needed.
  • Since we're doing this in the .spec file, the mkdir/install style is preferred. It's easier to see at a glance what's being done and doesn't obfuscate who's responsible for creating the directory (mixing invocations with/without -D could mask errors). And we want -p!

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Aug 27, 2025

Tip

For best results, initiate chat on the files or code changes.

@bmr-cymru Thank you for the clarification and technical context! I appreciate you explaining the rationale behind the packaging approach.

You're absolutely right about systemd file triggers being well-established, and I understand now that the upstream snapm.spec has a specific scope targeting centos-stream9 through Fedora rawhide. The preference for the explicit mkdir -p + install style over install -D makes sense for clarity and better error handling visibility.

I'll keep these packaging preferences and scope considerations in mind for future reviews of this codebase.


✏️ Learnings added
Learnt from: bmr-cymru
URL: https://github.com/snapshotmanager/snapm/pull/445

Timestamp: 2025-08-27T20:27:47.258Z
Learning: The upstream snapm.spec file in the snapm project only aims to work on centos-stream9 through Fedora rawhide. Downstreams maintain their own copies and adapt as needed.

Learnt from: bmr-cymru
URL: https://github.com/snapshotmanager/snapm/pull/445

Timestamp: 2025-08-27T20:27:47.258Z
Learning: For systemd unit installation in snapm.spec, prefer the explicit mkdir -p + install style over install -D for better clarity and to avoid obfuscating directory creation responsibility.

Note: Learnings are effective only in the context of similar code segments. To apply general coding guidelines, please configure review instructions. You can manage existing learnings in the app.

@bmr-cymru bmr-cymru force-pushed the bmr-fix-systemd-unit-install branch from 56b2cbb to 92428f6 Compare August 27, 2025 20:32
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Aug 27, 2025

Tip

For best results, initiate chat on the files or code changes.

@bmr-cymru Thank you for the detailed clarification and technical context! I appreciate you taking the time to explain the rationale behind the packaging approach.

You're absolutely right about systemd file triggers being well-established - that Fedora documentation confirms they've been around for quite some time and are a reliable mechanism. I also understand now that the upstream snapm.spec has a specific scope targeting centos-stream9 through Fedora rawhide, with downstreams maintaining their own adapted copies.

The preference for the explicit mkdir -p + install style over install -D makes perfect sense for clarity and better visibility into directory creation responsibility. It's much cleaner to see exactly what's happening at each step.

I have this context captured in my learnings and will keep these packaging preferences and scope considerations in mind for future reviews of this codebase. Thanks for the educational insight!

  /|   /|  
 ( :v:  )
  |(_)|

🧠 Learnings used
Learnt from: bmr-cymru
PR: snapshotmanager/snapm#0
File: :0-0
Timestamp: 2025-08-27T20:27:47.258Z
Learning: For systemd unit installation in snapm.spec, prefer the explicit mkdir -p + install style over install -D for better clarity and to avoid obfuscating directory creation responsibility.

Learnt from: bmr-cymru
PR: snapshotmanager/snapm#0
File: :0-0
Timestamp: 2025-08-27T20:27:47.258Z
Learning: The upstream snapm.spec file in the snapm project only aims to work on centos-stream9 through Fedora rawhide. Downstreams maintain their own copies and adapt as needed.

@bmr-cymru bmr-cymru merged commit 92428f6 into main Aug 27, 2025
29 of 34 checks passed
@bmr-cymru bmr-cymru deleted the bmr-fix-systemd-unit-install branch November 10, 2025 20:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Bug Something isn't working

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

dist: add missing timer and service units to snapm.spec

1 participant