3 # create_projects_bom.pl - generate list of files to backup
4 # Copyright (C) 2020 Kyle J. McKay. All rights reserved.
5 # License GPLv2+: GNU GPL version 2 or later.
6 # www.gnu.org/licenses/gpl-2.0.html
7 # This is free software: you are free to change and redistribute it.
8 # There is NO WARRANTY, to the extent permitted by law.
12 use vars
qw($VERSION);
13 BEGIN {*VERSION = \'1.0.0'}
14 use lib "__BASEDIR__";
19 exit(&main(@ARGV)||0);
22 BEGIN {@projparts = qw(
51 objects/info/alternates
63 my ($rdir, $pdir) = @_;
64 my $odir = "$rdir/$pdir";
65 opendir LISTDIR
, "$odir" or return;
66 my @tags = grep { !/^\./ && !/[,\s\/\\]/ && ! -l "$odir/$_" && -f "$odir/$_" } readdir(LISTDIR);
68 print "$pdir/$_\n" foreach sort({lc($a) cmp lc($b) || $a cmp $b} @tags);
71 sub bom_for_project($) {
72 my $rroot = $Girocco::Config::reporoot;
75 -l "$rroot/$proj.git
" and return;
77 # For each entry from @projparts that exists, output
78 # a line. BUT, if it exists AND it's a symlink, SKIP
79 # outputting a line for anything beneath it that's also
83 my $test = "$rroot/$proj.git
";
84 foreach (@projparts) {
85 my $idx = index($_, "/");
86 next if $idx > 0 && $links{substr($_, 0, $idx)};
89 print "$proj.git
/$_\n";
91 } elsif ($_ eq "packed
-refs
") {
93 } elsif (-e "$test/$_") {
94 print "$proj.git
/$_\n";
95 list_files($rroot, "$proj.git
/$_") if $_ eq "ctags
";
102 my %projects = map({$_ => 1} Girocco::Project::get_full_list());
104 my $rroot = $Girocco::Config::reporoot;
110 $projects{$_} || (-l "$rroot/$_.git" && -d "$rroot/$_.git
") or
111 die "no such project
: $_\n";
114 my %list = map({$_ => 1} @list);
115 @names = sort({lc($a) cmp lc($b) || $a cmp $b} keys(%list));
117 if (opendir REPOROOT, $rroot) {
119 /^[^._]/ && s/\.git$//i &&
120 -l "$rroot/$_.git" && -d "$rroot/$_.git
"
123 $projects{$_} = 1 foreach @links;
125 @names = sort({lc($a) cmp lc($b) || $a cmp $b} keys(%projects));
127 @names or die "no projects specified
\n";
128 #print map("$_\n", @names);
129 bom_for_project($_) foreach @names;