Skip to content

Commit

Permalink
meson: fix incorrect substitutions in configured files
Browse files Browse the repository at this point in the history
The custom Makefile rules performed this substitution:

@@var@@ -> VAL

However, meson did this substitution:

@@var@@ -> @Val@

This produced incorrect behavior, such as configuring a udev file to
read:

install_items+=" @/usr/etc/udev/rules.d@/70-nvmf-autoconnect.rules "

muon, meanwhile, failed loudly with:

/tmp/nvme-cli/nvmf-autoconnect/dracut-conf/70-nvmf-autoconnect.conf.in:1:19: error: key of zero length not supported
  1 | install_items+=" @@UDEVRULESDIR@@/70-nvmf-autoconnect.rules "
                        ^
/tmp/nvme-cli/meson.build:161:1: error: in function configure_file
161 | configure_file(
      ^

Since meson does not support custom token rules for configuring
replacements, and there is no real benefit to doubling the @@, just fix
this to use one @.
  • Loading branch information
eli-schwartz committed Dec 24, 2021
1 parent 6e6e4ea commit bdec225
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 9 deletions.
8 changes: 4 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -222,11 +222,11 @@ install-spec: install-bin install-man install-bash-completion install-zsh-comple
install: install-spec install-hostparams

nvme.spec: nvme.spec.in NVME-VERSION-FILE
sed -e 's/@@VERSION@@/$(NVME_VERSION)/g' < $< > $@+
sed -e 's/@VERSION@/$(NVME_VERSION)/g' < $< > $@+
mv $@+ $@

70-nvmf-autoconnect.conf: nvmf-autoconnect/dracut-conf/70-nvmf-autoconnect.conf.in
sed -e 's#@@UDEVRULESDIR@@#$(UDEVRULESDIR)#g' < $< > $@+
sed -e 's#@UDEVRULESDIR@#$(UDEVRULESDIR)#g' < $< > $@+
mv $@+ $@

dist: nvme.spec
Expand All @@ -236,9 +236,9 @@ dist: nvme.spec
gzip -f -9 nvme-$(NVME_VERSION).tar

control: nvme.control.in NVME-VERSION-FILE
sed -e 's/@@VERSION@@/$(NVME_VERSION)/g' < $< > $@+
sed -e 's/@VERSION@/$(NVME_VERSION)/g' < $< > $@+
mv $@+ $@
sed -e 's/@@DEPENDS@@/$(LIB_DEPENDS)/g' < $@ > $@+
sed -e 's/@DEPENDS@/$(LIB_DEPENDS)/g' < $@ > $@+
mv $@+ $@

pkg: control nvme.control.in
Expand Down
4 changes: 2 additions & 2 deletions nvme.control.in
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
Package: nvme
Version: @@VERSION@@
Version: @VERSION@
Section: base
Priority: optional
Architecture: amd64
Depends: @@DEPENDS@@
Depends: @DEPENDS@
Maintainer: Keith Busch <kbusch@kernel.org>
Description: NVM-Express Command Line Interface
The nvme management tool
4 changes: 2 additions & 2 deletions nvme.spec.in
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
Name: nvme
Version: @@VERSION@@
Version: @VERSION@
Release: 1%{?dist}
Summary: Core nvme tools
License: GPL
Group: Development/Tools
URL: https://github.com/linux-nvme/nvme-cli/
Source: nvme-@@VERSION@@.tar.gz
Source: nvme-@VERSION@.tar.gz
Provides: nvme
Requires(post): util-linux systemd systemd-udev
BuildRoot: %{_tmppath}/%{name}-%{version}-root
Expand Down
2 changes: 1 addition & 1 deletion nvmf-autoconnect/dracut-conf/70-nvmf-autoconnect.conf.in
Original file line number Diff line number Diff line change
@@ -1 +1 @@
install_items+=" @@UDEVRULESDIR@@/70-nvmf-autoconnect.rules "
install_items+=" @UDEVRULESDIR@/70-nvmf-autoconnect.rules "

0 comments on commit bdec225

Please sign in to comment.