[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Quilt-dev] Default header for new patches
From: |
Rene Kita |
Subject: |
Re: [Quilt-dev] Default header for new patches |
Date: |
Wed, 24 Jan 2024 18:10:39 +0100 |
ping
On Wed, Sep 27, 2023 at 01:39:21PM +0200, Rene Kita wrote:
> On Tue, Sep 26, 2023 at 06:03:35PM +0200, Jean Delvare wrote:
> > Hi Rene,
>
> Hi Jean,
>
> > On Thu, 2023-08-10 at 16:34 +0200, Rene Kita wrote:
> > > When I create a new patch with quilt I usually want to add some
> > > header, e.g. a From: line and a Date:. From the docs I found no way
> > > to this.
> > >
> > > After getting tired of doing it manually (or forgetting it) I wrote a
> > > small hacky patch the creates the header I need. I would like to
> > > avoid to carry my own patch for this.
> >
> > Where's the patch? ;-)
>
> Inlined at the end of this email.
>
> > > Do others have the same problem?
> >
> > There's probably a need for such a feature indeed. For example I see
> > such a request here:
> >
> > https://www.mail-archive.com/quilt-dev@nongnu.org/msg02600.html
>
> Interesting. I took a different approach.
>
> > > Would upstream be willing to add such a feature?
> >
> > Assuming the implementation is clean, yes.
>
> Here is my version. It's missing documentation and the code is just
> added where needed, but it shows the idea. If you are OK with the
> approach I will continue working on it.
>
> The basic idea is to provide a QUILT_DEFAULT_HEADER option which takes
> printf-like sequences. These placeholders will be replaced when creating
> a new patch.
>
> %d - current date
> %s - name of the patch file w/o .patch extension and '-' replaced by ' '
> %p - name of the patch file
>
> From da558d66a01549ef9f1576e26242995a1d123a45 Mon Sep 17 00:00:00 2001
> From: Rene Kita <mail@rkta.de>
> Date: Thu, 10 Aug 2023 16:06:52 +0200
> Subject: [PATCH] Add option to set default header
>
> ---
> quilt/new.in | 22 ++++++++++++++++++++++
> 1 file changed, 22 insertions(+)
>
> diff --git a/quilt/new.in b/quilt/new.in
> index 4906f66..2960698 100644
> --- a/quilt/new.in
> +++ b/quilt/new.in
> @@ -102,9 +102,31 @@ create_db
> rm -rf "$QUILT_PC/$patch"
> mkdir -p "$QUILT_PC/$patch"
>
> +QUILT_DEFAULT_HEADER='Author: Rene Kita <mail@rkta.de>
> +Date: %d
> +Subject: %s
> +Patch: %p
> +'
> +
> +add_header()
> +{
> + # Add a default header
> + p="$QUILT_PATCHES"/"$patch"
> + d=$(date)
> + s="${patch%*.patch}"
> + s="${s//-/ }"
> +
> + h="${QUILT_DEFAULT_HEADER//%d/$d}"
> + h="${h//%s/$s}"
> + h="${h//%p/$p}"
> +
> + printf "%s\n" "$h" >> "$p"
> +}
> +
> if insert_in_series $patch ${opt_strip_level:+-p$opt_strip_level} && \
> add_to_db $patch
> then
> + [ "$QUILT_DEFAULT_HEADER" ] && add_header
> printf $"Patch %s is now on top\n" "$(print_patch $patch)"
> else
> printf $"Failed to create patch %s\n" "$(print_patch $patch)" >&2
> --
> 2.42.0.rc1
>
> _______________________________________________
> Quilt-dev mailing list
> Quilt-dev@nongnu.org
> https://lists.nongnu.org/mailman/listinfo/quilt-dev
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- Re: [Quilt-dev] Default header for new patches,
Rene Kita <=