package/dosfstools: introduce custom install routine
PATCH v4 1/1 package/dosfstools: introduce custom install routine
We can't use dosfstools' install target, because it'll install *all* binaries, even the disabled ones. Also, we can't just delete dosfstools binaries from the target directory after installing them, because other packages (specifically Busybox) may provide tools of the same name, and we may end up deleting those instead.
To avoid any issues, we create our own install routines, which only copy the enabled binaries into the target location.
---
Changes since v3:
- use $(INSTALL) -D -m 0755 $(@D)/src ...
- don't use post-install hooks
- instead call install macros from custom install target
Changes since v2:
- use custom install routine that only copies the binaries we want
Changes since v1:
- don't bother removing man page files
- use rsync instead of tar to copy files to the destination
package/dosfstools/dosfstools.mk | 34 +++++++++++++++++++++----------- 1 file changed, 22 insertions(+), 12 deletions(-)
package/dosfstools/dosfstools.mk +22 -12
@@ -24,26 +24,36 @@ DOSFSTOOLS_CONF_OPTS += LIBS="-liconv" DOSFSTOOLS_DEPENDENCIES += libiconv endif -ifeq ($(BR2_PACKAGE_DOSFSTOOLS_FATLABEL),) -define DOSFSTOOLS_REMOVE_FATLABEL - rm -f $(addprefix $(TARGET_DIR)/sbin/,dosfslabel fatlabel) +ifeq ($(BR2_PACKAGE_DOSFSTOOLS_FATLABEL),y) +define DOSFSTOOLS_INSTALL_FATLABEL + $(INSTALL) -D -m 0755 $(@D)/src/fatlabel $(TARGET_DIR)/sbin + ln -sf fatlabel $(TARGET_DIR)/sbin/dosfslabel endef -DOSFSTOOLS_POST_INSTALL_TARGET_HOOKS += DOSFSTOOLS_REMOVE_FATLABEL endif -ifeq ($(BR2_PACKAGE_DOSFSTOOLS_FSCK_FAT),) -define DOSFSTOOLS_REMOVE_FSCK_FAT - rm -f $(addprefix $(TARGET_DIR)/sbin/,fsck.fat dosfsck fsck.msdos fsck.vfat) +ifeq ($(BR2_PACKAGE_DOSFSTOOLS_FSCK_FAT),y) +define DOSFSTOOLS_INSTALL_FSCK_FAT + $(INSTALL) -D -m 0755 $(@D)/src/fsck.fat $(TARGET_DIR)/sbin + ln -sf fsck.fat $(TARGET_DIR)/sbin/fsck.vfat + ln -sf fsck.fat $(TARGET_DIR)/sbin/fsck.msdos + ln -sf fsck.fat $(TARGET_DIR)/sbin/dosfsck endef -DOSFSTOOLS_POST_INSTALL_TARGET_HOOKS += DOSFSTOOLS_REMOVE_FSCK_FAT endif -ifeq ($(BR2_PACKAGE_DOSFSTOOLS_MKFS_FAT),) -define DOSFSTOOLS_REMOVE_MKFS_FAT - rm -f $(addprefix $(TARGET_DIR)/sbin/,mkfs.fat mkdosfs mkfs.msdos mkfs.vfat) +ifeq ($(BR2_PACKAGE_DOSFSTOOLS_MKFS_FAT),y) +define DOSFSTOOLS_INSTALL_MKFS_FAT + $(INSTALL) -D -m 0755 $(@D)/src/mkfs.fat $(TARGET_DIR)/sbin + ln -sf mkfs.fat $(TARGET_DIR)/sbin/mkdosfs + ln -sf mkfs.fat $(TARGET_DIR)/sbin/mkfs.msdos + ln -sf mkfs.fat $(TARGET_DIR)/sbin/mkfs.vfat endef -DOSFSTOOLS_POST_INSTALL_TARGET_HOOKS += DOSFSTOOLS_REMOVE_MKFS_FAT endif +define DOSFSTOOLS_INSTALL_TARGET_CMDS + $(call DOSFSTOOLS_INSTALL_FATLABEL) + $(call DOSFSTOOLS_INSTALL_FSCK_FAT) + $(call DOSFSTOOLS_INSTALL_MKFS_FAT) +endef + $(eval $(autotools-package)) $(eval $(host-autotools-package))
Signature · 1 line
2.17.1
PATCH v4 1/1 package/dosfstools: introduce custom install routine
Markus, All,
On 2019-05-31 12:41 -0700, Markus Mayer spake thusly:
Quoted 4 lines
We can't use dosfstools' install target, because it'll install *all* binaries, even the disabled ones. Also, we can't just delete dosfstools binaries from the target directory after installing them, because other packages (specifically Busybox) may provide tools of the same name, and
If busybox installs applets also installed by dosfstools, then we also want to expand the exsiting list to also cover dosfstools:
https://git.buildroot.org/buildroot/tree/package/busybox/busybox.mk#n24
Can you send a (separate) patch doing so?
As for "other packages", which one do you refer to? We want to ensure that those other packages and dosfstools do not compete to install their files, so we want to guarantee the ordering between those, so we need an explicit dependency too.
However, I checked in Ubtuntu 19.04, and all the files referenced in this patch ({mkfs,fsck).{fat,vfat,msdos} or mkdosfs or dosfsck) are only provided by dosfstools. I also could not readily identify a package in Buildroot that could provide them either...
Regards,
Yann E. MORIN.
Quoted 82 lines
we may end up deleting those instead.
To avoid any issues, we create our own install routines, which only copy the enabled binaries into the target location.
Signed-off-by Markus Mayer <[email protected]>---
Changes since v3:
- use $(INSTALL) -D -m 0755 $(@D)/src ...
- don't use post-install hooks
- instead call install macros from custom install targetChanges since v2:
- use custom install routine that only copies the binaries we wantChanges since v1:
- don't bother removing man page files
- use rsync instead of tar to copy files to the destinationpackage/dosfstools/dosfstools.mk | 34 +++++++++++++++++++++----------- 1 file changed, 22 insertions(+), 12 deletions(-)package/dosfstools/dosfstools.mk +22
-12@@ -24,26 +24,36 @@ DOSFSTOOLS_CONF_OPTS += LIBS="-liconv" DOSFSTOOLS_DEPENDENCIES += libiconv endif -ifeq ($(BR2_PACKAGE_DOSFSTOOLS_FATLABEL),) -define DOSFSTOOLS_REMOVE_FATLABEL - rm -f $(addprefix $(TARGET_DIR)/sbin/,dosfslabel fatlabel) +ifeq ($(BR2_PACKAGE_DOSFSTOOLS_FATLABEL),y) +define DOSFSTOOLS_INSTALL_FATLABEL + $(INSTALL) -D -m 0755 $(@D)/src/fatlabel $(TARGET_DIR)/sbin + ln -sf fatlabel $(TARGET_DIR)/sbin/dosfslabel endef -DOSFSTOOLS_POST_INSTALL_TARGET_HOOKS += DOSFSTOOLS_REMOVE_FATLABEL endif -ifeq ($(BR2_PACKAGE_DOSFSTOOLS_FSCK_FAT),) -define DOSFSTOOLS_REMOVE_FSCK_FAT - rm -f $(addprefix $(TARGET_DIR)/sbin/,fsck.fat dosfsck fsck.msdos fsck.vfat) +ifeq ($(BR2_PACKAGE_DOSFSTOOLS_FSCK_FAT),y) +define DOSFSTOOLS_INSTALL_FSCK_FAT + $(INSTALL) -D -m 0755 $(@D)/src/fsck.fat $(TARGET_DIR)/sbin + ln -sf fsck.fat $(TARGET_DIR)/sbin/fsck.vfat + ln -sf fsck.fat $(TARGET_DIR)/sbin/fsck.msdos + ln -sf fsck.fat $(TARGET_DIR)/sbin/dosfsck endef -DOSFSTOOLS_POST_INSTALL_TARGET_HOOKS += DOSFSTOOLS_REMOVE_FSCK_FAT endif -ifeq ($(BR2_PACKAGE_DOSFSTOOLS_MKFS_FAT),) -define DOSFSTOOLS_REMOVE_MKFS_FAT - rm -f $(addprefix $(TARGET_DIR)/sbin/,mkfs.fat mkdosfs mkfs.msdos mkfs.vfat) +ifeq ($(BR2_PACKAGE_DOSFSTOOLS_MKFS_FAT),y) +define DOSFSTOOLS_INSTALL_MKFS_FAT + $(INSTALL) -D -m 0755 $(@D)/src/mkfs.fat $(TARGET_DIR)/sbin + ln -sf mkfs.fat $(TARGET_DIR)/sbin/mkdosfs + ln -sf mkfs.fat $(TARGET_DIR)/sbin/mkfs.msdos + ln -sf mkfs.fat $(TARGET_DIR)/sbin/mkfs.vfat endef -DOSFSTOOLS_POST_INSTALL_TARGET_HOOKS += DOSFSTOOLS_REMOVE_MKFS_FAT endif +define DOSFSTOOLS_INSTALL_TARGET_CMDS + $(call DOSFSTOOLS_INSTALL_FATLABEL) + $(call DOSFSTOOLS_INSTALL_FSCK_FAT) + $(call DOSFSTOOLS_INSTALL_MKFS_FAT) +endef + $(eval $(autotools-package)) $(eval $(host-autotools-package))Signature · 6 lines
2.17.1 _______________________________________________ buildroot mailing list buildroot at busybox.net http://lists.busybox.net/mailman/listinfo/buildroot
Signature · 6 lines
.-----------------.--------------------.------------------.--------------------. | Yann E. MORIN | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: | | +33 662 376 056 | Software Designer | \ / CAMPAIGN | ___ | | +33 561 099 427 `------------.-------: X AGAINST | \e/ There is no | | http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL | v conspiracy. | '------------------------------^-------^------------------^--------------------'
PATCH v4 1/1 package/dosfstools: introduce custom install routine
Quoted 9 lines · Yann E. MORIN
Markus, All,
On 2019-05-31 12:41 -0700, Markus Mayer spake thusly:
Quoted 4 lines
We can't use dosfstools' install target, because it'll install *all* binaries, even the disabled ones. Also, we can't just delete dosfstools binaries from the target directory after installing them, because other packages (specifically Busybox) may provide tools of the same name, and
Quoted 5 lines
If busybox installs applets also installed by dosfstools, then we also want to expand the exsiting list to also cover dosfstools:
https://git.buildroot.org/buildroot/tree/package/busybox/busybox.mk#n24Can you send a (separate) patch doing so?
Will do.
Quoted 4 lines
As for "other packages", which one do you refer to? We want to ensure that those other packages and dosfstools do not compete to install their files, so we want to guarantee the ordering between those, so we need an explicit dependency too.
I think busybox is the only other package. Maybe my wording was a bit too general.
Quoted 4 lines
However, I checked in Ubtuntu 19.04, and all the files referenced in this patch ({mkfs,fsck).{fat,vfat,msdos} or mkdosfs or dosfsck) are only provided by dosfstools. I also could not readily identify a package in Buildroot that could provide them either...
We have:
$ grep DOS build/busybox-1.30.1/.config CONFIG_DOS2UNIX=y CONFIG_UNIX2DOS=y CONFIG_MKDOSFS=y
That results in:
[...]
-rwxr-xr-x 1 mmayer mmayer 58088 May 31 12:37 fsck.fat
lrwxrwxrwx 1 mmayer mmayer 8 May 31 12:37 fsck.vfat -> fsck.fat lrwxrwxrwx 1 mmayer mmayer 8 May 31 12:37 fsck.msdos -> fsck.fat lrwxrwxrwx 1 mmayer mmayer 8 May 31 12:37 dosfsck -> fsck.fat
lrwxrwxrwx 1 mmayer mmayer 14 May 31 13:32 mkdosfs -> ../bin/busybox
lrwxrwxrwx 1 mmayer mmayer 14 May 31 13:32 mkfs.vfat -> ../bin/busybox
fsck.fat comes from dosfstools, but mkdosfs is provided by busybox.
Regards,
-Markus
Quoted 93 lines
Regards,
Yann E. MORIN.Quoted 78 lines
we may end up deleting those instead.
To avoid any issues, we create our own install routines, which only copy the enabled binaries into the target location.
Signed-off-by Markus Mayer <[email protected]>---
Changes since v3:
- use $(INSTALL) -D -m 0755 $(@D)/src ...
- don't use post-install hooks
- instead call install macros from custom install targetChanges since v2:
- use custom install routine that only copies the binaries we wantChanges since v1:
- don't bother removing man page files
- use rsync instead of tar to copy files to the destinationpackage/dosfstools/dosfstools.mk | 34 +++++++++++++++++++++----------- 1 file changed, 22 insertions(+), 12 deletions(-)package/dosfstools/dosfstools.mk +22
-13@@ -24,26 +24,36 @@ DOSFSTOOLS_CONF_OPTS += LIBS="-liconv" DOSFSTOOLS_DEPENDENCIES += libiconv endif -ifeq ($(BR2_PACKAGE_DOSFSTOOLS_FATLABEL),) -define DOSFSTOOLS_REMOVE_FATLABEL - rm -f $(addprefix $(TARGET_DIR)/sbin/,dosfslabel fatlabel) +ifeq ($(BR2_PACKAGE_DOSFSTOOLS_FATLABEL),y) +define DOSFSTOOLS_INSTALL_FATLABEL + $(INSTALL) -D -m 0755 $(@D)/src/fatlabel $(TARGET_DIR)/sbin + ln -sf fatlabel $(TARGET_DIR)/sbin/dosfslabel endef -DOSFSTOOLS_POST_INSTALL_TARGET_HOOKS += DOSFSTOOLS_REMOVE_FATLABEL endif -ifeq ($(BR2_PACKAGE_DOSFSTOOLS_FSCK_FAT),) -define DOSFSTOOLS_REMOVE_FSCK_FAT - rm -f $(addprefix $(TARGET_DIR)/sbin/,fsck.fat dosfsck fsck.msdos fsck.vfat) +ifeq ($(BR2_PACKAGE_DOSFSTOOLS_FSCK_FAT),y) +define DOSFSTOOLS_INSTALL_FSCK_FAT + $(INSTALL) -D -m 0755 $(@D)/src/fsck.fat $(TARGET_DIR)/sbin + ln -sf fsck.fat $(TARGET_DIR)/sbin/fsck.vfat + ln -sf fsck.fat $(TARGET_DIR)/sbin/fsck.msdos + ln -sf fsck.fat $(TARGET_DIR)/sbin/dosfsck endef -DOSFSTOOLS_POST_INSTALL_TARGET_HOOKS += DOSFSTOOLS_REMOVE_FSCK_FAT endif -ifeq ($(BR2_PACKAGE_DOSFSTOOLS_MKFS_FAT),) -define DOSFSTOOLS_REMOVE_MKFS_FAT - rm -f $(addprefix $(TARGET_DIR)/sbin/,mkfs.fat mkdosfs mkfs.msdos mkfs.vfat) +ifeq ($(BR2_PACKAGE_DOSFSTOOLS_MKFS_FAT),y) +define DOSFSTOOLS_INSTALL_MKFS_FAT + $(INSTALL) -D -m 0755 $(@D)/src/mkfs.fat $(TARGET_DIR)/sbin + ln -sf mkfs.fat $(TARGET_DIR)/sbin/mkdosfs + ln -sf mkfs.fat $(TARGET_DIR)/sbin/mkfs.msdos + ln -sf mkfs.fat $(TARGET_DIR)/sbin/mkfs.vfat endef -DOSFSTOOLS_POST_INSTALL_TARGET_HOOKS += DOSFSTOOLS_REMOVE_MKFS_FAT endif +define DOSFSTOOLS_INSTALL_TARGET_CMDS + $(call DOSFSTOOLS_INSTALL_FATLABEL) + $(call DOSFSTOOLS_INSTALL_FSCK_FAT) + $(call DOSFSTOOLS_INSTALL_MKFS_FAT) +endef + $(eval $(autotools-package)) $(eval $(host-autotools-package)) --2.17.1
Quoted 4 lines
_______________________________________________
buildroot mailing list
buildroot at busybox.net
http://lists.busybox.net/mailman/listinfo/buildroot--
.-----------------.--------------------.------------------.--------------------.| Yann E. MORIN | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: | | +33 662 376 056 | Software Designer | \ / CAMPAIGN | ___ | | +33 561 099 427 `------------.-------: X AGAINST | \e/ There is no | | http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL | v conspiracy. |'------------------------------^-------^------------------^--------------------'
PATCH v4 1/1 package/dosfstools: introduce custom install routine
Markus, All,
On 2019-05-31 13:35 -0700, Markus Mayer spake thusly:
Quoted 11 lines · Yann E. MORIN
Quoted 9 lines
On 2019-05-31 12:41 -0700, Markus Mayer spake thusly:
Quoted 4 lines
We can't use dosfstools' install target, because it'll install *all* binaries, even the disabled ones. Also, we can't just delete dosfstools binaries from the target directory after installing them, because other packages (specifically Busybox) may provide tools of the same name, and
If busybox installs applets also installed by dosfstools, then we also want to expand the exsiting list to also cover dosfstools:
https://git.buildroot.org/buildroot/tree/package/busybox/busybox.mk#n24
Can you send a (separate) patch doing so?Will do.
Great, thanks.
Quoted 2 lines
I think busybox is the only other package. Maybe my wording was a bit too general.
Ok, sounds sane. Thanks for the feedback!
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 561 099 427 `------------.-------: X AGAINST | \e/ There is no | | http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL | v conspiracy. | '------------------------------^-------^------------------^--------------------'
PATCH v4 1/1 package/dosfstools: introduce custom install routine
In reply to Markus MayerHello,
Quoted 10 lines · On Fri, 31 May 2019 12:41:59 -0700 Markus Mayer <[email protected]> wrote:
We can't use dosfstools' install target, because it'll install *all* binaries, even the disabled ones. Also, we can't just delete dosfstools binaries from the target directory after installing them, because other packages (specifically Busybox) may provide tools of the same name, and we may end up deleting those instead.
To avoid any issues, we create our own install routines, which only copy the enabled binaries into the target location.
Signed-off-by Markus Mayer <[email protected]>
I've applied to master, after doing one change, see below.
package/dosfstools/dosfstools.mk DOSFSTOOLS_CONF_OPTS += LIBS="-liconv" · line 36
Quoted 2 lines
package/dosfstools/dosfstools.mk +2
-0+define DOSFSTOOLS_INSTALL_FSCK_FAT + $(INSTALL) -D -m 0755 $(@D)/src/fsck.fat $(TARGET_DIR)/sbin
The destination path should be a full destination path, which includes the file name. I fixed that in the three places.
Thomas
Signature · 3 lines
Thomas Petazzoni, CTO, Bootlin Embedded Linux and Kernel engineering https://bootlin.com
PATCH v4 1/1 package/dosfstools: introduce custom install routine
In reply to Markus MayerQuoted 11 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
"Markus" == Markus Mayer <[email protected]> writes:
We can't use dosfstools' install target, because it'll install *all* binaries, even the disabled ones. Also, we can't just delete dosfstools binaries from the target directory after installing them, because other packages (specifically Busybox) may provide tools of the same name, and we may end up deleting those instead.
To avoid any issues, we create our own install routines, which only copy the enabled binaries into the target location.
Quoted 6 lines
Signed-off-by Markus Mayer <[email protected]>---
Changes since v3:
- use $(INSTALL) -D -m 0755 $(@D)/src ...
- don't use post-install hooks
- instead call install macros from custom install target
Committed to 2019.02.x, thanks.
Signature · 1 line
Bye, Peter Korsgaard