Skip to content

Commit

Permalink
Run Travis compile-test
Browse files Browse the repository at this point in the history
This enables using Travis CI for Dreamwidth.

This is very minimal at the moment and just runs the compile test to ensure that all code compiles. We should be able to fairly trivially extend this to work with other unit tests we have.

This also updates how dependencies are tracked in a file in the `doc` directory. This should be a step towards making it easier to set up new hosts, too.
  • Loading branch information
zorkian committed Dec 7, 2018
1 parent 8406c21 commit 7ced15c
Show file tree
Hide file tree
Showing 6 changed files with 106 additions and 251 deletions.
11 changes: 11 additions & 0 deletions .travis.yml
@@ -0,0 +1,11 @@
dist: trusty
language: generic
install:
- sudo apt-get update
- cat doc/dependencies-system | xargs sudo apt-get install -y
- cat doc/dependencies-cpanm | xargs cpanm -n -L extlib
before_script:
- perl -v
- env LJHOME=$TRAVIS_BUILD_DIR bin/checkconfig.pl --only=modules
script:
- env LJHOME=$TRAVIS_BUILD_DIR perl -Iextlib/lib/perl5 t/00-compile.t
258 changes: 13 additions & 245 deletions bin/checkconfig.pl
Expand Up @@ -19,7 +19,7 @@
use Getopt::Long;

my $debs_only = 0;
my ($only_check, $no_check, $opt_nolocal, $opt_cpanm);
my ($only_check, $no_check, $opt_nolocal);

my %dochecks; # these are the ones we'll actually do
my @checks = ( # put these in the order they should be checked in
Expand All @@ -35,7 +35,6 @@ sub usage {
die "Usage: checkconfig.pl
checkconfig.pl --needed-debs
checkconfig.pl --only=<check> | --no=<check>
checkconfig.pl --cpanm
Checks are:
" . join(', ', @checks);
Expand All @@ -46,7 +45,6 @@ sub usage {
'only=s' => \$only_check,
'no=s' => \$no_check,
'nolocal' => \$opt_nolocal,
'cpanm' => \$opt_cpanm,
);

if ($debs_only) {
Expand All @@ -69,241 +67,17 @@ sub usage {
die "\nProblem:\n" . join('', map { " * $_\n" } @_);
};

# base packages we need installed
my @packages = ('apache2-mpm-prefork');

# packages we need if we're building from source (using cpanm)
my @cpanm_packages = ('libexpat1-dev', 'g++', 'make', 'libgtop2-dev', 'libgmp3-dev',
'libxml2-dev');

my %modules = (
"Date::Parse" => { 'deb' => 'libtimedate-perl' },
"DateTime" => { 'deb' => 'libdatetime-perl' },
"DBI" => { 'deb' => 'libdbi-perl', 'system' => 1, },
"DBD::mysql" => { 'deb' => 'libdbd-mysql-perl', 'system' => 1, },
"DBD::SQLite" => {
deb => 'libdbd-sqlite3-perl',
opt => 'Required for tests',
},
"Class::Autouse" => { 'deb' => 'libclass-autouse-perl', },
"Digest::MD5" => { 'deb' => 'libmd5-perl', },
"Digest::SHA1" => { 'deb' => 'libdigest-sha1-perl', },
"Digest::SHA" => { 'deb' =>'libdigest-sha-perl' },
"Image::Size" => { 'deb' => 'libimage-size-perl', },
"MIME::Lite" => { 'deb' => 'libmime-lite-perl', },
"MIME::Words" => { 'deb' => 'libmime-perl', },
"Compress::Zlib" => { 'deb' => 'libcompress-zlib-perl', },
"Net::DNS" => { 'deb' => 'libnet-dns-perl', },
"Template" => { 'deb' => 'libtemplate-perl', },
"CGI" => { deb => 'libcgi-pm-perl', },
"Net::OpenID::Server" => {
opt => 'Required for OpenID server support.'
},
"Net::OpenID::Consumer" => {
opt => 'Required for OpenID consumer support.'
},
"Net::OAuth" => {
#opt => 'Required for OAuth support.' # FIXME: Not optional
},
"URI::URL" => { 'deb' => 'liburi-perl' },
"HTML::Tagset" => { 'deb' => 'libhtml-tagset-perl' },
"HTML::Parser" => { 'deb' => 'libhtml-parser-perl', },
"LWP::Simple" => { 'deb' => 'libwww-perl', },
"LWP::UserAgent" => { 'deb' => 'libwww-perl', },
"GD" => { 'deb' => 'libgd-gd2-perl', 'system' => 1, },
"GD::Graph" => {
'deb' => 'libgd-graph-perl',
'opt' => 'Required for making graphs for the statistics page.',
'system' => 1,
},
"Mail::Address" => { 'deb' => 'libmailtools-perl', },
"Proc::ProcessTable" => {
'deb' => 'libproc-process-perl',
'opt' => "Better reliability for starting daemons necessary for high-traffic installations.",
},
"RPC::XML" => {
'deb' => 'librpc-xml-perl',
'opt' => 'Required for outgoing XML-RPC support',
},
"XMLRPC::Lite" => {},
"SOAP::Lite" => {
'deb' => 'libsoap-lite-perl',
'opt' => 'Required for XML-RPC support.',
'ver' => '0.710.8',
},
"Unicode::MapUTF8" => { 'deb' => 'libunicode-maputf8-perl', },
"XML::RSS" => {
'deb' => 'libxml-rss-perl',
'opt' => 'Required for retrieving RSS off of other sites (syndication).',
},
"XML::Simple" => {
'deb' => 'libxml-simple-perl',
'ver' => 2.12,
},
"String::CRC32" => {
'deb' => 'libstring-crc32-perl',
'opt' => 'Required for palette-altering of PNG files. Only necessary if you plan to make your own S2 styles that use PNGs, not GIFs.',
},
"IO::WrapTie" => { 'deb' => 'libio-stringy-perl' },
"XML::Atom" => {
'deb' => 'libxml-atom-perl',
},
"Math::BigInt::GMP" => {
'deb' => 'libmath-bigint-gmp-perl',
'opt' => 'Aides Crypt::DH so it is not crazy slow.',
},
"URI::Fetch" => {
'deb' => 'liburi-fetch-perl',
'opt' => 'Required for OpenID support.',
},
"Crypt::DH" => {
'deb' => 'libcrypt-dh-perl',
'opt' => 'Required for OpenID support.',
},
"Unicode::CheckUTF8" => {},
"Captcha::reCAPTCHA" => {
'deb' => 'libcaptcha-recaptcha-perl',
},
"Digest::HMAC_SHA1" => {
'deb' => 'libdigest-hmac-perl',
},
"Image::Magick" => {
'deb' => 'perlmagick',
'opt' => "Required for the userpic factory.",
'system' => 1,
},
"Class::Accessor" => {
'deb' => 'libclass-accessor-perl',
},
"Class::Trigger" => {
'deb' => 'libclass-trigger-perl',
},
"Class::Data::Inheritable" => {
'deb' => 'libclass-data-inheritable-perl',
},
"Data::ObjectDriver" => {
'deb' => 'libdata-objectdriver-perl',
},
"GnuPG::Interface" => {
'deb' => 'libgnupg-interface-perl',
'opt' => "Required for email posting.",
},
"Mail::GnuPG" => {
'deb' => 'libmail-gnupg-perl',
'opt' => "Required for email posting.",
},
"GTop" => {},
"Apache2::RequestRec" => {
'deb' => "libapache2-mod-perl2",
#'opt' => "Required for modperl2", # FIXME: actually required
'system' => 1, # don't cpanm this
},
"Apache2::Request" => {
'deb' => "libapache2-request-perl",
#'opt' => "Required for Apache2", # FIXME: actually required
'system' => 1, # don't cpanm this
},
"Test::Most" => {
deb => "libtest-most-perl",
opt => "Required for tests",
},
"Test::More" => {
'deb' => "libtest-simple-perl",
'opt' => "Required for subtest support.",
'ver' => '0.96',
},
"HTML::TokeParser" => {
'deb' => "libhtml-parser-perl",
'opt' => "Required for clean-embed.t.",
'ver' => '3.56',
},
"YAML" => { 'deb' => 'libyaml-perl', },
"Business::CreditCard" => {
'deb' => "libbusiness-creditcard-perl",
'opt' => "Required for taking credit/debit cards in the shop.",
},
"Hash::MultiValue" => { ver => '0.10' },
"DateTime::TimeZone" => { 'deb' => "libdatetime-timezone-perl", },
"Sys::Syscall" => {
deb => 'libsys-syscall-perl',
opt => 'Required for Perlbal',
},
"Danga::Socket" => {
deb => 'libdanga-socket-perl',
opt => 'Required for Perlbal',
},
"IO::AIO" => {
deb => 'libio-aio-perl',
opt => 'Required for Perlbal',
},
"MogileFS::Client" => {
ver => '1.12',
opt => 'Used for legacy MogileFS support',
},
"TheSchwartz" => {
deb => 'libtheschwartz-perl',
},
"TheSchwartz::Worker::SendEmail" => {},
"Text::Markdown" => {
deb => 'libtext-markdown-perl',
opt => 'Required to allow using Markdown in entries.',
},
"Cache::Memcached" => {
deb => 'libcache-memcached-perl',
},
"Gearman::Client" => {
deb => 'libgearman-client-perl',
},
"File::Type" => {
deb => 'libfile-type-perl',
},
"JSON" => {
deb => 'libjson-perl',
ver => '2.53',
},
"Image::ExifTool" => {
deb => 'libimage-exiftool-perl',
},
"Net::SSL" => { ver => "2.85" },
"MIME::Base64::URLSafe" => {
deb => 'libmime-base64-urlsafe-perl',
},
"List::MoreUtils" => {},
"Locale::Country" => { ver => '3.32' },
"Net::SMTPS" => {},
"IO::Socket::SSL" => {},
"LWP::UserAgent::Paranoid" => {},
"Mozilla::CA" => {},
"File::Find::Rule" => {
deb => 'libfile-find-rule-perl',
opt => "Used by t/00-compile.t test.",
},
"Log::Log4perl" => {
deb => 'liblog-log4perl-perl',
},
"Params::Validate" => {
ver => '1.2',
},
"List::Util" => {
ver => '1.45',
},
"Params::Util" => {
opt => "Used for BlobStore support of S3",
},
"Paws::S3" => {
opt => "Used for BlobStore support of S3",
},
"Text::Wrap" => {
ver => '2013.0523', # issue #1447
},
"Moose" => {
opt => "Used for BlobStore support of S3",
},
"Text::Fuzzy" => {
ver => '0.27',
}
);
my %modules;

open MODULES, "<$ENV{LJHOME}/doc/dependencies-cpanm" or die;
foreach my $module_line (<MODULES>) {
my ( $module, $ver ) = ( $1, $2 )
if $module_line =~ /^(.+?)(?:@(.+))?$/;
if ( $module ) {
$modules{$module} = { ver => $ver };
}
}
close MODULES;

sub check_modules {
print "[Checking for Perl Modules....]\n"
Expand All @@ -316,19 +90,13 @@ sub check_modules {
if ($@) {
my $dt = $modules{$mod};
unless ($debs_only) {
if ($dt->{'opt'}) {
if ($dt->{opt}) {
print STDERR "Missing optional module $mod: $dt->{'opt'}\n";
} else {
push @errors, "Missing perl module: $mod";
}
}
if ($opt_cpanm) {
push @debs, $dt->{'deb'} if $dt->{'deb'} && $dt->{'system'};
push @mods, $mod unless $dt->{system};
die "Cannot use system module: $_" if $dt->{system} and ! $dt->{deb};
} else {
push @debs, $dt->{'deb'} if $dt->{'deb'};
}
push @mods, $dt->{ver} ? "$mod\@$dt->{ver}" : $mod;
next;
}

Expand Down
10 changes: 5 additions & 5 deletions cgi-bin/DW/User/DVersion/Migrate8To9.pm
Expand Up @@ -34,13 +34,13 @@ unless (defined $readonly_bit) {
die "Won't move user without %LJ::CAP capability class named '_moveinprogress' with readonly => 1\n";
}

my $logpropid = LJ::get_prop( log => 'picture_keyword' )->{id};
my $talkpropid = LJ::get_prop( talk => 'picture_keyword' )->{id};
sub do_upgrade {
my $logpropid = LJ::get_prop( log => 'picture_keyword' )->{id};
my $talkpropid = LJ::get_prop( talk => 'picture_keyword' )->{id};

my $logpropid_map = LJ::get_prop( log => 'picture_mapid' )->{id};
my $talkpropid_map = LJ::get_prop( talk => 'picture_mapid' )->{id};
my $logpropid_map = LJ::get_prop( log => 'picture_mapid' )->{id};
my $talkpropid_map = LJ::get_prop( talk => 'picture_mapid' )->{id};

sub do_upgrade {
my $BLOCK_INSERT = 25;

my ( $u ) = @_;
Expand Down
59 changes: 59 additions & 0 deletions doc/dependencies-cpanm
@@ -0,0 +1,59 @@
Business::CreditCard
Cache::Memcached
Captcha::reCAPTCHA
Class::Autouse
Class::Data::Inheritable
Class::Trigger
Crypt::DH
Danga::Socket
Data::ObjectDriver
Digest::HMAC_SHA1
Digest::SHA1
File::Type
GTop
Gearman::Client
GnuPG::Interface
Hash::MultiValue@0.10
IO::WrapTie
Image::ExifTool
Image::Size
JSON@2.53
LWP::UserAgent::Paranoid
List::Util@1.45
Locale::Country@3.32
Log::Log4perl
MIME::Base64::URLSafe
MIME::Lite
MIME::Words
Mail::GnuPG
Math::BigInt::GMP
MogileFS::Client@1.12
Moose
Mozilla::CA
Net::DNS
Net::OAuth
Net::OpenID::Consumer
Net::OpenID::Server
Net::SMTPS
Net::SSL@2.85
Paws::S3
Proc::ProcessTable
RPC::XML
SOAP::Lite@0.710.8
String::CRC32
Sys::Syscall
Template
Test::Most
Text::Fuzzy@0.27
Text::Markdown
Text::Wrap@2013.0523
TheSchwartz
TheSchwartz::Worker::SendEmail
URI::Fetch
Unicode::CheckUTF8
Unicode::MapUTF8
XML::Atom
XML::RSS
XML::Simple@2.12
XMLRPC::Lite
YAML

0 comments on commit 7ced15c

Please sign in to comment.