guestfs-tools/0005-builder-Get-rid-of-etc-xdg-and-XDG_CONFIG_DIRS-nonse.patch
Richard W.M. Jones 6f2364b74b Initial import (RHBZ#1942114).
Created as a split from libguestfs, see:
https://bugzilla.redhat.com/show_bug.cgi?id=1942114
2021-03-25 18:58:35 +00:00

204 lines
7.6 KiB
Diff

From f66af6b6ddfefcbd6ecd6f4d47e0fa4ca231b125 Mon Sep 17 00:00:00 2001
From: "Richard W.M. Jones" <rjones@redhat.com>
Date: Tue, 23 Mar 2021 14:06:12 +0000
Subject: [PATCH 5/7] builder: Get rid of /etc/xdg and XDG_CONFIG_DIRS
nonsense.
Put the configuration in /etc/virt-builder as god intended.
---
builder/Makefile.am | 8 ++------
builder/libguestfs.conf.in | 4 ++--
builder/opensuse.conf.in | 2 +-
builder/paths.ml | 4 ++--
builder/paths.mli | 4 ++--
builder/test-virt-builder-cacheall.sh | 2 +-
builder/test-virt-builder-list-simplestreams.sh | 2 +-
builder/test-virt-builder-list.sh | 2 +-
builder/test-virt-builder-planner.sh | 2 +-
builder/test-virt-builder.sh | 2 +-
builder/virt-builder.pod | 8 ++++----
run.in | 6 +++---
12 files changed, 21 insertions(+), 25 deletions(-)
diff --git a/builder/Makefile.am b/builder/Makefile.am
index d67c8e0ded..4d2e07843c 100644
--- a/builder/Makefile.am
+++ b/builder/Makefile.am
@@ -423,12 +423,8 @@ endif
# virt-builder's default repository
-repoconfdir = $(sysconfdir)/xdg/virt-builder/repos.d
-repoconf_DATA = libguestfs.conf libguestfs.gpg \
- opensuse.conf opensuse.gpg
-
-install-exec-hook:
- $(LN_S) -f xdg/virt-builder $(DESTDIR)$(sysconfdir)/virt-builder
+repoconfdir = $(sysconfdir)/virt-builder/repos.d
+repoconf_DATA = libguestfs.conf libguestfs.gpg opensuse.conf opensuse.gpg
# Build a small C index validator program.
bin_PROGRAMS += virt-index-validate
diff --git a/builder/libguestfs.conf.in b/builder/libguestfs.conf.in
index 412079df64..8d8feab756 100644
--- a/builder/libguestfs.conf.in
+++ b/builder/libguestfs.conf.in
@@ -1,7 +1,7 @@
[libguestfs.org]
uri=http://builder.libguestfs.org/index.asc
-gpgkey=file://@SYSCONFDIR@/xdg/virt-builder/repos.d/libguestfs.gpg
+gpgkey=file://@SYSCONFDIR@/virt-builder/repos.d/libguestfs.gpg
[archive.libguestfs.org]
uri=http://archive.libguestfs.org/builder/index.asc
-gpgkey=file://@SYSCONFDIR@/xdg/virt-builder/repos.d/libguestfs.gpg
+gpgkey=file://@SYSCONFDIR@/virt-builder/repos.d/libguestfs.gpg
diff --git a/builder/opensuse.conf.in b/builder/opensuse.conf.in
index 80db267113..19f9796992 100644
--- a/builder/opensuse.conf.in
+++ b/builder/opensuse.conf.in
@@ -1,3 +1,3 @@
[opensuse.org]
uri=http://download.opensuse.org/repositories/Virtualization:/virt-builder-images/images/index
-gpgkey=file://@SYSCONFDIR@/xdg/virt-builder/repos.d/opensuse.gpg
+gpgkey=file://@SYSCONFDIR@/virt-builder/repos.d/opensuse.gpg
diff --git a/builder/paths.ml b/builder/paths.ml
index b8ce57191e..a7b1f4cc63 100644
--- a/builder/paths.ml
+++ b/builder/paths.ml
@@ -35,8 +35,8 @@ let xdg_config_home () =
let xdg_config_dirs () =
let dirs =
- try Sys.getenv "XDG_CONFIG_DIRS"
- with Not_found -> "/etc/xdg" in
+ try Sys.getenv "VIRT_BUILDER_DIRS"
+ with Not_found -> "/etc" in
let dirs = String.nsplit ":" dirs in
let dirs = List.filter (fun x -> x <> "") dirs in
List.map (fun x -> x // prog) dirs
diff --git a/builder/paths.mli b/builder/paths.mli
index 566c323e57..f4897da952 100644
--- a/builder/paths.mli
+++ b/builder/paths.mli
@@ -23,6 +23,6 @@ val xdg_config_home : unit -> string option
(** [$XDG_CONFIG_HOME/prog] or [$HOME/.config/prog] or [None]. *)
val xdg_config_dirs : unit -> string list
-(** [$XDG_CONFIG_DIRS] (which is a colon-separated path), split. Empty
+(** [$VIRT_BUILDER_DIRS] (which is a colon-separated path), split. Empty
elements are removed from the list. If the environment variable
- is not set [["/etc/xdg"]] is returned instead. *)
+ is not set [["/etc/virt-builder"]] is returned instead. *)
diff --git a/builder/test-virt-builder-cacheall.sh b/builder/test-virt-builder-cacheall.sh
index c80d9ecd2a..26298228a0 100755
--- a/builder/test-virt-builder-cacheall.sh
+++ b/builder/test-virt-builder-cacheall.sh
@@ -68,7 +68,7 @@ uri=$indexfile
EOF
export XDG_CONFIG_HOME=
-export XDG_CONFIG_DIRS="$tmpdir"
+export VIRT_BUILDER_DIRS="$tmpdir"
export XDG_CACHE_HOME="$cachedir"
short_list=$($VG virt-builder --no-check-signature --no-cache --list)
diff --git a/builder/test-virt-builder-list-simplestreams.sh b/builder/test-virt-builder-list-simplestreams.sh
index 3158066b16..4467971a90 100755
--- a/builder/test-virt-builder-list-simplestreams.sh
+++ b/builder/test-virt-builder-list-simplestreams.sh
@@ -22,7 +22,7 @@ $TEST_FUNCTIONS
skip_if_skipped
export XDG_CONFIG_HOME=
-export XDG_CONFIG_DIRS="$abs_builddir/test-simplestreams"
+export VIRT_BUILDER_DIRS="$abs_builddir/test-simplestreams"
short_list=$($VG virt-builder --no-check-signature --no-cache --list)
diff --git a/builder/test-virt-builder-list.sh b/builder/test-virt-builder-list.sh
index 66910fcc3d..a66c1b5d0f 100755
--- a/builder/test-virt-builder-list.sh
+++ b/builder/test-virt-builder-list.sh
@@ -24,7 +24,7 @@ $TEST_FUNCTIONS
skip_if_skipped
export XDG_CONFIG_HOME=
-export XDG_CONFIG_DIRS="$abs_builddir/test-config"
+export VIRT_BUILDER_DIRS="$abs_builddir/test-config"
short_list=$($VG virt-builder --no-check-signature --no-cache --list)
diff --git a/builder/test-virt-builder-planner.sh b/builder/test-virt-builder-planner.sh
index 108b70e95f..135319398c 100755
--- a/builder/test-virt-builder-planner.sh
+++ b/builder/test-virt-builder-planner.sh
@@ -24,7 +24,7 @@ skip_if_skipped
skip_if_backend uml
export XDG_CONFIG_HOME=
-export XDG_CONFIG_DIRS="$abs_builddir/test-config"
+export VIRT_BUILDER_DIRS="$abs_builddir/test-config"
if [ ! -f fedora.xz -o ! -f fedora.qcow2 -o ! -f fedora.qcow2.xz ]; then
echo "$0: test skipped because there is no fedora.xz, fedora.qcow2 or fedora.qcow2.xz in the build directory"
diff --git a/builder/test-virt-builder.sh b/builder/test-virt-builder.sh
index 18673874a3..fe06071370 100755
--- a/builder/test-virt-builder.sh
+++ b/builder/test-virt-builder.sh
@@ -22,7 +22,7 @@ $TEST_FUNCTIONS
skip_if_skipped
export XDG_CONFIG_HOME=
-export XDG_CONFIG_DIRS="$abs_builddir/test-config"
+export VIRT_BUILDER_DIRS="$abs_builddir/test-config"
if [ ! -f fedora.xz ]; then
echo "$0: test skipped because there is no fedora.xz in the build directory"
diff --git a/builder/virt-builder.pod b/builder/virt-builder.pod
index eddadc7962..a56fa89cb1 100644
--- a/builder/virt-builder.pod
+++ b/builder/virt-builder.pod
@@ -1146,9 +1146,9 @@ F<$HOME/.config> if not set).
=item *
-$XDG_CONFIG_DIRS/virt-builder/repos.d/ (where C<$XDG_CONFIG_DIRS>
-means any of the directories in that environment variable, or just F</etc/xdg>
-if not set)
+$VIRT_BUILDER_DIRS/virt-builder/repos.d/ (where C<$VIRT_BUILDER_DIRS>
+means any of the directories in that environment variable, or just F</etc>
+if not set).
=back
@@ -1866,7 +1866,7 @@ Used to determine the location of the template cache. See L</CACHING>.
Used to determine the location of the user' sources. See
L</SOURCES OF TEMPLATES>.
-=item C<XDG_CONFIG_DIRS>
+=item C<VIRT_BUILDER_DIRS>
Used to determine the location of the system sources. See
L</SOURCES OF TEMPLATES>.
diff --git a/run.in b/run.in
index 5e36aa819b..7b401870d5 100755
--- a/run.in
+++ b/run.in
@@ -95,9 +95,9 @@ export PATH
# Make virt-builder use the local website copy to avoid hitting
# the network all the time.
-if [ -z "$XDG_CONFIG_DIRS" ]; then
- prepend XDG_CONFIG_DIRS "$b/builder/test-website"
- export XDG_CONFIG_DIRS
+if [ -z "$VIRT_BUILDER_DIRS" ]; then
+ prepend VIRT_BUILDER_DIRS "$b/builder/test-website"
+ export VIRT_BUILDER_DIRS
fi
# This is a cheap way to find some use-after-free and uninitialized
--
2.29.0.rc2