[PATCH 1/3] lib: Use $PROG instead of $PROG_PATH

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Due to the way we detect programs at runtime there's no
difference between $PROG and $PROG_PATH macros that come from
meson-config.h. Either both are set to the path found during
configure or both are set to just "$prog", e.g.:

  #define EBTABLES "/sbin/ebtables"
  #define EBTABLES_PATH "/sbin/ebtables"
  #define FLAKE8 "flake8"
  #define FLAKE8_PATH "flake8"

Change those few places which use _PATH.

Signed-off-by: Michal Privoznik <mprivozn@xxxxxxxxxx>
---
 src/util/virfirewall.c  |  8 ++--
 src/util/virnetdevip.c  | 14 +++---
 tests/virfirewalltest.c | 98 ++++++++++++++++++++---------------------
 3 files changed, 60 insertions(+), 60 deletions(-)

diff --git a/src/util/virfirewall.c b/src/util/virfirewall.c
index 9594192a7b..fb02992912 100644
--- a/src/util/virfirewall.c
+++ b/src/util/virfirewall.c
@@ -42,9 +42,9 @@ typedef struct _virFirewallGroup virFirewallGroup;
 VIR_ENUM_DECL(virFirewallLayerCommand);
 VIR_ENUM_IMPL(virFirewallLayerCommand,
               VIR_FIREWALL_LAYER_LAST,
-              EBTABLES_PATH,
-              IPTABLES_PATH,
-              IP6TABLES_PATH,
+              EBTABLES,
+              IPTABLES,
+              IP6TABLES,
 );
 
 struct _virFirewallRule {
@@ -99,7 +99,7 @@ static int
 virFirewallValidateBackend(virFirewallBackend backend)
 {
     const char *commands[] = {
-        IPTABLES_PATH, IP6TABLES_PATH, EBTABLES_PATH
+        IPTABLES, IP6TABLES, EBTABLES
     };
     size_t i;
 
diff --git a/src/util/virnetdevip.c b/src/util/virnetdevip.c
index 0ce8f5b536..2eacb64ebe 100644
--- a/src/util/virnetdevip.c
+++ b/src/util/virnetdevip.c
@@ -394,8 +394,8 @@ virNetDevIPAddrAdd(const char *ifname,
         return -1;
     }
 
-# ifdef IFCONFIG_PATH
-    cmd = virCommandNew(IFCONFIG_PATH);
+# ifdef IFCONFIG
+    cmd = virCommandNew(IFCONFIG);
     virCommandAddArg(cmd, ifname);
     if (VIR_SOCKET_ADDR_IS_FAMILY(addr, AF_INET6))
         virCommandAddArg(cmd, "inet6");
@@ -408,7 +408,7 @@ virNetDevIPAddrAdd(const char *ifname,
         virCommandAddArgList(cmd, "broadcast", bcaststr, NULL);
     virCommandAddArg(cmd, "alias");
 # else
-    cmd = virCommandNew(IP_PATH);
+    cmd = virCommandNew(IP);
     virCommandAddArgList(cmd, "addr", "add", NULL);
     virCommandAddArgFormat(cmd, "%s/%u", addrstr, prefix);
     if (peerstr)
@@ -435,8 +435,8 @@ virNetDevIPAddrDel(const char *ifname,
 
     if (!(addrstr = virSocketAddrFormat(addr)))
         return -1;
-# ifdef IFCONFIG_PATH
-    cmd = virCommandNew(IFCONFIG_PATH);
+# ifdef IFCONFIG
+    cmd = virCommandNew(IFCONFIG);
     virCommandAddArg(cmd, ifname);
     if (VIR_SOCKET_ADDR_IS_FAMILY(addr, AF_INET6))
         virCommandAddArg(cmd, "inet6");
@@ -445,7 +445,7 @@ virNetDevIPAddrDel(const char *ifname,
     virCommandAddArgFormat(cmd, "%s/%u", addrstr, prefix);
     virCommandAddArg(cmd, "-alias");
 # else
-    cmd = virCommandNew(IP_PATH);
+    cmd = virCommandNew(IP);
     virCommandAddArgList(cmd, "addr", "del", NULL);
     virCommandAddArgFormat(cmd, "%s/%u", addrstr, prefix);
     virCommandAddArgList(cmd, "dev", ifname, NULL);
@@ -473,7 +473,7 @@ virNetDevIPRouteAdd(const char *ifname,
         return -1;
     if (!(gatewaystr = virSocketAddrFormat(gateway)))
         return -1;
-    cmd = virCommandNew(IP_PATH);
+    cmd = virCommandNew(IP);
     virCommandAddArgList(cmd, "route", "add", NULL);
     virCommandAddArgFormat(cmd, "%s/%u", addrstr, prefix);
     virCommandAddArgList(cmd, "via", gatewaystr, "dev", ifname,
diff --git a/tests/virfirewalltest.c b/tests/virfirewalltest.c
index ac039f3bbf..c6f4ca05e2 100644
--- a/tests/virfirewalltest.c
+++ b/tests/virfirewalltest.c
@@ -116,11 +116,11 @@ VIR_MOCK_WRAP_RET_ARGS(g_dbus_connection_call_sync,
 
         if (fwBuf) {
             if (STREQ(type, "ipv4"))
-                virBufferAddLit(fwBuf, IPTABLES_PATH);
+                virBufferAddLit(fwBuf, IPTABLES);
             else if (STREQ(type, "ipv6"))
-                virBufferAddLit(fwBuf, IP6TABLES_PATH);
+                virBufferAddLit(fwBuf, IP6TABLES);
             else
-                virBufferAddLit(fwBuf, EBTABLES_PATH);
+                virBufferAddLit(fwBuf, EBTABLES);
         }
 
         while (g_variant_iter_loop(iter, "s", &item)) {
@@ -186,8 +186,8 @@ testFirewallSingleGroup(const void *opaque)
     int ret = -1;
     const char *actual = NULL;
     const char *expected =
-        IPTABLES_PATH " -w -A INPUT --source 192.168.122.1 --jump ACCEPT\n"
-        IPTABLES_PATH " -w -A INPUT --source '!192.168.122.1' --jump REJECT\n";
+        IPTABLES " -w -A INPUT --source 192.168.122.1 --jump ACCEPT\n"
+        IPTABLES " -w -A INPUT --source '!192.168.122.1' --jump REJECT\n";
     const struct testFirewallData *data = opaque;
     g_autoptr(virCommandDryRunToken) dryRunToken = virCommandDryRunTokenNew();
 
@@ -239,8 +239,8 @@ testFirewallRemoveRule(const void *opaque)
     int ret = -1;
     const char *actual = NULL;
     const char *expected =
-        IPTABLES_PATH " -w -A INPUT --source 192.168.122.1 --jump ACCEPT\n"
-        IPTABLES_PATH " -w -A INPUT --source '!192.168.122.1' --jump REJECT\n";
+        IPTABLES " -w -A INPUT --source 192.168.122.1 --jump ACCEPT\n"
+        IPTABLES " -w -A INPUT --source '!192.168.122.1' --jump REJECT\n";
     const struct testFirewallData *data = opaque;
     virFirewallRule *fwrule;
     g_autoptr(virCommandDryRunToken) dryRunToken = virCommandDryRunTokenNew();
@@ -299,10 +299,10 @@ testFirewallManyGroups(const void *opaque G_GNUC_UNUSED)
     int ret = -1;
     const char *actual = NULL;
     const char *expected =
-        IPTABLES_PATH " -w -A INPUT --source 192.168.122.1 --jump ACCEPT\n"
-        IPTABLES_PATH " -w -A INPUT --source '!192.168.122.1' --jump REJECT\n"
-        IPTABLES_PATH " -w -A OUTPUT --source 192.168.122.1 --jump ACCEPT\n"
-        IPTABLES_PATH " -w -A OUTPUT --jump DROP\n";
+        IPTABLES " -w -A INPUT --source 192.168.122.1 --jump ACCEPT\n"
+        IPTABLES " -w -A INPUT --source '!192.168.122.1' --jump REJECT\n"
+        IPTABLES " -w -A OUTPUT --source 192.168.122.1 --jump ACCEPT\n"
+        IPTABLES " -w -A OUTPUT --jump DROP\n";
     const struct testFirewallData *data = opaque;
     g_autoptr(virCommandDryRunToken) dryRunToken = virCommandDryRunTokenNew();
 
@@ -387,10 +387,10 @@ testFirewallIgnoreFailGroup(const void *opaque G_GNUC_UNUSED)
     int ret = -1;
     const char *actual = NULL;
     const char *expected =
-        IPTABLES_PATH " -w -A INPUT --source 192.168.122.1 --jump ACCEPT\n"
-        IPTABLES_PATH " -w -A INPUT --source 192.168.122.255 --jump REJECT\n"
-        IPTABLES_PATH " -w -A OUTPUT --source 192.168.122.1 --jump ACCEPT\n"
-        IPTABLES_PATH " -w -A OUTPUT --jump DROP\n";
+        IPTABLES " -w -A INPUT --source 192.168.122.1 --jump ACCEPT\n"
+        IPTABLES " -w -A INPUT --source 192.168.122.255 --jump REJECT\n"
+        IPTABLES " -w -A OUTPUT --source 192.168.122.1 --jump ACCEPT\n"
+        IPTABLES " -w -A OUTPUT --jump DROP\n";
     const struct testFirewallData *data = opaque;
     g_autoptr(virCommandDryRunToken) dryRunToken = virCommandDryRunTokenNew();
 
@@ -456,10 +456,10 @@ testFirewallIgnoreFailRule(const void *opaque G_GNUC_UNUSED)
     int ret = -1;
     const char *actual = NULL;
     const char *expected =
-        IPTABLES_PATH " -w -A INPUT --source 192.168.122.1 --jump ACCEPT\n"
-        IPTABLES_PATH " -w -A INPUT --source 192.168.122.255 --jump REJECT\n"
-        IPTABLES_PATH " -w -A OUTPUT --source 192.168.122.1 --jump ACCEPT\n"
-        IPTABLES_PATH " -w -A OUTPUT --jump DROP\n";
+        IPTABLES " -w -A INPUT --source 192.168.122.1 --jump ACCEPT\n"
+        IPTABLES " -w -A INPUT --source 192.168.122.255 --jump REJECT\n"
+        IPTABLES " -w -A OUTPUT --source 192.168.122.1 --jump ACCEPT\n"
+        IPTABLES " -w -A OUTPUT --jump DROP\n";
     const struct testFirewallData *data = opaque;
     g_autoptr(virCommandDryRunToken) dryRunToken = virCommandDryRunTokenNew();
 
@@ -524,8 +524,8 @@ testFirewallNoRollback(const void *opaque G_GNUC_UNUSED)
     int ret = -1;
     const char *actual = NULL;
     const char *expected =
-        IPTABLES_PATH " -w -A INPUT --source 192.168.122.1 --jump ACCEPT\n"
-        IPTABLES_PATH " -w -A INPUT --source 192.168.122.255 --jump REJECT\n";
+        IPTABLES " -w -A INPUT --source 192.168.122.1 --jump ACCEPT\n"
+        IPTABLES " -w -A INPUT --source 192.168.122.255 --jump REJECT\n";
     const struct testFirewallData *data = opaque;
     g_autoptr(virCommandDryRunToken) dryRunToken = virCommandDryRunTokenNew();
 
@@ -585,11 +585,11 @@ testFirewallSingleRollback(const void *opaque G_GNUC_UNUSED)
     int ret = -1;
     const char *actual = NULL;
     const char *expected =
-        IPTABLES_PATH " -w -A INPUT --source 192.168.122.1 --jump ACCEPT\n"
-        IPTABLES_PATH " -w -A INPUT --source 192.168.122.255 --jump REJECT\n"
-        IPTABLES_PATH " -w -D INPUT --source 192.168.122.1 --jump ACCEPT\n"
-        IPTABLES_PATH " -w -D INPUT --source 192.168.122.255 --jump REJECT\n"
-        IPTABLES_PATH " -w -D INPUT --source '!192.168.122.1' --jump REJECT\n";
+        IPTABLES " -w -A INPUT --source 192.168.122.1 --jump ACCEPT\n"
+        IPTABLES " -w -A INPUT --source 192.168.122.255 --jump REJECT\n"
+        IPTABLES " -w -D INPUT --source 192.168.122.1 --jump ACCEPT\n"
+        IPTABLES " -w -D INPUT --source 192.168.122.255 --jump REJECT\n"
+        IPTABLES " -w -D INPUT --source '!192.168.122.1' --jump REJECT\n";
     const struct testFirewallData *data = opaque;
     g_autoptr(virCommandDryRunToken) dryRunToken = virCommandDryRunTokenNew();
 
@@ -666,10 +666,10 @@ testFirewallManyRollback(const void *opaque G_GNUC_UNUSED)
     int ret = -1;
     const char *actual = NULL;
     const char *expected =
-        IPTABLES_PATH " -w -A INPUT --source 192.168.122.1 --jump ACCEPT\n"
-        IPTABLES_PATH " -w -A INPUT --source 192.168.122.255 --jump REJECT\n"
-        IPTABLES_PATH " -w -D INPUT --source 192.168.122.255 --jump REJECT\n"
-        IPTABLES_PATH " -w -D INPUT --source '!192.168.122.1' --jump REJECT\n";
+        IPTABLES " -w -A INPUT --source 192.168.122.1 --jump ACCEPT\n"
+        IPTABLES " -w -A INPUT --source 192.168.122.255 --jump REJECT\n"
+        IPTABLES " -w -D INPUT --source 192.168.122.255 --jump REJECT\n"
+        IPTABLES " -w -D INPUT --source '!192.168.122.1' --jump REJECT\n";
     const struct testFirewallData *data = opaque;
     g_autoptr(virCommandDryRunToken) dryRunToken = virCommandDryRunTokenNew();
 
@@ -750,14 +750,14 @@ testFirewallChainedRollback(const void *opaque G_GNUC_UNUSED)
     int ret = -1;
     const char *actual = NULL;
     const char *expected =
-        IPTABLES_PATH " -w -A INPUT --source 192.168.122.1 --jump ACCEPT\n"
-        IPTABLES_PATH " -w -A INPUT --source 192.168.122.127 --jump REJECT\n"
-        IPTABLES_PATH " -w -A INPUT --source '!192.168.122.1' --jump REJECT\n"
-        IPTABLES_PATH " -w -A INPUT --source 192.168.122.255 --jump REJECT\n"
-        IPTABLES_PATH " -w -D INPUT --source 192.168.122.127 --jump REJECT\n"
-        IPTABLES_PATH " -w -D INPUT --source '!192.168.122.1' --jump REJECT\n"
-        IPTABLES_PATH " -w -D INPUT --source 192.168.122.255 --jump REJECT\n"
-        IPTABLES_PATH " -w -D INPUT --source '!192.168.122.1' --jump REJECT\n";
+        IPTABLES " -w -A INPUT --source 192.168.122.1 --jump ACCEPT\n"
+        IPTABLES " -w -A INPUT --source 192.168.122.127 --jump REJECT\n"
+        IPTABLES " -w -A INPUT --source '!192.168.122.1' --jump REJECT\n"
+        IPTABLES " -w -A INPUT --source 192.168.122.255 --jump REJECT\n"
+        IPTABLES " -w -D INPUT --source 192.168.122.127 --jump REJECT\n"
+        IPTABLES " -w -D INPUT --source '!192.168.122.1' --jump REJECT\n"
+        IPTABLES " -w -D INPUT --source 192.168.122.255 --jump REJECT\n"
+        IPTABLES " -w -D INPUT --source '!192.168.122.1' --jump REJECT\n";
     const struct testFirewallData *data = opaque;
     g_autoptr(virCommandDryRunToken) dryRunToken = virCommandDryRunTokenNew();
 
@@ -892,11 +892,11 @@ testFirewallQueryHook(const char *const*args,
                       int *status G_GNUC_UNUSED,
                       void *opaque G_GNUC_UNUSED)
 {
-    if (STREQ(args[0], IPTABLES_PATH) &&
+    if (STREQ(args[0], IPTABLES) &&
         STREQ(args[1], "-w") &&
         STREQ(args[2], "-L")) {
         *output = g_strdup(TEST_FILTER_TABLE_LIST);
-    } else if (STREQ(args[0], IPTABLES_PATH) &&
+    } else if (STREQ(args[0], IPTABLES) &&
                STREQ(args[1], "-w") &&
                STREQ(args[2], "-t") &&
                STREQ(args[3], "nat") &&
@@ -943,15 +943,15 @@ testFirewallQuery(const void *opaque G_GNUC_UNUSED)
     int ret = -1;
     const char *actual = NULL;
     const char *expected =
-        IPTABLES_PATH " -w -A INPUT --source 192.168.122.1 --jump ACCEPT\n"
-        IPTABLES_PATH " -w -A INPUT --source 192.168.122.127 --jump REJECT\n"
-        IPTABLES_PATH " -w -L\n"
-        IPTABLES_PATH " -w -t nat -L\n"
-        IPTABLES_PATH " -w -A INPUT --source 192.168.122.130 --jump REJECT\n"
-        IPTABLES_PATH " -w -A INPUT --source '!192.168.122.129' --jump REJECT\n"
-        IPTABLES_PATH " -w -A INPUT --source '!192.168.122.129' --jump REJECT\n"
-        IPTABLES_PATH " -w -A INPUT --source 192.168.122.128 --jump REJECT\n"
-        IPTABLES_PATH " -w -A INPUT --source '!192.168.122.1' --jump REJECT\n";
+        IPTABLES " -w -A INPUT --source 192.168.122.1 --jump ACCEPT\n"
+        IPTABLES " -w -A INPUT --source 192.168.122.127 --jump REJECT\n"
+        IPTABLES " -w -L\n"
+        IPTABLES " -w -t nat -L\n"
+        IPTABLES " -w -A INPUT --source 192.168.122.130 --jump REJECT\n"
+        IPTABLES " -w -A INPUT --source '!192.168.122.129' --jump REJECT\n"
+        IPTABLES " -w -A INPUT --source '!192.168.122.129' --jump REJECT\n"
+        IPTABLES " -w -A INPUT --source 192.168.122.128 --jump REJECT\n"
+        IPTABLES " -w -A INPUT --source '!192.168.122.1' --jump REJECT\n";
     const struct testFirewallData *data = opaque;
     g_autoptr(virCommandDryRunToken) dryRunToken = virCommandDryRunTokenNew();
 
-- 
2.32.0




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux