fs/common.mk: support comments in user table files
PATCH 1/1 fs/common.mk: support comments in user table files
The format of the users table files is non trivial, so it is sometimes handy to add comments explaining the syntax (or simply the reason for the user) inline in the files.
Support comment lines prefixed with '#' similar to shell / makedevs files and strip those lines before passing to the mkusers script.
--- fs/common.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/common.mk +1 -1
@@ -87,7 +87,7 @@ endif echo "$$(HOST_DIR)/usr/bin/makedevs -d $$(FULL_DEVICE_TABLE) $$(TARGET_DIR)" >> $$(FAKEROOT_SCRIPT) endif ifneq ($$(ROOTFS_USERS_TABLES),) - cat $$(ROOTFS_USERS_TABLES) >> $$(USERS_TABLE) + sed '/^#/d' $$(ROOTFS_USERS_TABLES) >> $$(USERS_TABLE) endif printf '$$(subst $$(sep),\n,$$(PACKAGES_USERS))' >> $$(USERS_TABLE) PATH=$$(BR_PATH) $$(TOPDIR)/support/scripts/mkusers $$(USERS_TABLE) $$(TARGET_DIR) >> $$(FAKEROOT_SCRIPT)
Signature · 1 line
2.1.4
PATCH 1/1 fs/common.mk: support comments in user table files
Peter, Yann,
Quoted 8 lines · Peter Korsgaard
The format of the users table files is non trivial, so it is sometimes handy to add comments explaining the syntax (or simply the reason for the user) inline in the files.
Support comment lines prefixed with '#' similar to shell / makedevs files and strip those lines before passing to the mkusers script.
Signed-off-by Peter Korsgaard <[email protected]>
Shouldn't it the responsibility of the mkusers script to ignore such comments instead ?
Thanks,
Thomas
Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons Embedded Linux, Kernel and Android engineering http://free-electrons.com
PATCH 1/1 fs/common.mk: support comments in user table files
Quoted 8 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
"Thomas" == Thomas Petazzoni <[email protected]> writes:
Peter, Yann,
Quoted 4 lines · Peter Korsgaard
The format of the users table files is non trivial, so it is sometimes handy to add comments explaining the syntax (or simply the reason for the user) inline in the files.
Quoted 7 lines
Quoted 4 lines
Support comment lines prefixed with '#' similar to shell / makedevs files and strip those lines before passing to the mkusers script.
Signed-off-by Peter Korsgaard <[email protected]>Shouldn't it the responsibility of the mkusers script to ignore such comments instead ?
It could be, but that is more work as it iterates over the (combined) file multiple times, and comments only really makes sense for custom users files (and nog <PKG>_USERS) so just stripping those lines when handling the custom files imho makes sense.
Signature · 2 lines
Venlig hilsen, Peter Korsgaard
PATCH 1/1 fs/common.mk: support comments in user table files
Peter, Thomas, All,
On 2015-10-16 17:10 +0200, Peter Korsgaard spake thusly:
Quoted 11 lines
Quoted 11 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
"Thomas" == Thomas Petazzoni <[email protected]> writes:
Peter, Yann,
Quoted 7 lines · Peter Korsgaard
The format of the users table files is non trivial, so it is sometimes handy to add comments explaining the syntax (or simply the reason for the user) inline in the files.
Support comment lines prefixed with '#' similar to shell / makedevs files and strip those lines before passing to the mkusers script.
Quoted 7 lines
Quoted 4 lines
Quoted 1 line
Signed-off-by Peter Korsgaard <[email protected]>Shouldn't it the responsibility of the mkusers script to ignore such comments instead ?
It could be, but that is more work as it iterates over the (combined) file multiple times,
Arguably, we could read the file only once and store the lines in variables. Then, we could do the filtering in the script.
However, that script is not supposed to be called outside of Buildroot, so we don't really care where we do the filtering.
Quoted 3 lines
and comments only really makes sense for custom
users files (and nog <PKG>_USERS) so just stripping those lines when handling the custom files imho makes sense.
Still, the script could probably use a bit of love in this area...
Regards,
Yann E. MORIN.
Signature · 6 lines
.-----------------.--------------------.------------------.--------------------. | Yann E. MORIN | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: | | +33 662 376 056 | Software Designer | \ / CAMPAIGN | ___ | | +33 223 225 172 `------------.-------: X AGAINST | \e/ There is no | | http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL | v conspiracy. | '------------------------------^-------^------------------^--------------------'
PATCH 1/1 fs/common.mk: support comments in user table files
In reply to Peter KorsgaardPeter, All,
On 2015-10-16 16:50 +0200, Peter Korsgaard spake thusly:
Quoted 17 lines
The format of the users table files is non trivial, so it is sometimes handy to add comments explaining the syntax (or simply the reason for the user) inline in the files.
Support comment lines prefixed with '#' similar to shell / makedevs files and strip those lines before passing to the mkusers script.
Signed-off-by Peter Korsgaard <[email protected]>--- fs/common.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)fs/common.mk +0
-0
fs/common.mk endif · line 90
Quoted 5 lines
fs/common.mk +1
-1@@ -87,7 +87,7 @@ endif echo "$$(HOST_DIR)/usr/bin/makedevs -d $$(FULL_DEVICE_TABLE) $$(TARGET_DIR)" >> $$(FAKEROOT_SCRIPT) endif ifneq ($$(ROOTFS_USERS_TABLES),) - cat $$(ROOTFS_USERS_TABLES) >> $$(USERS_TABLE) + sed '/^#/d' $$(ROOTFS_USERS_TABLES) >> $$(USERS_TABLE)
Thomas and I both think it should be done in the script itself. I'll do it. ;-)
Regards,
Yann E. MORIN.
Quoted 6 lines
fs/common.mk +0
-0endif printf '$$(subst $$(sep),\n,$$(PACKAGES_USERS))' >> $$(USERS_TABLE) PATH=$$(BR_PATH) $$(TOPDIR)/support/scripts/mkusers $$(USERS_TABLE) $$(TARGET_DIR) >> $$(FAKEROOT_SCRIPT)Signature · 1 line
2.1.4
Signature · 6 lines
.-----------------.--------------------.------------------.--------------------. | Yann E. MORIN | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: | | +33 662 376 056 | Software Designer | \ / CAMPAIGN | ___ | | +33 223 225 172 `------------.-------: X AGAINST | \e/ There is no | | http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL | v conspiracy. | '------------------------------^-------^------------------^--------------------'
PATCH 1/1 fs/common.mk: support comments in user table files
Quoted 16 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
"Yann" == Yann E MORIN <[email protected]> writes:
Peter, All,
On 2015-10-16 16:50 +0200, Peter Korsgaard spake thusly:Quoted 12 lines
The format of the users table files is non trivial, so it is sometimes handy to add comments explaining the syntax (or simply the reason for the user) inline in the files.
Support comment lines prefixed with '#' similar to shell / makedevs files and strip those lines before passing to the mkusers script.
Signed-off-by Peter Korsgaard <[email protected]>---
fs/common.mk| 2 +-1 file changed, 1 insertion(+), 1 deletion(-)
Quoted 13 lines
fs/common.mk endif · line 90
Quoted 10 lines
fs/common.mk +0
-0@@ -87,7 +87,7 @@ endif echo "$$(HOST_DIR)/usr/bin/makedevs -d $$(FULL_DEVICE_TABLE) $$(TARGET_DIR)" >> $$(FAKEROOT_SCRIPT)endif
ifneq ($$(ROOTFS_USERS_TABLES),)fs/common.mk +1
-1- cat $$(ROOTFS_USERS_TABLES) >> $$(USERS_TABLE) + sed '/^#/d' $$(ROOTFS_USERS_TABLES) >> $$(USERS_TABLE)Thomas and I both think it should be done in the script itself. I'll do it. ;-)
Ok, fine by me. Again, I'm not particular in favour of one approach over the other - Doing it like this was just simpler as it is a trivial oneliner.
Signature · 2 lines
Venlig hilsen, Peter Korsgaard
PATCH 1/1 fs/common.mk: support comments in user table files
In reply to Peter KorsgaardPeter,
Quoted 8 lines · Peter Korsgaard
The format of the users table files is non trivial, so it is sometimes handy to add comments explaining the syntax (or simply the reason for the user) inline in the files.
Support comment lines prefixed with '#' similar to shell / makedevs files and strip those lines before passing to the mkusers script.
Signed-off-by Peter Korsgaard <[email protected]>
Yann has added support in mkusers to ignore comments, so I applied Yann's patch and marked yours as Rejected.
Thanks!
Thomas
Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons Embedded Linux, Kernel and Android engineering http://free-electrons.com