File autopatch.diff of Package rpm-ndb
--- build/parsePreamble.c.orig 2024-04-25 14:17:42.836352000 +0000
+++ build/parsePreamble.c 2024-04-25 14:22:14.031854767 +0000
@@ -316,6 +316,15 @@ static int addSource(rpmSpec spec, Packa
rpmluaSetVar(lua, var);
rpmluavFree(var);
rpmluaPop(lua);
+
+ what = (flag & RPMBUILD_ISPATCH) ? "patch_nums" : "source_nums";
+ rpmluaPushTable(lua, what);
+ var = rpmluavNew();
+ rpmluavSetListMode(var, 1);
+ rpmluavSetValueNum(var, p->num);
+ rpmluaSetVar(lua, var);
+ rpmluavFree(var);
+ rpmluaPop(lua);
}
#endif
free(body);
--- build/spec.c.orig 2024-04-25 14:17:32.004371864 +0000
+++ build/spec.c 2024-04-25 14:20:20.096063708 +0000
@@ -256,8 +256,14 @@ rpmSpec newSpec(void)
rpmlua lua = NULL; /* global state */
rpmluaDelVar(lua, "patches");
rpmluaDelVar(lua, "sources");
+ rpmluaDelVar(lua, "patch_nums");
+ rpmluaDelVar(lua, "source_nums");
rpmluaPushTable(lua, "patches");
rpmluaPushTable(lua, "sources");
+ rpmluaPushTable(lua, "patch_nums");
+ rpmluaPushTable(lua, "source_nums");
+ rpmluaPop(lua);
+ rpmluaPop(lua);
rpmluaPop(lua);
rpmluaPop(lua);
}
@@ -313,6 +319,8 @@ rpmSpec rpmSpecFree(rpmSpec spec)
rpmlua lua = NULL; /* global state */
rpmluaDelVar(lua, "patches");
rpmluaDelVar(lua, "sources");
+ rpmluaDelVar(lua, "patch_nums");
+ rpmluaDelVar(lua, "source_nums");
}
#endif
--- macros.in.orig 2024-04-25 14:26:23.335390558 +0000
+++ macros.in 2024-04-25 14:37:50.114099548 +0000
@@ -1458,11 +1458,16 @@ else\
end}
# Automatically apply all patches
-%autopatch(vp:)\
+%autopatch(vp:m:M:)\
%{lua:\
+local lo = tonumber(rpm.expand("%{-m:%{-m*}}"))\
+local hi = tonumber(rpm.expand("%{-M:%{-M*}}"))\
local options = rpm.expand("%{!-v:-q} %{-p:-p%{-p*}} ")\
for i, p in ipairs(patches) do\
- print(rpm.expand("%apply_patch -m %{basename:"..p.."} "..options..p.." "..i.."\\n"))\
+ local inum = patch_nums[i]\
+ if ((not lo or inum>=lo) and (not hi or inum<=hi)) then\
+ print(rpm.expand("%apply_patch -m %{basename:"..p.."} "..options..p.." "..i.."\\n"))\
+ end\
end}
# One macro to (optionally) do it all.