Re: [PATCH 1/1] scripts: sphinx-pre-install: add required ctex dependency

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Em Tue, 4 Jan 2022 19:26:10 +0900
Akira Yokosawa <akiyks@xxxxxxxxx> escreveu:

> On Tue, 4 Jan 2022 09:05:48 +0100, Mauro Carvalho Chehab wrote:
> > Em Tue, 4 Jan 2022 10:54:52 +0900
> > Akira Yokosawa <akiyks@xxxxxxxxx> escreveu:
> >   
> >> Hi Mauro, see inline comments below.
> >>
> >> On Tue, 4 Jan 2022 09:04:30 +0900, Akira Yokosawa wrote:  
> >>> Hi,
> >>>
> >>> On Mon, 03 Jan 2022 15:46:30 -0700, Jonathan Corbet <corbet@xxxxxxx> wrote:    
> >>>> Mauro Carvalho Chehab <mchehab@xxxxxxxxxx> writes:
> >>>>    
> >>>>> After a change meant to fix support for oriental characters
> >>>>> (Chinese, Japanese, Korean), ctex stylesheet is now a requirement
> >>>>> for PDF output.    
> >>>
> >>> FWIW, ctexhook.sty is a new requirement of xeCJK.sty v3.8.7 released
> >>> in June 2021.
> >>>
> >>>         Thanks, Akira
> >>>     
> >>>>>
> >>>>> Reported-by: Christoph Hellwig <hch@xxxxxx>
> >>>>> Signed-off-by: Mauro Carvalho Chehab <mchehab@xxxxxxxxxx>
> >>>>> ---
> >>>>>
> >>>>> See [PATCH 0/1] at: https://lore.kernel.org/all/cover.1641243581.git.mchehab@xxxxxxxxxx/
> >>>>>
> >>>>>  scripts/sphinx-pre-install | 1 +
> >>>>>  1 file changed, 1 insertion(+)
> >>>>>
> >>>>> diff --git a/scripts/sphinx-pre-install b/scripts/sphinx-pre-install
> >>>>> index 288e86a9d1e5..46aaab414098 100755
> >>>>> --- a/scripts/sphinx-pre-install
> >>>>> +++ b/scripts/sphinx-pre-install
> >>>>> @@ -78,6 +78,7 @@ my %texlive = (
> >>>>>  	'ucs.sty'            => 'texlive-ucs',
> >>>>>  	'upquote.sty'        => 'texlive-upquote',
> >>>>>  	'wrapfig.sty'        => 'texlive-wrapfig',
> >>>>> +	'ctexhook.sty'       => 'texlive-ctex',
> >>>>>  );    
> >>>>    
> >>
> >> I'm afraid this update of the list for Fedora/openSUSE won't help
> >> Debian Stable (bullseye) users.
> >>
> >> ctexhook.sty is in texlive-lang-chinese on Debian/Ubuntu.  
> > 
> > On such case, it is needed to map it for Debian/Ubuntu.
> > Could you please test the enclosed patch, applied on the top
> > of the previous one?  
> 
> Looks like we need an additional hunk.  See below.
> 
>         Thanks, Akira
> 
> > 
> > Thanks!
> > Mauro
> > 
> > -
> > 
> > [PATCH] scripts: sphinx-pre-install: Fix ctex support on Debian
> > 
> > The name of the package with ctexhook.sty is different on
> > Debian/Ubuntu.
> > 
> > Reported-by: Akira Yokosawa <akiyks@xxxxxxxxx>
> > Signed-off-by: Mauro Carvalho Chehab <mchehab@xxxxxxxxxx>
> > 
> > diff --git a/scripts/sphinx-pre-install b/scripts/sphinx-pre-install
> > index 46aaab414098..ea96d18ee946 100755
> > --- a/scripts/sphinx-pre-install
> > +++ b/scripts/sphinx-pre-install
> > @@ -367,6 +367,7 @@ sub give_debian_hints()
> >  		"Pod::Usage"		=> "perl-modules",
> >  		"xelatex"		=> "texlive-xetex",
> >  		"rsvg-convert"		=> "librsvg2-bin",
> > +		"texlive-ctex"		=> "texlive-lang-chinese",
> >  	);
> >  
> >  	if ($pdf) {
> >   
> @@ -380,6 +381,7 @@ sub give_debian_hints()
>         }
>  
>         check_program("dvipng", 2) if ($pdf);
> +       check_missing_tex(2) if ($pdf);
>         check_missing(\%map);
>  
>         return if (!$need && !$optional);
> 

This would be more complex than that, and per-distro tests are
required, in order to avoid the script to fail on other
distros.

Something like the following (possibly incomplete) patch.

Thanks,
Mauro

[PATCH RFC] scripts: sphinx-pre-install: better handle pdf dependencies

Not all distro hints check for missing LaTeX dependencies.
So add a call for it for check_missing_tex() to all distros.

While here, change the parameters to pass the map hash, as
distro-specific mapping could be needed.

Reported-by: Akira Yokosawa <akiyks@xxxxxxxxx>
Signed-off-by: Mauro Carvalho Chehab <mchehab@xxxxxxxxxx>

diff --git a/scripts/sphinx-pre-install b/scripts/sphinx-pre-install
index ea96d18ee946..03c252590e54 100755
--- a/scripts/sphinx-pre-install
+++ b/scripts/sphinx-pre-install
@@ -227,7 +227,8 @@ sub check_pacman_missing($$)
 
 sub check_missing_tex($)
 {
-	my $is_optional = shift;
+	my $map = %{$_[0]};
+	my $is_optional = 2;
 	my $kpsewhich = findprog("kpsewhich");
 
 	foreach my $prog(keys %texlive) {
@@ -381,6 +382,7 @@ sub give_debian_hints()
 	}
 
 	check_program("dvipng", 2) if ($pdf);
+	check_missing_tex(\%map) if ($pdf);
 	check_missing(\%map);
 
 	return if (!$need && !$optional);
@@ -449,7 +451,7 @@ sub give_redhat_hints()
 
 	check_rpm_missing(\@fedora26_opt_pkgs, 2) if ($pdf && !$old);
 	check_rpm_missing(\@fedora_tex_pkgs, 2) if ($pdf);
-	check_missing_tex(2) if ($pdf);
+	check_missing_tex(\%map) if ($pdf);
 	check_missing(\%map);
 
 	return if (!$need && !$optional);
@@ -503,7 +505,7 @@ sub give_opensuse_hints()
 	# "Noto Sans CJK SC" on openSUSE
 
 	check_rpm_missing(\@suse_tex_pkgs, 2) if ($pdf);
-	check_missing_tex(2) if ($pdf);
+	check_missing_tex(\%map) if ($pdf);
 	check_missing(\%map);
 
 	return if (!$need && !$optional);
@@ -548,6 +550,7 @@ sub give_mageia_hints()
 	}
 
 	check_rpm_missing(\@tex_pkgs, 2) if ($pdf);
+	# check_missing_tex(\%map) if ($pdf);
 	check_missing(\%map);
 
 	return if (!$need && !$optional);
@@ -578,6 +581,7 @@ sub give_arch_linux_hints()
 				   "noto-fonts-cjk", 2);
 	}
 
+	check_missing_tex(\%map) if ($pdf);
 	check_missing(\%map);
 
 	return if (!$need && !$optional);
@@ -604,6 +608,8 @@ sub give_gentoo_hints()
 				   "media-fonts/noto-cjk", 2);
 	}
 
+	# Gentoo doesn't need to map tex, as there's a single package,
+	# and extra fonts are mapped via check_missing_file()
 	check_missing(\%map);
 
 	return if (!$need && !$optional);
@@ -622,7 +628,7 @@ sub give_gentoo_hints()
 		printf("\tsudo su -c 'echo \"$cairo\" > $portage_cairo'\n");
 	}
 
-	printf("\tsudo emerge --ask $install\n");
+	printf("\tsudo USE="-cjk" emerge --ask $install\n");
 
 }
 
@@ -685,7 +691,7 @@ sub check_distros()
 	my %map = (
 		"sphinx-build" => "sphinx"
 	);
-	check_missing_tex(2) if ($pdf);
+	check_missing_tex(\%map) if ($pdf);
 	check_missing(\%map);
 	print "I don't know distro $system_release.\n";
 	print "So, I can't provide you a hint with the install procedure.\n";




[Index of Archives]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Linux FS]     [Yosemite Forum]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]     [Linux Resources]

  Powered by Linux