Skip to content

Conversation

@bkmgit
Copy link
Contributor

@bkmgit bkmgit commented Dec 24, 2025

No description provided.

@bkmgit
Copy link
Contributor Author

bkmgit commented Dec 24, 2025

Closes #100

@packit-as-a-service
Copy link

Congratulations! One of the builds has completed. 🍾

You can install the built RPMs by following these steps:

  • sudo dnf install -y 'dnf*-command(copr)'
  • dnf copr enable packit/enactic-openarm_can-100
  • And now you can install the packages.

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

.packit.yaml Outdated

actions:
post-upstream-clone:
- rake spec
Copy link
Contributor

Choose a reason for hiding this comment

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

Could you do this by rake -C packages yum:spec (packages/Rakefile not the top-level Rakefile)? Packages related code exist in packages/.

Could you use packages/yum/openarm-can.spec.in not .../fedora/...? We can reuse existing code by using packages/yum/openarm-can.spec.in.

diff --git a/packages/Rakefile b/packages/Rakefile
index 6091959..e921775 100644
--- a/packages/Rakefile
+++ b/packages/Rakefile
@@ -89,12 +89,36 @@ class OpenArmCANPackageTask < PackageTask
     false
   end
 
-  def update_spec
-    update_content("fedora/openarm-can.spec") do |content|
-      content.gsub!(/^(Version:\s+)[\d.]+$/) do
-        "#{$1}#{@version}"
+  def yum_spec
+    "#{yum_dir}/#{@rpm_package}.spec"
+  end
+
+  def define_yum_task
+    super
+
+    file yum_spec => yum_spec_in_path do
+      spec_in_data = File.read(yum_spec_in_path, encoding: "UTF-8")
+      spec_data = substitute_content(spec_in_data) do |key, matched|
+        yum_expand_variable(key) || matched
+      end
+      File.open(spec, "w") do |spec_file|
+        spec_file.print(spec_data)
       end
     end
+
+    namespace :yum do
+      desc "Update #{yum_spec}"
+      task spec: yum_spec
+    end
+  end
+
+  def yum_expand_variable(key)
+    case key
+    when "EXECUTABLES"
+      # ...
+    else
+      super
+    end
   end
 
   def define_archive_task

FYI: @VERSION@ is expanded by default: https://github.com/apache/arrow/blob/3dc982183db45ced57ef1565e022dcb647a00745/dev/tasks/linux-packages/package-task.rb#L444-L455

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Would it be possible to make https://github.com/apache/arrow/blob/main/dev/tasks/linux-packages/package-task.rb part of a gem? This would allow easy reuse in other projects.

Requiring Arrow and Groonga repositories at https://github.com/enactic/openarm_can/blob/main/packages/Rakefile#L17-L29 complicates the workflow. For the moment have placed the Rakefile in packages/yum/Rakefile to avoid these extra dependencies. If the logic they encode could be in a separate Gem or repository for use by multiple projects, it would be easier to incorporate.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Happy to help with refactoring.

@bkmgit bkmgit force-pushed the update-spec-file branch 2 times, most recently from 0476c08 to 8449b4f Compare December 26, 2025 04:55
@bkmgit
Copy link
Contributor Author

bkmgit commented Dec 26, 2025

/packit build

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants