[OS-BUILD PATCHv2] redhat/kernel.spec.template: Add log_msg macro

2024-02-21 Thread Prarit Bhargava (via Email Bridge)
From: Prarit Bhargava 

redhat/kernel.spec.template: Add log_msg macro

After last week's debugging session I was reminded why I hate debugging
the kernel.spec.  It's not that it's long, or that the code is difficult
to understand -- it's that it can be difficult to map precisely where the
fault in the spec file is.  This isn't due to poor design and is due to
the size of the kernel.spec and how rpmbuild creates bash scripts.

In the %prep, %build, and %install stages, we often end up with an error
that looks like

cc1: error: unrecognized command-line option '-mbranch-protection=standard'
cc1: error: unrecognized command-line option '-mbranch-protection=standard'
error: Bad exit status from /var/tmp/rpm-tmp.W1qm1T (%build)

In this example, the /var/tmp/rpm-tmp.W1qm1T script is created by
rpmbuild, and represents the %build stage of the spec file.  It is left to
the user to decipher the script and map that into the kernel.spec file to
find the exact command(s) that failed; sometimes that is easy to do, and
other times it is the most infuriating thing ever.  It's made me question
my choices in life and sent me into an existential crisis from which I'm
likely never to recover.

This changeset adds a log_msg macro. The hope is that this will be much
more useful than digging through the resulting prep, build, and install
scripts and trying to map the result to the spec file.

Add log_msg() to the %prep, %build, and %install stages, and prepopulate
the spec file with some log_msg's to indicate progress.

Signed-off-by: Prarit Bhargava 

diff --git a/redhat/kernel.spec.template b/redhat/kernel.spec.template
index blahblah..blahblah 100644
--- a/redhat/kernel.spec.template
+++ b/redhat/kernel.spec.template
@@ -1711,11 +1711,20 @@ Prebuilt 64k unified kernel image for virtual machines.
 %kernel_ipaclones_package
 %endif
 
+%define log_msg() set +x \
+   _log_msglineno=$(grep -n %{*} %{_specdir}/${RPM_PACKAGE_NAME}.spec | 
grep log_msg | cut -d":" -f1) \
+   echo "kernel.spec:${_log_msglineno}: %{*}" \
+   set -x
+
 %prep
+%{log_msg "Start of prep stage"}
+
+%{log_msg "Sanity checks"}
+
 # do a few sanity-checks for --with *only builds
 %if %{with_baseonly}
 %if !%{with_up}
-echo "Cannot build --with baseonly, up build is disabled"
+%{log_msg "Cannot build --with baseonly, up build is disabled"}
 exit 1
 %endif
 %endif
@@ -1724,7 +1733,7 @@ exit 1
 if [ "%{patches}" != "%%{patches}" ] ; then
   for patch in %{patches} ; do
 if [ ! -f $patch ] ; then
-  echo "ERROR: Patch  ${patch##/*/}  listed in specfile but is missing"
+   %{log_msg "ERROR: Patch  ${patch##/*/}  listed in specfile but is 
missing"}
   exit 1
 fi
   done
@@ -1740,7 +1749,7 @@ ApplyPatch()
   fi
   if ! grep -E "^Patch[0-9]+: $patch\$" %{_specdir}/${RPM_PACKAGE_NAME}.spec ; 
then
 if [ "${patch:0:8}" != "patch-%{kversion}." ] ; then
-  echo "ERROR: Patch  $patch  not listed as a source patch in specfile"
+   %{log_msg "ERROR: Patch  $patch  not listed as a source patch in 
specfile"}
   exit 1
 fi
   fi 2>/dev/null
@@ -1757,6 +1766,7 @@ ApplyOptionalPatch()
 {
   local patch=$1
   shift
+  %{log_msg "ApplyOptionalPatch: $1"}
   if [ ! -f $RPM_SOURCE_DIR/$patch ]; then
 exit 1
   fi
@@ -1766,12 +1776,14 @@ ApplyOptionalPatch()
   fi
 }
 
+%{log_msg "Untar kernel tarball"}
 %setup -q -n kernel-%{tarfile_release} -c
 mv linux-%{tarfile_release} linux-%{KVERREL}
 
 cd linux-%{KVERREL}
 cp -a %{SOURCE1} .
 
+%{log_msg "Start of patch applications"}
 %if !%{nopatches}
 
 ApplyOptionalPatch patch-%{patchversion}-redhat.patch
@@ -1779,10 +1791,11 @@ ApplyOptionalPatch patch-%{patchversion}-redhat.patch
 
 ApplyOptionalPatch linux-kernel-test.patch
 
+%{log_msg "End of patch applications"}
 # END OF PATCH APPLICATIONS
 
 # Any further pre-build tree manipulations happen here.
-
+%{log_msg "Pre-build tree manipulations"}
 chmod +x scripts/checkpatch.pl
 mv COPYING COPYING-%{specrpmversion}-%{release}
 
@@ -1797,7 +1810,7 @@ rm -f localversion-next
 # This fixes errors such as
 # *** ERROR: ambiguous python shebang in /usr/bin/kvm_stat: #!/usr/bin/python. 
Change it to python3 (or python2) explicitly.
 # We patch all sources below for which we got a report/error.
-echo "Fixing Python shebangs..."
+%{log_msg "Fixing Python shebangs..."}
 %py3_shebang_fix \
tools/kvm/kvm_stat/kvm_stat \
scripts/show_delta \
@@ -1817,6 +1830,7 @@ fi
 mkdir configs
 cd configs
 
+%{log_msg "Copy additional source files into buildroot"}
 # Drop some necessary files from the source dir into the buildroot
 cp $RPM_SOURCE_DIR/%{name}-*.config .
 cp %{SOURCE80} .
@@ -1828,6 +1842,7 @@ cp %{SOURCE3001} partial-kernel-local-debug-snip.config
 FLAVOR=%{primary_target} SPECPACKAGE_NAME=%{name} SPECVERSION=%{specversion} 
SPECRPMVERSION=%{specrpmversion} ./generate_all_configs.sh %{debugbuildsenabled}
 
 # Collect custom defined config options
+%{log_msg "Collect custom defined config options"}
 PARTIAL_CONFIGS=""
 

[OS-BUILD PATCH] redhat/kernel.spec.template: Add log_msg macro

2024-02-21 Thread Prarit Bhargava (via Email Bridge)
From: Prarit Bhargava 

redhat/kernel.spec.template: Add log_msg macro

After last week's debugging session I was reminded why I hate debugging
the kernel.spec.  It's not that it's long, or that the code is difficult
to understand -- it's that it can be difficult to map precisely where the
fault in the spec file is.  This isn't due to poor design and is due to
the size of the kernel.spec and how rpmbuild creates bash scripts.

In the %prep, %build, and %install stages, we often end up with an error
that looks like

cc1: error: unrecognized command-line option '-mbranch-protection=standard'
cc1: error: unrecognized command-line option '-mbranch-protection=standard'
error: Bad exit status from /var/tmp/rpm-tmp.W1qm1T (%build)

In this example, the /var/tmp/rpm-tmp.W1qm1T script is created by
rpmbuild, and represents the %build stage of the spec file.  It is left to
the user to decipher the script and map that into the kernel.spec file to
find the exact command(s) that failed; sometimes that is easy to do, and
other times it is the most infuriating thing ever.  It's made me question
my choices in life and sent me into an existential crisis from which I'm
likely never to recover.

This changeset adds a log_msg macro. The hope is that this will be much
more useful than digging through the resulting prep, build, and install
scripts and trying to map the result to the spec file.

Add log_msg() to the %prep, %build, and %install stages, and prepopulate
the spec file with some log_msg's to indicate progress.

Signed-off-by: Prarit Bhargava 

diff --git a/redhat/kernel.spec.template b/redhat/kernel.spec.template
index blahblah..blahblah 100644
--- a/redhat/kernel.spec.template
+++ b/redhat/kernel.spec.template
@@ -1711,11 +1711,20 @@ Prebuilt 64k unified kernel image for virtual machines.
 %kernel_ipaclones_package
 %endif
 
+%define log_msg() set +x \
+   _log_msglineno=$(grep -n %{*} %{_specdir}/${RPM_PACKAGE_NAME}.spec | 
grep log_msg | cut -d":" -f1) \
+   echo "kernel.spec:${_log_msglineno}: %{*}" \
+   set -x
+
 %prep
+%{log_msg "Start of prep stage"}
+
+%{log_msg "Sanity checks"}
+
 # do a few sanity-checks for --with *only builds
 %if %{with_baseonly}
 %if !%{with_up}
-echo "Cannot build --with baseonly, up build is disabled"
+%{log_msg "Cannot build --with baseonly, up build is disabled"}
 exit 1
 %endif
 %endif
@@ -1724,7 +1733,7 @@ exit 1
 if [ "%{patches}" != "%%{patches}" ] ; then
   for patch in %{patches} ; do
 if [ ! -f $patch ] ; then
-  echo "ERROR: Patch  ${patch##/*/}  listed in specfile but is missing"
+   %{log_msg "ERROR: Patch  ${patch##/*/}  listed in specfile but is 
missing"}
   exit 1
 fi
   done
@@ -1740,7 +1749,7 @@ ApplyPatch()
   fi
   if ! grep -E "^Patch[0-9]+: $patch\$" %{_specdir}/${RPM_PACKAGE_NAME}.spec ; 
then
 if [ "${patch:0:8}" != "patch-%{kversion}." ] ; then
-  echo "ERROR: Patch  $patch  not listed as a source patch in specfile"
+   %{log_msg "ERROR: Patch  $patch  not listed as a source patch in 
specfile"}
   exit 1
 fi
   fi 2>/dev/null
@@ -1757,6 +1766,7 @@ ApplyOptionalPatch()
 {
   local patch=$1
   shift
+  %{log_msg "ApplyOptionalPatch: $1"}
   if [ ! -f $RPM_SOURCE_DIR/$patch ]; then
 exit 1
   fi
@@ -1766,12 +1776,14 @@ ApplyOptionalPatch()
   fi
 }
 
+%{log_msg "Untar kernel tarball"}
 %setup -q -n kernel-%{tarfile_release} -c
 mv linux-%{tarfile_release} linux-%{KVERREL}
 
 cd linux-%{KVERREL}
 cp -a %{SOURCE1} .
 
+%{log_msg "Start of patch applications"}
 %if !%{nopatches}
 
 ApplyOptionalPatch patch-%{patchversion}-redhat.patch
@@ -1779,10 +1791,11 @@ ApplyOptionalPatch patch-%{patchversion}-redhat.patch
 
 ApplyOptionalPatch linux-kernel-test.patch
 
+%{log_msg "End of patch applications"}
 # END OF PATCH APPLICATIONS
 
 # Any further pre-build tree manipulations happen here.
-
+%{log_msg "Pre-build tree manipulations"}
 chmod +x scripts/checkpatch.pl
 mv COPYING COPYING-%{specrpmversion}-%{release}
 
@@ -1797,7 +1810,7 @@ rm -f localversion-next
 # This fixes errors such as
 # *** ERROR: ambiguous python shebang in /usr/bin/kvm_stat: #!/usr/bin/python. 
Change it to python3 (or python2) explicitly.
 # We patch all sources below for which we got a report/error.
-echo "Fixing Python shebangs..."
+%{log_msg "Fixing Python shebangs..."}
 %py3_shebang_fix \
tools/kvm/kvm_stat/kvm_stat \
scripts/show_delta \
@@ -1817,6 +1830,7 @@ fi
 mkdir configs
 cd configs
 
+%{log_msg "Copy additional source files into buildroot"}
 # Drop some necessary files from the source dir into the buildroot
 cp $RPM_SOURCE_DIR/%{name}-*.config .
 cp %{SOURCE80} .
@@ -1828,6 +1842,7 @@ cp %{SOURCE3001} partial-kernel-local-debug-snip.config
 FLAVOR=%{primary_target} SPECPACKAGE_NAME=%{name} SPECVERSION=%{specversion} 
SPECRPMVERSION=%{specrpmversion} ./generate_all_configs.sh %{debugbuildsenabled}
 
 # Collect custom defined config options
+%{log_msg "Collect custom defined config options"}
 PARTIAL_CONFIGS=""
 

Re: kernel leftovers in /boot/efi/EFI/Linux/

2024-02-21 Thread Germano Massullo

Thank you for your support.
Perhaps I am missing something in the kernel-install commands

root@machine:/home/user# rpm -q --scripts kernel-uki-virt
package kernel-uki-virt not installed

root@machine:/home/user# kernel-install -v add
Loading /usr/lib/kernel/install.conf…
Loaded /usr/lib/kernel/install.conf.
MACHINE_ID=xxx set via /etc/machine-id.
Found cgroup2 on /sys/fs/cgroup/, full unified hierarchy
Found container virtualization none.
/dev/nvme0n1p1: Partition has wrong PART_ENTRY_TYPE=xxx for XBOOTLDR 
partition.

Couldn't find an XBOOTLDR partition.
Failed to check file system type of "/efi": No such file or directory
File system "/boot" is not a FAT EFI System Partition (ESP) file system.
Using EFI System Partition at /boot/efi as $BOOT_ROOT.
Using entry token: xxx
Too few arguments.

root@machine:/home/user# kernel-install -v remove
Loading /usr/lib/kernel/install.conf…
Loaded /usr/lib/kernel/install.conf.
MACHINE_ID=xxx set via /etc/machine-id.
Found cgroup2 on /sys/fs/cgroup/, full unified hierarchy
Found container virtualization none.
/dev/nvme0n1p1: Partition has wrong PART_ENTRY_TYPE=xxx for XBOOTLDR 
partition.

Couldn't find an XBOOTLDR partition.
Failed to check file system type of "/efi": No such file or directory
File system "/boot" is not a FAT EFI System Partition (ESP) file system.
Using EFI System Partition at /boot/efi as $BOOT_ROOT.
Using entry token: xxx
Too few arguments.
--
___
kernel mailing list -- kernel@lists.fedoraproject.org
To unsubscribe send an email to kernel-le...@lists.fedoraproject.org
Fedora Code of Conduct: 
https://docs.fedoraproject.org/en-US/project/code-of-conduct/
List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines
List Archives: 
https://lists.fedoraproject.org/archives/list/kernel@lists.fedoraproject.org
Do not reply to spam, report it: 
https://pagure.io/fedora-infrastructure/new_issue


[OS-BUILD PATCH] gitlab-ci: drop test_makefile job

2024-02-21 Thread Scott Weaver (via Email Bridge)
From: Scott Weaver 

gitlab-ci: drop test_makefile job

We no longer need this test because we build using the cki build
containers which already have the build dependencies installed and those
build containers are gated on being able to build the kernel.

Signed-off-by: Scott Weaver 

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index blahblah..blahblah 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -446,28 +446,6 @@ rawhide_release:
 - *only-os-build-schedule
 - if: $RAWHIDE_RELEASE == "true"
 
-test_makefile:
-  image: quay.io/fedora/fedora:rawhide
-  variables:
-GIT_DEPTH: "0"
-GIT_CLONE_PATH: $CI_BUILDS_DIR/$CI_CONCURRENT_ID/kernel-ark
-  before_script:
-- echo "fastestmirror=true" >> /etc/dnf/dnf.conf
-- dnf -y install python3-gitlab git openssh-clients dnf-utils gnupg2
-# These packages are required for 'make dist-get-buildreqs'
-- dnf -y install make rpm-build
-- git config user.name "Fedora Kernel Team"
-- git config user.email "kernel-t...@fedoraproject.org"
-  script:
-- export missing=$(make dist-get-buildreqs | grep "Missing dependencies:" 
| cut -d":" -f2-)
-- if [ "$missing" == "" ]; then echo "Missing dependencies should not be 
null but are empty. Review test log." && exit 1; fi;
-- dnf -y install $missing
-- export missingafter=$(make dist-get-buildreqs | grep "Missing 
dependencies:" | cut -d":" -f2-)
-- if [ "$missingafter" != "" ]; then echo "Missing dependencies should be 
null but are $missingafter. Review test log." && exit 1; fi;
-  rules:
-- *only-os-build-mr
-- *on-success
-
 docs:
   image: quay.io/cki/cki-tools:production
   script:

--
https://gitlab.com/cki-project/kernel-ark/-/merge_requests/2951
--
___
kernel mailing list -- kernel@lists.fedoraproject.org
To unsubscribe send an email to kernel-le...@lists.fedoraproject.org
Fedora Code of Conduct: 
https://docs.fedoraproject.org/en-US/project/code-of-conduct/
List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines
List Archives: 
https://lists.fedoraproject.org/archives/list/kernel@lists.fedoraproject.org
Do not reply to spam, report it: 
https://pagure.io/fedora-infrastructure/new_issue


[OS-BUILD PATCHv2] Add libperf-debuginfo subpackage

2024-02-21 Thread Justin M. Forbes (via Email Bridge)
From: Justin M. Forbes 

Add libperf-debuginfo subpackage

When libperf was added, I failed to add the libperf-debuginfo
subpackage. This leaves libperf debuginfo in kernel-debuginfo-common
which is installonly, and creaes file conflicts.  Add the debuginfo
subpackage so things are where they belong.

Signed-off-by: Justin M. Forbes 

diff --git a/redhat/kernel.spec.template b/redhat/kernel.spec.template
index blahblah..blahblah 100644
--- a/redhat/kernel.spec.template
+++ b/redhat/kernel.spec.template
@@ -1137,6 +1137,19 @@ Summary: Developement files for the perf library from 
kernel source
 This package includes libraries and header files needed for development
 of applications which use perf library from kernel source.
 
+%package -n libperf-debuginfo
+Summary: Debug information for package libperf
+Group: Development/Debug
+Requires: %{name}-debuginfo-common-%{_target_cpu} = %{version}-%{release}
+AutoReqProv: no
+%description -n libperf-debuginfo
+This package provides debug information for the libperf package.
+
+# Note that this pattern only works right to match the .build-id
+# symlinks because of the trailing nonmatching alternation and
+# the leading .*, because of find-debuginfo.sh's buggy handling
+# of matching the pattern against the symlinks file.
+%{expand:%%global _find_debuginfo_opts %{?_find_debuginfo_opts} -p 
'.*%%{_libdir}/libperf.so(\.debug)?|XXX' -o libperf-debuginfo.list}
 # with_libperf
 %endif
 
@@ -3561,6 +3574,7 @@ fi\
 %{_docdir}/libperf/html/libperf-counting.html
 %{_docdir}/libperf/html/libperf-sampling.html
 
+%files -f libperf-debuginfo.list -n libperf-debuginfo
 # with_libperf
 %endif
 

--
https://gitlab.com/cki-project/kernel-ark/-/merge_requests/2950
--
___
kernel mailing list -- kernel@lists.fedoraproject.org
To unsubscribe send an email to kernel-le...@lists.fedoraproject.org
Fedora Code of Conduct: 
https://docs.fedoraproject.org/en-US/project/code-of-conduct/
List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines
List Archives: 
https://lists.fedoraproject.org/archives/list/kernel@lists.fedoraproject.org
Do not reply to spam, report it: 
https://pagure.io/fedora-infrastructure/new_issue


[OS-BUILD PATCH] Add libperf-debuginfo subpackage

2024-02-21 Thread Justin M. Forbes (via Email Bridge)
From: Justin M. Forbes 

Add libperf-debuginfo subpackage

When libperf was added, I failed to add the libperf-debuginfo
subpackage. This leaves libperf debuginfo in kernel-debuginfo-common
which is installonly, and creaes file conflicts.  Add the debuginfo
subpackage so things are where they belong.

Signed-off-by: Justin M. Forbes 

diff --git a/redhat/kernel.spec.template b/redhat/kernel.spec.template
index blahblah..blahblah 100644
--- a/redhat/kernel.spec.template
+++ b/redhat/kernel.spec.template
@@ -1137,6 +1137,19 @@ Summary: Developement files for the perf library from 
kernel source
 This package includes libraries and header files needed for development
 of applications which use perf library from kernel source.
 
+%package -n libperf-debuginfo
+Summary: Debug information for package libperf
+Group: Development/Debug
+Requires: %{name}-debuginfo-common-%{_target_cpu} = %{version}-%{release}
+AutoReqProv: no
+%description -n libperf-debuginfo
+This package provides debug information for the libperf package.
+
+# Note that this pattern only works right to match the .build-id
+# symlinks because of the trailing nonmatching alternation and
+# the leading .*, because of find-debuginfo.sh's buggy handling
+# of matching the pattern against the symlinks file.
+%{expand:%%global _find_debuginfo_opts %{?_find_debuginfo_opts} -p 
'.*%%{_libdir}/libperf.so(\.debug)?|XXX' -o libperf-debuginfo.list}
 # with_libperf
 %endif
 
@@ -3561,6 +3574,7 @@ fi\
 %{_docdir}/libperf/html/libperf-counting.html
 %{_docdir}/libperf/html/libperf-sampling.html
 
+%files -f libperf-debuginfo.list -n libperf-debuginfo
 # with_libperf
 %endif
 

--
https://gitlab.com/cki-project/kernel-ark/-/merge_requests/2950
--
___
kernel mailing list -- kernel@lists.fedoraproject.org
To unsubscribe send an email to kernel-le...@lists.fedoraproject.org
Fedora Code of Conduct: 
https://docs.fedoraproject.org/en-US/project/code-of-conduct/
List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines
List Archives: 
https://lists.fedoraproject.org/archives/list/kernel@lists.fedoraproject.org
Do not reply to spam, report it: 
https://pagure.io/fedora-infrastructure/new_issue


Re: [OS-BUILD PATCHv2 0/3] Intel Pinctrl Updates

2024-02-21 Thread David Arcari (via Email Bridge)
From: David Arcari on gitlab.com
https://gitlab.com/cki-project/kernel-ark/-/merge_requests/2946#note_1782994436

@jmflinuxtx - please review.
--
___
kernel mailing list -- kernel@lists.fedoraproject.org
To unsubscribe send an email to kernel-le...@lists.fedoraproject.org
Fedora Code of Conduct: 
https://docs.fedoraproject.org/en-US/project/code-of-conduct/
List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines
List Archives: 
https://lists.fedoraproject.org/archives/list/kernel@lists.fedoraproject.org
Do not reply to spam, report it: 
https://pagure.io/fedora-infrastructure/new_issue