Re: [OE-core] [PATCH 7/7] lib/oe/patch: Use git notes to store the filenames for the patches

2024-02-18 Thread Peter Kjellerstedt
> -Original Message-
> From: Richard Purdie 
> Sent: den 17 februari 2024 13:34
> To: Peter Kjellerstedt ; openembedded-
> c...@lists.openembedded.org
> Subject: Re: [OE-core] [PATCH 7/7] lib/oe/patch: Use git notes to store
> the filenames for the patches
> 
> On Fri, 2024-02-16 at 19:59 +0100, Peter Kjellerstedt wrote:
> > The old way of keeping track of the filenames for the patches that
> > correspond to the commits was to add a special comment line to the end
> > of the commit message, e.g., "%% original patch: ", using a
> > temporary git hook. This method had some drawbacks, e.g.:
> >
> > * It caused problems if one wanted to push the commits upstream as the
> >   comment line had to be manually removed.
> > * The comment line would end up in patches if someone used git
> >   format-path rather than devtool finish to generate the patches.
> > * The comment line could interfere with global Git hooks used to
> >   validate the format of the Git commit message.
> > * When regenerating patches with `devtool finish --force-patch-refresh`,
> >   the process typically resulted in adding empty lines to the end of the
> >   commit messages in the updated patches.
> >
> > A better way of keeping track of the patch filenames is to use Git
> > notes. This way the commit messages remain unaffected, but the
> > information is still shown when, e.g., doing `git log`. A special Git
> > notes space, refs/notes/devtool, is used to not intefere with the
> > default Git notes. It is configured to be shown in, e.g., `git log` and
> > to survive rewrites (i.e., `git commit --amend` and `git rebase`).
> >
> > Since there is no longer any need for a temporary Git hook, the code
> > that manipulated the .git/hooks directory has also been removed. To
> > avoid potential problems due to global Git hooks, --no-verify was added
> > to the `git commit` command.
> >
> > To not cause troubles for those who have done `devtool modify` for a
> > recipe with the old solution and then do `devtool finish` with the new
> > solution, the code will fall back to look for the old strings in the
> > commit message if no Git note can be found.
> >
> > While not technically motivated like above, the way to keep track of
> > ignored commits is also changed to use Git notes to avoid having
> > different methods to store similar information.
> >
> > Signed-off-by: Peter Kjellerstedt 
> > ---
> >  meta/lib/oe/patch.py    | 105 +++-
> >  meta/lib/oeqa/selftest/cases/devtool.py |   9 +-
> >  scripts/lib/devtool/standard.py |  15 ++--
> >  3 files changed, 78 insertions(+), 51 deletions(-)
> 
> I've tweaked the EXCLUDE_FROM_WORLD issue and I can squash that in but
> with that we still saw:
> 
> https://autobuilder.yoctoproject.org/typhoon/#/builders/87/builds/6433/steps/14/logs/stdio
> 
> which I think is from this patch.
> 
> Cheers,
> 
> Richard

While I had checked when `git notes` was introduced (1.7.1 for the 
functionality I use), I had not realized that the --fixed-value option 
to `git config` was only introduced in 2.30 (way after the current OE 
minimum requirement of Git 1.8.3.1). Thankfully, the --fixed-value 
option is not really needed in this case and can just be removed.

I have an updated patch series that fixes this, the missing 
EXCLUDE_FROM_WORLD, and a problem related to how git rebase handles 
notes when a commit is fully absorbed during a rebase. The latter 
could trigger when devtool upgrade is used.

I will send the patches once oe-selftest -r devtool is done...

//Peter


-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#195851): 
https://lists.openembedded.org/g/openembedded-core/message/195851
Mute This Topic: https://lists.openembedded.org/mt/104398931/21656
Group Owner: openembedded-core+ow...@lists.openembedded.org
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub 
[arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-



Re: [OE-core] [PATCH 7/7] lib/oe/patch: Use git notes to store the filenames for the patches

2024-02-17 Thread Richard Purdie
On Fri, 2024-02-16 at 19:59 +0100, Peter Kjellerstedt wrote:
> The old way of keeping track of the filenames for the patches that
> correspond to the commits was to add a special comment line to the end
> of the commit message, e.g., "%% original patch: ", using a
> temporary git hook. This method had some drawbacks, e.g.:
> 
> * It caused problems if one wanted to push the commits upstream as the
>   comment line had to be manually removed.
> * The comment line would end up in patches if someone used git
>   format-path rather than devtool finish to generate the patches.
> * The comment line could interfere with global Git hooks used to
>   validate the format of the Git commit message.
> * When regenerating patches with `devtool finish --force-patch-refresh`,
>   the process typically resulted in adding empty lines to the end of the
>   commit messages in the updated patches.
> 
> A better way of keeping track of the patch filenames is to use Git
> notes. This way the commit messages remain unaffected, but the
> information is still shown when, e.g., doing `git log`. A special Git
> notes space, refs/notes/devtool, is used to not intefere with the
> default Git notes. It is configured to be shown in, e.g., `git log` and
> to survive rewrites (i.e., `git commit --amend` and `git rebase`).
> 
> Since there is no longer any need for a temporary Git hook, the code
> that manipulated the .git/hooks directory has also been removed. To
> avoid potential problems due to global Git hooks, --no-verify was added
> to the `git commit` command.
> 
> To not cause troubles for those who have done `devtool modify` for a
> recipe with the old solution and then do `devtool finish` with the new
> solution, the code will fall back to look for the old strings in the
> commit message if no Git note can be found.
> 
> While not technically motivated like above, the way to keep track of
> ignored commits is also changed to use Git notes to avoid having
> different methods to store similar information.
> 
> Signed-off-by: Peter Kjellerstedt 
> ---
>  meta/lib/oe/patch.py    | 105 +++-
>  meta/lib/oeqa/selftest/cases/devtool.py |   9 +-
>  scripts/lib/devtool/standard.py |  15 ++--
>  3 files changed, 78 insertions(+), 51 deletions(-)

I've tweaked the EXCLUDE_FROM_WORLD issue and I can squash that in but
with that we still saw:

https://autobuilder.yoctoproject.org/typhoon/#/builders/87/builds/6433/steps/14/logs/stdio

which I think is from this patch.

Cheers,

Richard

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#195813): 
https://lists.openembedded.org/g/openembedded-core/message/195813
Mute This Topic: https://lists.openembedded.org/mt/104398931/21656
Group Owner: openembedded-core+ow...@lists.openembedded.org
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub 
[arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-