version.pl 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. #!/usr/sbin/perl
  2. #
  3. # This Source Code Form is subject to the terms of the Mozilla Public
  4. # License, v. 2.0. If a copy of the MPL was not distributed with this
  5. # file, You can obtain one at http://mozilla.org/MPL/2.0/.
  6. # Compose lowercase alphabet
  7. @alphabet = ( "a", "b", "c", "d", "e", "f", "g", "h",
  8. "i", "j", "k", "l", "m", "n", "o", "p",
  9. "q", "r", "s", "t", "u", "v", "w", "x",
  10. "y", "z" );
  11. # Compute year
  12. $year = (localtime)[5] + 1900;
  13. # Compute month
  14. $month = (localtime)[4] + 1;
  15. # Compute day
  16. $day = (localtime)[3];
  17. # Compute base build number
  18. $version = sprintf( "%d%02d%02d", $year, $month, $day );
  19. $directory = sprintf( "%s\/%s\/%d%02d%02d", $ARGV[0], $ARGV[1], $year, $month, $day );
  20. # Print out the name of the first version directory which does not exist
  21. #if( ! -e $directory )
  22. #{
  23. print $version;
  24. #}
  25. #else
  26. #{
  27. # # Loop through combinations
  28. # foreach $ch1 (@alphabet)
  29. # {
  30. # foreach $ch2 (@alphabet)
  31. # {
  32. # $version = sprintf( "%d%02d%02d%s%s", $year, $month, $day, $ch1, $ch2 );
  33. # $directory = sprintf( "%s\/%s\/%d%02d%02d%s%s", $ARGV[0], $ARGV[1], $year, $month, $day, $ch1, $ch2 );
  34. # if( ! -e $directory )
  35. # {
  36. # print STDOUT $version;
  37. # exit;
  38. # }
  39. # }
  40. # }
  41. #}