Skip to content

Commit 38f9976

Browse files
committed
Merge pr-43: Resolve conflicts and integrate dependency checking improvements
Resolved merge conflicts by keeping our changes: - BUILDVCS_FLAG for conditional VCS embedding - Portable tar commands (mkdir/cp/tar approach) - Fixed awk variable passing Integrated from pr-43: - Improved dependency checking in build-rpm.sh
2 parents ffb3731 + 90c6e52 commit 38f9976

File tree

1 file changed

+25
-11
lines changed

1 file changed

+25
-11
lines changed

build-rpm.sh

Lines changed: 25 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -36,19 +36,33 @@ EOF
3636
}
3737

3838
check_dependencies() {
39-
local deps=("rpm-build" "go" "pandoc" "make" "git")
40-
local missing=()
41-
42-
for dep in "${deps[@]}"; do
43-
if ! command -v "$dep" &> /dev/null; then
44-
missing+=("$dep")
39+
# Command name -> Package name mapping for Fedora
40+
declare -A deps=(
41+
["rpmbuild"]="rpm-build"
42+
["go"]="golang"
43+
["pandoc"]="pandoc"
44+
["make"]="make"
45+
["git"]="git"
46+
)
47+
local missing_cmds=()
48+
local missing_pkgs=()
49+
50+
for cmd in "${!deps[@]}"; do
51+
if ! command -v "$cmd" &> /dev/null; then
52+
missing_cmds+=("$cmd")
53+
missing_pkgs+=("${deps[$cmd]}")
4554
fi
4655
done
4756

48-
if [ ${#missing[@]} -ne 0 ]; then
49-
echo -e "${RED}Error: Missing dependencies: ${missing[*]}${NC}"
50-
echo -e "${YELLOW}Install on Fedora:${NC}"
51-
echo " sudo dnf install -y rpm-build golang pandoc make git"
57+
if [ ${#missing_cmds[@]} -ne 0 ]; then
58+
echo -e "${RED}Error: Missing required commands: ${missing_cmds[*]}${NC}"
59+
echo
60+
echo -e "${YELLOW}These commands are required but not found in your PATH.${NC}"
61+
echo
62+
echo -e "${YELLOW}To install on Fedora:${NC}"
63+
echo " sudo dnf install -y ${missing_pkgs[*]}"
64+
echo
65+
echo -e "${YELLOW}If packages are already installed, ensure the commands are in your PATH.${NC}"
5266
exit 1
5367
fi
5468
}
@@ -84,7 +98,7 @@ show_info() {
8498
echo " .rpmmacros: $HOME/.rpmmacros"
8599
echo
86100

87-
# Try to get version
101+
# Get version
88102
local version=$(get_version "")
89103
echo "Version Information:"
90104
echo " Current version: $version"

0 commit comments

Comments
 (0)