From a7820e648c271e85f408353c1be009ad16a5b70c Mon Sep 17 00:00:00 2001 From: Moritz Bunkus Date: Wed, 31 Jan 2007 13:14:16 +0000 Subject: [PATCH] =?utf8?q?Script=20wird=20nicht=20mehr=20ben=C3=B6tigt,=20?= =?utf8?q?da=20f=C3=BCr=20den=20neuen=20Upgrademechanismus=20keine=20Versi?= =?utf8?q?onsnummern=20mehr=20verwendet=20werden.?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- scripts/pgupadd.pl | 80 ---------------------------------------------- 1 file changed, 80 deletions(-) delete mode 100755 scripts/pgupadd.pl diff --git a/scripts/pgupadd.pl b/scripts/pgupadd.pl deleted file mode 100755 index a0b343eee..000000000 --- a/scripts/pgupadd.pl +++ /dev/null @@ -1,80 +0,0 @@ -#!/usr/bin/perl -l -# -$db = "Pg"; -$version = "0.2b"; - -($name,$exec) = @ARGV; -opendir SQLDIR, "sql/$db-upgrade" or die "Can't open sql dir"; -@ups = sort(cmp_script_version grep(/$db-upgrade-.*?\.(sql|pl)$/, readdir(SQLDIR))); -closedir SQLDIR; -$up = $ups[-1]; -$up =~ s/(.*de-)|(.sql$)|(.pl$)//g; -($from, $to) = split /-/, $up; -@next = split(/\./, $to); -$newsub = (pop @next)+1; -$next = join (".",@next).".".$newsub; - -$name =~ /\.([^\.]+)$/; -$ext = $1; - -print qq| -$db-upgrade Adder v$version - -USE: pgupadd [file] [!] - -Computes the next minor database version. -If [file] is given, proposes a copy command to add this file to the upgrade dir. -Use pgupadd [file] ! to let the adder copy and add it to svn for you (check the command first). - -Current highest upgrade: $up -Proposed next version: $next -Proposed name for upgrade: $db-upgrade-$to-$next.$ext |; - -$cmd = "cp $name sql/$db-upgrade/$db-upgrade-$to-$next.$ext; svn add sql/$db-upgrade/$db-upgrade-$to-$next.$ext;"; -print qq|Proposed copy/add command: - -$cmd -| if $name; - -if ($name && !-f $name) { - print qq|Warning! Given file does not exist!|; - exit; -} - -if ($name && -f "sql/$db-upgrade/$db-upgrade-$up.$ext" && - !`cmp $name sql/$db-upgrade/$db-upgrade-$up.$ext`) { - print qq|Warning! Given file is identical to latest $db-upgrade!|; - exit; -} - -exec($cmd) if ($exec eq "!" and $name); - - -# both functions stolen and slightly modified from SL/User.pm -sub cmp_script_version { - my ($a_from, $a_to, $b_from, $b_to); - my ($i, $res_a, $res_b); - my ($my_a, $my_b) = ($a, $b); - - $my_a =~ s/.*-upgrade-//; - $my_a =~ s/.(sql|pl)$//; - $my_b =~ s/.*-upgrade-//; - $my_b =~ s/.(sql|pl)$//; - ($my_a_from, $my_a_to) = split(/-/, $my_a); - ($my_b_from, $my_b_to) = split(/-/, $my_b); - - $res_a = calc_version($my_a_from); - $res_b = calc_version($my_b_from); - - if ($res_a == $res_b) { - $res_a = calc_version($my_a_to); - $res_b = calc_version($my_b_to); - } - - return $res_a <=> $res_b; -} -sub calc_version { - my $r = !(my @v = split(/\./, shift)); - map { $r = $r * 1000 + $v[$_] } 0..4; - $r; -} -- 2.20.1