From 858c3b6f128f59d7c6721be8ab429ff9149d7f25 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Mon, 15 Dec 2025 00:36:35 +0000 Subject: [PATCH 1/4] Initial plan From 9e7d59462b9f5a469432acd1f1ce3fc91cf62e0b Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Mon, 15 Dec 2025 00:38:37 +0000 Subject: [PATCH 2/4] Improve dependency checking with actual command names - Changed from checking package names (rpm-build) to actual commands (rpmbuild) - Added mapping between command names and package names for Fedora - Enhanced error messages to be more specific about missing commands - Added guidance for when packages are installed but commands not in PATH Co-authored-by: mapitman <4205286+mapitman@users.noreply.github.com> --- build-rpm.sh | 34 ++++++++++++++++++++++++---------- 1 file changed, 24 insertions(+), 10 deletions(-) diff --git a/build-rpm.sh b/build-rpm.sh index 4a53bac..9f1c96f 100755 --- a/build-rpm.sh +++ b/build-rpm.sh @@ -36,19 +36,33 @@ EOF } check_dependencies() { - local deps=("rpm-build" "go" "pandoc" "make" "git") - local missing=() - - for dep in "${deps[@]}"; do - if ! command -v "$dep" &> /dev/null; then - missing+=("$dep") + # Map of command names to package names for Fedora + declare -A deps=( + ["rpmbuild"]="rpm-build" + ["go"]="golang" + ["pandoc"]="pandoc" + ["make"]="make" + ["git"]="git" + ) + local missing_cmds=() + local missing_pkgs=() + + for cmd in "${!deps[@]}"; do + if ! command -v "$cmd" &> /dev/null; then + missing_cmds+=("$cmd") + missing_pkgs+=("${deps[$cmd]}") fi done - if [ ${#missing[@]} -ne 0 ]; then - echo -e "${RED}Error: Missing dependencies: ${missing[*]}${NC}" - echo -e "${YELLOW}Install on Fedora:${NC}" - echo " sudo dnf install -y rpm-build golang pandoc make git" + if [ ${#missing_cmds[@]} -ne 0 ]; then + echo -e "${RED}Error: Missing required commands: ${missing_cmds[*]}${NC}" + echo + echo -e "${YELLOW}These commands are required but not found in your PATH.${NC}" + echo + echo -e "${YELLOW}To install on Fedora:${NC}" + echo " sudo dnf install -y ${missing_pkgs[*]}" + echo + echo -e "${YELLOW}If packages are already installed, ensure the commands are in your PATH.${NC}" exit 1 fi } From 850d0d441c72249df308705ffd601550955c0e4d Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Mon, 15 Dec 2025 00:39:28 +0000 Subject: [PATCH 3/4] Improve comment clarity in check_dependencies Co-authored-by: mapitman <4205286+mapitman@users.noreply.github.com> --- build-rpm.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build-rpm.sh b/build-rpm.sh index 9f1c96f..ea780f9 100755 --- a/build-rpm.sh +++ b/build-rpm.sh @@ -36,7 +36,7 @@ EOF } check_dependencies() { - # Map of command names to package names for Fedora + # Command name -> Package name mapping for Fedora declare -A deps=( ["rpmbuild"]="rpm-build" ["go"]="golang" From 19f0f9d01feb3daffc3871d9ab005990633f8b51 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Mon, 15 Dec 2025 00:51:19 +0000 Subject: [PATCH 4/4] Fix tar command to handle VERSION with forward slashes Co-authored-by: mapitman <4205286+mapitman@users.noreply.github.com> --- Makefile | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/Makefile b/Makefile index aef5e10..989adee 100644 --- a/Makefile +++ b/Makefile @@ -1,5 +1,8 @@ MANSECTION ?= 1 SHELL=/bin/bash +# Sanitize VERSION for use in filenames and tar transform expressions +# Replace forward slashes with dashes to avoid issues with tar --transform +VERSION_SAFE = $(subst /,-,$(VERSION)) .PHONY: clean snap rpm rpm-setup rpm-local rpm-clean ci-sim-ubuntu ci-sim-fedora ci-sim default: linux all: linux windows darwin freebsd @@ -20,7 +23,7 @@ deb/linux-amd64: bin/linux-amd64/mdview cp -r bin/linux-amd64/mdview package/usr/bin/mdview cp mdview.1 package/usr/share/man/man1/ dpkg-deb --build package - mv package.deb mdview_$(VERSION)_amd64.deb + mv package.deb mdview_$(VERSION_SAFE)_amd64.deb deb/linux-arm64: bin/linux-arm64/mdview mkdir -p package/DEBIAN @@ -31,7 +34,7 @@ deb/linux-arm64: bin/linux-arm64/mdview cp -r bin/linux-arm64/mdview package/usr/bin/mdview cp mdview.1 package/usr/share/man/man1/ dpkg-deb --build package - mv package.deb mdview_$(VERSION)_arm64.deb + mv package.deb mdview_$(VERSION_SAFE)_arm64.deb snap: snapcraft pack @@ -39,36 +42,36 @@ snap: bin/linux-amd64/mdview: manpage env GOOS=linux GOARCH=amd64 go build -buildvcs=false -ldflags "-X main.appVersion=$(VERSION)" -o ./bin/linux-amd64/mdview cp mdview.1 bin/linux-amd64/ - tar czvf mdview-$(VERSION)-linux-amd64.tar.gz --transform s/linux-amd64/mdview-$(VERSION)/ -C bin linux-amd64 + tar czvf mdview-$(VERSION_SAFE)-linux-amd64.tar.gz --transform s/linux-amd64/mdview-$(VERSION_SAFE)/ -C bin linux-amd64 bin/linux-i386/mdview: env GOOS=linux GOARCH=386 go build -buildvcs=false -ldflags "-X main.appVersion=$(VERSION)" -o ./bin/linux-i386/mdview cp mdview.1 bin/linux-i386/ - tar czvf mdview-$(VERSION)-linux-i386.tar.gz --transform s/linux-i386/mdview-$(VERSION)/ -C bin linux-i386 + tar czvf mdview-$(VERSION_SAFE)-linux-i386.tar.gz --transform s/linux-i386/mdview-$(VERSION_SAFE)/ -C bin linux-i386 bin/linux-arm64/mdview: env GOOS=linux GOARCH=arm64 go build -buildvcs=false -ldflags "-X main.appVersion=$(VERSION)" -o ./bin/linux-arm64/mdview cp mdview.1 bin/linux-arm64/ - tar czvf mdview-$(VERSION)-linux-arm64.tar.gz --transform s/linux-arm64/mdview-$(VERSION)/ -C bin linux-arm64 + tar czvf mdview-$(VERSION_SAFE)-linux-arm64.tar.gz --transform s/linux-arm64/mdview-$(VERSION_SAFE)/ -C bin linux-arm64 bin/windows-amd64/mdview.exe: env GOOS=windows GOARCH=amd64 go build -buildvcs=false -ldflags "-X main.appVersion=$(VERSION)" -o ./bin/windows-amd64/mdview.exe - zip -j mdview-$(VERSION)-windows-amd64.zip bin/windows-amd64/mdview.exe + zip -j mdview-$(VERSION_SAFE)-windows-amd64.zip bin/windows-amd64/mdview.exe bin/darwin-amd64/mdview: env GOOS=darwin GOARCH=amd64 go build -buildvcs=false -ldflags "-X main.appVersion=$(VERSION)" -o ./bin/darwin-amd64/mdview cp mdview.1 bin/darwin-amd64/ - tar czvf mdview-$(VERSION)-darwin-amd64.tar.gz --transform s/darwin-amd64/mdview-$(VERSION)/ -C bin darwin-amd64 + tar czvf mdview-$(VERSION_SAFE)-darwin-amd64.tar.gz --transform s/darwin-amd64/mdview-$(VERSION_SAFE)/ -C bin darwin-amd64 bin/darwin-arm64/mdview: env GOOS=darwin GOARCH=arm64 go build -buildvcs=false -ldflags "-X main.appVersion=$(VERSION)" -o ./bin/darwin-arm64/mdview cp mdview.1 bin/darwin-arm64/ - tar czvf mdview-$(VERSION)-darwin-arm64.tar.gz --transform s/darwin-arm64/mdview-$(VERSION)/ -C bin darwin-arm64 + tar czvf mdview-$(VERSION_SAFE)-darwin-arm64.tar.gz --transform s/darwin-arm64/mdview-$(VERSION_SAFE)/ -C bin darwin-arm64 bin/freebsd-amd64/mdview: env GOOS=freebsd GOARCH=amd64 go build -buildvcs=false -ldflags "-X main.appVersion=$(VERSION)" -o ./bin/freebsd-amd64/mdview cp mdview.1 bin/freebsd-amd64/mdview - tar czvf mdview-$(VERSION)-freebsd-amd64.tar.gz --transform s/freebsd-amd64/mdview-$(VERSION)/ -C bin freebsd-amd64 + tar czvf mdview-$(VERSION_SAFE)-freebsd-amd64.tar.gz --transform s/freebsd-amd64/mdview-$(VERSION_SAFE)/ -C bin freebsd-amd64 clean: rm -rf bin