Changeset 1468 in ProjectBuilder for projects


Ignore:
Timestamp:
Apr 16, 2012, 2:46:27 AM (12 years ago)
Author:
Bruno Cornec
Message:
  • Still working to have a first cbusterize version working
Location:
projects/casparbuster
Files:
1 added
4 edited

Legend:

Unmodified
Added
Removed
  • projects/casparbuster/devel/Makefile.PL

    r1466 r1468  
    2222            'bin/cb' => '$(INST_MAN1DIR)/cb.$(MAN1EXT)',
    2323    },
    24     MAN3PODS      => {  'lib/CasparBuster/Env.pm' => '$(INST_MAN3DIR)/CasparBuster::Env.$(MAN3EXT)',
    25                         #'lib/ProjectBuilder/Base.pm' => '$(INST_MAN3DIR)/ProjectBuilder::Base.$(MAN3EXT)',
     24    MAN3PODS      => { 
     25            'lib/CasparBuster/Env.pm' => '$(INST_MAN3DIR)/CasparBuster::Env.$(MAN3EXT)',
     26            'lib/CasparBuster/Version.pm' => '$(INST_MAN3DIR)/CasparBuster::Version.$(MAN3EXT)',
    2627                    },
    2728);
  • projects/casparbuster/devel/bin/cbusterize

    r1466 r1468  
    77=head1 SYNOPSIS
    88
    9 cbusterize.pl [options] --source /path/to/file/to/CasparBusterize
     9cbusterize [options] --source /path/to/file/to/CasparBusterize
    1010
    1111 Options:
     
    100100=cut
    101101use strict;
    102 use Cwd 'realpath';
     102use CasparBuster::Version;
     103use CasparBuster::Env;
     104#use Cwd 'realpath';
    103105use File::Find;
    104106use File::Copy;
     
    108110use Getopt::Long;
    109111use Pod::Usage;
     112use Data::Dumper;
    110113use List::Util qw(first);
    111114use ProjectBuilder::Base;
    112115use ProjectBuilder::Conf;
    113 use CasparBuster::Env;
    114116
    115117# settings
    116118my $debug = 0;
    117 my $help = 0;
    118 my $man = 0;
     119my $help = undef;
     120my $man = undef;
    119121my $source = undef;
    120122my $machine = undef;
     123my $plugin = undef;
    121124my $quiet = undef;
    122125my $log = undef;
    123126my $LOG = undef;
    124127
    125 my ($cbver,$cbrev) = pb_version_init();
     128my ($cbver,$cbrev) = cb_version_init();
    126129my $appname = "cb";
    127130$ENV{'PBPROJ'} = $appname;
     
    140143    'log-files|l=s' => \$log,
    141144    'source|s=s'  => \$source,
     145    'plugin|p=s'  => \$plugin,
    142146) || pb_syntax(-1,0);
    143147
     
    156160    $debug = 0  if ($debug == -1);
    157161}
     162
     163$pbdebug = $debug;
    158164pb_log_init($debug, $LOG);
    159165pb_log(0,"Starting cbusterize\n");
     
    161167# Get conf file in context
    162168pb_conf_init($appname);
     169# The personal one if there is such
     170pb_conf_add("$ENV{'HOME'}/.cbrc") if (-f "$ENV{'HOME'}/.cbrc");
    163171# The system one
    164172pb_conf_add(cb_env_conffile());
    165 # The personal one if there is such
    166 pb_conf_add("$ENV{'HOME'}/.cbrc") if (-f "$ENV{'HOME'}/.cbrc");
    167173
    168174# Get configuration parameters
    169 my ($basedir,$opt,$usemach,$pluginsdir,$cms) = pb_conf_get("cbbasedir","cbdatabase","cbusemachines","cbpluginssubdir","cbcms");
     175my %cb;
     176my $cb = \%cb;
     177($cb->{'basedir'},$cb->{'database'},$cb->{'usemachines'},$cb->{'pluginsdir'},$cb->{'cms'}) = pb_conf_get("cbbasedir","cbdatabase","cbusemachines","cbpluginssubdir","cbcms");
     178
     179print Dumper($cb) if ($debug);
    170180
    171181# Check for mandatory params
    172 pod2usage("Error: --source is a mandatory argument\n") (if not defined $source);
    173 pod2usage("Error: --machine is a mandatory argument when configure with cbusemachines = true\n") if ($usemach->{$appname} =~ /true/) && (not defined $machine));
    174 
    175 # Are the source and basedir full path names ? if not, make it such
    176 $source = realpath($source);
    177 $basedir = realpath($basedir->{$appname});
     182pod2usage("Error: --source or --plugin is a mandatory argument\n") if ((not defined $source) && (not defined $plugin));
     183pod2usage("Error: --machine is a mandatory argument when configure with cbusemachines = true\n") if (($cb->{'usemachines'}->{$appname} =~ /true/) && (not defined $machine));
     184
     185if (defined $plugin) {
     186    # Load plugin conf
     187}
     188
     189my $basedir = $cb->{'basedir'}->{$appname};
     190eval { $basedir =~ s/(\$ENV.+\})/$1/eeg };
    178191
    179192# debug mode overview
     
    218231}
    219232
    220 # Find the include/install.mk file by looking up the tree
    221 # from basedir/machine or basedir if no machine given
    222 my $sdir1 = $basedir;
    223 $sdir1 .= "/$machine" if defined ($machine);
    224 my $sdir = $sdir1;
    225 while (! -f "$sdir/include/install.mk") {
    226     $sdir = dirname($sdir);
    227     if ($sdir eq "/") {
    228         die <<EOF;
    229 ERROR: No include/install.mk file was found while
    230        parsing $sdir1 and its parents
    231        Your tree is not CasparBuster compliant.
    232        Please fix it before relaunching CasparBuster.pl
    233 EOF
    234     }
    235 }
    236 if ($debug) {
    237     print "DEBUG: Found sdir = $sdir\n";
    238 }
    239 # Now checking conformity
    240 print "CHECK: $sdir/include/install.mk\n" if ($debug);
    241 my $cf = 0;
    242 my $remote = undef;
    243 open(MF,"$sdir/include/install.mk");
    244 while (<MF>) {
    245     if (($_ =~ /csp_UHOST\s*=/) && ($_ =~ /(\w+\@$machine.*)/)) {
    246         $remote = $1;
    247         $cf++;
    248         if ($debug) {
    249             print "DEBUG: csp_UHOST conform line found with ref to $machine\n";
    250             print "DEBUG: remote configuration is $remote\n";
    251         }
    252     }
    253     if (/include\s+CasparBuster\/mk\/CasparBuster.mk/) {
    254         $cf++;
    255         if ($debug) {
    256             print "DEBUG: include conform line found with ref to CasparBuster.mk\n";
    257         }
    258     }
    259 }
    260 close(MF);
    261 if ($cf < 2) {
    262     print "WARNING: Non conform $sdir/include/install.mk file found\n";
    263 }
    264 die "No remote configuration defined in $sdir/include/install.mk" if (not defined $remote);
    265 
    266 my $target = "$sdir1/$srcdir";
     233# Deduce the target directory from the local structure and the source
     234my $target = $basedir;
     235$target .= "/$machine" if defined ($machine);
     236$target .= "$srcdir";
     237
    267238# If both source and target are dirs, then copy into the parent of the target
    268239$target = basename($target) if ((not defined $srcfile) && (-d $target));
    269240
    270 # Create Makefiles if none exists also in parents, warn else
    271 my $tdir = $target;
    272 my $sd = $srcdir;
    273 while (! -f "$tdir/Makefile") {
    274 
    275     # Create target if it doesn't exist
    276     if (not -d $tdir) {
    277         if ($debug) {
    278             print "DEBUG: Creating recursively directory $tdir\n";
    279         } else {
    280             mkpath($tdir,0,0755) or die "Unable to recursively create $tdir";
    281             print "INFO: Created $tdir you may want to add it to your CMS\n";
    282         }
    283     }
    284 
    285     if (-f "$tdir/Makefile") {
    286         print "CHECK: $tdir/Makefile\n" if ($debug);
    287         # Now checking conformity
    288         $cf = 0;
    289         open(MF,"$tdir/Makefile") || die "Unable to open $tdir/Makefile";
    290         while (<MF>) {
    291             my $sd1 = $sd;
    292             $sd1 =~ s|/|\/|g;
    293             if (/csp_DIR\s*=\s*$sd1/) {
    294                 $cf++;
    295                 if ($debug) {
    296                     print "DEBUG: csp_DIR conform line found with ref to $sd\n";
    297                 }
    298             }
    299             $sd1 = $sdir;
    300             $sd1 =~ s|/|\/|g;
    301             if (/include\s+$sd1[\/]*install.mk/) {
    302                 $cf++;
    303                 if ($debug) {
    304                     print "DEBUG: include conform line found with ref to install.mk\n";
    305                 }
    306             }
    307             close(MF);
    308    
    309             if ($cf < 2) {
    310                 print "WARNING: Non conform $tdir/Makefile file found\n";
    311             }
    312         }
    313     } else {
    314         # In this case we create one
    315         if ($debug) {
    316             print <<EOF;
    317 DEBUG: Creating $tdir/Makefile with the following content:
    318 csp_DIR = $sd
    319 include $sdir/include/install.mk
    320 EOF
    321         } else {
    322             my $mf = "$tdir/Makefile";
    323             $mf =~ s|//|/|g;
    324             open(MF,"> $mf") || die "Unable to create $mf";
    325             print MF <<EOF;
    326 # Created by CasparBuster.pl - \$Id\$
    327 csp_DIR = $sd
    328 # That include should be last of these declarations
    329 include $sdir/include/install.mk
    330 EOF
    331             close(MF);
    332             print "INFO: Created $mf you may want to add it to your CMS\n";
    333         }
    334     }
    335     $tdir = dirname($tdir);
    336     $sd = dirname($sd);
     241# Create target if it doesn't exist
     242if (not -d $target) {
    337243    if ($debug) {
    338         print "DEBUG: Next round, tdir = $tdir and sd = $sd\n";
    339     }
    340     # Stop at basedir
    341     last if ($tdir eq $basedir);
     244        print "DEBUG: Creating recursively directory $target\n";
     245    } else {
     246        mkpath($target,0,0755) or die "Unable to recursively create $target";
     247        print "INFO: Created $target you may want to add it to your CMS\n";
     248        # TODO: Add it to the CMS
     249    }
    342250}
    343251
     
    350258
    351259if (defined $machine) {
    352     $cmd = "scp -p -q $cmdopt $remote:$source $target";
     260    $cmd = "scp -p -q $cmdopt $machine:$source $target";
    353261} else {
    354262    $cmd = "cp -p $cmdopt $source $target";
    355263}
     264
    356265# Now add content if not already there
    357266if ((defined $srcfile) && (! -f "$target/$srcfile")) {
  • projects/casparbuster/pbconf/devel/casparbuster.pb

    r1467 r1468  
    6868# List of files per pkg on which to apply filters
    6969# Files are mentioned relatively to pbroot/defpkgdir
    70 filteredfiles cb = Makefile.PL
     70filteredfiles cb = Makefile.PL,lib/CasparBuster/Version.pm
    7171#,cb.1,cbusterize.1
    7272#supfiles cb = cb.init
  • projects/casparbuster/pbconf/devel/cb/rpm/cb.spec

    r1467 r1468  
    1616BuildRoot:      %{_tmppath}/%{name}-%{version}-%{release}-root-%(id -u -n)
    1717BuildArch:      noarch
    18 Requires:       perl >= 5.8.4,perl-DateManip,perl-ProjectBuilder,perl-File-MimeInfo
     18Requires:       perl >= 5.8.4,perl-DateManip,perl-ProjectBuilder,perl-File-MimeInfo,perl-Data-Dumper
    1919
    2020%description
     
    4141%doc AUTHORS INSTALL COPYING README
    4242
    43 #%{perlvendorlib}/*
     43%{perlvendorlib}/*
    4444%{_bindir}/*
    4545%{_sysconfdir}/cb
    4646%{_mandir}/man1/*
     47%{_mandir}/man3/*
    4748%{_mandir}/man5/*
    4849
Note: See TracChangeset for help on using the changeset viewer.