[debhelper-devel] [debhelper] 02/02: dh_fixperms: Reset perms of some images, css and js files

Niels Thykier nthykier at moszumanska.debian.org
Mon Aug 31 19:06:51 UTC 2015


This is an automated email from the git hooks/post-receive script.

nthykier pushed a commit to branch master
in repository debhelper.

commit 2c3ac22e826079f28d5676c3d86a8b8e9a4ec6e7
Author: Niels Thykier <niels at thykier.net>
Date:   Mon Aug 31 21:06:40 2015 +0200

    dh_fixperms: Reset perms of some images, css and js files
    
    Signed-off-by: Niels Thykier <niels at thykier.net>
---
 debian/changelog |  3 +++
 dh_fixperms      | 30 +++++++++++++++++++-----------
 2 files changed, 22 insertions(+), 11 deletions(-)

diff --git a/debian/changelog b/debian/changelog
index 37a9432..e78e3be 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -36,6 +36,9 @@ debhelper (9.20150811+unreleased) UNRELEASED; urgency=medium
     reflect the current implementation (rather than the
     desired "state").  Thanks to Jakub Wilk for the report.
     (Closes: #797002)
+  * dh_fixperms: Reset permissions to 0644 for .js, .css,
+    .jpeg, .jpg, .png, and .gif files.  Thanks to Ernesto
+    Hernández-Novich for the suggestion.  (Closes: #595097)
 
   [ Paul Tagliamonte ]
   * dh_gencontrol: Put debug debs back in the "debug" section.
diff --git a/dh_fixperms b/dh_fixperms
index 90fbe3a..40dac8b 100755
--- a/dh_fixperms
+++ b/dh_fixperms
@@ -48,6 +48,21 @@ init();
 
 my $vendorlib = substr $Config{vendorlib}, 1;
 my $vendorarch = substr $Config{vendorarch}, 1;
+my @mode_0644_patterns = (
+	# Libraries and related files
+	'*.so.*', '*.so', '*.la', '*.a',
+	# Web application related files
+	'*.js', '*.css',
+	# Images
+	'*.jpeg', '*.jpg', '*.png', '*.gif',
+	# OCaml native-code shared objects
+	'*.cmxs',
+);
+# Turn the patterns in to a find pattern
+my $mode_0644_find_pattern = sprintf('\\( -name %s \\)',
+									 join(' -o -name ',
+										  map { "'$_'" } @mode_0644_patterns));
+
 
 foreach my $package (@{$dh{DOPACKAGES}}) {
 	my $tmp=tmpdir($package);
@@ -74,12 +89,6 @@ foreach my $package (@{$dh{DOPACKAGES}}) {
 	complex_doit("find $tmp/usr/share/man $tmp/usr/man/ $tmp/usr/X11*/man/ -type f",
 		"$find_options -print0 2>/dev/null | xargs -0r chmod 0644");
 
-	# ..and so are executable shared and static libraries 
-	# (and .la files from libtool) ..
-	complex_doit("find $tmp -perm -5 -type f",
-		"\\( -name '*.so.*' -or -name '*.so' -or -name '*.la' -or -name '*.a' \\) $find_options -print0",
-		"2>/dev/null | xargs -0r chmod 0644");
-	
 	# ..and header files ..
 	complex_doit("find $tmp/usr/include -type f $find_options -print0",
 		"2>/dev/null | xargs -0r chmod 0644");
@@ -87,16 +96,15 @@ foreach my $package (@{$dh{DOPACKAGES}}) {
 	# ..and desktop files ..
 	complex_doit("find $tmp/usr/share/applications -type f $find_options -print0",
 		"2>/dev/null | xargs -0r chmod 0644");
-
-	# ..and OCaml native-code shared objects ..
-	complex_doit("find $tmp -perm -5 -type f",
-		"\\( -name '*.cmxs' \\) $find_options -print0",
-		"2>/dev/null | xargs -0r chmod 0644");
 	
 	# .. and perl modules.
 	complex_doit("find $tmp/$vendorarch $tmp/$vendorlib -type f",
 		"-perm -5 -name '*.pm' $find_options -print0",
 		"2>/dev/null | xargs -0r chmod a-X");
+
+	complex_doit("find $tmp -perm 5 -type f ${mode_0644_find_pattern}",
+				 "${find_options} -print0 2>/dev/null",
+				 "| xargs -0r chmod 0644");
 	
 	# v4 and up
 	if (! compat(3)) {

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debhelper/debhelper.git




More information about the debhelper-devel mailing list