linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/2] scripts/sphinx-pre-install: Change the function 'check_missing_file'
@ 2019-10-02  9:53 Jeremy MAURO
  2019-10-02 10:35 ` Mauro Carvalho Chehab
  0 siblings, 1 reply; 4+ messages in thread
From: Jeremy MAURO @ 2019-10-02  9:53 UTC (permalink / raw)
  To: j.mauro
  Cc: Mauro Carvalho Chehab, Jonathan Corbet,
	open list:DOCUMENTATION SCRIPTS, open list

The current implementation take a simple file as first argument, this
change allows to take a list as a first argument.

Some file could have a different path according distribution version

Signed-off-by: Jeremy MAURO <j.mauro@criteo.com>
---
 scripts/sphinx-pre-install | 20 +++++++++++---------
 1 file changed, 11 insertions(+), 9 deletions(-)

diff --git a/scripts/sphinx-pre-install b/scripts/sphinx-pre-install
index 3b638c0e1a4f..b5077ae63a4b 100755
--- a/scripts/sphinx-pre-install
+++ b/scripts/sphinx-pre-install
@@ -124,11 +124,13 @@ sub add_package($$)
 
 sub check_missing_file($$$)
 {
-	my $file = shift;
+	my $files = shift;
 	my $package = shift;
 	my $is_optional = shift;
 
-	return if(-e $file);
+	for (@$files) {
+		return if(-e $_);
+	}
 
 	add_package($package, $is_optional);
 }
@@ -343,10 +345,10 @@ sub give_debian_hints()
 	);
 
 	if ($pdf) {
-		check_missing_file("/usr/share/fonts/truetype/dejavu/DejaVuSans.ttf",
+		check_missing_file(["/usr/share/fonts/truetype/dejavu/DejaVuSans.ttf"],
 				   "fonts-dejavu", 2);
 
-		check_missing_file("/usr/share/fonts/noto-cjk/NotoSansCJK-Regular.ttc",
+		check_missing_file(["/usr/share/fonts/noto-cjk/NotoSansCJK-Regular.ttc"],
 				   "fonts-noto-cjk", 2);
 	}
 
@@ -413,7 +415,7 @@ sub give_redhat_hints()
 	}
 
 	if ($pdf) {
-		check_missing_file("/usr/share/fonts/google-noto-cjk/NotoSansCJK-Regular.ttc",
+		check_missing_file(["/usr/share/fonts/google-noto-cjk/NotoSansCJK-Regular.ttc"],
 				   "google-noto-sans-cjk-ttc-fonts", 2);
 	}
 
@@ -498,7 +500,7 @@ sub give_mageia_hints()
 	$map{"latexmk"} = "texlive-collection-basic";
 
 	if ($pdf) {
-		check_missing_file("/usr/share/fonts/google-noto-cjk/NotoSansCJK-Regular.ttc",
+		check_missing_file(["/usr/share/fonts/google-noto-cjk/NotoSansCJK-Regular.ttc"],
 				   "google-noto-sans-cjk-ttc-fonts", 2);
 	}
 
@@ -528,7 +530,7 @@ sub give_arch_linux_hints()
 	check_pacman_missing(\@archlinux_tex_pkgs, 2) if ($pdf);
 
 	if ($pdf) {
-		check_missing_file("/usr/share/fonts/noto-cjk/NotoSansCJK-Regular.ttc",
+		check_missing_file(["/usr/share/fonts/noto-cjk/NotoSansCJK-Regular.ttc"],
 				   "noto-fonts-cjk", 2);
 	}
 
@@ -549,11 +551,11 @@ sub give_gentoo_hints()
 		"rsvg-convert"		=> "gnome-base/librsvg",
 	);
 
-	check_missing_file("/usr/share/fonts/dejavu/DejaVuSans.ttf",
+	check_missing_file(["/usr/share/fonts/dejavu/DejaVuSans.ttf"],
 			   "media-fonts/dejavu", 2) if ($pdf);
 
 	if ($pdf) {
-		check_missing_file("/usr/share/fonts/noto-cjk/NotoSansCJKsc-Regular.otf",
+		check_missing_file(["/usr/share/fonts/noto-cjk/NotoSansCJKsc-Regular.otf"],
 				   "media-fonts/noto-cjk", 2);
 	}
 
-- 
2.23.0


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH 1/2] scripts/sphinx-pre-install: Change the function 'check_missing_file'
  2019-10-02  9:53 [PATCH 1/2] scripts/sphinx-pre-install: Change the function 'check_missing_file' Jeremy MAURO
@ 2019-10-02 10:35 ` Mauro Carvalho Chehab
  2019-10-02 13:33   ` [PATCH v2 1/2] scripts/sphinx-pre-install: allow checking for multiple missing files Jeremy MAURO
  0 siblings, 1 reply; 4+ messages in thread
From: Mauro Carvalho Chehab @ 2019-10-02 10:35 UTC (permalink / raw)
  To: Jeremy MAURO
  Cc: j.mauro, Jonathan Corbet, open list:DOCUMENTATION SCRIPTS, open list

Em Wed,  2 Oct 2019 11:53:30 +0200
Jeremy MAURO <jeremy.mauro@gmail.com> escreveu:

> The current implementation take a simple file as first argument, this
> change allows to take a list as a first argument.

Please change the title of this patch in a way that it will describe
what it will do, and not what function was changed.

Something like:

	scripts/sphinx-pre-install: allow checking for multiple missing files

> 
> Some file could have a different path according distribution version
> 
> Signed-off-by: Jeremy MAURO <j.mauro@criteo.com>
> ---
>  scripts/sphinx-pre-install | 20 +++++++++++---------
>  1 file changed, 11 insertions(+), 9 deletions(-)
> 
> diff --git a/scripts/sphinx-pre-install b/scripts/sphinx-pre-install
> index 3b638c0e1a4f..b5077ae63a4b 100755
> --- a/scripts/sphinx-pre-install
> +++ b/scripts/sphinx-pre-install
> @@ -124,11 +124,13 @@ sub add_package($$)
>  
>  sub check_missing_file($$$)

As it is now expecting a list, I would change this function name as
well to:
	check_missing_files


With those changes, feel free to add:

Reviewed-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>


>  {
> -	my $file = shift;
> +	my $files = shift;
>  	my $package = shift;
>  	my $is_optional = shift;
>  
> -	return if(-e $file);
> +	for (@$files) {
> +		return if(-e $_);
> +	}
>  
>  	add_package($package, $is_optional);
>  }
> @@ -343,10 +345,10 @@ sub give_debian_hints()
>  	);
>  
>  	if ($pdf) {
> -		check_missing_file("/usr/share/fonts/truetype/dejavu/DejaVuSans.ttf",
> +		check_missing_file(["/usr/share/fonts/truetype/dejavu/DejaVuSans.ttf"],
>  				   "fonts-dejavu", 2);
>  
> -		check_missing_file("/usr/share/fonts/noto-cjk/NotoSansCJK-Regular.ttc",
> +		check_missing_file(["/usr/share/fonts/noto-cjk/NotoSansCJK-Regular.ttc"],
>  				   "fonts-noto-cjk", 2);
>  	}
>  
> @@ -413,7 +415,7 @@ sub give_redhat_hints()
>  	}
>  
>  	if ($pdf) {
> -		check_missing_file("/usr/share/fonts/google-noto-cjk/NotoSansCJK-Regular.ttc",
> +		check_missing_file(["/usr/share/fonts/google-noto-cjk/NotoSansCJK-Regular.ttc"],
>  				   "google-noto-sans-cjk-ttc-fonts", 2);
>  	}
>  
> @@ -498,7 +500,7 @@ sub give_mageia_hints()
>  	$map{"latexmk"} = "texlive-collection-basic";
>  
>  	if ($pdf) {
> -		check_missing_file("/usr/share/fonts/google-noto-cjk/NotoSansCJK-Regular.ttc",
> +		check_missing_file(["/usr/share/fonts/google-noto-cjk/NotoSansCJK-Regular.ttc"],
>  				   "google-noto-sans-cjk-ttc-fonts", 2);
>  	}
>  
> @@ -528,7 +530,7 @@ sub give_arch_linux_hints()
>  	check_pacman_missing(\@archlinux_tex_pkgs, 2) if ($pdf);
>  
>  	if ($pdf) {
> -		check_missing_file("/usr/share/fonts/noto-cjk/NotoSansCJK-Regular.ttc",
> +		check_missing_file(["/usr/share/fonts/noto-cjk/NotoSansCJK-Regular.ttc"],
>  				   "noto-fonts-cjk", 2);
>  	}
>  
> @@ -549,11 +551,11 @@ sub give_gentoo_hints()
>  		"rsvg-convert"		=> "gnome-base/librsvg",
>  	);
>  
> -	check_missing_file("/usr/share/fonts/dejavu/DejaVuSans.ttf",
> +	check_missing_file(["/usr/share/fonts/dejavu/DejaVuSans.ttf"],
>  			   "media-fonts/dejavu", 2) if ($pdf);
>  
>  	if ($pdf) {
> -		check_missing_file("/usr/share/fonts/noto-cjk/NotoSansCJKsc-Regular.otf",
> +		check_missing_file(["/usr/share/fonts/noto-cjk/NotoSansCJKsc-Regular.otf"],
>  				   "media-fonts/noto-cjk", 2);
>  	}
>  



Thanks,
Mauro

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH v2 1/2] scripts/sphinx-pre-install: allow checking for multiple missing files
  2019-10-02 10:35 ` Mauro Carvalho Chehab
@ 2019-10-02 13:33   ` Jeremy MAURO
  2019-10-02 13:44     ` Mauro Carvalho Chehab
  0 siblings, 1 reply; 4+ messages in thread
From: Jeremy MAURO @ 2019-10-02 13:33 UTC (permalink / raw)
  Cc: j.mauro, Mauro Carvalho Chehab, Jonathan Corbet,
	open list:DOCUMENTATION SCRIPTS, open list

The current implementation take a simple file as first argument, this
change allows to take a list as a first argument.

Some file could have a different path according distribution version

Signed-off-by: Jeremy MAURO <j.mauro@criteo.com>
---
Changes in v2:
- Change the commit message

 scripts/sphinx-pre-install | 20 +++++++++++---------
 1 file changed, 11 insertions(+), 9 deletions(-)

diff --git a/scripts/sphinx-pre-install b/scripts/sphinx-pre-install
index 3b638c0e1a4f..b5077ae63a4b 100755
--- a/scripts/sphinx-pre-install
+++ b/scripts/sphinx-pre-install
@@ -124,11 +124,13 @@ sub add_package($$)
 
 sub check_missing_file($$$)
 {
-	my $file = shift;
+	my $files = shift;
 	my $package = shift;
 	my $is_optional = shift;
 
-	return if(-e $file);
+	for (@$files) {
+		return if(-e $_);
+	}
 
 	add_package($package, $is_optional);
 }
@@ -343,10 +345,10 @@ sub give_debian_hints()
 	);
 
 	if ($pdf) {
-		check_missing_file("/usr/share/fonts/truetype/dejavu/DejaVuSans.ttf",
+		check_missing_file(["/usr/share/fonts/truetype/dejavu/DejaVuSans.ttf"],
 				   "fonts-dejavu", 2);
 
-		check_missing_file("/usr/share/fonts/noto-cjk/NotoSansCJK-Regular.ttc",
+		check_missing_file(["/usr/share/fonts/noto-cjk/NotoSansCJK-Regular.ttc"],
 				   "fonts-noto-cjk", 2);
 	}
 
@@ -413,7 +415,7 @@ sub give_redhat_hints()
 	}
 
 	if ($pdf) {
-		check_missing_file("/usr/share/fonts/google-noto-cjk/NotoSansCJK-Regular.ttc",
+		check_missing_file(["/usr/share/fonts/google-noto-cjk/NotoSansCJK-Regular.ttc"],
 				   "google-noto-sans-cjk-ttc-fonts", 2);
 	}
 
@@ -498,7 +500,7 @@ sub give_mageia_hints()
 	$map{"latexmk"} = "texlive-collection-basic";
 
 	if ($pdf) {
-		check_missing_file("/usr/share/fonts/google-noto-cjk/NotoSansCJK-Regular.ttc",
+		check_missing_file(["/usr/share/fonts/google-noto-cjk/NotoSansCJK-Regular.ttc"],
 				   "google-noto-sans-cjk-ttc-fonts", 2);
 	}
 
@@ -528,7 +530,7 @@ sub give_arch_linux_hints()
 	check_pacman_missing(\@archlinux_tex_pkgs, 2) if ($pdf);
 
 	if ($pdf) {
-		check_missing_file("/usr/share/fonts/noto-cjk/NotoSansCJK-Regular.ttc",
+		check_missing_file(["/usr/share/fonts/noto-cjk/NotoSansCJK-Regular.ttc"],
 				   "noto-fonts-cjk", 2);
 	}
 
@@ -549,11 +551,11 @@ sub give_gentoo_hints()
 		"rsvg-convert"		=> "gnome-base/librsvg",
 	);
 
-	check_missing_file("/usr/share/fonts/dejavu/DejaVuSans.ttf",
+	check_missing_file(["/usr/share/fonts/dejavu/DejaVuSans.ttf"],
 			   "media-fonts/dejavu", 2) if ($pdf);
 
 	if ($pdf) {
-		check_missing_file("/usr/share/fonts/noto-cjk/NotoSansCJKsc-Regular.otf",
+		check_missing_file(["/usr/share/fonts/noto-cjk/NotoSansCJKsc-Regular.otf"],
 				   "media-fonts/noto-cjk", 2);
 	}
 
-- 
2.23.0


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH v2 1/2] scripts/sphinx-pre-install: allow checking for multiple missing files
  2019-10-02 13:33   ` [PATCH v2 1/2] scripts/sphinx-pre-install: allow checking for multiple missing files Jeremy MAURO
@ 2019-10-02 13:44     ` Mauro Carvalho Chehab
  0 siblings, 0 replies; 4+ messages in thread
From: Mauro Carvalho Chehab @ 2019-10-02 13:44 UTC (permalink / raw)
  To: Jeremy MAURO
  Cc: j.mauro, Jonathan Corbet, open list:DOCUMENTATION SCRIPTS, open list

Em Wed,  2 Oct 2019 15:33:39 +0200
Jeremy MAURO <jeremy.mauro@gmail.com> escreveu:

> The current implementation take a simple file as first argument, this
> change allows to take a list as a first argument.
> 
> Some file could have a different path according distribution version
> 
> Signed-off-by: Jeremy MAURO <j.mauro@criteo.com>

Reviewed-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>

> ---
> Changes in v2:
> - Change the commit message
> 
>  scripts/sphinx-pre-install | 20 +++++++++++---------
>  1 file changed, 11 insertions(+), 9 deletions(-)
> 
> diff --git a/scripts/sphinx-pre-install b/scripts/sphinx-pre-install
> index 3b638c0e1a4f..b5077ae63a4b 100755
> --- a/scripts/sphinx-pre-install
> +++ b/scripts/sphinx-pre-install
> @@ -124,11 +124,13 @@ sub add_package($$)
>  
>  sub check_missing_file($$$)
>  {
> -	my $file = shift;
> +	my $files = shift;
>  	my $package = shift;
>  	my $is_optional = shift;
>  
> -	return if(-e $file);
> +	for (@$files) {
> +		return if(-e $_);
> +	}
>  
>  	add_package($package, $is_optional);
>  }
> @@ -343,10 +345,10 @@ sub give_debian_hints()
>  	);
>  
>  	if ($pdf) {
> -		check_missing_file("/usr/share/fonts/truetype/dejavu/DejaVuSans.ttf",
> +		check_missing_file(["/usr/share/fonts/truetype/dejavu/DejaVuSans.ttf"],
>  				   "fonts-dejavu", 2);
>  
> -		check_missing_file("/usr/share/fonts/noto-cjk/NotoSansCJK-Regular.ttc",
> +		check_missing_file(["/usr/share/fonts/noto-cjk/NotoSansCJK-Regular.ttc"],
>  				   "fonts-noto-cjk", 2);
>  	}
>  
> @@ -413,7 +415,7 @@ sub give_redhat_hints()
>  	}
>  
>  	if ($pdf) {
> -		check_missing_file("/usr/share/fonts/google-noto-cjk/NotoSansCJK-Regular.ttc",
> +		check_missing_file(["/usr/share/fonts/google-noto-cjk/NotoSansCJK-Regular.ttc"],
>  				   "google-noto-sans-cjk-ttc-fonts", 2);
>  	}
>  
> @@ -498,7 +500,7 @@ sub give_mageia_hints()
>  	$map{"latexmk"} = "texlive-collection-basic";
>  
>  	if ($pdf) {
> -		check_missing_file("/usr/share/fonts/google-noto-cjk/NotoSansCJK-Regular.ttc",
> +		check_missing_file(["/usr/share/fonts/google-noto-cjk/NotoSansCJK-Regular.ttc"],
>  				   "google-noto-sans-cjk-ttc-fonts", 2);
>  	}
>  
> @@ -528,7 +530,7 @@ sub give_arch_linux_hints()
>  	check_pacman_missing(\@archlinux_tex_pkgs, 2) if ($pdf);
>  
>  	if ($pdf) {
> -		check_missing_file("/usr/share/fonts/noto-cjk/NotoSansCJK-Regular.ttc",
> +		check_missing_file(["/usr/share/fonts/noto-cjk/NotoSansCJK-Regular.ttc"],
>  				   "noto-fonts-cjk", 2);
>  	}
>  
> @@ -549,11 +551,11 @@ sub give_gentoo_hints()
>  		"rsvg-convert"		=> "gnome-base/librsvg",
>  	);
>  
> -	check_missing_file("/usr/share/fonts/dejavu/DejaVuSans.ttf",
> +	check_missing_file(["/usr/share/fonts/dejavu/DejaVuSans.ttf"],
>  			   "media-fonts/dejavu", 2) if ($pdf);
>  
>  	if ($pdf) {
> -		check_missing_file("/usr/share/fonts/noto-cjk/NotoSansCJKsc-Regular.otf",
> +		check_missing_file(["/usr/share/fonts/noto-cjk/NotoSansCJKsc-Regular.otf"],
>  				   "media-fonts/noto-cjk", 2);
>  	}
>  



Thanks,
Mauro

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2019-10-02 13:44 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-10-02  9:53 [PATCH 1/2] scripts/sphinx-pre-install: Change the function 'check_missing_file' Jeremy MAURO
2019-10-02 10:35 ` Mauro Carvalho Chehab
2019-10-02 13:33   ` [PATCH v2 1/2] scripts/sphinx-pre-install: allow checking for multiple missing files Jeremy MAURO
2019-10-02 13:44     ` Mauro Carvalho Chehab

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).