[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: (un)patching patched files



debian-devel@liska.ath.cx (Olе Streicher) writes:

> Dear Mentors,
>
> For a package [1], I have to patch one file (Makefile.am) twice: once
> from debian/patches, and the other times from debian/rules. The patch in
> debian/patches is needed to bring allow the use of a standard automake
> (upstream uses a patched version), while the patch done from
> debian/rules contains a rename of all libraries built. It is done in the
> following way:
>
> ------------------------8<-------------------------------------
> override_dh_autoreconf:
> 	sed s/libast/libstarlink_ast/g -i Makefile.am
> 	AUTOMAKE="automake --foreign" dh_autoreconf
>
> override_dh_clean:
> 	sed s/libstarlink_ast/libast/g -i Makefile.am
> 	dh_clean
> ------------------------8<-------------------------------------
>

Why not add the library renaming as a patch too?

One patch to allow the use of standard automake, another to update the
lib names. That should do the right thing in every case, I believe.

> What is the proper solution to deal with this? Converting the patching
> from debian/rules to a debian/patches patch is not a good solution,
> since the library names are heavily used in the whole Makefile.am, and
> the resulting patch would be huge, complicated (understanding the lines
> in debian/rules is much easier) and fill fail on each small change.

You can create a small script, or even a debian/rules target that takes
a half-patched Makefile.am, does the sed magic, and produces the final
result. Then each time you need to update the Makefile, you run this
script to refresh the patch.

The patch in debian/patches will be large, possibly complicated and
whatnot, but you can explain how it is created in debian/README.source,
and live happily ever after.

There are cases where a bit of ugliness is acceptable. This is one such
case.

-- 
|8]


Reply to: