From 3accc089487a86c5563f5cf8380281fded8f2245 Mon Sep 17 00:00:00 2001 From: Dan Voiculeasa Date: Thu, 19 Aug 2021 10:37:43 +0300 Subject: [PATCH] Enhance Makefile and RPM specs For debian build the dh_auto_install step will inject a DESTDIR based on the artifact build directory PKGBUILDIDR (equivalent to buildroot for spec files), but without control for the desired destination on the system (local_stx_ansible_dir): make -j32 install DESTDIR=/<>/debian/playbookconfig Change Makefile to support DESTDIR and PREFIX. Change spec files to use DESTDIR as buildroot and PREFIX as destination on the system. This allows to write clean debian rules files. Tested by doing a CentOS7 build-pkg & build-iso, then did run the ansible playbook. Story: 2009101 Task: 43051 Signed-off-by: Dan Voiculeasa Change-Id: Ic5a0463a8b5fa804f7829435d91e51a8e315802e --- playbookconfig/centos/playbookconfig.spec | 2 +- playbookconfig/opensuse/playbookconfig.spec | 2 +- playbookconfig/src/Makefile | 6 +++--- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/playbookconfig/centos/playbookconfig.spec b/playbookconfig/centos/playbookconfig.spec index 285431cd2..f88dfa696 100644 --- a/playbookconfig/centos/playbookconfig.spec +++ b/playbookconfig/centos/playbookconfig.spec @@ -32,7 +32,7 @@ This package contains playbooks used for configuring StarlingX. %build %install -make install DESTDIR=%{buildroot}%{local_stx_ansible_dir} +make install DESTDIR=%{buildroot} PREFIX=%{local_stx_ansible_dir} %post cp %{local_stx_ansible_dir}/playbooks/ansible.cfg %{local_etc_ansible} diff --git a/playbookconfig/opensuse/playbookconfig.spec b/playbookconfig/opensuse/playbookconfig.spec index a1fba40d8..531ca7b3c 100644 --- a/playbookconfig/opensuse/playbookconfig.spec +++ b/playbookconfig/opensuse/playbookconfig.spec @@ -33,7 +33,7 @@ This package contains playbooks used for configuring StarlingX. %build %install -make install DESTDIR=%{buildroot}%{local_stx_ansible_dir} +make install DESTDIR=%{buildroot} PREFIX=%{local_stx_ansible_dir} chmod 755 %{buildroot}%{local_stx_ansible_dir}/playbooks/roles/bootstrap/persist-config/files/populate_initial_config.py chmod 755 %{buildroot}%{local_stx_ansible_dir}/playbooks/roles/bootstrap/prepare-env/files/check_root_disk_size.py chmod 755 %{buildroot}%{local_stx_ansible_dir}/playbooks/roles/backup/backup-system/files/fm_alarm.py diff --git a/playbookconfig/src/Makefile b/playbookconfig/src/Makefile index d35b37f20..a34a12608 100644 --- a/playbookconfig/src/Makefile +++ b/playbookconfig/src/Makefile @@ -2,8 +2,8 @@ # SPDX-License-Identifier: Apache-2.0 # -DESTDIR ?= /usr/share/ansible/stx-ansible +PREFIX ?= /usr/share/ansible/stx-ansible install: - install -d -m 0755 $(DESTDIR)/playbooks - cp -R playbooks/ $(DESTDIR)/ + install -d -m 0755 $(DESTDIR)$(PREFIX)/playbooks + cp -R playbooks/ $(DESTDIR)$(PREFIX)/