summaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
authorMauro Carvalho Chehab <mchehab@s-opensource.com>2017-07-24 08:09:24 -0400
committerJonathan Corbet <corbet@lwn.net>2017-08-07 16:26:41 -0400
commit9b756a9d07fd34be189ccc3d3fc6dfc686e532fb (patch)
tree4f08f1a02675c6bf54002ec9cbc9b7aabc2114b4 /scripts
parent3d91a353674c9cb38431d631598c9ed15d22fbc8 (diff)
scripts/sphinx-pre-install: add minimum support for RHEL
RHEL 7.x and clone distros are shipped with Sphinx 1.1.x, with is incompatible with Kernel ReST markups. So, on those systems, the only alternative is to install it via a Python virtual environment. While seeking for "pip" on CentOS 7.3, I noticed that it is not really needed, as python-virtualenv has its version packaged there already. So, remove this from the list of requirements for all distributions. With regards to PDF, we need at least texlive-tabulary extension, but that is not shipped there (at least on CentOS). So, disable PDF packages as a whole. Please notice, however, that texlive + amsmath is needed for ReST to properly handle ReST ".. math::" tags. Yet, Sphinx fall back to display the LaTeX math expressions as-is, if such extension is not available. So, let's just disable all texlive packages as a whole. Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com> Signed-off-by: Jonathan Corbet <corbet@lwn.net>
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/sphinx-pre-install54
1 files changed, 42 insertions, 12 deletions
diff --git a/scripts/sphinx-pre-install b/scripts/sphinx-pre-install
index 5d2799dcfceb..677756ae34c9 100755
--- a/scripts/sphinx-pre-install
+++ b/scripts/sphinx-pre-install
@@ -216,7 +216,6 @@ sub check_sphinx()
216 $prog = findprog("virtualenv-3.5") if (!$prog); 216 $prog = findprog("virtualenv-3.5") if (!$prog);
217 217
218 check_program("virtualenv", 0) if (!$prog); 218 check_program("virtualenv", 0) if (!$prog);
219 check_program("pip", 0) if (!findprog("pip3"));
220 $need_sphinx = 1; 219 $need_sphinx = 1;
221 } else { 220 } else {
222 add_package("python-sphinx", 0); 221 add_package("python-sphinx", 0);
@@ -256,7 +255,6 @@ sub give_debian_hints()
256 "python-sphinx" => "python3-sphinx", 255 "python-sphinx" => "python3-sphinx",
257 "sphinx_rtd_theme" => "python3-sphinx-rtd-theme", 256 "sphinx_rtd_theme" => "python3-sphinx-rtd-theme",
258 "virtualenv" => "virtualenv", 257 "virtualenv" => "virtualenv",
259 "pip" => "python3-pip",
260 "dot" => "graphviz", 258 "dot" => "graphviz",
261 "convert" => "imagemagick", 259 "convert" => "imagemagick",
262 "Pod::Usage" => "perl-modules", 260 "Pod::Usage" => "perl-modules",
@@ -282,7 +280,6 @@ sub give_redhat_hints()
282 "python-sphinx" => "python3-sphinx", 280 "python-sphinx" => "python3-sphinx",
283 "sphinx_rtd_theme" => "python3-sphinx_rtd_theme", 281 "sphinx_rtd_theme" => "python3-sphinx_rtd_theme",
284 "virtualenv" => "python3-virtualenv", 282 "virtualenv" => "python3-virtualenv",
285 "pip" => "python3-pip",
286 "dot" => "graphviz", 283 "dot" => "graphviz",
287 "convert" => "ImageMagick", 284 "convert" => "ImageMagick",
288 "Pod::Usage" => "perl-Pod-Usage", 285 "Pod::Usage" => "perl-Pod-Usage",
@@ -302,6 +299,13 @@ sub give_redhat_hints()
302 "dejavu-sans-mono-fonts", 299 "dejavu-sans-mono-fonts",
303 ); 300 );
304 301
302 #
303 # Checks valid for RHEL/CentOS version 7.x.
304 #
305 if (! $system_release =~ /Fedora/) {
306 $map{"virtualenv"} = "python-virtualenv";
307 }
308
305 my $release; 309 my $release;
306 310
307 $release = $1 if ($system_release =~ /Fedora\s+release\s+(\d+)/); 311 $release = $1 if ($system_release =~ /Fedora\s+release\s+(\d+)/);
@@ -312,7 +316,14 @@ sub give_redhat_hints()
312 check_missing(\%map); 316 check_missing(\%map);
313 317
314 return if (!$need && !$optional); 318 return if (!$need && !$optional);
315 printf("You should run:\n\n\tsudo dnf install -y $install\n"); 319
320 if ($release >= 18) {
321 # dnf, for Fedora 18+
322 printf("You should run:\n\n\tsudo dnf install -y $install\n");
323 } else {
324 # yum, for RHEL (and clones) or Fedora version < 18
325 printf("You should run:\n\n\tsudo yum install -y $install\n");
326 }
316} 327}
317 328
318sub give_opensuse_hints() 329sub give_opensuse_hints()
@@ -321,7 +332,6 @@ sub give_opensuse_hints()
321 "python-sphinx" => "python3-sphinx", 332 "python-sphinx" => "python3-sphinx",
322 "sphinx_rtd_theme" => "python3-sphinx_rtd_theme", 333 "sphinx_rtd_theme" => "python3-sphinx_rtd_theme",
323 "virtualenv" => "python3-virtualenv", 334 "virtualenv" => "python3-virtualenv",
324 "pip" => "python3-pip",
325 "dot" => "graphviz", 335 "dot" => "graphviz",
326 "convert" => "ImageMagick", 336 "convert" => "ImageMagick",
327 "Pod::Usage" => "perl-Pod-Usage", 337 "Pod::Usage" => "perl-Pod-Usage",
@@ -360,7 +370,6 @@ sub give_mageia_hints()
360 "python-sphinx" => "python3-sphinx", 370 "python-sphinx" => "python3-sphinx",
361 "sphinx_rtd_theme" => "python3-sphinx_rtd_theme", 371 "sphinx_rtd_theme" => "python3-sphinx_rtd_theme",
362 "virtualenv" => "python3-virtualenv", 372 "virtualenv" => "python3-virtualenv",
363 "pip" => "python3-pip",
364 "dot" => "graphviz", 373 "dot" => "graphviz",
365 "convert" => "ImageMagick", 374 "convert" => "ImageMagick",
366 "Pod::Usage" => "perl-Pod-Usage", 375 "Pod::Usage" => "perl-Pod-Usage",
@@ -372,8 +381,6 @@ sub give_mageia_hints()
372 "texlive-fontsextra", 381 "texlive-fontsextra",
373 ); 382 );
374 383
375 my $release;
376
377 check_rpm_missing(\@tex_pkgs, 1) if ($pdf); 384 check_rpm_missing(\@tex_pkgs, 1) if ($pdf);
378 check_missing(\%map); 385 check_missing(\%map);
379 386
@@ -386,7 +393,6 @@ sub give_arch_linux_hints()
386 my %map = ( 393 my %map = (
387 "sphinx_rtd_theme" => "python-sphinx_rtd_theme", 394 "sphinx_rtd_theme" => "python-sphinx_rtd_theme",
388 "virtualenv" => "python-virtualenv", 395 "virtualenv" => "python-virtualenv",
389 "pip" => "python-pip",
390 "dot" => "graphviz", 396 "dot" => "graphviz",
391 "convert" => "imagemagick", 397 "convert" => "imagemagick",
392 "xelatex" => "texlive-bin", 398 "xelatex" => "texlive-bin",
@@ -410,7 +416,6 @@ sub give_gentoo_hints()
410 my %map = ( 416 my %map = (
411 "sphinx_rtd_theme" => "dev-python/sphinx_rtd_theme", 417 "sphinx_rtd_theme" => "dev-python/sphinx_rtd_theme",
412 "virtualenv" => "dev-python/virtualenv", 418 "virtualenv" => "dev-python/virtualenv",
413 "pip" => "dev-python/pip",
414 "dot" => "media-gfx/graphviz", 419 "dot" => "media-gfx/graphviz",
415 "convert" => "media-gfx/imagemagick", 420 "convert" => "media-gfx/imagemagick",
416 "xelatex" => "dev-texlive/texlive-xetex media-fonts/dejavu", 421 "xelatex" => "dev-texlive/texlive-xetex media-fonts/dejavu",
@@ -438,6 +443,18 @@ sub check_distros()
438 give_redhat_hints; 443 give_redhat_hints;
439 return; 444 return;
440 } 445 }
446 if ($system_release =~ /CentOS/) {
447 give_redhat_hints;
448 return;
449 }
450 if ($system_release =~ /Scientific Linux/) {
451 give_redhat_hints;
452 return;
453 }
454 if ($system_release =~ /Oracle Linux Server/) {
455 give_redhat_hints;
456 return;
457 }
441 if ($system_release =~ /Fedora/) { 458 if ($system_release =~ /Fedora/) {
442 give_redhat_hints; 459 give_redhat_hints;
443 return; 460 return;
@@ -488,9 +505,22 @@ sub check_distros()
488sub check_needs() 505sub check_needs()
489{ 506{
490 if ($system_release) { 507 if ($system_release) {
491 print "Checking if the needed tools for $system_release are available\n"; 508 print "Detected OS: $system_release.\n";
492 } else { 509 } else {
493 print "Checking if the needed tools are present\n"; 510 print "Unknown OS\n";
511 }
512
513 # RHEL 7.x and clones have Sphinx version 1.1.x and incomplete texlive
514 if (($system_release =~ /Red Hat Enterprise Linux/) ||
515 ($system_release =~ /CentOS/) ||
516 ($system_release =~ /Scientific Linux/) ||
517 ($system_release =~ /Oracle Linux Server/)) {
518 $virtualenv = 1;
519 $pdf = 0;
520
521 printf("NOTE: On this distro, Sphinx and TexLive shipped versions are incompatible\n");
522 printf("with doc build. So, use Sphinx via a Python virtual environment.\n\n");
523 printf("This script can't install a TexLive version that would provide PDF.\n");
494 } 524 }
495 525
496 # Check for needed programs/tools 526 # Check for needed programs/tools