# 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 "time" apache_arrow_repository = ENV["APACHE_ARROW_REPOSITORY"] if apache_arrow_repository.nil? raise "Specify APACHE_ARROW_REPOSITORY environment variable" end require "#{apache_arrow_repository}/dev/tasks/linux-packages/package-task" groonga_repository = ENV["GROONGA_REPOSITORY"] if groonga_repository.nil? puts("You need to specify GROONGA_REPOSITORY environment variable " + "to push packages to Launchpad") else require "#{groonga_repository}/packages/launchpad-helper" end require_relative "../helper" class OpenArmCANPackageTask < PackageTask include LaunchpadHelper if Object.const_defined?(:LaunchpadHelper) def initialize super("openarm-can", detect_version, detect_release_time) end def define super define_ubuntu_tasks if respond_to?(:define_ubuntu_tasks, true) end private def detect_version Helper.detect_version end def detect_release_time release_time_env = ENV["RELEASE_TIME"] if release_time_env Time.parse(release_time_env).utc else Time.now.utc end end def enable_yum? 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}") ln_s("../#{@archive_name}", @archive_name) else download("https://github.com/#{github_repository}/" + "releases/download/#{@version}/#{@archive_name}", @archive_name) end end end def github_repository Helper.github_repository end def docker_image(os, architecture) "ghcr.io/#{github_repository.gsub("_", "-")}-package:#{super}" end def dput_configuration_name "openarm-ppa" end def dput_incoming "~openarm/main/ubuntu/" end end task = OpenArmCANPackageTask.new task.define