my $previous_commit = ""; ## Store current upstream state, so we can revert afterwards.
my $show_help = 0;
my @source_files = (); ## Final file list to process, generated in in generate_file_list().
-my $upstream_path = "";
+my $upstream_path = "";
my $wanted_commit = "";
my @wanted_files = (); ## User given file list (if any) to limit generate_file_list()
# -----------------------------------------------------------------------
# --- Check for attempts to remove elogind_*() special function calls. --
-# --- We have som special functions, needed oly by elogind. ---
+# --- We have some special functions, needed only by elogind. ---
# --- One of the most important ones is elogind_set_program_name(), ---
# --- which has an important role in musl_libc compatibility. ---
# --- These calls must not be removed of course. ---
# If upstream adds something after a mask #else block, we move it up before the #else.
# ------------------------------------------------------------------------------------
if ( ($else_block_start > -1) && !$in_mask_block) {
+ my $moved_line = $$line;
splice(@{$hHunk->{lines}}, $i, 1); ## Order matters here.
- splice(@{$hHunk->{lines}}, $else_block_start++, 0, $$line);
+ splice(@{$hHunk->{lines}}, $else_block_start++, 0, $moved_line);
next;
}
# If a name reverts pulls a line under a mask start, push it back up.
# -------------------------------------------------------------------
if ( ($mask_block_start > -1) && $in_mask_block && (1 ==($i - $mask_block_start))) {
+ my $moved_line = $$line;
splice(@{$hHunk->{lines}}, $i, 1); ## Order matters here, too.
- splice(@{$hHunk->{lines}}, $mask_block_start++, 0, $$line);
+ splice(@{$hHunk->{lines}}, $mask_block_start++, 0, $moved_line);
}
}
} ## End of looping lines
return 1;
}
+
# -----------------------------------------------------------------------
# --- Check for musl_libc compatibility blocks ---
# --- Rules: ---
"";
# --- Case A) If this is a simple switch, undo it. ---
- # --- Simple means, one line to another. ---
# ----------------------------------------------------
- if ( length($o_txt) && (1 == ($i - $hRemovals{$o_txt}{line})) ) {
+ if ( length($o_txt) ) {
substr($hHunk->{lines}[$hRemovals{$o_txt}{line}], 0, 1) = " ";
splice(@{$hHunk->{lines}}, $i--, 1);
$hHunk->{count}--;
}
# --- Case B) Otherwise replace the addition with our text. ---
- # --- Unless we are in a mask block. ---
+ # --- Unless we are in a mask block or comment. ---
# -------------------------------------------------------------
$in_mask_block > 0 and (0 == $in_else_block) and next;
$is_in_comment and next;