1 package App::EzPz::TestSetup;
4 use IPC::System::Simple qw(run);
9 our @EXPORT = qw(create_install create_list);
12 die "Usage: ezpz-create-test-ezmlm-install ezmlm-source.tgz build-dir install-dir"
15 my ($ezmlm_tarball_path, $build_dir_path, $install_to_path) = @ARGV;
17 my $ezmlm_tarball = io->file(io->file($ezmlm_tarball_path)->rel2abs);
19 my $orig_cwd = io->dir(cwd);
21 my $build_dir = io->dir($build_dir_path)->absolute;
22 my $install_to = io->dir($install_to_path)->absolute;
24 unless ($build_dir->exists) {
27 run 'tar', 'xzf', $ezmlm_tarball;
31 my ($src_dir) = ($build_dir->all_dirs)[0];
33 die "No source dir found in ${build_dir}" unless $src_dir;
35 foreach my $type (qw(bin etc lib man qmail)) {
36 $src_dir->catfile("conf-${type}")->print($install_to->catdir($type)."\n");
45 $install_to->catdir('bin')->mkpath;
46 run make => 'install';
50 die "Usage: ezpz-create-test-ezmlm-list ezmlm-bindir list-base-dir list-name"
53 my ($ezmlm_bin_path, $list_base_path, $list_name) = @_;
55 my $ezmlm_bin = io->dir($ezmlm_bin_path)->absolute;
57 my $list_base = io->dir($list_base_path)->absolute;
60 $ezmlm_bin->catfile('ezmlm-make'),
61 $list_base->catdir($list_name),
62 $list_base->catfile("dot-qmail-for-${list_name}"),