Skip to content

Commit

Permalink
Item11172: Owner and group options not supported
Browse files Browse the repository at this point in the history
BSD and MacOS can't override the file ownership in the archive.

git-svn-id: http://svn.foswiki.org/trunk@12896 0b4bb1d4-4e5a-0410-9cc4-b2b747904278
  • Loading branch information
GeorgeClark authored and GeorgeClark committed Oct 27, 2011
1 parent 316a059 commit 002dadd
Showing 1 changed file with 24 additions and 2 deletions.
26 changes: 24 additions & 2 deletions BuildContrib/lib/Foswiki/Contrib/Build.pm
Expand Up @@ -897,6 +897,18 @@ sub prot {
}
}

=begin TML
---++++ _test_tar()
Determine if the tar command has --owner and --group options
=cut

sub _tarSupportsOwner {

return ( `tar --owner 2>&1` =~ m/unrecognized/ );

}

=begin TML
---++++ sys_action(@params)
Expand Down Expand Up @@ -1607,10 +1619,20 @@ sub target_archive {
. $target
. '.zip");' );

# BSD and MacOS don't support owner/group options.
if ( `tar --owner 2>&1` =~ m/unrecognized/ ) {

# SMELL: sys_action will auto quote any parameter containing a space. So the parameter
# and argument for group and user must be passed in as separate parameters.
$this->sys_action( 'tar', '--owner', '0', '--group', '0', '-czhpf',
$project . '.tgz', '*' );
print STDERR
"tar --owner / --group not supported. Recommend building as root\n";
$this->sys_action( 'tar', '-czhpf', $project . '.tgz', '*' );
}
else {
$this->sys_action( 'tar', '--owner', '0', '--group', '0', '-czhpf',
$project . '.tgz', '*' );
}

$this->perl_action( 'File::Copy::move("'
. $project
. '.tgz", "'
Expand Down

0 comments on commit 002dadd

Please sign in to comment.