On Mon, Feb 28, 2022 at 11:51:38PM +0100, Marc Espie wrote:
> On Mon, Feb 28, 2022 at 10:12:38PM +0000, Stuart Henderson wrote:
> > On 2022/02/28 19:02, Marc Espie wrote:
> > > This kills both the generation and copying of $OpenBSD$ lines in update-patches.
> > >
> > > Main question is: are we okay generatin patches starting with Index: or
> > > do we want to leave an empty line (or something) reminding people to add
> > > an actual comment
> > >
> > > (that's the first chunk of the patch)
> >
> > I think it's fine like that, but it could have some handling for
> > an empty second line in existing patches, as-is it keeps them,
> > so after a while we'll have a mixture of some files with an
> > empty first line and others with the comment or patch on the
> > first line.
> >
> > Diff on top is not the prettiest but seems to do the trick.
>
> Oh, it's probably simpler to post-process the comment list before returning.
>
> Then there's no need to keep state.
> (It worked for just one line being simple enough)
>
> I'll have a look tomorrow unless you beat me to it.
>
>
Here's a proper patch
Index: update-patches
===================================================================
RCS file: /cvs/ports/infrastructure/bin/update-patches,v
retrieving revision 1.21
diff -u -p -r1.21 update-patches
--- update-patches 9 Feb 2021 17:34:40 -0000 1.21
+++ update-patches 1 Mar 2022 10:45:07 -0000
@@ -206,12 +206,10 @@ sub create_patch
die "diff exited with an error";
}
}
- my $comment = "!OpenBSD!\n";
- $comment =~ tr/!/$/;
may_fuzz_patch($stem, \@lines);
return {stem => $stem, patch => \@lines,
filename => patch_name($stem),
- comment => [$comment, "\n"] };
+ comment => [] };
}
sub parse_existing_patch
@@ -239,6 +237,12 @@ sub parse_existing_patch
last;
}
push(@comment, $_);
+ }
+ if (@comment > 0 && $comment[0] =~ m/^\$OpenBSD/) {
+ shift @comment;
+ }
+ while (@comment > 0 && $comment[0] =~ m/^\s*$/) {
+ shift @comment;
}
return {stem => $src, filename => $filename,
comment => \@comment, patch => \@patch};
No comments:
Post a Comment