All of lore.kernel.org
 help / color / mirror / Atom feed
From: Siddharth Menon <simeddon@gmail.com>
To: shuah@kernel.org, trenn@suse.com, jwyatt@redhat.com, jkacur@redhat.com
Cc: Siddharth Menon <simeddon@gmail.com>, linux-pm@vger.kernel.org
Subject: [PATCH] cpupower: add checks for xgettext and msgfmt
Date: Tue, 15 Oct 2024 22:08:54 +0530	[thread overview]
Message-ID: <20241015163854.35204-1-simeddon@gmail.com> (raw)

Check whether xgettext and msgfmt are available on the system before
attempting to generate the .pot and .gmo files and generate.
In case of missing dependency, generate error message directing user
to install the necessary package.

Signed-off-by: Siddharth Menon <simeddon@gmail.com>
---
 tools/power/cpupower/Makefile | 14 +++++++++++---
 1 file changed, 11 insertions(+), 3 deletions(-)

diff --git a/tools/power/cpupower/Makefile b/tools/power/cpupower/Makefile
index 6c02f401069e..38e7daacecf4 100644
--- a/tools/power/cpupower/Makefile
+++ b/tools/power/cpupower/Makefile
@@ -220,12 +220,20 @@ endif
 
 $(OUTPUT)po/$(PACKAGE).pot: $(UTIL_SRC)
 	$(ECHO) "  GETTEXT " $@
-	$(QUIET) xgettext --default-domain=$(PACKAGE) --add-comments \
-		--keyword=_ --keyword=N_ $(UTIL_SRC) -p $(@D) -o $(@F)
+	$(QUIET) if ! command -v xgettext > /dev/null; then \
+		echo "Error: gettext not found. Please install gettext."; \
+	else \
+		xgettext --default-domain=$(PACKAGE) --add-comments \
+		--keyword=_ --keyword=N_ $(UTIL_SRC) -p $(@D) -o $(@F); \
+	fi
 
 $(OUTPUT)po/%.gmo: po/%.po
 	$(ECHO) "  MSGFMT  " $@
-	$(QUIET) msgfmt -o $@ po/$*.po
+	$(QUIET) if ! command -v msgfmt > /dev/null; then \
+		echo "Error: msgfmt not found. Make sure gettext is set up correctly."; \
+	else \
+		msgfmt -o $@ po/$*.po; \
+	fi
 
 create-gmo: ${GMO_FILES}
 
-- 
2.39.5


             reply	other threads:[~2024-10-15 16:39 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-10-15 16:38 Siddharth Menon [this message]
2024-10-15 17:49 ` [PATCH] cpupower: add checks for xgettext and msgfmt John B. Wyatt IV
2024-10-15 21:55   ` Sid
2024-10-15 22:16     ` Shuah Khan

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20241015163854.35204-1-simeddon@gmail.com \
    --to=simeddon@gmail.com \
    --cc=jkacur@redhat.com \
    --cc=jwyatt@redhat.com \
    --cc=linux-pm@vger.kernel.org \
    --cc=shuah@kernel.org \
    --cc=trenn@suse.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.