File: generate_diff_dirs.pl

package info (click to toggle)
libchado-perl 1.31-6
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, sid
  • size: 44,716 kB
  • sloc: sql: 282,721; xml: 192,553; perl: 25,524; sh: 102; python: 73; makefile: 57
file content (40 lines) | stat: -rw-r--r-- 927 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#!/usr/bin/env perl
use strict;
use warnings;
use Scalar::Util qw(looks_like_number);
use File::Copy;

my $VERSION = $ARGV[0];

die unless $VERSION;

#make this versions directory
mkdir $VERSION;
copy("../modules/default_schema.sql", $VERSION);
system("git add $VERSION");

#make the diff dirs and skelton diff files
my @add_to_manifest;
my @dirs = <*>;

for my $dir (@dirs) {
    next unless -d $dir;

    if (looks_like_number($dir)) {
        next if ($dir == $VERSION);
        my $newdir = $dir.'-'.$VERSION;
        mkdir $newdir;
        system("touch $newdir/diff.sql");
        push @add_to_manifest, "schemas/$newdir/diff.sql";
        system("git add $newdir");
    }
}

#add the created files to the MANIFEST
my $manifest = "../MANIFEST";
open(MANIFEST, ">>", $manifest) or die;
print MANIFEST "#the following added by generate_diff_dirs.pl\n";
for (@add_to_manifest) {
    print MANIFEST "$_\n";
}
close MANIFEST;