All of lore.kernel.org
 help / color / mirror / Atom feed
From: Akira Yokosawa <akiyks@gmail.com>
To: Mauro Carvalho Chehab <mchehab@kernel.org>
Cc: hch@lst.de, linux-doc@vger.kernel.org,
	linux-kernel@vger.kernel.org, corbet@lwn.net
Subject: Re: [PATCH 1/1] scripts: sphinx-pre-install: add required ctex dependency
Date: Wed, 5 Jan 2022 21:09:59 +0900	[thread overview]
Message-ID: <241d31e4-5447-a075-69b6-11c14427582d@gmail.com> (raw)
In-Reply-To: <20220105084809.157e3f34@coco.lan>

On Wed, 5 Jan 2022 08:48:09 +0100, Mauro Carvalho Chehab wrote:
> Em Tue, 4 Jan 2022 19:26:10 +0900
> Akira Yokosawa <akiyks@gmail.com> 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@gmail.com> 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@lwn.net> wrote:    
>>>>>> Mauro Carvalho Chehab <mchehab@kernel.org> 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@lst.de>
>>>>>>> Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
>>>>>>> ---
>>>>>>>
>>>>>>> See [PATCH 0/1] at: https://lore.kernel.org/all/cover.1641243581.git.mchehab@kernel.org/
>>>>>>>
>>>>>>>  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@gmail.com>
>>> Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
>>>
>>> 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.

Thank you for looking into this!
I must admit I'm far from grasping how this perl script works...

> 
> Something like the following (possibly incomplete) patch.

I'll test it under various distros/setups.
It may take a while.

        Thanks, Akira

> 
> 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@gmail.com>
> Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
> 
> 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";
> 

  reply	other threads:[~2022-01-05 12:10 UTC|newest]

Thread overview: 37+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-01-03 16:30 make pdfdocs fails on Debian stable Christoph Hellwig
2022-01-03 16:58 ` Mauro Carvalho Chehab
2022-01-03 17:11   ` Christoph Hellwig
2022-01-03 20:58     ` Mauro Carvalho Chehab
2022-01-03 21:01       ` [PATCH 0/1] Detect the need of texlive-ctex Mauro Carvalho Chehab
2022-01-03 21:01         ` [PATCH 1/1] scripts: sphinx-pre-install: add required ctex dependency Mauro Carvalho Chehab
2022-01-03 22:46           ` Jonathan Corbet
2022-01-04  0:04             ` Akira Yokosawa
2022-01-04  1:54               ` Akira Yokosawa
2022-01-04  8:05                 ` Mauro Carvalho Chehab
2022-01-04 10:26                   ` Akira Yokosawa
2022-01-05  7:48                     ` Mauro Carvalho Chehab
2022-01-05 12:09                       ` Akira Yokosawa [this message]
2022-01-05 21:42                         ` Mauro Carvalho Chehab
2022-01-05 22:57                           ` Akira Yokosawa
2022-01-06  0:41                             ` [PATCH v2] scripts: sphinx-pre-install: Fix ctex support on Debian Mauro Carvalho Chehab
2022-01-06  2:00                               ` Akira Yokosawa
     [not found]                                 ` <20220106043707.0d40cd11@coco.lan>
2022-01-09  4:09                                   ` Akira Yokosawa
2022-01-09  6:28                                     ` Mauro Carvalho Chehab
2022-01-09  7:48                                       ` Akira Yokosawa
2022-01-06 22:35                               ` Jonathan Corbet
2022-01-06  0:42                             ` [PATCH 1/1] scripts: sphinx-pre-install: add required ctex dependency Mauro Carvalho Chehab
2022-01-04  2:00               ` Akira Yokosawa
2022-01-04  6:47       ` make pdfdocs fails on Debian stable Christoph Hellwig
2022-01-04  7:32         ` Akira Yokosawa
2022-01-04  7:36           ` Christoph Hellwig
2022-01-04  7:53             ` Akira Yokosawa
2022-01-04  7:56               ` Christoph Hellwig
2022-01-04  8:07                 ` Akira Yokosawa
2022-01-04  8:16                   ` Christoph Hellwig
2022-01-04  8:44                     ` Akira Yokosawa
2022-01-04  9:31             ` Akira Yokosawa
2022-01-04 13:19               ` Christoph Hellwig
2022-01-04 13:46                 ` Akira Yokosawa
2022-01-05  1:47                   ` Akira Yokosawa
2022-01-05  7:35                     ` Christoph Hellwig
2022-01-05 12:03                       ` Akira Yokosawa

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=241d31e4-5447-a075-69b6-11c14427582d@gmail.com \
    --to=akiyks@gmail.com \
    --cc=corbet@lwn.net \
    --cc=hch@lst.de \
    --cc=linux-doc@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mchehab@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.