Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion .packit.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,15 @@

# https://packit.dev/docs/configuration/

specfile_path: packages/fedora/openarm-can.spec
specfile_path: packages/yum/openarm-can.spec

actions:
post-upstream-clone:
- rake -C packages/yum spec

srpm_build_deps:
- rubygem-json
- rubygem-rake

notifications:
pull_request:
Expand Down
26 changes: 25 additions & 1 deletion Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
# limitations under the License.

require "date"
require "fileutils"

require_relative "helper"

Expand Down Expand Up @@ -110,7 +111,6 @@ namespace :release do
"CMakeLists.txt",
"package.xml",
"packages/debian/changelog",
"packages/fedora/openarm-can.spec",
"python/CMakeLists.txt",
"python/openarm_can/__init__.py",
"python/pyproject.toml",
Expand Down Expand Up @@ -165,3 +165,27 @@ task release: [
"release:tag",
"release:ubuntu",
]

desc "Create RPM spec file"
task :spec do
FileUtils.copy_file("packages/fedora/openarm-can.spec.in", "openarm-can.spec")
current_version = Helper.detect_version
Helper.update_content("openarm-can.spec") do |content|
content.sub!("%{VERSION}", current_version)
end
executable_files = Array.new()
File.readlines('CMakeLists.txt', chomp: true).each do |line|
if !!(line =~ /install\(TARGETS openarm-can-*.* DESTINATION \${CMAKE_INSTALL_BINDIR}\)/)
executable=line.delete_prefix("install(TARGETS ").delete_suffix(" DESTINATION ${CMAKE_INSTALL_BINDIR})")
executable_files.append("%{_bindir}/" + executable)
end
if !!(line =~ /setup\/openarm-can-[a-z0-9\-]/)
/(?<rhs>.+)\s*setup\/\s*(?<executable>.+)/ =~ line
executable_files.append("%{_bindir}/" + executable)
end
end
executable_files.sort!
Helper.update_content("openarm-can.spec") do |content|
content.sub!("%{EXECUTABLES}", executable_files.join("\n"))
end
end
8 changes: 0 additions & 8 deletions packages/Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -89,14 +89,6 @@ class OpenArmCANPackageTask < PackageTask
false
end

def update_spec
update_content("fedora/openarm-can.spec") do |content|
content.gsub!(/^(Version:\s+)[\d.]+$/) do
"#{$1}#{@version}"
end
end
end

def define_archive_task
file @archive_name do
if File.exist?("../#{@archive_name}")
Expand Down
43 changes: 43 additions & 0 deletions packages/yum/Rakefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
# Copyright 2025 Enactic, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

require "fileutils"

require_relative "../../helper"

version = ENV["VERSION"] || Helper.detect_version

desc "Create RPM spec file"
task :spec do
FileUtils.copy_file("openarm-can.spec.in", "openarm-can.spec")
current_version = Helper.detect_version
Helper.update_content("openarm-can.spec") do |content|
content.sub!("@VERSION@", current_version)
end
executable_files = Array.new()
File.readlines('../../CMakeLists.txt', chomp: true).each do |line|
if !!(line =~ /install\(TARGETS openarm-can-*.* DESTINATION \${CMAKE_INSTALL_BINDIR}\)/)
executable=line.delete_prefix("install(TARGETS ").delete_suffix(" DESTINATION ${CMAKE_INSTALL_BINDIR})")
executable_files.append("%{_bindir}/" + executable)
end
if !!(line =~ /setup\/openarm-can-[a-z0-9\-]/)
/(?<rhs>.+)\s*setup\/\s*(?<executable>.+)/ =~ line
executable_files.append("%{_bindir}/" + executable)
end
end
executable_files.sort!
Helper.update_content("openarm-can.spec") do |content|
content.sub!("@EXECUTABLES@", executable_files.join("\n"))
end
end
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
# limitations under the License.

Name: openarm-can
Version: 1.2.2
Version: @VERSION@
Release: %{autorelease}
Summary: OpenArm CAN control library

Expand Down Expand Up @@ -68,14 +68,7 @@ Setup and configuration utility scripts.

%files utils
%license LICENSE.txt
%{_bindir}/openarm-can-change-baudrate
%{_bindir}/openarm-can-configure-socketcan
%{_bindir}/openarm-can-configure-socketcan-4-arms
%{_bindir}/openarm-can-demo
%{_bindir}/openarm-can-diagnosis
%{_bindir}/openarm-can-motor-check
%{_bindir}/openarm-can-set-zero
%{_bindir}/openarm-can-zero-position-calibration
@EXECUTABLES@

%changelog
%autochangelog
Loading