You are not logged in.
I am trying to build a package in chroot environment. This package as part of the build process applies a patch, but the patch fails when I am in the chroot. I am adding the error I am seeing and the patch file. If someone can point me in the right direction I would really appreciate it.
error:
==> Starting build()...
can't find file to patch at input line 3
Perhaps you used the wrong -p or --strip option?
The text leading up to this was:
--------------------------
|--- src/system76/src/graphics.rs 2018-09-11 20:08:40.269995504 -0700
|+++ src/system76/src/graphics.rs.new 2018-09-11 20:10:14.403327798 -0700
--------------------------
File to patch:
Skip this patch? [y]
Skipping patch.
2 out of 2 hunks ignored
==> ERROR: A failure occurred in build().
Aborting...
==> ERROR: Build failed, check /home/hhernandez/chroot/hhernandez/build
patch file:
cat graphics.patch
--- src/system76/src/graphics.rs 2018-09-11 20:08:40.269995504 -0700
+++ src/system76/src/graphics.rs.new 2018-09-11 20:10:14.403327798 -0700
@@ -12,10 +12,10 @@
blacklist nvidia
blacklist nvidia-drm
blacklist nvidia-modeset
-alias nouveau off
-alias nvidia off
-alias nvidia-drm off
-alias nvidia-modeset off
+#alias nouveau off
+#alias nvidia off
+#alias nvidia-drm off
+#alias nvidia-modeset off
"#;
pub struct Graphics {
@@ -135,12 +135,12 @@
}
}
- info!("Updating initramfs");
- let status = process::Command::new("update-initramfs").arg("-u").status()?;
+ info!("Updating mkinitcpio");
+ let status = process::Command::new("mkinitcpio").arg("-P").status()?;
if ! status.success() {
return Err(io::Error::new(
io::ErrorKind::Other,
- format!("update-initramfs: failed with {}", status)
+ format!("mkinitcpio: failed with {}", status)
));
}
Last edited by rican-linux (2019-03-19 01:34:51)
Offline
Have you tried using the -p1 option to patch (as suggested in the error message)?
Are you familiar with our Forum Rules, and How To Ask Questions The Smart Way?
BlueHackers // fscanary // resticctl
Offline
Have you tried using the -p1 option to patch (as suggested in the error message)?
yes that is why I am scratching my head...
Offline
OK, so including that in your post would have avoided me needing to ask. Posting your PKGBUILD would be helpful too please.
Are you familiar with our Forum Rules, and How To Ask Questions The Smart Way?
BlueHackers // fscanary // resticctl
Offline
Running the patch command doesn't need the chroot nor makepkg... You can debug with just the source and your shell.
CPU-optimized Linux-ck packages @ Repo-ck • AUR packages • Zsh and other configs
Offline
OK, so including that in your post would have avoided me needing to ask. Posting your PKGBUILD would be helpful too please.
You are right my apologies. Here is the original PKGBUILD
cat PKGBUILD
# Maintainer: Francisco Soto <ebobby(at)ebobby(dot)org>
_pkgname=system76
_pkgbase=system76-power
pkgname=system76-power
pkgver=135
pkgrel=1
pkgdesc="System76 Power Management"
arch=('any')
url="https://github.com/pop-os/system76-power"
license=('GPL')
install="${pkgname}.install"
depends=(
'dbus'
'systemd'
'system76-dkms'
)
makedepends=('rust')
source=(
'system76::git+https://github.com/pop-os/system76-power.git#commit=d861dfd6553e68d214d9cbade99b334e347d0d16'
'graphics.patch'
)
sha1sums=(
'SKIP'
'e486644709099b6348dc96d5f468ae289840dade'
)
pkgver() {
cd ${srcdir}/${_pkgname}
git rev-list --count HEAD
}
build() {
cd ${startdir}
patch -p0 < ${startdir}/graphics.patch
cd ${srcdir}/${_pkgname}
# Build and install base package
cargo build --release
}
package() {
# Install daemons
install -Dm755 ${srcdir}/${_pkgname}/target/release/system76-power ${pkgdir}/usr/bin/system76-power
# Install systemd unit files
install -Dm644 ${srcdir}/${_pkgname}/debian/system76-power.service ${pkgdir}/usr/lib/systemd/system/system76-power.service
# Install scripts and configuration
install -Dm755 ${srcdir}/${_pkgname}/data/system76-power.conf ${pkgdir}/usr/share/dbus-1/system.d/system76-power.conf
}
Offline
You would normally patch in prepare(). You need to remove two patch elements from the patch src/system76/
cd "${srcdir}"/${_pkgname}
patch -p2 < "${srcdir}"/graphics.patch
Also missing makedepends on git and please quote "${srcdir}" and "${pkgdir}" as the paths they expand to may contain space.
Last edited by loqs (2019-03-19 01:24:07)
Offline
So this what I figured out, in the srcdir there is a symlink to the patch file which is located in /startdir (of my chroot)
ls -l
total 0
lrwxrwxrwx 1 rican-linux rican-linux 24 Mar 18 18:02 graphics.patch -> /startdir/graphics.patch
drwxr-xr-x 7 rican-linux rican-linux 209 Mar 18 18:02 system76
I was able to patch manually like so
patch -p1 < ../../../startdir/graphics.patch
patching file system76/src/graphics.rs
Hunk #1 succeeded at 13 (offset 1 line).
Hunk #2 succeeded at 130 (offset -5 lines).
So made the following edits to the PKSBUILD and it worked
before:
build() {
cd ${startdir}
patch -p0 < ${startdir}/graphics.patch
cd ${srcdir}/${_pkgname}
# Build and install base package
cargo build --release
}
after:
build() {
cd ${srcdir}
patch -p1 < ${startdir}/graphics.patch
cd ${srcdir}/${_pkgname}
# Build and install base package
cargo build --release
}
Offline
Makepkg used to have a startdir env var, but iirc that was deprecated long ago.
No idea whether $startdir has meaning outside of the chroot.
This format for patch in prepare is more common :
prepare() {
cd folder-where-sourcecode-is-found #not sure if this is always necessary
patch -Np1 -i "$srcdir"/foo.patch
}
edit : typos
Last edited by Lone_Wolf (2019-03-19 11:07:30)
Disliking systemd intensely, but not satisfied with alternatives so focusing on taming systemd.
(A works at time B) && (time C > time B ) ≠ (A works at time C)
Offline