From 447db00a81eba87339cb9e9958b564447f65243e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vin=C3=ADcius=20Ferr=C3=A3o?= <2031761+viniciusferrao@users.noreply.github.com> Date: Mon, 26 Oct 2026 18:05:40 -0300 Subject: [PATCH] fix(netboot): keep profile helpers with shared image utilities Shared image utilities must not require the Debian source directory. Keep the profile helper beside imgutils and materialize the Debian copy when building RPM and DEB packages. Source-only Debian copies must follow symlinks; installed Debian directories stay self-contained. --- xCAT-server/debian/rules | 3 +++ .../xcat/netboot/debian/xCAT/ProfileUtils.pm | 18 +----------------- .../share/xcat/netboot/imgutils/imgutils.pm | 3 +-- .../xcat/netboot/imgutils/xCAT/ProfileUtils.pm | 17 +++++++++++++++++ xCAT-server/xCAT-server.spec | 5 +++++ 5 files changed, 27 insertions(+), 19 deletions(-) mode change 100644 => 120000 xCAT-server/share/xcat/netboot/debian/xCAT/ProfileUtils.pm create mode 100644 xCAT-server/share/xcat/netboot/imgutils/xCAT/ProfileUtils.pm diff --git a/xCAT-server/debian/rules b/xCAT-server/debian/rules index 4e7eb5bb70..42e73c583f 100755 --- a/xCAT-server/debian/rules +++ b/xCAT-server/debian/rules @@ -44,6 +44,9 @@ binary-arch: dh_installdocs # dh_installexamples dh_install -X".svn" + # Debian scripts must remain self-contained when copied from an installed package. + rm -f $(rootdir)/share/xcat/netboot/debian/xCAT/ProfileUtils.pm + install -m 0644 share/xcat/netboot/imgutils/xCAT/ProfileUtils.pm $(rootdir)/share/xcat/netboot/debian/xCAT/ProfileUtils.pm chmod 755 $(rootdir)/bin/* chmod 755 $(rootdir)/sbin/* chmod 644 $(rootdir)/share/xcat/ca/* diff --git a/xCAT-server/share/xcat/netboot/debian/xCAT/ProfileUtils.pm b/xCAT-server/share/xcat/netboot/debian/xCAT/ProfileUtils.pm deleted file mode 100644 index fb6e53e1e2..0000000000 --- a/xCAT-server/share/xcat/netboot/debian/xCAT/ProfileUtils.pm +++ /dev/null @@ -1,17 +0,0 @@ -package xCAT::ProfileUtils; - -use strict; -use warnings; - -sub find_profile_asset { - my ($base, $profile, $arch, $ext, @versions) = @_; - - my @suffixes = ((map { "$_.$arch" } @versions), $arch, @versions, ''); - foreach my $suffix (@suffixes) { - my $file = "$base/$profile" . (length($suffix) ? ".$suffix" : '') . ".$ext"; - return $file if -r $file; - } - return ''; -} - -1; diff --git a/xCAT-server/share/xcat/netboot/debian/xCAT/ProfileUtils.pm b/xCAT-server/share/xcat/netboot/debian/xCAT/ProfileUtils.pm new file mode 120000 index 0000000000..39bd0e65dd --- /dev/null +++ b/xCAT-server/share/xcat/netboot/debian/xCAT/ProfileUtils.pm @@ -0,0 +1 @@ +../../imgutils/xCAT/ProfileUtils.pm \ No newline at end of file diff --git a/xCAT-server/share/xcat/netboot/imgutils/imgutils.pm b/xCAT-server/share/xcat/netboot/imgutils/imgutils.pm index 73b50343eb..9cc0b35c7b 100644 --- a/xCAT-server/share/xcat/netboot/imgutils/imgutils.pm +++ b/xCAT-server/share/xcat/netboot/imgutils/imgutils.pm @@ -11,8 +11,7 @@ use File::Copy qw(move); use File::Find; use File::Path; use Cwd qw(realpath); -# Debian's standalone builder carries this helper with its copied scripts. -use lib dirname(__FILE__) . '/../debian'; +use lib dirname(__FILE__); use xCAT::ProfileUtils; use xCAT::SvrUtils; diff --git a/xCAT-server/share/xcat/netboot/imgutils/xCAT/ProfileUtils.pm b/xCAT-server/share/xcat/netboot/imgutils/xCAT/ProfileUtils.pm new file mode 100644 index 0000000000..fb6e53e1e2 --- /dev/null +++ b/xCAT-server/share/xcat/netboot/imgutils/xCAT/ProfileUtils.pm @@ -0,0 +1,17 @@ +package xCAT::ProfileUtils; + +use strict; +use warnings; + +sub find_profile_asset { + my ($base, $profile, $arch, $ext, @versions) = @_; + + my @suffixes = ((map { "$_.$arch" } @versions), $arch, @versions, ''); + foreach my $suffix (@suffixes) { + my $file = "$base/$profile" . (length($suffix) ? ".$suffix" : '') . ".$ext"; + return $file if -r $file; + } + return ''; +} + +1; diff --git a/xCAT-server/xCAT-server.spec b/xCAT-server/xCAT-server.spec index 2bbeaaaad3..ccd3db0837 100644 --- a/xCAT-server/xCAT-server.spec +++ b/xCAT-server/xCAT-server.spec @@ -179,6 +179,11 @@ cp -hpR share/xcat/install/* $RPM_BUILD_ROOT/%{prefix}/share/xcat/install/ cp -hpR share/xcat/netboot/* $RPM_BUILD_ROOT/%{prefix}/share/xcat/netboot/ %endif +# Debian scripts must remain self-contained when copied from an installed package. +rm -f $RPM_BUILD_ROOT/%{prefix}/share/xcat/netboot/debian/xCAT/ProfileUtils.pm +cp share/xcat/netboot/imgutils/xCAT/ProfileUtils.pm $RPM_BUILD_ROOT/%{prefix}/share/xcat/netboot/debian/xCAT/ProfileUtils.pm +chmod 644 $RPM_BUILD_ROOT/%{prefix}/share/xcat/netboot/debian/xCAT/ProfileUtils.pm $RPM_BUILD_ROOT/%{prefix}/share/xcat/netboot/imgutils/xCAT/ProfileUtils.pm + %ifos linux # pwd cp -d sbin/* $RPM_BUILD_ROOT/%{prefix}/sbin