From: Moritz Bunkus Date: Wed, 31 Jan 2007 13:14:16 +0000 (+0000) Subject: Script wird nicht mehr benötigt, da für den neuen Upgrademechanismus keine Versionsnu... X-Git-Tag: release-2.4.2~200 X-Git-Url: http://wagnertech.de/gitweb/gitweb.cgi/kivitendo-erp.git/commitdiff_plain/a7820e648c271e85f408353c1be009ad16a5b70c?hp=e0cb5a6ca85cc69f874e44e8518231a6a51f5f4d Script wird nicht mehr benötigt, da für den neuen Upgrademechanismus keine Versionsnummern mehr verwendet werden. --- 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; -}