Stories
Slash Boxes
Comments
NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.

All the Perl that's Practical to Extract and Report

The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
 Full
 Abbreviated
 Hidden
More | Login | Reply
Loading... please wait.
  • On top of this, would it be possible to get, say, a VM copy of the setup with database etc as well, so that we can run test bug fixes (like the annoying "NoAuth -> Login takes you back to NoAuth ticket" bug...)
    • The actual database has an awful lot of personal information I'm not comfortable publishing.
      But this is the tool we use to do a live install of rt.cpan:

      diesel:~# svn cat svn+ssh://svn.bestpractical.com/svn/bps-private/rt.cpan.org/pull-rt-cpan
      root@s vn.bestpractical.com's password:
      #!/usr/bin/env perl

      my $root = $ENV{'RTHOME'} = "/opt/rt/rt.cpan.org-managed/";
      use Cwd qw/getcwd abs_path/;

      my @CO = qw{
        svn+ssh://svn.bestpractical.com/svn/bps-public/rt/branches/3.6-RELEASE/
        svn+ssh://svn.bestpractical.com/svn/bps-public/RT-Authen-Bitcard/
        svn+ssh://svn.bestpractical.com/svn/bps-public/RT-Authen-OpenID/
        svn+ssh://svn.bestpractical.com/svn/bps-public/RT-Authen-PAUSE/
        svn+ssh://svn.bestpractical.com/svn/bps-public/RT-BugTracker/
        svn+ssh://svn.bestpractical.com/svn/bps-public/RT-BugTracker-Public/
        svn+ssh://svn.bestpractical.com/svn/bps-public/RT-Extension-MergeUsers/
        svn+ssh://svn.bestpractical.com/svn/bps-public/RT-Extension-QuickDelete/
        svn+ssh://svn.bestpractical.com/svn/bps-public/RT-Extension-rt_cpan_org/
        svn+ssh://svn.bestpractical.com/svn/bps-private/rt.cpan.org/
      };

      my @UPDATE = qw{
        RT-Extension-MergeUsers
        RT-Authen-Bitcard
        RT-Authen-PAUSE
        RT-BugTracker
        RT-BugTracker-Public
        RT-Extension-rt_cpan_org
        RT-Extension-QuickDelete
        RT-Authen-OpenID
      };

      foreach my $url (@CO) {

          print "Getting $url...\n";
          `svn export --quiet --non-interactive $url`;

      }

      my $fully_installed = 1;

      `cd 3.6-RELEASE && sh ./configure.ac --prefix=$root --with-db-database=rt3cpan; sudo make upgrade `;

      INSTALL:
      foreach my $module (@UPDATE) {

          print "Trying to install $module...\n";

          my $dir = getcwd();
          opendir DIR, $dir or die "Can't open directory $dir: $!";

          # Breadth-First Search on canonicalized directories
          my @elts = filter_paths($dir, readdir DIR);
          foreach my $elt (@elts) {
              #print "Checking $elt\n";       # verbose

              if ($elt !~ /$module$/) {
                  opendir SUBDIR, $elt or die "Can't open directory $elt: $!";
                  my @subelts = readdir SUBDIR;
                  @subelts = filter_paths($elt, @subelts);
                  push @elts, @subelts;
                  closedir SUBDIR;

                  next;
              }
              else {
                  print "Installing $module...\n";
                  `cd $elt && rm -rf inc && perl ./Makefile.PL && make && sudo make install`;
                  next INSTALL;
              }
          }

          print STDERR "*** Could not find module $module.  Did not install.\n";
          $fully_installed = 0;
      }

      if (!$fully_installed) {
          print STDERR "Some modules were not able to be installed.\n";
          print STDERR "You will need to install them manually.\n\n";
      }

      `cp rt.cpan.org/RT_SiteConfig.pm ${root}etc`;

      #print "Remember to copy the RT_SiteConfig.pm file to the live directory!\n";

      1;

      sub filter_paths {
          my $base_path = shift;
          my @paths = @_;
          return grep { ( -d $_) }
              (map { abs_path("$base_path/$_") }
                  (grep {$_ !~ /^\./} @paths));
      }