obs build fails -- no file to patch. skipping patch

I’m trying to patch libwnck to solve a bug (1204157), so I’ve branched the package (see https://build.opensuse.org/package/show/home:Sound0fSilence:branches:GNOME:Factory/libwnck) and created a diff following the steps mentioned in https://openbuildservice.org/help/manuals/obs-user-guide/art.obs.bg.html#sec.obsbg.uc.patching.

  1. The patch:
--- libwnck/wnck-handle.c.orig    2022-11-09 14:54:06.445579490 +0100
+++ libwnck/wnck-handle.c    2022-11-09 14:54:45.522267274 +0100
@@ -70,6 +70,9 @@
   Display *xdisplay;
   int i;
 
+  if (self->screens == NULL)
+    return;
+
   xdisplay = _wnck_get_default_display ();
 
   for (i = 0; i < ScreenCount (xdisplay); ++i)


  1. I added
Patch0:         fix-1204157.diff

under the

Source98:       baselibs.conf

line in the .spec file

  1. When runnig
osc build

I get the following error:

    4s] -----------------------------------------------------------------
    4s] I have the following modifications for libwnck.spec:
    4s] -----------------------------------------------------------------
    4s] ----- building libwnck.spec (user abuild)
    4s] -----------------------------------------------------------------
    4s] -----------------------------------------------------------------
    5s] + exec rpmbuild -ba --define '_srcdefattr (-,root,root)' --nosignature --undefine _enable_debug_packages /home/abuild/rpmbuild/SOURCES/libwnck.spec
    5s] setting SOURCE_DATE_EPOCH=1663286400
    5s] Executing(%prep): /usr/bin/bash -e /var/tmp/rpm-tmp.YYUNS2
    5s] + umask 022
    5s] + cd /home/abuild/rpmbuild/BUILD
    5s] + cd /home/abuild/rpmbuild/BUILD
    5s] + rm -rf libwnck-43.0
    5s] + /usr/bin/xz -dc /home/abuild/rpmbuild/SOURCES/libwnck-43.0.tar.xz
    5s] + /usr/bin/tar -xof -
    5s] + STATUS=0
    5s] + '' 0 -ne 0 ']'
    5s] + cd libwnck-43.0
    5s] + /usr/bin/chmod -Rf a+rX,u+w,g-w,o-w .
    5s] + /usr/bin/cat /home/abuild/rpmbuild/SOURCES/fix-1204157.diff
    5s] + /usr/bin/patch -p1 -s --fuzz=0 --no-backup-if-mismatch -f
    5s] The text leading up to this was:
    5s] --------------------------
    5s] |--- libwnck/wnck-handle.c.orig    2022-11-09 14:54:06.445579490 +0100
    5s] |+++ libwnck/wnck-handle.c    2022-11-09 14:54:45.522267274 +0100
    5s] --------------------------
    5s] No file to patch.  Skipping patch.
    5s] 1 out of 1 hunk ignored
    5s] error: Bad exit status from /var/tmp/rpm-tmp.YYUNS2 (%prep)
    5s] 
    5s] RPM build errors:
    5s]     Bad exit status from /var/tmp/rpm-tmp.YYUNS2 (%prep)
    5s] 
    5s] Ultrabook failed "build libwnck.spec" at Wed Nov  9 14:47:07 UTC 2022.
    5s] 


Any idea why this patch fails? Is it related to the file paths in the patch?

Never mind. I fixed it by editing the paths in the patch file as follows:

--- a/libwnck/wnck-handle.c.orig    2022-11-09 14:54:06.445579490 +0100
+++ a/libwnck/wnck-handle.c    2022-11-09 14:54:45.522267274 +0100
@@ -70,6 +70,9 @@
   Display *xdisplay;
   int i;
 
+  if (self->screens == NULL)
+    return;
+
   xdisplay = _wnck_get_default_display ();
 
   for (i = 0; i < ScreenCount (xdisplay); ++i)

Looks like I created my first submit request :slight_smile: