diff options
author | Marius Storm-Olsen <marius.storm-olsen@nokia.com> | 2011-04-04 11:07:52 -0500 |
---|---|---|
committer | Marius Storm-Olsen <marius.storm-olsen@nokia.com> | 2011-04-04 13:52:41 -0500 |
commit | 1d80b49f931846677e990330d3d48a2e02f7c045 (patch) | |
tree | 506d41a373dd158b15429fb4ff7503d0d34b8293 | |
parent | 5b77729521cabf2702f94c811f0d1ee10df606f3 (diff) |
Add option -afterlive/-redo-afterlive to automatically apply patches
These are just convenience options to apply/reapply the afterlive/
patches. Some might be actively working with afterlive patches with
others, and will need to reapply the patch set based on new patches
coming in through the qtmodularization repo.
-rwxr-xr-x | modularize | 81 | ||||
-rw-r--r-- | scripts/905_git_split | 2 |
2 files changed, 65 insertions, 18 deletions
@@ -66,6 +66,25 @@ if ($qtWebKitType =~ /^webkit$/) { our $OStype; our $verbose; +our $run_split = 1; +our $run_rest = 1; +our $run_push = 0; +our $commit_changes = 1; +our $redo = 0; +our $move = 0; +our $move_dest = ""; +our $repos_base; +our $good_sha1; +our $link_type = COPY; +our $qtdir = getcwd(); +our $qtVersion; +our $isMaster = 1; + +my $regenerate_patches = 0; +my $rebase_patches = 0; +my $no_patches = 0; +my $apply_afterlive = 0; + # -- Functions ------------------------------------------------------------------------------------- sub checkOS { @@ -260,6 +279,21 @@ sub findBranchVersion return $qglobal; } +# Find SHA1 of commit of $subject, else the SHA1 of HEAD +sub findSHA1 +{ + my ($qtdir, $subject) = @_; + my @commits = `cd $qtdir && git rev-list --grep="$subject" HEAD`; + if (@commits) { + my $commit = $commits[0]; + chomp $commit; + return $commit; + } + my $commit = `git rev-parse HEAD`; + chomp $commit; + return $commit; +} + # Find SHA1 of commit before $subject, else the SHA1 of HEAD sub findSHA1Before { @@ -304,6 +338,26 @@ sub patchHasChanges return !!@content; } +sub applyAfterLivePatches { + my @modules = sort(findFiles("$basepath/afterlive", '.*', 0)); + print "---\nApplying 'afterlive' patches for modules ". join(", ", @modules). "\n"; + $repos_base = $qtdir . "/qt" if (!defined $repos_base); + foreach my $module (@modules) { + chdir($qtdir); + if (-e "$repos_base/$module") { + print "Applying patches for '$module' @ '$repos_base/$module'\n"; + chdir("$repos_base/$module"); + my $commit = findSHA1("$repos_base/$module", 'Added dependency information to the sync.profile.'); + run("git reset -q --hard $commit"); + run("git am $basepath/afterlive/$module/*.patch"); + } else { + print "** Cannot find $repos_base/$module\n"; + } + } + + print "All 'afterlive' patches applied!\n"; +} + sub showUsage { print "$0 usage:\n"; print " -no-modularize Don't run the 0xx-8xx script range\n"; @@ -328,29 +382,15 @@ sub showUsage { print " to current HEAD\n"; print " -regenerate-patches Automatically regenerate all the patches for the\n"; print " modularization project (does not copy to the repo!)\n"; + print " -afterlive Apply 'afterlive' patches to modularized repos\n"; + print " -redo-afterlive Reapply 'afterlive' patches\n"; print " -? This help\n"; } # -- End functions --------------------------------------------------------------------------------- # -- main ------------------------------------------------------------------------------------------ $OStype = checkOS; -our $run_split = 1; -our $run_rest = 1; -our $run_push = 0; -our $commit_changes = 1; -our $redo = 0; -our $move = 0; -our $move_dest = ""; -our $good_sha1; -our $link_type = COPY; -our $qtdir = getcwd(); -our $qtVersion = findBranchVersion($qtdir); -our $isMaster = 1; -#$isMaster = 1 if ($qtVersion =~ /4.8/); - -my $regenerate_patches = 0; -my $rebase_patches = 0; -my $no_patches = 0; +$qtVersion = findBranchVersion($qtdir); while ( @ARGV ) { my $arg = shift @ARGV; @@ -394,6 +434,11 @@ while ( @ARGV ) { $rebase_patches = 1; } elsif ($arg eq "-regenerate-patches") { $regenerate_patches = 1; + } elsif ($arg eq "-afterlive") { + $apply_afterlive = 1; + } elsif ($arg eq "-redo-afterlive") { + applyAfterLivePatches(); + exit 0; } else { print "Unknown option: $arg\n\n"; showUsage(); @@ -577,5 +622,7 @@ if($run_split) { } chdir($qtdir); +applyAfterLivePatches() if ($apply_afterlive); + print "===\n"; print "Modularization done!\n"; diff --git a/scripts/905_git_split b/scripts/905_git_split index 6d16c2d..16d3d69 100644 --- a/scripts/905_git_split +++ b/scripts/905_git_split @@ -29,7 +29,7 @@ fsRmdir("tools"); # Ensure that the qt-bundle repo <QTDIR>/qt is created # any by default use that as the repo base for the modules my $qtbundledir = "qt"; -my $repos_base = $qtdir . "/" . $qtbundledir; +$repos_base = $qtdir . "/" . $qtbundledir; ensureDir($qtbundledir); my $cacheDir = $qtWebKitType; |