After getting really annoyed at the cesspool that spec/patches has become,
I looked at fixing pkgtool.pl to be a little smarter about where it can look for
patches. I totally discounted setting up a .pkgtoolrc file to tell it where to
find patches, because that requires manual intervention and full paths.
Actually, any path prefixed to a patch defined in a spec file was stripped
anyway, so my initial attempt at relative pathing failed.
The folks from #pkgbuild reminded me that patches have to be unique
since they are copied to SOURCES which is a flat directory structure.
So I've come up with a relatively sane scheme to do this:
where ever I am defining patches, I set:
%define patchprefix %{src_name}/%{src_ver}/%{src_name}-%{src_ver}
so patches for lame-3.97 would be in
spec/patches/lame/3.97/lame-3.97-patch1.diff
spec/patches/lame/3.97/lame-3.97-patch2.diff
and be listed in the spec files as:
Patch1: %{patchprefix}-patch1.diff
Patch2: %{patchprefix}-patch2.diff
so as long as the patches for a paritcular application are uniquely named,
there's no chance another app's patches could overwrite a patch from
a different app, and it's totally clear what the patch is associated with.
Thoughts? I submitted this to laca and he thinks it will probably be
added to the next release of pkgbuild.
The beauty of this addition means that nothing *has* to change, but
if folks want to start making it easier to roll a set of patches for a
new rev, the new patches can be copied from an older version, in
their own directory and modifications won't affect anything else.
Only tricky part is that upgrades probably have to exclude some
patches, and that's easily done with an %if clause.
Ben
--- /opt/dtbld/lib/pkgbuild-1.3.1/pkgtool.pl.ORIG 2009-11-22
09:45:49.502034777 -0500
+++ /opt/dtbld/lib/pkgbuild-1.3.1/pkgtool.pl 2009-11-22
09:55:03.975974582 -0500
@@ -1932,6 +1932,23 @@
last;
}
}
+ #
+ # didn't find the patch after stripping off any relative
+ # directories, try and see if the spec writer knew
+ # what he wanted.
+ #
+ if (! -f "$patch_path") {
+ foreach my $the_patch_dir (@the_patch_dirlist) {
+ $patch_path = "$the_patch_dir/$patch";
+
+ if (! -f "$patch_path") {
+ msg_info (3, " not found in $patch_path");
+ } else {
+ msg_info (3, " found in $patch_path");
+ last;
+ }
+ }
+ }
if (! -f "$patch_path") {
# patch not found in the patch dirlist