From de2c80d091a62afe9d66c09688a4fa39c8e69760 Mon Sep 17 00:00:00 2001
From: Rune Morling <ermo@serpentos.com>
Date: Tue, 18 Jun 2024 15:01:23 +0200
Subject: [PATCH] solbuild: Use eopkg.py3 to build pspec.xml recipes

**Summary**
This is necessary to be able to build the old-sk00l pisi recipe, as part
of phase1+2 of the py2->py3 eopkg migration in getsolus/packages#2193

Signed-off-by: Rune Morling <ermo@serpentos.com>
---
 ...eopkg.py3-to-build-pspec.xml-recipes.patch | 47 +++++++++++++++++++
 packages/s/solbuild/package.yml               |  5 +-
 packages/s/solbuild/pspec_x86_64.xml          | 16 +++----
 3 files changed, 59 insertions(+), 9 deletions(-)
 create mode 100644 packages/s/solbuild/files/0001-builder-Use-eopkg.py3-to-build-pspec.xml-recipes.patch

diff --git a/packages/s/solbuild/files/0001-builder-Use-eopkg.py3-to-build-pspec.xml-recipes.patch b/packages/s/solbuild/files/0001-builder-Use-eopkg.py3-to-build-pspec.xml-recipes.patch
new file mode 100644
index 000000000000..c72844647061
--- /dev/null
+++ b/packages/s/solbuild/files/0001-builder-Use-eopkg.py3-to-build-pspec.xml-recipes.patch
@@ -0,0 +1,47 @@
+From cd93718b3252ca60af3503ed90a6a0d39765273f Mon Sep 17 00:00:00 2001
+From: Rune Morling <ermo@serpentos.com>
+Date: Tue, 18 Jun 2024 14:45:57 +0200
+Subject: [PATCH] builder: Use eopkg.py3 to build pspec.xml recipes
+
+This ensures that solbuild will work with the phase1+2 changes to eopkg
+and pisi packages [here](https://github.com/getsolus/packages/pull/2964)
+
+In addition, make a cosmetic tweak to eopkg install commands (which will
+effectively be using eopkg.bin when the PR above lands) so the -y flag
+is set before the -c flag when installing components.
+
+Signed-off-by: Rune Morling <ermo@serpentos.com>
+---
+ builder/build.go | 2 +-
+ builder/eopkg.go | 2 +-
+ 2 files changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/builder/build.go b/builder/build.go
+index 92d426f..ba03ccf 100644
+--- a/builder/build.go
++++ b/builder/build.go
+@@ -382,7 +382,7 @@ func (p *Package) BuildXML(notif PidNotifier, pman *EopkgManager, overlay *Overl
+ 
+ 	// Now build the package, ignore-sandbox in case someone is stupid
+ 	// and activates it in eopkg.conf...
+-	cmd := eopkgCommand(fmt.Sprintf("eopkg build --ignore-sandbox --yes-all -O %s %s", wdir, xmlFile))
++	cmd := eopkgCommand(fmt.Sprintf("eopkg.py3 build --ignore-sandbox --yes-all -O %s %s", wdir, xmlFile))
+ 
+ 	slog.Info("Now starting build", "package", p.Name)
+ 
+diff --git a/builder/eopkg.go b/builder/eopkg.go
+index 1c0c887..1f1f1a1 100644
+--- a/builder/eopkg.go
++++ b/builder/eopkg.go
+@@ -219,7 +219,7 @@ func (e *EopkgManager) Upgrade() error {
+ 
+ // InstallComponent will install the named component inside the chroot.
+ func (e *EopkgManager) InstallComponent(comp string) error {
+-	err := ChrootExec(e.notif, e.root, eopkgCommand(fmt.Sprintf("eopkg install -c %v -y", comp)))
++	err := ChrootExec(e.notif, e.root, eopkgCommand(fmt.Sprintf("eopkg install -y -c %v", comp)))
+ 	e.notif.SetActivePID(0)
+ 
+ 	return err
+-- 
+2.45.1
+
diff --git a/packages/s/solbuild/package.yml b/packages/s/solbuild/package.yml
index ca52b3a5412e..4ab69e543caa 100644
--- a/packages/s/solbuild/package.yml
+++ b/packages/s/solbuild/package.yml
@@ -1,6 +1,6 @@
 name       : solbuild
 version    : 1.6.3
-release    : 54
+release    : 55
 source     :
     - https://github.com/getsolus/solbuild/archive/refs/tags/v1.6.3.tar.gz : 51fd8fde341847b3a8aeb37fce257600ff5185a83371bc5cee14cc3d38a4b38d
 homepage   : https://github.com/getsolus/solbuild
@@ -26,6 +26,9 @@ rundeps    :
     - config-local-unstable : solbuild
     - config-unstable : solbuild
     - git
+setup      : |
+    # Ensure that eopkg.py3 is used for old-sk00l pspec.xml builds
+    %patch -p1 -i $pkgfiles/0001-builder-Use-eopkg.py3-to-build-pspec.xml-recipes.patch
 build      : |
     %make
 install    : |
diff --git a/packages/s/solbuild/pspec_x86_64.xml b/packages/s/solbuild/pspec_x86_64.xml
index 317acd004cee..52029a601cb7 100644
--- a/packages/s/solbuild/pspec_x86_64.xml
+++ b/packages/s/solbuild/pspec_x86_64.xml
@@ -3,8 +3,8 @@
         <Name>solbuild</Name>
         <Homepage>https://github.com/getsolus/solbuild</Homepage>
         <Packager>
-            <Name>Silke Hofstra</Name>
-            <Email>silke@slxh.eu</Email>
+            <Name>Rune Morling</Name>
+            <Email>ermo@serpentos.com</Email>
         </Packager>
         <License>Apache-2.0</License>
         <PartOf>programming.tools</PartOf>
@@ -38,7 +38,7 @@
 </Description>
         <PartOf>programming.tools</PartOf>
         <RuntimeDependencies>
-            <Dependency releaseFrom="54">solbuild</Dependency>
+            <Dependency releaseFrom="55">solbuild</Dependency>
         </RuntimeDependencies>
         <Files>
             <Path fileType="data">/usr/share/solbuild/local-unstable-x86_64.profile</Path>
@@ -51,19 +51,19 @@
 </Description>
         <PartOf>programming.tools</PartOf>
         <RuntimeDependencies>
-            <Dependency releaseFrom="54">solbuild</Dependency>
+            <Dependency releaseFrom="55">solbuild</Dependency>
         </RuntimeDependencies>
         <Files>
             <Path fileType="data">/usr/share/solbuild/99_unstable.conf</Path>
         </Files>
     </Package>
     <History>
-        <Update release="54">
-            <Date>2024-06-16</Date>
+        <Update release="55">
+            <Date>2024-06-18</Date>
             <Version>1.6.3</Version>
             <Comment>Packaging update</Comment>
-            <Name>Silke Hofstra</Name>
-            <Email>silke@slxh.eu</Email>
+            <Name>Rune Morling</Name>
+            <Email>ermo@serpentos.com</Email>
         </Update>
     </History>
 </PISI>
\ No newline at end of file