| version 1.1, 2012/02/17 15:09:30 | version 1.1.1.3, 2016/11/01 09:54:32 | 
| Line 23  my $make_gen_cmd = 'make -f prepare-source.mak conf && | Line 23  my $make_gen_cmd = 'make -f prepare-source.mak conf && | 
 | ); | ); | 
 | &usage if $help_opt; | &usage if $help_opt; | 
 |  |  | 
 |  | $ENV{GIT_MERGE_AUTOEDIT} = 'no'; | 
 |  |  | 
 | if (defined $incl_generated_files) { | if (defined $incl_generated_files) { | 
 | $patches_dir = $incl_generated_files if $incl_generated_files ne ''; | $patches_dir = $incl_generated_files if $incl_generated_files ne ''; | 
 | $incl_generated_files = 1; | $incl_generated_files = 1; | 
| Line 32  die "No '$patches_dir' directory was found.\n" unless | Line 34  die "No '$patches_dir' directory was found.\n" unless | 
 | die "No '.git' directory present in the current dir.\n" unless -d '.git'; | die "No '.git' directory present in the current dir.\n" unless -d '.git'; | 
 |  |  | 
 | require 'packaging/git-status.pl'; | require 'packaging/git-status.pl'; | 
| check_git_state($master_branch, !$skip_branch_check, 1); | my $starting_branch = check_git_state($master_branch, !$skip_branch_check, 1); | 
 |  |  | 
 | my $master_commit; | my $master_commit; | 
 | open PIPE, '-|', "git log -1 --no-color $master_branch" or die $!; | open PIPE, '-|', "git log -1 --no-color $master_branch" or die $!; | 
| Line 45  while (<PIPE>) { | Line 47  while (<PIPE>) { | 
 | close PIPE; | close PIPE; | 
 | die "Unable to determine commit hash for master branch: $master_branch\n" unless defined $master_commit; | die "Unable to determine commit hash for master branch: $master_branch\n" unless defined $master_commit; | 
 |  |  | 
 | my @extra_files; |  | 
 | open(IN, '<', 'Makefile.in') or die "Couldn't open Makefile.in: $!\n"; |  | 
 | while (<IN>) { |  | 
 | if (s/^GENFILES=//) { |  | 
 | while (s/\\$//) { |  | 
 | $_ .= <IN>; |  | 
 | } |  | 
 | @extra_files = split(' ', $_); |  | 
 | last; |  | 
 | } |  | 
 | } |  | 
 | close IN; |  | 
 |  |  | 
 | if ($incl_generated_files) { | if ($incl_generated_files) { | 
 |  | my @extra_files = get_extra_files(); | 
 | die "'$tmp_dir' must not exist in the current directory.\n" if -e $tmp_dir; | die "'$tmp_dir' must not exist in the current directory.\n" if -e $tmp_dir; | 
 | mkdir($tmp_dir, 0700) or die "Unable to mkdir($tmp_dir): $!\n"; | mkdir($tmp_dir, 0700) or die "Unable to mkdir($tmp_dir): $!\n"; | 
 | system "$make_gen_cmd && rsync -a @extra_files $tmp_dir/master/" and exit 1; | system "$make_gen_cmd && rsync -a @extra_files $tmp_dir/master/" and exit 1; | 
| Line 124  if ($incl_generated_files) { | Line 114  if ($incl_generated_files) { | 
 | } | } | 
 |  |  | 
 | sleep 1 while $last_touch >= time; | sleep 1 while $last_touch >= time; | 
| system "git checkout $master_branch" and exit 1; | system "git checkout $starting_branch" and exit 1; | 
 |  |  | 
 | exit; | exit; | 
 |  |  | 
| Line 171  sub update_patch | Line 161  sub update_patch | 
 | open(OUT, '>', "$patches_dir/$patch.diff") or die $!; | open(OUT, '>', "$patches_dir/$patch.diff") or die $!; | 
 | print OUT $description{$patch}, "\nbased-on: $based_on\n"; | print OUT $description{$patch}, "\nbased-on: $based_on\n"; | 
 |  |  | 
 |  | my @extra_files; | 
 | if ($incl_generated_files) { | if ($incl_generated_files) { | 
 |  | @extra_files = get_extra_files(); | 
 | system "$make_gen_cmd && rsync -a @extra_files $tmp_dir/$patch/" and exit 1; | system "$make_gen_cmd && rsync -a @extra_files $tmp_dir/$patch/" and exit 1; | 
 | } | } | 
 | $last_touch = time; | $last_touch = time; | 
| Line 196  sub update_patch | Line 188  sub update_patch | 
 | } else { | } else { | 
 | ($parent_dir) = $parent =~ m{([^/]+)$}; | ($parent_dir) = $parent =~ m{([^/]+)$}; | 
 | } | } | 
| open(PIPE, '-|', 'diff', '-up', "$tmp_dir/$parent_dir", "$tmp_dir/$patch") or die $!; | open(PIPE, '-|', 'diff', '-Nurp', "$tmp_dir/$parent_dir", "$tmp_dir/$patch") or die $!; | 
 | while (<PIPE>) { | while (<PIPE>) { | 
| s#^(diff -up) $tmp_dir/[^/]+/(.*?) $tmp_dir/[^/]+/(.*)#$1 a/$2 b/$3#o; | s#^(diff -Nurp) $tmp_dir/[^/]+/(.*?) $tmp_dir/[^/]+/(.*)#$1 a/$2 b/$3#o; | 
 | s#^\Q---\E $tmp_dir/[^/]+/([^\t]+)\t.*#--- a/$1#o; | s#^\Q---\E $tmp_dir/[^/]+/([^\t]+)\t.*#--- a/$1#o; | 
 | s#^\Q+++\E $tmp_dir/[^/]+/([^\t]+)\t.*#+++ b/$1#o; | s#^\Q+++\E $tmp_dir/[^/]+/([^\t]+)\t.*#+++ b/$1#o; | 
 | print OUT $_; | print OUT $_; | 
 | } | } | 
 | close PIPE; | close PIPE; | 
 |  | unlink @extra_files; | 
 | } | } | 
 |  |  | 
 | close OUT; | close OUT; | 
| Line 212  sub update_patch | Line 205  sub update_patch | 
 | } | } | 
 |  |  | 
 | exit; | exit; | 
 |  |  | 
 |  | sub get_extra_files | 
 |  | { | 
 |  | my @extras; | 
 |  |  | 
 |  | open(IN, '<', 'Makefile.in') or die "Couldn't open Makefile.in: $!\n"; | 
 |  | while (<IN>) { | 
 |  | if (s/^GENFILES=//) { | 
 |  | while (s/\\$//) { | 
 |  | $_ .= <IN>; | 
 |  | } | 
 |  | @extras = split(' ', $_); | 
 |  | last; | 
 |  | } | 
 |  | } | 
 |  | close IN; | 
 |  |  | 
 |  | return @extras; | 
 |  | } | 
 |  |  | 
 | sub usage | sub usage | 
 | { | { |