Blame SOURCES/hwloc-1.11.2-dump-cleanups.patch

3ddd73
diff -Nrup hwloc-1.11.2.orig/config/hwloc_internal.m4 hwloc-1.11.2/config/hwloc_internal.m4
3ddd73
--- hwloc-1.11.2.orig/config/hwloc_internal.m4	2016-06-06 13:45:07.591491542 -0400
3ddd73
+++ hwloc-1.11.2/config/hwloc_internal.m4	2016-06-06 14:11:17.698625007 -0400
3ddd73
@@ -1,6 +1,6 @@
3ddd73
 dnl -*- Autoconf -*-
3ddd73
 dnl
3ddd73
-dnl Copyright © 2009-2014 Inria.  All rights reserved.
3ddd73
+dnl Copyright © 2009-2016 Inria.  All rights reserved.
3ddd73
 dnl Copyright © 2009, 2011 Université Bordeaux
3ddd73
 dnl Copyright © 2004-2005 The Trustees of Indiana University and Indiana
3ddd73
 dnl                         University Research and Technology
3ddd73
@@ -247,6 +247,14 @@ EOF
3ddd73
 
3ddd73
     AC_REQUIRE([AC_PROG_SED])
3ddd73
 
3ddd73
+    # runstatedir only supported in autoconf >= 2.70 and in some backports
3ddd73
+    if test "x${runstatedir}" != "x"; then
3ddd73
+      HWLOC_runstatedir=${runstatedir}
3ddd73
+    else
3ddd73
+      HWLOC_runstatedir='${localstatedir}/run'
3ddd73
+    fi
3ddd73
+    AC_SUBST([HWLOC_runstatedir])
3ddd73
+
3ddd73
     # Cairo support
3ddd73
     hwloc_cairo_happy=no
3ddd73
     if test "x$enable_cairo" != "xno"; then
3ddd73
diff -Nrup hwloc-1.11.2.orig/doc/hwloc.doxy hwloc-1.11.2/doc/hwloc.doxy
3ddd73
--- hwloc-1.11.2.orig/doc/hwloc.doxy	2015-12-17 05:05:59.000000000 -0500
3ddd73
+++ hwloc-1.11.2/doc/hwloc.doxy	2016-06-06 14:10:34.211094730 -0400
3ddd73
@@ -816,6 +816,9 @@ assembling them with hwloc-assembler.
3ddd73
 
3ddd73
 
3ddd73
 
3ddd73
+See <tt>HWLOC_DUMPED_HWDATA_DIR</tt> in \ref envvar for details
3ddd73
+about the location of dumped files.
3ddd73
+
3ddd73
 
3ddd73
 \page envvar Environment Variables
3ddd73
 
3ddd73
@@ -963,7 +966,12 @@ following environment variables.
3ddd73
 
3ddd73
 
HWLOC_DUMPED_HWDATA_DIR=/path/to/dumped/files/
3ddd73
   
loads files dumped by <tt>hwloc-dump-hwdata</tt> (on Linux)
3ddd73
-  from the given directory instead of <tt>/var/run/hwloc/</tt>.
3ddd73
+  from the given directory.
3ddd73
+  The default dump/load directory is configured during build based
3ddd73
+  on \--runstatedir, \--localstatedir, and \--prefix options.
3ddd73
+  It usually points to <tt>/var/run/hwloc/</tt> in Linux distribution
3ddd73
+  packages, but it may also point to <tt>$prefix/var/run/hwloc/</tt>
3ddd73
+  when manually installing and only specifying \--prefix.
3ddd73
   
3ddd73
 
3ddd73
 
HWLOC_COMPONENTS=list,of,components
3ddd73
@@ -2777,6 +2785,8 @@ The utility <tt>hwloc-dump-hwdata</tt> i
3ddd73
 privileged information at boot time and making it available to
3ddd73
 non-privileged users. However it only applies to Intel Knights Landing
3ddd73
 Xeon Phi for now (see \ref faq_knl_dump).
3ddd73
+See also <tt>HWLOC_DUMPED_HWDATA_DIR</tt> in \ref envvar for details
3ddd73
+about the location of dumped files.
3ddd73
 
3ddd73
 
3ddd73
 \section faq_onedim hwloc only has a one-dimensional view of the architecture, it ignores distances
3ddd73
@@ -3149,6 +3159,9 @@ hwloc-dump-hwdata requires <tt>dmi-sysfs
3ddd73
 
3ddd73
 The utility is currently unneeded on non-KNL platforms.
3ddd73
 
3ddd73
+See <tt>HWLOC_DUMPED_HWDATA_DIR</tt> in \ref envvar for details
3ddd73
+about the location of dumped files.
3ddd73
+
3ddd73
 
3ddd73
 \section faq_phi How do I build for Intel Xeon Phi coprocessor?
3ddd73
 
3ddd73
diff -Nrup hwloc-1.11.2.orig/NEWS hwloc-1.11.2/NEWS
3ddd73
--- hwloc-1.11.2.orig/NEWS	2016-06-06 13:45:54.947068832 -0400
3ddd73
+++ hwloc-1.11.2/NEWS	2016-06-06 14:11:52.160045046 -0400
3ddd73
@@ -60,6 +60,8 @@ Version 1.11.2
3ddd73
 * Add systemd service template contrib/systemd/hwloc-dump-hwdata.service
3ddd73
   for launching hwloc-dump-hwdata at boot on Linux.
3ddd73
   Thanks to Grzegorz Andrejczuk.
3ddd73
+* Make the hwloc-dump-hwdata dump directory configurable through configure
3ddd73
+  options such as --runstatedir or --localstatedir.
3ddd73
 
3ddd73
 
3ddd73
 Version 1.11.1
3ddd73
diff -Nrup hwloc-1.11.2.orig/src/Makefile.am hwloc-1.11.2/src/Makefile.am
3ddd73
--- hwloc-1.11.2.orig/src/Makefile.am	2015-10-06 13:06:45.000000000 -0400
3ddd73
+++ hwloc-1.11.2/src/Makefile.am	2016-06-06 14:10:34.212094742 -0400
3ddd73
@@ -1,4 +1,4 @@
3ddd73
-# Copyright © 2009-2014 Inria.  All rights reserved.
3ddd73
+# Copyright © 2009-2016 Inria.  All rights reserved.
3ddd73
 # Copyright © 2009-2012 Université Bordeaux
3ddd73
 # Copyright © 2009-2014 Cisco Systems, Inc.  All rights reserved.
3ddd73
 # Copyright © 2011-2012 Oracle and/or its affiliates.  All rights reserved.
3ddd73
@@ -22,7 +22,8 @@ endif
3ddd73
 pluginsdir = @HWLOC_PLUGINS_DIR@
3ddd73
 plugins_LTLIBRARIES =
3ddd73
 plugins_ldflags = -module -avoid-version -lltdl
3ddd73
-AM_CPPFLAGS += -DHWLOC_PLUGINS_PATH=\"$(HWLOC_PLUGINS_PATH)\"
3ddd73
+# Beware that files are not rebuilt automatically when reconfiguring with different paths in these flags.
3ddd73
+AM_CPPFLAGS += -DHWLOC_PLUGINS_PATH=\"$(HWLOC_PLUGINS_PATH)\" -DRUNSTATEDIR=\"$(HWLOC_runstatedir)\"
3ddd73
 
3ddd73
 # Sources and ldflags
3ddd73
 
3ddd73
diff -Nrup hwloc-1.11.2.orig/src/topology-linux.c hwloc-1.11.2/src/topology-linux.c
3ddd73
--- hwloc-1.11.2.orig/src/topology-linux.c	2015-12-10 07:09:45.000000000 -0500
3ddd73
+++ hwloc-1.11.2/src/topology-linux.c	2016-06-06 14:10:34.214094766 -0400
3ddd73
@@ -5237,7 +5237,7 @@ hwloc_linux_component_instantiate(struct
3ddd73
 
3ddd73
   data->dumped_hwdata_dirname = getenv("HWLOC_DUMPED_HWDATA_DIR");
3ddd73
   if (!data->dumped_hwdata_dirname)
3ddd73
-    data->dumped_hwdata_dirname = "/var/run/hwloc/";
3ddd73
+    data->dumped_hwdata_dirname = RUNSTATEDIR "/hwloc/";
3ddd73
 
3ddd73
   data->deprecated_classlinks_model = -2; /* never tried */
3ddd73
   data->mic_need_directlookup = -1; /* not initialized */
3ddd73
diff -Nrup hwloc-1.11.2.orig/utils/hwloc/hwloc-dump-hwdata.1in hwloc-1.11.2/utils/hwloc/hwloc-dump-hwdata.1in
3ddd73
--- hwloc-1.11.2.orig/utils/hwloc/hwloc-dump-hwdata.1in	2015-12-10 07:09:45.000000000 -0500
3ddd73
+++ hwloc-1.11.2/utils/hwloc/hwloc-dump-hwdata.1in	2016-06-06 14:10:34.216094790 -0400
3ddd73
@@ -1,5 +1,5 @@
3ddd73
 .\" -*- nroff -*-
3ddd73
-.\" Copyright © 2015 Inria.  All rights reserved.
3ddd73
+.\" Copyright © 2015-2016 Inria.  All rights reserved.
3ddd73
 .\" See COPYING in top-level directory.
3ddd73
 .TH HWLOC-DUMP-HWDATA "1" "#HWLOC_DATE#" "#PACKAGE_VERSION#" "#PACKAGE_NAME#"
3ddd73
 .SH NAME
3ddd73
@@ -21,7 +21,11 @@ hwloc-dump-hwdata \- Dump topology and l
3ddd73
 .TP 10
3ddd73
 \fB\-o <dir>\fR
3ddd73
 save output files to directory <dir> instead of the default
3ddd73
-\fI/var/run/hwloc/\fR.
3ddd73
+\fI#RUNSTATEDIR#/hwloc/\fR that was specified at configure time.
3ddd73
+
3ddd73
+You may want to set the HWLOC_DUMPED_HWDATA_DIR environment variable
3ddd73
+as well so that the hwloc library looks for dumped files in that same
3ddd73
+directory.
3ddd73
 .
3ddd73
 .\" **************************
3ddd73
 .\"    Description Section
3ddd73
@@ -54,11 +58,6 @@ gathered from specific SMBIOS entries su
3ddd73
 \fI/sys/firmware/dmi/entries/160-*\fR,
3ddd73
 and saved in file \fIknl_memoryside_cache\fR.
3ddd73
 .
3ddd73
-.PP
3ddd73
-If the output directory is changed, you may want to set the
3ddd73
-HWLOC_DUMPED_HWDATA_DIR environment variable accordingly so that
3ddd73
-the hwloc library finds the dumped files.
3ddd73
-.
3ddd73
 .\" **************************
3ddd73
 .\"    See also section
3ddd73
 .\" **************************
3ddd73
diff -Nrup hwloc-1.11.2.orig/utils/hwloc/hwloc-dump-hwdata.c hwloc-1.11.2/utils/hwloc/hwloc-dump-hwdata.c
3ddd73
--- hwloc-1.11.2.orig/utils/hwloc/hwloc-dump-hwdata.c	2016-06-06 14:08:17.576429196 -0400
3ddd73
+++ hwloc-1.11.2/utils/hwloc/hwloc-dump-hwdata.c	2016-06-06 14:10:34.216094790 -0400
3ddd73
@@ -23,7 +23,7 @@ static void usage(const char *name, FILE
3ddd73
 {
3ddd73
     fprintf (where, "Usage: %s [ options ] ...\n", name);
3ddd73
     fprintf (where, "Options:\n");
3ddd73
-    fprintf (where, "  -o <dir>      Output files to directory <dir> instead of /var/run/hwloc/\n");
3ddd73
+    fprintf (where, "  -o <dir>      Output files to directory <dir> instead of " DEFAULT_DUMP_DIR "\n");
3ddd73
 }
3ddd73
 
3ddd73
 int main(int argc, char *argv[])
3ddd73
diff -Nrup hwloc-1.11.2.orig/utils/hwloc/hwloc-gather-topology.in hwloc-1.11.2/utils/hwloc/hwloc-gather-topology.in
3ddd73
--- hwloc-1.11.2.orig/utils/hwloc/hwloc-gather-topology.in	2015-12-10 07:09:45.000000000 -0500
3ddd73
+++ hwloc-1.11.2/utils/hwloc/hwloc-gather-topology.in	2016-06-06 14:10:34.216094790 -0400
3ddd73
@@ -3,7 +3,7 @@
3ddd73
 
3ddd73
 #
3ddd73
 # Copyright © 2009 CNRS
3ddd73
-# Copyright © 2009-2015 Inria.  All rights reserved.
3ddd73
+# Copyright © 2009-2016 Inria.  All rights reserved.
3ddd73
 # Copyright © 2009-2012 Université Bordeaux
3ddd73
 # See COPYING in top-level directory.
3ddd73
 #
3ddd73
@@ -12,6 +12,8 @@ HWLOC_top_builddir="@HWLOC_top_builddir@
3ddd73
 prefix="@prefix@"
3ddd73
 exec_prefix="@exec_prefix@"
3ddd73
 bindir="@bindir@"
3ddd73
+localstatedir="@localstatedir@"
3ddd73
+runstatedir="@HWLOC_runstatedir@"
3ddd73
 # this will be changed into $bindir/lstopo during make install
3ddd73
 lstopo="$HWLOC_top_builddir/utils/lstopo/lstopo-no-graphics"
3ddd73
 
3ddd73
@@ -138,7 +140,7 @@ cat << EOF | while read -r path ; do sav
3ddd73
 EOF
3ddd73
 
3ddd73
 if test "x$HWLOC_DUMPED_HWDATA_DIR" = x; then
3ddd73
-  savedir "$destdir/$basename" /var/run/hwloc/
3ddd73
+  savedir "$destdir/$basename" "$runstatedir"/hwloc/
3ddd73
 else
3ddd73
   savedir "$destdir/$basename" "$HWLOC_DUMPED_HWDATA_DIR"
3ddd73
 fi
3ddd73
diff -Nrup hwloc-1.11.2.orig/utils/hwloc/Makefile.am hwloc-1.11.2/utils/hwloc/Makefile.am
3ddd73
--- hwloc-1.11.2.orig/utils/hwloc/Makefile.am	2016-06-06 14:08:17.575429209 -0400
3ddd73
+++ hwloc-1.11.2/utils/hwloc/Makefile.am	2016-06-06 14:10:34.215094778 -0400
3ddd73
@@ -45,7 +45,7 @@ endif HWLOC_HAVE_LINUX
3ddd73
 hwloc_dump_hwdata_SOURCES = \
3ddd73
 	hwloc-dump-hwdata.c \
3ddd73
 	hwloc-dump-hwdata-knl.c
3ddd73
-hwloc_dump_hwdata_CPPFLAGS = $(AM_CPPFLAGS) -DRUNSTATEDIR=\"@runstatedir@\"
3ddd73
+hwloc_dump_hwdata_CPPFLAGS = $(AM_CPPFLAGS) -DRUNSTATEDIR=\"$(HWLOC_runstatedir)\"
3ddd73
 
3ddd73
 hwloc_calc_SOURCES = \
3ddd73
         hwloc-calc.h \
3ddd73
@@ -123,6 +123,7 @@ endif HWLOC_HAVE_LINUX
3ddd73
 	@ $(SED) -e 's/#PACKAGE_NAME#/@PACKAGE_NAME@/g' \
3ddd73
 	  -e 's/#PACKAGE_VERSION#/@PACKAGE_VERSION@/g' \
3ddd73
 	  -e 's/#HWLOC_DATE#/@HWLOC_RELEASE_DATE@/g' \
3ddd73
+	  -e 's@#RUNSTATEDIR#@'$(HWLOC_runstatedir)'@g' \
3ddd73
 	  > $@ < $<
3ddd73
 
3ddd73
 .3in.3: