summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoraquanight <aquanight@e03df62e-2008-0410-955e-edbf42e46eb7>2008-03-02 00:57:32 +0000
committeraquanight <aquanight@e03df62e-2008-0410-955e-edbf42e46eb7>2008-03-02 00:57:32 +0000
commit741682d5c54bcf9bb2c0dc79dc2c318b7df9381c (patch)
tree186ab2d560a1b8bd04d5ec8339bca3879fe685b8
parentf7dc18aef78950d292aa21d7de2638654522659e (diff)
Make ./configure -svnupdate smarter (don't actually do the update if it's not needed, or only do -modupdate if full -update isn't needed)
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@9053 e03df62e-2008-0410-955e-edbf42e46eb7
-rwxr-xr-xconfigure79
1 files changed, 76 insertions, 3 deletions
diff --git a/configure b/configure
index 4adedf04e..ff83fab19 100755
--- a/configure
+++ b/configure
@@ -483,14 +483,87 @@ sub svnupdate
open(FH,"<.svn/entries") or $fail = 1;
if ($fail) {
print "This is not an SVN copy of InspIRCd.\n";
- exit;
+ exit 1;
}
else
{
close(FH);
}
- system("svn update");
- system("perl configure -update");
+ open my $fd, "-|", "svn update";
+ my $configurechanged = 0; # Needs ./configure -update
+ my $coredirchanged = 0; # Needs ./configure -update
+ my $moduledirchanged = 0; # Needs ./configure -modupdate
+ my @conflicted = ();
+ while (defined(my $line = <$fd>))
+ {
+ my ($action, $file);
+ print $line;
+ $line =~ m/^([ADUCG])\s+(.*)$/ or next;
+ ($action, $file) = ($1, $2);
+ if ($action eq "C")
+ {
+ push @conflicted, $file;
+ if ($file eq "configure")
+ {
+ $configurechanged = 1;
+ }
+ if ($file =~ m#^src/modules#)
+ {
+ $moduledirchanged = 1;
+ }
+ elsif ($file =~ m#^src/#)
+ {
+ $coredirchanged = 1;
+ }
+ }
+ elsif ($action eq "U" || $action eq "G")
+ {
+ if ($file eq "configure")
+ {
+ $configurechanged = 1;
+ }
+ }
+ elsif ($action eq "A" || $action eq "D")
+ {
+ if ($file =~ m#^src/modules#)
+ {
+ $moduledirchanged = 1;
+ }
+ elsif ($file =~ m#^src/#)
+ {
+ $coredirchanged = 1;
+ }
+ }
+ }
+ unless (close $fd) # close() waits for exit and returns false if the command failed
+ {
+ if ($! == 0)
+ {
+ print STDERR "Problem updating from SVN, please check above for errors\n";
+ }
+ else
+ {
+ print STDERR "Failed to run SVN: $!\n";
+ }
+ exit 1;
+ }
+ if (scalar(@conflicted) > 0)
+ {
+ print STDERR "\e[0;33;1mERROR:\e[0m You have local modifications which conflicted with the updates from SVN\n";
+ printf STDERR "Configure is not able to complete the update. Please resolve these conflicts, then run ./configure -%supdate", (($coredirchanged || $configurechanged) ? "" : "mod");
+ }
+ if ($configurechanged || $coredirchanged)
+ {
+ system("perl configure -update");
+ }
+ elsif ($moduledirchanged)
+ {
+ system("perl configure -modupdate");
+ }
+ else
+ {
+ print "No need to update Makefiles.\n";
+ }
if (defined $opt_rebuild) {
system("make install");
}