summaryrefslogtreecommitdiff
path: root/Porting/sync-with-cpan
diff options
context:
space:
mode:
authorMax Maischein <corion@corion.net>2013-10-05 19:59:11 +0200
committerMax Maischein <corion@corion.net>2013-10-06 19:48:08 +0200
commitcd9a17141adacfdd66e379334b50b7516d4f2cec (patch)
treee47ec405c8b4c59721499f00c3817dfa798bd4c7 /Porting/sync-with-cpan
parentfc134225747f7f6b1e38daa4f85f3c36c99755ee (diff)
downloadperl-cd9a17141adacfdd66e379334b50b7516d4f2cec.tar.gz
Elide use of `chmod`
We simplify life here and try to set Porting/Makefile.PL always to mode 755 (u=rwx , ao=rx) instead of being more precise.
Diffstat (limited to 'Porting/sync-with-cpan')
-rwxr-xr-xPorting/sync-with-cpan17
1 files changed, 14 insertions, 3 deletions
diff --git a/Porting/sync-with-cpan b/Porting/sync-with-cpan
index 0fe3733bcb..fc6515078e 100755
--- a/Porting/sync-with-cpan
+++ b/Porting/sync-with-cpan
@@ -114,7 +114,7 @@ Handle complicated C<FILES>
This is an initial version; no attempt has been made yet to make this
portable. It shells out instead of trying to find a Perl solution.
-In particular, it assumes git, chmod, perl, and make
+In particular, it assumes git, perl, and make
to be available.
=cut
@@ -173,6 +173,17 @@ sub find_type_f {
@res
};
+# Equivalent of `chmod a-x`
+sub de_exec {
+ for my $filename ( @_ ) {
+ my $mode= (stat $filename)[2] & 0777;
+ if( $mode & 0111 ) { # exec-bit set
+ chmod $mode & 0666, $filename;
+ };
+ }
+}
+
+sub make {
my ($module) = shift;
my $cpan_mod = @ARGV ? shift : $module;
@@ -394,7 +405,7 @@ print "Hit return to continue; ^C to abort "; <STDIN>;
unlink "$pkg_dir/$_" for @delete;
system git => 'add', "$pkg_dir/$_" for @commit;
system git => 'rm', '-f', "$pkg_dir/$_" for @gone;
-system chmod => 'a-x', "$pkg_dir/$_" for @de_exec;
+de_exec( "$pkg_dir/$_" ) for @de_exec;
#
# Restore anything that is customized.
@@ -495,7 +506,7 @@ while (<$Maintainers_pl>) {
if ($found) {
unlink 'Porting/Maintainers.pl';
rename 'Maintainers.pl' => 'Porting/Maintainers.pl';
- system chmod => 'a+x', 'Porting/Maintainers.pl';
+ chmod 0755 => 'Porting/Maintainers.pl';
}
else {
say "Could not update Porting/Maintainers.pl.";