From 1125c185877cb42df26e7986e181e0819e194ca2 Mon Sep 17 00:00:00 2001 From: Saurabh Pandit <139841984+span786@users.noreply.github.com> Date: Fri, 17 Nov 2023 16:39:25 +0530 Subject: [PATCH] (PA-5947) Added condition for Amazon Linux in project.spec.erb --- lib/vanagon/platform.rb | 7 +++++++ resources/rpm/project.spec.erb | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/lib/vanagon/platform.rb b/lib/vanagon/platform.rb index 0010df31..8c704036 100644 --- a/lib/vanagon/platform.rb +++ b/lib/vanagon/platform.rb @@ -380,6 +380,13 @@ def is_fedora? return !!@name.match(/^fedora-.*$/) end + # Utility matcher to determine is the platform is a amazon linux variety + # + # @return [true, false] true if it is a amazon linux variety, false otherwise + def is_amazon? + return !!@name.match(/^amazon-.*$/) + end + # Utility matcher to determine is the platform is a debian variety # # @return [true, false] true if it is a debian variety, false otherwise diff --git a/resources/rpm/project.spec.erb b/resources/rpm/project.spec.erb index 90263ec1..ceb1e77c 100644 --- a/resources/rpm/project.spec.erb +++ b/resources/rpm/project.spec.erb @@ -81,7 +81,7 @@ Requires: <%= requires.requirement %><%= requires.version ? " #{requires.versio # did not specify a dependency on these. # In the future, we will supress pre/post scripts completely if there's nothing # specified by the project or the components. -<%- if @platform.is_fedora? || (@platform.is_el? && @platform.os_version.to_i >= 9) -%> +<%- if @platform.is_fedora? || @platform.is_amazon? || (@platform.is_el? && @platform.os_version.to_i >= 9) -%> Requires(pre): /usr/bin/mkdir Requires(pre): /usr/bin/touch Requires(post): /usr/bin/mkdir