[arch-commits] Commit in root/trunk (6 files)

Konstantin Gizdov kgizdov at archlinux.org
Mon Apr 13 22:04:34 UTC 2020


    Date: Monday, April 13, 2020 @ 22:04:34
  Author: kgizdov
Revision: 613813

upgpkg: root 6.20.04-1

Added:
  root/trunk/jupyter_notebook_config.py
  root/trunk/nbman-for-arch.patch
  root/trunk/thisroot.fail
Modified:
  root/trunk/PKGBUILD
  root/trunk/settings-cuda.cmake
  root/trunk/settings.cmake

----------------------------+
 PKGBUILD                   |   57 +++++++++++--
 jupyter_notebook_config.py |    1 
 nbman-for-arch.patch       |  176 +++++++++++++++++++++++++++++++++++++++++++
 settings-cuda.cmake        |    2 
 settings.cmake             |    2 
 thisroot.fail              |   12 ++
 6 files changed, 239 insertions(+), 11 deletions(-)

Modified: PKGBUILD
===================================================================
--- PKGBUILD	2020-04-13 22:00:43 UTC (rev 613812)
+++ PKGBUILD	2020-04-13 22:04:34 UTC (rev 613813)
@@ -6,8 +6,8 @@
 
 pkgbase=root
 pkgname=('root' 'root-cuda')
-pkgver=6.20.02
-pkgrel=2
+pkgver=6.20.04
+pkgrel=1
 pkgdesc='C++ data analysis framework and interpreter from CERN'
 arch=('x86_64')
 url='https://root.cern'
@@ -74,16 +74,22 @@
         'root.pc.tpl'
         'settings.cmake'
         'settings-cuda.cmake'
+        'jupyter_notebook_config.py'
         'add_missing_include_ROOT-10315.patch'
-        'fix_relative_paths.patch')
-sha256sums=('0997586bf097c0afbc6f08edbffcebf5eb6a4237262216114ba3f5c8087dcba6'
+        'fix_relative_paths.patch'
+        'nbman-for-arch.patch'
+        'thisroot.fail')
+sha256sums=('1f8c76ccdb550e64e6ddb092b4a7e9d0a10655ef80044828cba12d5e7c874472'
             '43fb857c82c23016dc9ae82a591503c47d12ecbc576cb8285aa632b3e83b9839'
             '50c08191a5b281a39aa05ace4feb8d5405707b4c54a5dcba061f954649c38cb0'
             '558b1c882ce166ad27349460f4da2a81a9a429ad0b5e802601b6ee2714610b0e'
-            '54cae85b8ff132cd0de6654048797281a7725efaa8158a3b97ea21ce8f258ebd'
-            'b1cad3e74be54ea7ef65a522d726e608b7f5b451c036c4cbb7511f454f015f4c'
+            '24d38e4a075755aece47acaa49b48e88e9736d69839fab92794dae6dbd6593fc'
+            '3dea5bbf14f8ce9851b5034df9a02b68ee34cd099ecdc5d27c9540b8ce603a3e'
+            'f33b7b6c4357b0c95cb6a19b4c7e0a1063e5a5ebe4f777f50ff7cde4d77b2241'
             '1cb2654f22b5f1de7f8621434c76266968db77a1f300de857e47d0f4ad5da217'
-            'd5b135fb4d6329277e33d612f8b81b1ca60681cca96196e33ab776f3018a2fa8')
+            'd5b135fb4d6329277e33d612f8b81b1ca60681cca96196e33ab776f3018a2fa8'
+            '58d9cd6ac3e8c7f243505c3c2d176d0d4e49c54dc5d166a4378f8bdc313cb161'
+            'd88c7d09ae2f20022d12c82bf981ae9dffeefc93d8dd766aca011b2b3193f413')
 
 get_pyver () {
     python -c 'import sys; print(str(sys.version_info[0]) + "." + str(sys.version_info[1]))'
@@ -167,7 +173,8 @@
     local _pyver=$(get_pyver)
     local _pydir="${pkgdir}/usr/lib/python${_pyver}/site-packages"
     install -d "${_pydir}"
-    find "${pkgdir}/usr/lib/root" -maxdepth 1 -mindepth 1 \( -iname "*py*" -or -name "*Js*" \) ! -name "*EGPythia8*" -print0 | while read -rd $'\0' _lib; do
+    find "${pkgdir}/usr/lib/root" -maxdepth 1 -mindepth 1 \( -iname "*py*" -or -name "*Js*" \) \
+            ! \( -name "*EGPythia8*" -or -iname "*.rootmap" -or -iname "*.pcm" \) -print0 | while read -rd $'\0' _lib; do
         _base=$(basename "${_lib}")
         ln -sf "/usr/lib/root/${_base}" "${pkgdir}/usr/lib/python${_pyver}/site-packages/${_base}"
     done
@@ -211,9 +218,41 @@
         -i "${bld_dir}/root.pc.tpl"
     install -Dm644 "${bld_dir}/root.pc.tpl" "${pkgdir}/usr/lib/pkgconfig/root.pc"
 
-    # install all licenses
+    # install all licenses & docs
     install -d "${pkgdir}/usr/share/licenses/roofit"
     install "${srcdir}/ROOFIT_LICENSE" "${pkgdir}/usr/share/licenses/roofit/LICENSE"
+    install -d "${pkgdir}/usr/share/licenses/${pkgname}"
+    ln -s '/usr/share/doc/root/LICENSE' "${pkgdir}/usr/share/licenses/${pkgname}/LICENSE"
+    ln -s '/usr/share/root/fonts' "${pkgdir}/usr/share/licenses/${pkgname}/fonts"
+    ln -s '/usr/share/root/js' "${pkgdir}/usr/share/licenses/${pkgname}/js"
+    ln -s '/usr/share/licenses/rootfit' "${pkgdir}/usr/share/licenses/${pkgname}/roofit"
+    if [ "${pkgname}" != "root" ]; then
+        ln -s "/usr/share/licenses/${pkgname}" "${pkgdir}/usr/share/licenses/root"
+        ln -s "/usr/share/doc/root" "${pkgdir}/usr/share/doc/${pkgname}"
+    fi
+
+    # install jupyter kernels and `root --notebook` config
+    install -d "${pkgdir}/usr/share/jupyter/kernels"
+    ln -s '/etc/notebook/kernels/root' "${pkgdir}/usr/share/jupyter/kernels/root"
+    install "${srcdir}/jupyter_notebook_config.py" "${pkgdir}/etc/notebook"/
+
+    # drop thisroot.* shell files
+    rm -rf "${pkgdir}"/usr/bin/thisroot.*
+    install -Dm755 "${srcdir}/thisroot.fail" "${pkgdir}/usr/bin/thisroot.sh"
+    for suffix in csh fish; do
+        ln -s '/usr/bin/thisroot.sh' "${pkgdir}/usr/bin/thisroot.${suffix}"
+    done
+
+    # strip build paths
+    find "${pkgdir}/" -type f -print0 | while read -rd $'\0' _file; do
+        sed -b -e "s@${bld_dir}/lib@/usr/lib/root at g" \
+               -e "s@${bld_dir}/etc@/etc at g" \
+               -e "s@${bld_dir}/include@/usr/include at g" \
+               -e "s@${bld_dir}/input@/input at g" \
+               -e "s@${srcdir}/${pkgbase}-${pkgver}@@g" \
+               -e "s@${srcdir}/${pkgbase}-${pkgver}-cuda@@g" \
+            -i "${_file}"
+    done
 }
 
 package_root() {

Added: jupyter_notebook_config.py
===================================================================
--- jupyter_notebook_config.py	                        (rev 0)
+++ jupyter_notebook_config.py	2020-04-13 22:04:34 UTC (rev 613813)
@@ -0,0 +1 @@
+c.NotebookApp.ip = '*'

Added: nbman-for-arch.patch
===================================================================
--- nbman-for-arch.patch	                        (rev 0)
+++ nbman-for-arch.patch	2020-04-13 22:04:34 UTC (rev 613813)
@@ -0,0 +1,176 @@
+diff -aur root-6.20.04-old/main/src/nbmain.cxx root-6.20.04-new/main/src/nbmain.cxx
+--- root-6.20.04-old/main/src/nbmain.cxx	2020-04-14 00:54:43.902408710 +0300
++++ root-6.20.04-new/main/src/nbmain.cxx	2020-04-14 01:00:48.022396130 +0300
+@@ -33,10 +33,6 @@
+ #define NB_OPT             "notebook"
+ #define JUPYTER_CONF_DIR_V "JUPYTER_CONFIG_DIR"
+ #define JUPYTER_PATH_V     "JUPYTER_PATH"
+-#define NB_CONF_DIR        "notebook"
+-#define ROOTNB_DIR         ".rootnb"
+-#define COMMIT_FILE        ".rootcommit"
+-#define JUPYTER_CONFIG     "jupyter_notebook_config.py"
+ 
+ using namespace std;
+ 
+@@ -49,160 +45,12 @@
+ #endif
+ 
+ ////////////////////////////////////////////////////////////////////////////////
+-/// Checks whether ROOT notebook files are installed and they are
+-/// the current version.
+-
+-static int CheckNbInstallation(string dir)
+-{
+-   string commit(gROOT->GetGitCommit());
+-   string inputfname(dir + pathsep + ROOTNB_DIR + pathsep + COMMIT_FILE);
+-   ifstream in(inputfname);
+-   if (in.is_open()) {
+-      string line;
+-      in >> line;
+-      in.close();
+-      if (line.compare(commit) == 0) return  0; // already installed
+-      else                           return -1; // install, it's outdated
+-   }
+-   else if (gSystem->AccessPathName(inputfname.c_str())) {
+-      // There is no installation
+-      return -1;
+-   }
+-   else {
+-      fprintf(stderr,
+-              "Error checking notebook installation -- cannot open %s\n",
+-              inputfname.c_str());
+-      return -2;
+-   }
+-}
+-
+-////////////////////////////////////////////////////////////////////////////////
+-/// Installs ROOT notebook files in the user's home directory.
+-
+-static bool InstallNbFiles(string source, string dest)
+-{
+-   // Create installation directory
+-   if (gSystem->AccessPathName(dest.c_str())) {
+-      if (gSystem->mkdir(dest.c_str())) {
+-         fprintf(stderr,
+-                 "Error installing notebook configuration files -- cannot create directory %s\n",
+-                 dest.c_str());
+-         return false;
+-      }
+-   }
+-
+-   // Copy files in source to dest
+-   TSystemDirectory dir(source.c_str(), source.c_str());
+-   TList *files = dir.GetListOfFiles();
+-   if (files) {
+-      TSystemFile *file;
+-      TListIter it(files);
+-      while ((file = (TSystemFile*)it())) {
+-         TString s = file->GetName();
+-         string fname(s.Data());
+-         string sourcefile = source + pathsep + fname;
+-         string destfile   = dest   + pathsep + fname;
+-         if (!file->IsDirectory()) {
+-            if (gSystem->CopyFile(sourcefile.c_str(), destfile.c_str(), true)) {
+-               fprintf(stderr,
+-                       "Error installing notebook configuration files -- cannot copy file %s to %s\n",
+-                       sourcefile.c_str(), destfile.c_str());
+-               return false;
+-            }
+-         }
+-         else if (fname.compare(".") && fname.compare("..") && fname.compare("html")) {
+-            if (!InstallNbFiles(sourcefile, destfile))
+-               return false;
+-         }
+-      }
+-   }
+-
+-   return true;
+-}
+-
+-////////////////////////////////////////////////////////////////////////////////
+-/// Creates the Jupyter notebook configuration file that sets the
+-/// necessary environment.
+-
+-static bool CreateJupyterConfig(string dest, string rootbin, string rootlib, string rootdata)
+-{
+-   string jupyconfig = dest + pathsep + JUPYTER_CONFIG;
+-   ofstream out(jupyconfig, ios::trunc);
+-   if (out.is_open()) {
+-      out << "import os" << endl;
+-      out << "rootbin = '" << rootbin << "'" << endl;
+-      out << "rootlib = '" << rootlib << "'" << endl;
+-#ifdef WIN32
+-      string jsrootsys = rootdata + "\\js\\";
+-      out << "os.environ['PYTHONPATH']      = '%s' % rootlib + ':' + os.getenv('PYTHONPATH', '')" << endl;
+-      out << "os.environ['PATH']            = '%s:%s\\bin' % (rootbin,rootbin) + ':' + '%s' % rootlib + ':' + os.getenv('PATH', '')" << endl;
+-#else
+-      string jsrootsys = rootdata + "/js/";
+-      out << "os.environ['PYTHONPATH']      = '%s' % rootlib + ':' + os.getenv('PYTHONPATH', '')" << endl;
+-      out << "os.environ['PATH']            = '%s:%s/bin' % (rootbin,rootbin) + ':' + os.getenv('PATH', '')" << endl;
+-      out << "os.environ['LD_LIBRARY_PATH'] = '%s' % rootlib + ':' + os.getenv('LD_LIBRARY_PATH', '')" << endl;
+-#endif
+-      out << "c.NotebookApp.extra_static_paths = ['" << jsrootsys << "']" << endl;
+-      out.close();
+-      return true;
+-   }
+-   else {
+-      fprintf(stderr,
+-              "Error installing notebook configuration files -- cannot create IPython config file at %s\n",
+-              jupyconfig.c_str());
+-      return false;
+-   }
+-}
+-
+-////////////////////////////////////////////////////////////////////////////////
+-/// Creates a file that stores the current commit id in it.
+-
+-static bool CreateStamp(string dest)
+-{
+-   ofstream out(dest + pathsep + COMMIT_FILE, ios::trunc);
+-   if (out.is_open()) {
+-      out << gROOT->GetGitCommit();
+-      out.close();
+-      return true;
+-   }
+-   else {
+-      fprintf(stderr,
+-              "Error installing notebook configuration files -- cannot create %s\n",
+-              COMMIT_FILE);
+-      return false;
+-   }
+-}
+-
+-////////////////////////////////////////////////////////////////////////////////
+ /// Spawn a Jupyter notebook customised by ROOT.
+ 
+ int main(int argc, char **argv)
+ {
+-   string rootbin(TROOT::GetBinDir().Data());
+-   string rootlib(TROOT::GetLibDir().Data());
+-   string rootetc(TROOT::GetEtcDir().Data());
+-   string rootdata(TROOT::GetDataDir().Data());
+-
+-   // If needed, install ROOT notebook files in the user's home directory
+-#ifdef WIN32
+-   string homedir(getenv("USERPROFILE"));
+-#else
+-   string homedir(getenv("HOME"));
+-#endif
+-   int inst = CheckNbInstallation(homedir);
+-   if (inst == -1) {
+-      // The etc directory contains the ROOT notebook files to install
+-      string source(rootetc + pathsep + NB_CONF_DIR);
+-      string dest(homedir + pathsep + ROOTNB_DIR);
+-      bool res = InstallNbFiles(source, dest) &&
+-                 CreateJupyterConfig(dest, rootbin, rootlib, rootdata) &&
+-                 CreateStamp(dest);
+-      if (!res) return 1;
+-   }
+-   else if (inst == -2) return 1;
+-
+    // Set IPython directory for the ROOT notebook flavour
+-   string rootnbpath = homedir + pathsep + ROOTNB_DIR;
++   string rootnbpath = pathsep + string("etc") + pathsep + string("notebook");
+    string jupyconfdir(JUPYTER_CONF_DIR_V + ("=" + rootnbpath));
+    string jupypathdir(JUPYTER_PATH_V + ("=" + rootnbpath));
+    putenv((char *)jupyconfdir.c_str());

Modified: settings-cuda.cmake
===================================================================
--- settings-cuda.cmake	2020-04-13 22:00:43 UTC (rev 613812)
+++ settings-cuda.cmake	2020-04-13 22:04:34 UTC (rev 613813)
@@ -5,7 +5,7 @@
 set (CMAKE_INSTALL_BINDIR /usr/bin CACHE PATH "" FORCE)
 set (CMAKE_INSTALL_LIBDIR /usr/lib/root CACHE PATH "" FORCE)
 set (CMAKE_INSTALL_INCLUDEDIR /usr/include CACHE PATH "" FORCE)
-set (CMAKE_INSTALL_SYSCONFDIR /etc/root CACHE PATH "" FORCE)
+set (CMAKE_INSTALL_SYSCONFDIR /etc CACHE PATH "" FORCE)
 set (CMAKE_INSTALL_DATAROOTDIR /usr/share CACHE PATH "" FORCE)
 set (CMAKE_CXX_STANDARD 14 CACHE STRING "" FORCE)
 set (alien OFF CACHE BOOL "" FORCE)

Modified: settings.cmake
===================================================================
--- settings.cmake	2020-04-13 22:00:43 UTC (rev 613812)
+++ settings.cmake	2020-04-13 22:04:34 UTC (rev 613813)
@@ -5,7 +5,7 @@
 set (CMAKE_INSTALL_BINDIR /usr/bin CACHE PATH "" FORCE)
 set (CMAKE_INSTALL_LIBDIR /usr/lib/root CACHE PATH "" FORCE)
 set (CMAKE_INSTALL_INCLUDEDIR /usr/include CACHE PATH "" FORCE)
-set (CMAKE_INSTALL_SYSCONFDIR /etc/root CACHE PATH "" FORCE)
+set (CMAKE_INSTALL_SYSCONFDIR /etc CACHE PATH "" FORCE)
 set (CMAKE_INSTALL_DATAROOTDIR /usr/share CACHE PATH "" FORCE)
 set (CMAKE_CXX_STANDARD 17 CACHE STRING "" FORCE)
 set (alien OFF CACHE BOOL "" FORCE)

Added: thisroot.fail
===================================================================
--- thisroot.fail	                        (rev 0)
+++ thisroot.fail	2020-04-13 22:04:34 UTC (rev 613813)
@@ -0,0 +1,12 @@
+#!/bin/bash
+
+# thisroot.* scripts should not be used to
+# configure ROOT on Arch. Notify user and
+# return an error
+
+function fail {
+    printf '%s\n' "$1" >&2
+    exit "${2:-$1}"
+}
+
+fail "ERROR: $(basename $0) should never be used!" 1



More information about the arch-commits mailing list