Skip to contentSkip to conversation

package/bash-completion: new package

PATCH Superseded Romain Naour 2 participants 3 messages Jan 11, 2018 – Jan 19, 2018

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 package/bash-completion: new package

From: Jeremy Rosen <[email protected]>

---
v2: use a install target hook (Baruch)
install to staging

---
 package/Config.in                            |  1 +
 package/bash-completion/Config.in            |  7 +++++++
 package/bash-completion/bash-completion.hash |  3 +++
 package/bash-completion/bash-completion.mk   | 22 ++++++++++++++++++++++
 4 files changed, 33 insertions(+)
 create mode 100644 package/bash-completion/Config.in
 create mode 100644 package/bash-completion/bash-completion.hash
 create mode 100644 package/bash-completion/bash-completion.mk
package/Config.in +1 -0
index 01f4095..d41d855 100644
@@ -1892,6 +1892,7 @@ comment "Shells"
 	source "package/zsh/Config.in"
 comment "Utilities"
 	source "package/at/Config.in"
+	source "package/bash-completion/Config.in"
 	source "package/ccrypt/Config.in"
 	source "package/crudini/Config.in"
 	source "package/dialog/Config.in"
package/bash-completion/Config.in new file +7 -0
new file mode 100644
index 0000000..597c928
@@ -0,0 +1,7 @@
+config BR2_PACKAGE_BASH_COMPLETION
+	bool "bash completion"
+	depends on BR2_PACKAGE_BASH
+	help
+	  Add bash completion infrastructure.
+
+	  https://github.com/scop/bash-completion
package/bash-completion/bash-completion.hash new file +3 -0
new file mode 100644
index 0000000..facbeb0
@@ -0,0 +1,3 @@
+# Locally calculated
+sha256 41ba892d3f427d4a686de32673f35401bc947a7801f684127120cdb13641441e  bash-completion-2.7.tar.xz
+sha256 ab15fd526bd8dd18a9e77ebc139656bf4d33e97fc7238cd11bf60e2b9b8666c6  COPYING
package/bash-completion/bash-completion.mk new file +22 -0
new file mode 100644
index 0000000..b6606ad
@@ -0,0 +1,22 @@
+################################################################################
+#
+# bash-completion
+#
+################################################################################
+
+BASH_COMPLETION_VERSION = 2.7
+BASH_COMPLETION_SITE = https://github.com/scop/bash-completion/releases/download/$(BASH_COMPLETION_VERSION)
+BASH_COMPLETION_SOURCE = bash-completion-$(BASH_COMPLETION_VERSION).tar.xz
+BASH_COMPLETION_LICENSE = GPL-2.0+
+BASH_COMPLETION_LICENSE_FILES = COPYING
+
+# Install bash-completion.pc file
+BASH_COMPLETION_INSTALL_STAGING = YES
+
+define BASH_COMPLETION_INSTALL_FILE
+	echo ". /usr/share/bash-completion/bash_completion" > $(TARGET_DIR)/etc/bash_completion
+endef
+
+BASH_COMPLETION_POST_INSTALL_TARGET_HOOKS += BASH_COMPLETION_INSTALL_FILE
+
+$(eval $(autotools-package))
Signature · 1 line
2.7.4
#1 lore raw

PATCH v2 1/1 package/bash-completion: new package

Hello,

package/bash-completion/bash-completion.mk line 18

Quoted 3 lines · Romain Naour
package/bash-completion/bash-completion.mk new file +3 -0
+define BASH_COMPLETION_INSTALL_FILE
+	echo ". /usr/share/bash-completion/bash_completion" > $(TARGET_DIR)/etc/bash_completion
+endef

Who/what is reading this /etc/bash_completion file? Is bash itself automatically loading this file? I'm asking because on my distro, I have /etc/bash_completion.d/ and no /etc/bash_completion.

It seems like my bashrc here is automatically
including /usr/share/bash-completion/bash_completion, and otherwise falls back to /etc/bash_completion:

if [ -f /usr/share/bash-completion/bash_completion ]; then
. /usr/share/bash-completion/bash_completion
elif [ -f /etc/bash_completion ]; then
. /etc/bash_completion
fi

Basically, my concerns are:

- You are using ">" for the redirection. Are we going to be the only package writing to this file?

- Do we support having other packages contribute additional bash completion logic?

Thanks!

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com
#2 lore raw

PATCH v2 1/1 package/bash-completion: new package

Hi Thomas,

Le 18/01/2018 ? 22:41, Thomas Petazzoni a ?crit?:

Quoted 11 lines

Hello,

package/bash-completion/bash-completion.mk line 18

Quoted 3 lines · Romain Naour
package/bash-completion/bash-completion.mk new file +3 -0
+define BASH_COMPLETION_INSTALL_FILE
+	echo ". /usr/share/bash-completion/bash_completion" > $(TARGET_DIR)/etc/bash_completion
+endef

Who/what is reading this /etc/bash_completion file? Is bash itself automatically loading this file? I'm asking because on my distro, I have /etc/bash_completion.d/ and no /etc/bash_completion.

I'm using different Linux distribution and the bash_completion install is not the same everywhere.

The bash-completion package install bash_completion script in /usr/share/bash-completion/bash_completion and all completion script to /usr/share/bash-completion/completion.

So, I guess that files located un /etc/bash_completion.h is distribution specific.

On my Fedora 27 I noticed that /etc/bash_completion is a symlink to /usr/share/bash-completion/bash_completion.

On my Ubuntu 16.04 I have /etc/bash_completion.d/ and /etc/bash_completion script.

Quoted 10 lines

It seems like my bashrc here is automatically
including /usr/share/bash-completion/bash_completion, and otherwise falls back to /etc/bash_completion:

if [ -f /usr/share/bash-completion/bash_completion ]; then
. /usr/share/bash-completion/bash_completion
elif [ -f /etc/bash_completion ]; then
. /etc/bash_completion
fi

Same here with my Ubuntu 16.04.

Quoted 5 lines

Basically, my concerns are:

- You are using ">" for the redirection. Are we going to be the only package writing to this file?

I'll check this indeed.
The Buildroot Makefile take care to remove /etc/bash_completion when bash is not selected. This means that some packages install some stuff here.

Quoted 3 lines

- Do we support having other packages contribute additional bash completion logic?

I'm wondering if we should let the user decide how to their bash_completion/bashrc settings.

Best regards,
Romain

Quoted 5 lines

Thanks!

Thomas