| 1 | package LCFG::Build::VCS::None; # -*-perl-*- | ||||||||||
| 2 | 1 | ▶ | use strict; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 3 | 1 | ▶ | use warnings; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 4 | |||||||||||
| 5 | # $Id: None.pm.in 35424 2019-01-18 10:01:16Z squinney@INF.ED.AC.UK $ | ||||||||||
| 6 | # $Source: /var/cvs/dice/LCFG-Build-VCS/lib/LCFG/Build/VCS/None.pm.in,v $ | ||||||||||
| 7 | # $Revision: 35424 $ | ||||||||||
| 8 | # $HeadURL: https://svn.lcfg.org/svn/source/tags/LCFG-Build-VCS/LCFG_Build_VCS_0_3_9/lib/LCFG/Build/VCS/None.pm.in $ | ||||||||||
| 9 | # $Date: 2019-01-18 10:01:16 +0000 (Fri, 18 Jan 2019) $ | ||||||||||
| 10 | |||||||||||
| 11 | 1 | our $VERSION = '0.3.9'; | |||||||||
| 12 | |||||||||||
| 13 | 1 | ▶ | use v5.10; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 14 | |||||||||||
| 15 | 1 | ▶ | use File::Copy::Recursive v0.36 (); | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 16 | 1 | ▶ | use File::HomeDir v0.58 (); | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 17 | 1 | ▶ | use File::Path (); | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 18 | 1 | ▶ | use File::Spec (); | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 19 | 1 | ▶ | use IO::Dir (); | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 20 | |||||||||||
| 21 | 1 | ▶ | use Moose; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 22 | 1 | with 'LCFG::Build::VCS'; | |||||||||
| 23 | |||||||||||
| 24 | has 'tagdir' => ( | ||||||||||
| 25 | is => 'rw', | ||||||||||
| 26 | isa => 'Str', | ||||||||||
| 27 | lazy => 1, | ||||||||||
| 28 | 0 | ▶ | default => sub { File::Spec->catdir( File::HomeDir->my_home(), | ||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||
| 29 | 'lcfgbuild', 'tags' ) }, | ||||||||||
| 30 | 1 | ); | |||||||||
| 31 | |||||||||||
| 32 | 1 | has '+id' => ( default => 'None' ); | |||||||||
| 33 | |||||||||||
| 34 | # This should give a speed-up in loading | ||||||||||
| 35 | |||||||||||
| 36 | 1 | __PACKAGE__->meta->make_immutable; | |||||||||
| 37 | |||||||||||
| 38 | 0 | ▶ | sub checkcommitted { | ||||||||
|
Subroutine
checkcommitted: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||
| 39 | 0 | return 1; | |||||||||
| 40 | } | ||||||||||
| 41 | |||||||||||
| 42 | 0 | ▶ | sub genchangelog { | ||||||||
|
Subroutine
genchangelog: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||
| 43 | 0 | return; | |||||||||
| 44 | } | ||||||||||
| 45 | |||||||||||
| 46 | 0 | ▶ | sub run_cmd { | ||||||||
|
Subroutine
run_cmd: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||
| 47 | 0 | return; | |||||||||
| 48 | } | ||||||||||
| 49 | |||||||||||
| 50 | 0 | ▶ | sub tagversion { | ||||||||
|
Subroutine
tagversion: not called CC=4 SCAR=30.0
Pod
documented
| |||||||||||
| 51 | 0 | my ( $self, $version ) = @_; | |||||||||
| 52 | |||||||||||
| 53 | 0 | my $module = $self->module; | |||||||||
| 54 | |||||||||||
| 55 | 0 | $self->update_changelog($version); | |||||||||
| 56 | |||||||||||
| 57 | 0 | my $tag = $self->gen_tag($version); | |||||||||
| 58 | 0 | my $tagdir = File::Spec->catdir( $self->tagdir, $module, $tag ); | |||||||||
| 59 | |||||||||||
| 60 | 0 | ▶ | if ( !$self->dryrun ) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 61 | 0 | ▶ | if ( -d $tagdir ) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 62 | 0 | File::Path::rmtree($tagdir); | |||||||||
| 63 | } | ||||||||||
| 64 | 0 | ▶ | File::Copy::Recursive::dircopy( $self->workdir, $tagdir ) | ||||||||
|
Branch: 1 branch
| |||||||||||
| 65 | or die "Could not tag $module at $version\n"; | ||||||||||
| 66 | } | ||||||||||
| 67 | |||||||||||
| 68 | 0 | return; | |||||||||
| 69 | } | ||||||||||
| 70 | |||||||||||
| 71 | 0 | ▶ | sub export { | ||||||||
|
Subroutine
export: not called CC=5 SCAR=34.0
Pod
documented
| |||||||||||
| 72 | 0 | my ( $self, $version, $builddir ) = @_; | |||||||||
| 73 | |||||||||||
| 74 | 0 | my $module = $self->module; | |||||||||
| 75 | |||||||||||
| 76 | 0 | my $tag = $self->gen_tag($version); | |||||||||
| 77 | 0 | my $storedir = File::Spec->catdir( $self->tagdir, $module, $tag ); | |||||||||
| 78 | |||||||||||
| 79 | 0 | ▶ | if ( !-d $storedir ) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 80 | 0 | die "Could not find stored tag for $version of $module in $storedir\n"; | |||||||||
| 81 | } | ||||||||||
| 82 | |||||||||||
| 83 | 0 | my $target = join q{-}, $module, $version; | |||||||||
| 84 | 0 | my $exportdir = File::Spec->catdir( $builddir, $target ); | |||||||||
| 85 | |||||||||||
| 86 | 0 | ▶ | if ( !$self->dryrun ) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 87 | 0 | ▶ | if ( -d $exportdir ) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 88 | 0 | File::Path::rmtree($exportdir); | |||||||||
| 89 | } | ||||||||||
| 90 | 0 | ▶ | File::Copy::Recursive::dircopy( $storedir, $exportdir ) | ||||||||
|
Branch: 1 branch
| |||||||||||
| 91 | or die "Could not copy $storedir to $exportdir\n"; | ||||||||||
| 92 | } | ||||||||||
| 93 | |||||||||||
| 94 | 0 | return $exportdir; | |||||||||
| 95 | } | ||||||||||
| 96 | |||||||||||
| 97 | 0 | ▶ | sub export_devel { | ||||||||
|
Subroutine
export_devel: not called CC=4 SCAR=30.0
Pod
documented
| |||||||||||
| 98 | 0 | my ( $self, $version, $builddir ) = @_; | |||||||||
| 99 | |||||||||||
| 100 | 0 | my $module = $self->module; | |||||||||
| 101 | |||||||||||
| 102 | 0 | my $target = join q{-}, $module, $version; | |||||||||
| 103 | 0 | my $exportdir = File::Spec->catdir( $builddir, $target ); | |||||||||
| 104 | |||||||||||
| 105 | 0 | ▶ | if ( !$self->dryrun ) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 106 | 0 | ▶ | if ( -d $exportdir ) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 107 | 0 | File::Path::rmtree($exportdir); | |||||||||
| 108 | } | ||||||||||
| 109 | 0 | my $workdir = $self->workdir; | |||||||||
| 110 | 0 | ▶ | File::Copy::Recursive::dircopy( $workdir, $exportdir ) | ||||||||
|
Branch: 1 branch
| |||||||||||
| 111 | or die "Could not copy $workdir to $exportdir\n"; | ||||||||||
| 112 | } | ||||||||||
| 113 | |||||||||||
| 114 | 0 | return $exportdir; | |||||||||
| 115 | |||||||||||
| 116 | } | ||||||||||
| 117 | |||||||||||
| 118 | 0 | ▶ | sub checkout_project { | ||||||||
|
Subroutine
checkout_project: not called CC=7 SCAR=40.3
Pod
documented
| |||||||||||
| 119 | 0 | my ( $self, $version, $outdir ) = @_; | |||||||||
| 120 | |||||||||||
| 121 | 0 | my $module = $self->module; | |||||||||
| 122 | 0 | my $basedir = File::Spec->catdir( $self->tagdir, $module ); | |||||||||
| 123 | |||||||||||
| 124 | 0 | ▶ | if ( !-d $basedir ) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 125 | 0 | die "Could not find the tag directory for $module\n"; | |||||||||
| 126 | } | ||||||||||
| 127 | |||||||||||
| 128 | 0 | my $tag; | |||||||||
| 129 | 0 | ▶ | if ( defined $version ) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 130 | 0 | $tag = $self->gen_tag($version); | |||||||||
| 131 | } | ||||||||||
| 132 | else { | ||||||||||
| 133 | 0 | tie my %dir, 'IO::Dir', $basedir; | |||||||||
| 134 | 0 | $tag = (sort grep { !m/^\./} keys %dir)[-1]; | |||||||||
| 135 | } | ||||||||||
| 136 | |||||||||||
| 137 | 0 | my $tagdir = File::Spec->catdir( $basedir, $tag ); | |||||||||
| 138 | |||||||||||
| 139 | 0 | ▶ | if ( !-d $tagdir ) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 140 | 0 | die "Could not find the tag $tag for $module\n"; | |||||||||
| 141 | } | ||||||||||
| 142 | |||||||||||
| 143 | 0 | ▶ | if ( !defined $outdir ) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 144 | 0 | $outdir = $module; | |||||||||
| 145 | } | ||||||||||
| 146 | |||||||||||
| 147 | 0 | ▶ | if ( !$self->dryrun ) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 148 | 0 | ▶ | File::Copy::Recursive::dircopy( $tagdir, $outdir ) | ||||||||
|
Branch: 1 branch
| |||||||||||
| 149 | or die "Could not checkout $module tag $tag\n"; | ||||||||||
| 150 | } | ||||||||||
| 151 | |||||||||||
| 152 | 0 | return; | |||||||||
| 153 | } | ||||||||||
| 154 | |||||||||||
| 155 | 0 | ▶ | sub import_project { | ||||||||
|
Subroutine
import_project: not called CC=4 SCAR=30.0
Pod
documented
| |||||||||||
| 156 | 0 | my ( $self, $dir, $version, $message ) = @_; | |||||||||
| 157 | |||||||||||
| 158 | 0 | my $module = $self->module; | |||||||||
| 159 | |||||||||||
| 160 | 0 | my $tag = $self->gen_tag($version); | |||||||||
| 161 | |||||||||||
| 162 | 0 | my $tagdir = File::Spec->catdir( $self->tagdir, $module, $tag ); | |||||||||
| 163 | |||||||||||
| 164 | 0 | ▶ | if ( !$self->dryrun ) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 165 | 0 | ▶ | if ( -d $tagdir ) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 166 | 0 | File::Path::rmtree($tagdir); | |||||||||
| 167 | } | ||||||||||
| 168 | 0 | ▶ | File::Copy::Recursive::dircopy( $dir, $tagdir ) | ||||||||
|
Branch: 1 branch
| |||||||||||
| 169 | or die "Could not import $dir\n"; | ||||||||||
| 170 | } | ||||||||||
| 171 | |||||||||||
| 172 | 0 | return; | |||||||||
| 173 | } | ||||||||||
| 174 | |||||||||||
| 175 | 1 | ▶ | no Moose; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 176 | 1 | 1; | |||||||||
| 177 | __END__ | ||||||||||