[pacman-dev] [PATCH v2] libmakepkg: fix missing or inaccurate interdependencies

Eli Schwartz eschwartz at archlinux.org
Tue Apr 16 17:12:39 UTC 2019


When the executable checking was refactored into libmakepkg, it carried
with it, usage of $E_* error codes, which need to be declared from
error.sh but are only available when the parent program already sources
error.sh; additionally, message.sh was only loaded in a parent
library, but not where it was needed, and option.sh was often loaded
when it wasn't needed at all.

util.sh, meanwhile, has always depended on message.sh functions.

Signed-off-by: Eli Schwartz <eschwartz at archlinux.org>
---

v2: fix a bunch more too

 scripts/libmakepkg/buildenv.sh.in            | 5 -----
 scripts/libmakepkg/executable.sh.in          | 5 -----
 scripts/libmakepkg/executable/ccache.sh.in   | 1 +
 scripts/libmakepkg/executable/checksum.sh.in | 1 +
 scripts/libmakepkg/executable/distcc.sh.in   | 1 +
 scripts/libmakepkg/executable/fakeroot.sh.in | 2 +-
 scripts/libmakepkg/executable/gpg.sh.in      | 1 +
 scripts/libmakepkg/executable/gzip.sh.in     | 1 +
 scripts/libmakepkg/executable/pacman.sh.in   | 2 +-
 scripts/libmakepkg/executable/strip.sh.in    | 1 +
 scripts/libmakepkg/executable/sudo.sh.in     | 2 +-
 scripts/libmakepkg/executable/vcs.sh.in      | 3 ++-
 scripts/libmakepkg/util/util.sh.in           | 3 +++
 13 files changed, 14 insertions(+), 14 deletions(-)

diff --git a/scripts/libmakepkg/buildenv.sh.in b/scripts/libmakepkg/buildenv.sh.in
index bb1c73bc..a8d416c8 100644
--- a/scripts/libmakepkg/buildenv.sh.in
+++ b/scripts/libmakepkg/buildenv.sh.in
@@ -22,11 +22,6 @@
 [[ -n "$LIBMAKEPKG_BUILDENV_SH" ]] && return
 LIBMAKEPKG_BUILDENV_SH=1
 
-LIBRARY=${LIBRARY:-'@libmakepkgdir@'}
-
-source "$LIBRARY/util/message.sh"
-
-
 declare -a buildenv_functions build_options
 
 for lib in "$LIBRARY/buildenv/"*.sh; do
diff --git a/scripts/libmakepkg/executable.sh.in b/scripts/libmakepkg/executable.sh.in
index 92031d43..cac016fb 100644
--- a/scripts/libmakepkg/executable.sh.in
+++ b/scripts/libmakepkg/executable.sh.in
@@ -21,11 +21,6 @@
 [[ -n "$LIBMAKEPKG_EXECUTABLE_SH" ]] && return
 LIBMAKEPKG_EXECUTABLE_SH=1
 
-LIBRARY=${LIBRARY:-'@libmakepkgdir@'}
-
-source "$LIBRARY/util/message.sh"
-
-
 declare -a executable_functions
 
 for lib in "$LIBRARY/executable/"*.sh; do
diff --git a/scripts/libmakepkg/executable/ccache.sh.in b/scripts/libmakepkg/executable/ccache.sh.in
index 6143fee2..df4a4ed4 100644
--- a/scripts/libmakepkg/executable/ccache.sh.in
+++ b/scripts/libmakepkg/executable/ccache.sh.in
@@ -23,6 +23,7 @@ LIBMAKEPKG_EXECUTABLE_CCACHE_SH=1
 
 LIBRARY=${LIBRARY:-'@libmakepkgdir@'}
 
+source "$LIBRARY/util/message.sh"
 source "$LIBRARY/util/option.sh"
 
 executable_functions+=('executable_ccache')
diff --git a/scripts/libmakepkg/executable/checksum.sh.in b/scripts/libmakepkg/executable/checksum.sh.in
index 0a4b0c9e..c521446c 100644
--- a/scripts/libmakepkg/executable/checksum.sh.in
+++ b/scripts/libmakepkg/executable/checksum.sh.in
@@ -23,6 +23,7 @@ LIBMAKEPKG_EXECUTABLE_CHECKSUM_SH=1
 
 LIBRARY=${LIBRARY:-'@libmakepkgdir@'}
 
+source "$LIBRARY/util/message.sh"
 
 executable_functions+=('executable_checksum')
 
diff --git a/scripts/libmakepkg/executable/distcc.sh.in b/scripts/libmakepkg/executable/distcc.sh.in
index d3a8cc25..9317b4ac 100644
--- a/scripts/libmakepkg/executable/distcc.sh.in
+++ b/scripts/libmakepkg/executable/distcc.sh.in
@@ -23,6 +23,7 @@ LIBMAKEPKG_EXECUTABLE_DISTCC_SH=1
 
 LIBRARY=${LIBRARY:-'@libmakepkgdir@'}
 
+source "$LIBRARY/util/message.sh"
 source "$LIBRARY/util/option.sh"
 
 executable_functions+=('executable_distcc')
diff --git a/scripts/libmakepkg/executable/fakeroot.sh.in b/scripts/libmakepkg/executable/fakeroot.sh.in
index 09064543..cda1100a 100644
--- a/scripts/libmakepkg/executable/fakeroot.sh.in
+++ b/scripts/libmakepkg/executable/fakeroot.sh.in
@@ -23,7 +23,7 @@ LIBMAKEPKG_EXECUTABLE_FAKEROOT_SH=1
 
 LIBRARY=${LIBRARY:-'@libmakepkgdir@'}
 
-source "$LIBRARY/util/option.sh"
+source "$LIBRARY/util/message.sh"
 
 executable_functions+=('executable_fakeroot')
 
diff --git a/scripts/libmakepkg/executable/gpg.sh.in b/scripts/libmakepkg/executable/gpg.sh.in
index 139773ef..5812a953 100644
--- a/scripts/libmakepkg/executable/gpg.sh.in
+++ b/scripts/libmakepkg/executable/gpg.sh.in
@@ -23,6 +23,7 @@ LIBMAKEPKG_EXECUTABLE_GPG_SH=1
 
 LIBRARY=${LIBRARY:-'@libmakepkgdir@'}
 
+source "$LIBRARY/util/message.sh"
 source "$LIBRARY/util/option.sh"
 
 executable_functions+=('executable_gpg')
diff --git a/scripts/libmakepkg/executable/gzip.sh.in b/scripts/libmakepkg/executable/gzip.sh.in
index bb1626bc..1b8cfdf5 100644
--- a/scripts/libmakepkg/executable/gzip.sh.in
+++ b/scripts/libmakepkg/executable/gzip.sh.in
@@ -23,6 +23,7 @@ LIBMAKEPKG_EXECUTABLE_GZIP_SH=1
 
 LIBRARY=${LIBRARY:-'@libmakepkgdir@'}
 
+source "$LIBRARY/util/message.sh"
 source "$LIBRARY/util/option.sh"
 
 executable_functions+=('executable_gzip')
diff --git a/scripts/libmakepkg/executable/pacman.sh.in b/scripts/libmakepkg/executable/pacman.sh.in
index d1433ffd..bb3ce921 100644
--- a/scripts/libmakepkg/executable/pacman.sh.in
+++ b/scripts/libmakepkg/executable/pacman.sh.in
@@ -23,7 +23,7 @@ LIBMAKEPKG_EXECUTABLE_PACMAN_SH=1
 
 LIBRARY=${LIBRARY:-'@libmakepkgdir@'}
 
-source "$LIBRARY/util/option.sh"
+source "$LIBRARY/util/message.sh"
 
 executable_functions+=('executable_pacman')
 
diff --git a/scripts/libmakepkg/executable/strip.sh.in b/scripts/libmakepkg/executable/strip.sh.in
index ab069a45..1917e78c 100644
--- a/scripts/libmakepkg/executable/strip.sh.in
+++ b/scripts/libmakepkg/executable/strip.sh.in
@@ -23,6 +23,7 @@ LIBMAKEPKG_EXECUTABLE_STRIP_SH=1
 
 LIBRARY=${LIBRARY:-'@libmakepkgdir@'}
 
+source "$LIBRARY/util/message.sh"
 source "$LIBRARY/util/option.sh"
 
 executable_functions+=('executable_strip')
diff --git a/scripts/libmakepkg/executable/sudo.sh.in b/scripts/libmakepkg/executable/sudo.sh.in
index 7ec18ec5..6cd007e1 100644
--- a/scripts/libmakepkg/executable/sudo.sh.in
+++ b/scripts/libmakepkg/executable/sudo.sh.in
@@ -23,7 +23,7 @@ LIBMAKEPKG_EXECUTABLE_SUDO_SH=1
 
 LIBRARY=${LIBRARY:-'@libmakepkgdir@'}
 
-source "$LIBRARY/util/option.sh"
+source "$LIBRARY/util/message.sh"
 
 executable_functions+=('executable_sudo')
 
diff --git a/scripts/libmakepkg/executable/vcs.sh.in b/scripts/libmakepkg/executable/vcs.sh.in
index 46631f39..021e1633 100644
--- a/scripts/libmakepkg/executable/vcs.sh.in
+++ b/scripts/libmakepkg/executable/vcs.sh.in
@@ -23,7 +23,8 @@ LIBMAKEPKG_EXECUTABLE_VCS_SH=1
 
 LIBRARY=${LIBRARY:-'@libmakepkgdir@'}
 
-source "$LIBRARY/util/option.sh"
+source "$LIBRARY/util/error.sh"
+source "$LIBRARY/util/message.sh"
 
 executable_functions+=('executable_vcs')
 
diff --git a/scripts/libmakepkg/util/util.sh.in b/scripts/libmakepkg/util/util.sh.in
index c2f5897e..5ea3ed9b 100644
--- a/scripts/libmakepkg/util/util.sh.in
+++ b/scripts/libmakepkg/util/util.sh.in
@@ -22,6 +22,9 @@
 [[ -n "$LIBMAKEPKG_UTIL_UTIL_SH" ]] && return
 LIBMAKEPKG_UTIL_UTIL_SH=1
 
+LIBRARY=${LIBRARY:-'@libmakepkgdir@'}
+
+source "$LIBRARY/util/message.sh"
 
 ##
 #  usage : in_array( $needle, $haystack )
-- 
2.21.0


More information about the pacman-dev mailing list