Skip to contentSkip to conversation

targetcli-fb: new package

PATCH New Christophe Vu-Brugier 2 participants 11 messages Sep 18, 2014 – Sep 21, 2014

lore
Share & tools
lore
#0 lore raw

v2 cover targetcli-fb: new package

This is version 2 of my patch serie that adds targetcli-fb to Buildroot. It fixes issues spotted by Thomas and Jerzy.

Changes v1 -> v2:
- rename python-rtslib.mk to python-rtslib-fb.mk (as suggested by Jerzy)
- Merge "targetcli-fb: add sysv initscript" (as suggested by Thomas)
- Use TARGETCLI_FB_INSTALL_INIT_SYSV (as suggested by Thomas)
- Describe the purpose of creating "/etc/target/" (as suggested by Thomas)

Christophe Vu-Brugier (5):
python, python3: add patch to prevent distutils from adjusting the
shebang
python-urwid: new package
python-rtslib-fb: new package
python-configshell-fb: new package
targetcli-fb: new package

 package/Config.in                                  |  4 ++
 package/python-configshell-fb/Config.in            | 11 ++++++
 .../python-configshell-fb/python-configshell-fb.mk | 14 +++++++
 package/python-rtslib-fb/Config.in                 |  9 +++++
 package/python-rtslib-fb/python-rtslib-fb.mk       | 13 ++++++
 package/python-urwid/Config.in                     |  7 ++++
 package/python-urwid/python-urwid.mk               | 14 +++++++
 ...017-distutils-scripts-dont-adjust-shebang.patch | 25 ++++++++++++
 ...015-distutils-scripts-dont-adjust-shebang.patch | 25 ++++++++++++
 package/targetcli-fb/Config.in                     | 14 +++++++
 package/targetcli-fb/S50target                     | 46 ++++++++++++++++++++++
 package/targetcli-fb/targetcli-fb.mk               | 26 ++++++++++++
 12 files changed, 208 insertions(+)
 create mode 100644 package/python-configshell-fb/Config.in
 create mode 100644 package/python-configshell-fb/python-configshell-fb.mk
 create mode 100644 package/python-rtslib-fb/Config.in
 create mode 100644 package/python-rtslib-fb/python-rtslib-fb.mk
 create mode 100644 package/python-urwid/Config.in
 create mode 100644 package/python-urwid/python-urwid.mk
 create mode 100644 package/python/python-017-distutils-scripts-dont-adjust-shebang.patch
 create mode 100644 package/python3/python3-015-distutils-scripts-dont-adjust-shebang.patch
 create mode 100644 package/targetcli-fb/Config.in
 create mode 100755 package/targetcli-fb/S50target
 create mode 100644 package/targetcli-fb/targetcli-fb.mk
Signature · 1 line
2.1.0
#1 lore raw

PATCH v2 1/5 python, python3: add patch to prevent distutils from adjusting the shebang

The copy_scripts() method in distutils copies the scripts listed in the setup file and adjusts the first line to refer to the current Python interpreter. When cross-compiling, this means that the adjusted shebang refers to the host Python interpreter.

As a consequence, we add a patch for python and python3 that force copy_scripts() to preserve the shebang when cross-compilation is detected.

---
 ...017-distutils-scripts-dont-adjust-shebang.patch | 25 ++++++++++++++++++++++
 ...015-distutils-scripts-dont-adjust-shebang.patch | 25 ++++++++++++++++++++++
 2 files changed, 50 insertions(+)
 create mode 100644 package/python/python-017-distutils-scripts-dont-adjust-shebang.patch
 create mode 100644 package/python3/python3-015-distutils-scripts-dont-adjust-shebang.patch
package/python/python-017-distutils-scripts-dont-adjust-shebang.patch new file +25 -0
new file mode 100644
index 0000000..da4dc36
@@ -0,0 +1,25 @@
+Do not adjust the shebang of Python scripts for cross-compilation
+
+The copy_scripts() method in distutils copies the scripts listed in
+the setup file and adjusts the first line to refer to the current
+Python interpreter. When cross-compiling, this means that the adjusted
+shebang refers to the host Python interpreter.
+
+This patch modifies copy_scripts() to preserve the shebang when
+cross-compilation is detected.
+
+Signed-off-by: Christophe Vu-Brugier <[email protected]>
+
+Index: b/Lib/distutils/command/build_scripts.py
+===================================================================
+--- a/Lib/distutils/command/build_scripts.py
++++ b/Lib/distutils/command/build_scripts.py
+@@ -89,7 +89,7 @@
+                     adjust = 1
+                     post_interp = match.group(1) or ''
+ 
+-            if adjust:
++            if adjust and not '_python_sysroot' in os.environ:
+                 log.info("copying and adjusting %s -> %s", script,
+                          self.build_dir)
+                 if not self.dry_run:
package/python3/python3-015-distutils-scripts-dont-adjust-shebang.patch new file +25 -0
new file mode 100644
index 0000000..ed2f193
@@ -0,0 +1,25 @@
+Do not adjust the shebang of Python scripts for cross-compilation
+
+The copy_scripts() method in distutils copies the scripts listed in
+the setup file and adjusts the first line to refer to the current
+Python interpreter. When cross-compiling, this means that the adjusted
+shebang refers to the host Python interpreter.
+
+This patch modifies copy_scripts() to preserve the shebang when
+cross-compilation is detected.
+
+Signed-off-by: Christophe Vu-Brugier <[email protected]>
+
+Index: b/Lib/distutils/command/build_scripts.py
+===================================================================
+--- a/Lib/distutils/command/build_scripts.py
++++ b/Lib/distutils/command/build_scripts.py
+@@ -91,7 +91,7 @@
+                     adjust = True
+                     post_interp = match.group(1) or b''
+ 
+-            if adjust:
++            if adjust and not '_python_sysroot' in os.environ:
+                 log.info("copying and adjusting %s -> %s", script,
+                          self.build_dir)
+                 updated_files.append(outfile)
Signature · 1 line
2.1.0
#2 lore raw

PATCH v2 1/5 python, python3: add patch to prevent distutils from adjusting the shebang

Dear Christophe Vu-Brugier,

Quoted 9 lines · Christophe Vu-Brugier

The copy_scripts() method in distutils copies the scripts listed in the setup file and adjusts the first line to refer to the current Python interpreter. When cross-compiling, this means that the adjusted shebang refers to the host Python interpreter.

As a consequence, we add a patch for python and python3 that force copy_scripts() to preserve the shebang when cross-compilation is detected.

Quoted 7 lines
---
 ...017-distutils-scripts-dont-adjust-shebang.patch | 25 ++++++++++++++++++++++
 ...015-distutils-scripts-dont-adjust-shebang.patch | 25 ++++++++++++++++++++++
 2 files changed, 50 insertions(+)
 create mode 100644 package/python/python-017-distutils-scripts-dont-adjust-shebang.patch
 create mode 100644 package/python3/python3-015-distutils-scripts-dont-adjust-shebang.patch

Applied, thanks.

Thomas

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

PATCH v2 2/5 python-urwid: new package

In reply to Christophe Vu-Brugier

Urwid is a console user interface library for Python.

---
 package/Config.in                    |  1 +
 package/python-urwid/Config.in       |  7 +++++++
 package/python-urwid/python-urwid.mk | 14 ++++++++++++++
 3 files changed, 22 insertions(+)
 create mode 100644 package/python-urwid/Config.in
 create mode 100644 package/python-urwid/python-urwid.mk
package/Config.in +1 -0
index 73ba86a..17930ea 100644
@@ -508,6 +508,7 @@ menu "external python modules"
 	source "package/python-simplejson/Config.in"
 	source "package/python-thrift/Config.in"
 	source "package/python-tornado/Config.in"
+	source "package/python-urwid/Config.in"
 	source "package/python-versiontools/Config.in"
 endmenu
 endif
package/python-urwid/Config.in new file +7 -0
new file mode 100644
index 0000000..92f7d53
@@ -0,0 +1,7 @@
+config BR2_PACKAGE_PYTHON_URWID
+	bool "python-urwid"
+	depends on BR2_PACKAGE_PYTHON || BR2_PACKAGE_PYTHON3
+	help
+	  Urwid is a console user interface library for Python
+
+	  http://urwid.org/
package/python-urwid/python-urwid.mk new file +14 -0
new file mode 100644
index 0000000..4f1be46
@@ -0,0 +1,14 @@
+################################################################################
+#
+# python-urwid
+#
+################################################################################
+
+PYTHON_URWID_VERSION = 1.2.1
+PYTHON_URWID_SOURCE = urwid-$(PYTHON_URWID_VERSION).tar.gz
+PYTHON_URWID_SITE = https://pypi.python.org/packages/source/u/urwid
+PYTHON_URWID_LICENSE = LGPLv2.1+
+PYTHON_URWID_LICENSE_FILES = COPYING
+PYTHON_URWID_SETUP_TYPE = setuptools
+
+$(eval $(python-package))
Signature · 1 line
2.1.0
#4 lore raw

PATCH v2 2/5 python-urwid: new package

Dear Christophe Vu-Brugier,

Quoted 11 lines · Christophe Vu-Brugier

Urwid is a console user interface library for Python.

---
 package/Config.in                    |  1 +
 package/python-urwid/Config.in       |  7 +++++++
 package/python-urwid/python-urwid.mk | 14 ++++++++++++++
 3 files changed, 22 insertions(+)
 create mode 100644 package/python-urwid/Config.in
 create mode 100644 package/python-urwid/python-urwid.mk

Applied, thanks.

Thomas

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

PATCH v2 3/5 python-rtslib-fb: new package

In reply to Christophe Vu-Brugier

rtslib-fb is an object-based Python library for configuring the LIO generic SCSI target, present in 3.x Linux kernel versions.

---
Changes v1 -> v2:
- rename python-rtslib.mk to python-rtslib-fb.mk (as suggested by Jerzy)

---
 package/Config.in                            |  1 +
 package/python-rtslib-fb/Config.in           |  9 +++++++++
 package/python-rtslib-fb/python-rtslib-fb.mk | 13 +++++++++++++
 3 files changed, 23 insertions(+)
 create mode 100644 package/python-rtslib-fb/Config.in
 create mode 100644 package/python-rtslib-fb/python-rtslib-fb.mk
package/Config.in +1 -0
index 17930ea..7447036 100644
@@ -503,6 +503,7 @@ menu "external python modules"
 	source "package/python-pysnmp-mibs/Config.in"
 	source "package/python-pyusb/Config.in"
 	source "package/python-pyzmq/Config.in"
+	source "package/python-rtslib-fb/Config.in"
 	source "package/python-serial/Config.in"
 	source "package/python-setuptools/Config.in"
 	source "package/python-simplejson/Config.in"
package/python-rtslib-fb/Config.in new file +9 -0
new file mode 100644
index 0000000..b2aebcf
@@ -0,0 +1,9 @@
+config BR2_PACKAGE_PYTHON_RTSLIB_FB
+	bool "python-rtslib-fb"
+	depends on BR2_PACKAGE_PYTHON
+	help
+	  rtslib-fb is an object-based Python library for configuring
+	  the LIO generic SCSI target, present in 3.x Linux kernel
+	  versions.
+
+	  https://github.com/agrover/rtslib-fb
package/python-rtslib-fb/python-rtslib-fb.mk new file +13 -0
new file mode 100644
index 0000000..70b0257
@@ -0,0 +1,13 @@
+################################################################################
+#
+# python-rtslib-fb
+#
+################################################################################
+
+PYTHON_RTSLIB_FB_VERSION = v2.1.fb49
+PYTHON_RTSLIB_FB_SITE = $(call github,agrover,rtslib-fb,$(PYTHON_RTSLIB_FB_VERSION))
+PYTHON_RTSLIB_FB_LICENSE = Apache-2.0
+PYTHON_RTSLIB_FB_LICENSE_FILES = COPYING
+PYTHON_RTSLIB_FB_SETUP_TYPE = setuptools
+
+$(eval $(python-package))
Signature · 1 line
2.1.0
#6 lore raw

PATCH v2 3/5 python-rtslib-fb: new package

Dear Christophe Vu-Brugier,

Quoted 9 lines · Christophe Vu-Brugier

rtslib-fb is an object-based Python library for configuring the LIO generic SCSI target, present in 3.x Linux kernel versions.

---
Changes v1 -> v2:
- rename python-rtslib.mk to python-rtslib-fb.mk (as suggested by Jerzy)

Quoted 8 lines
---
 package/Config.in                            |  1 +
 package/python-rtslib-fb/Config.in           |  9 +++++++++
 package/python-rtslib-fb/python-rtslib-fb.mk | 13 +++++++++++++
 3 files changed, 23 insertions(+)
 create mode 100644 package/python-rtslib-fb/Config.in
 create mode 100644 package/python-rtslib-fb/python-rtslib-fb.mk

Applied, thanks.

Thomas

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

PATCH v2 4/5 python-configshell-fb: new package

In reply to Christophe Vu-Brugier

configshell-fb is a Python library that provides a framework for building simple but nice CLI-based applications.

---
 package/Config.in                                      |  1 +
 package/python-configshell-fb/Config.in                | 11 +++++++++++
 package/python-configshell-fb/python-configshell-fb.mk | 14 ++++++++++++++
 3 files changed, 26 insertions(+)
 create mode 100644 package/python-configshell-fb/Config.in
 create mode 100644 package/python-configshell-fb/python-configshell-fb.mk
package/Config.in +1 -0
index 7447036..096d8c6 100644
@@ -473,6 +473,7 @@ menu "external python modules"
 	source "package/python-bottle/Config.in"
 	source "package/python-cffi/Config.in"
 	source "package/python-configobj/Config.in"
+	source "package/python-configshell-fb/Config.in"
 	source "package/python-crc16/Config.in"
 	source "package/python-daemon/Config.in"
 	source "package/python-dialog/Config.in"
package/python-configshell-fb/Config.in new file +11 -0
new file mode 100644
index 0000000..05de585
@@ -0,0 +1,11 @@
+config BR2_PACKAGE_PYTHON_CONFIGSHELL_FB
+	bool "python-configshell-fb"
+	depends on BR2_PACKAGE_PYTHON
+	select BR2_PACKAGE_PYTHON_PYPARSING
+	select BR2_PACKAGE_PYTHON_READLINE
+	select BR2_PACKAGE_PYTHON_URWID
+	help
+	  configshell-fb is a Python library that provides a framework
+	  for building simple but nice CLI-based applications.
+
+	  https://github.com/agrover/configshell-fb
package/python-configshell-fb/python-configshell-fb.mk new file +14 -0
new file mode 100644
index 0000000..64b27fe
@@ -0,0 +1,14 @@
+################################################################################
+#
+# python-configshell-fb
+#
+################################################################################
+
+PYTHON_CONFIGSHELL_FB_VERSION = v1.1.fb14
+PYTHON_CONFIGSHELL_FB_SITE = $(call github,agrover,configshell-fb,$(PYTHON_CONFIGSHELL_FB_VERSION))
+PYTHON_CONFIGSHELL_FB_LICENSE = Apache-2.0
+PYTHON_CONFIGSHELL_FB_LICENSE_FILES = COPYING
+PYTHON_CONFIGSHELL_FB_SETUP_TYPE = setuptools
+PYTHON_CONFIGSHELL_FB_DEPENDENCIES = python-pyparsing python-urwid
+
+$(eval $(python-package))
Signature · 1 line
2.1.0
#8 lore raw

PATCH v2 4/5 python-configshell-fb: new package

Dear Christophe Vu-Brugier,

Quoted 5 lines · Christophe Vu-Brugier

configshell-fb is a Python library that provides a framework for building simple but nice CLI-based applications.

Quoted 7 lines
---
 package/Config.in                                      |  1 +
 package/python-configshell-fb/Config.in                | 11 +++++++++++
 package/python-configshell-fb/python-configshell-fb.mk | 14 ++++++++++++++
 3 files changed, 26 insertions(+)
 create mode 100644 package/python-configshell-fb/Config.in
 create mode 100644 package/python-configshell-fb/python-configshell-fb.mk

Applied, thanks.

I have prepared some patches to fix the PEP 3147 issues with Python 3, I hope to send them soon. If you have a bit of time to test them with those new packages, and maybe re-enable them for Python 3, it would be great.

Thanks!

Thomas

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

PATCH v2 5/5 targetcli-fb: new package

In reply to Christophe Vu-Brugier

targetcli-fb is a command-line interface for configuring the LIO generic SCSI target, present in 3.x Linux kernel versions.

---
Changes v1 -> v2:
- Merge "targetcli-fb: add sysv initscript" (as suggested by Thomas)
- Use TARGETCLI_FB_INSTALL_INIT_SYSV (as suggested by Thomas)
- Describe the purpose of creating "/etc/target/" (as suggested by Thomas)

---
 package/Config.in                    |  1 +
 package/targetcli-fb/Config.in       | 14 +++++++++++
 package/targetcli-fb/S50target       | 46 ++++++++++++++++++++++++++++++++++++
 package/targetcli-fb/targetcli-fb.mk | 26 ++++++++++++++++++++
 4 files changed, 87 insertions(+)
 create mode 100644 package/targetcli-fb/Config.in
 create mode 100755 package/targetcli-fb/S50target
 create mode 100644 package/targetcli-fb/targetcli-fb.mk
package/Config.in +1 -0
index 096d8c6..b10225b 100644
@@ -364,6 +364,7 @@ endif
 	source "package/sunxi-mali/Config.in"
 	source "package/sunxi-mali-prop/Config.in"
 	source "package/sysstat/Config.in"
+	source "package/targetcli-fb/Config.in"
 	source "package/ti-gfx/Config.in"
 	source "package/ti-uim/Config.in"
 	source "package/ti-utils/Config.in"
package/targetcli-fb/Config.in new file +14 -0
new file mode 100644
index 0000000..dcc6a54
@@ -0,0 +1,14 @@
+comment "targetcli-fb depends on python"
+	depends on !BR2_PACKAGE_PYTHON
+
+config BR2_PACKAGE_TARGETCLI_FB
+	bool "targetcli-fb"
+	depends on BR2_PACKAGE_PYTHON
+	select BR2_PACKAGE_PYTHON_CONFIGSHELL_FB
+	select BR2_PACKAGE_PYTHON_RTSLIB_FB
+	help
+	  targetcli-fb is a command-line interface for configuring the
+	  LIO generic SCSI target, present in 3.x Linux kernel
+	  versions.
+
+	  https://github.com/agrover/targetcli-fb
package/targetcli-fb/S50target new file +46 -0

46 lines not on this page · raw message

package/targetcli-fb/targetcli-fb.mk new file +26 -0
new file mode 100644
index 0000000..1faad07
@@ -0,0 +1,26 @@
+################################################################################
+#
+# targetcli-fb
+#
+################################################################################
+
+TARGETCLI_FB_VERSION = v2.1.fb36
+TARGETCLI_FB_SITE = $(call github,agrover,targetcli-fb,$(TARGETCLI_FB_VERSION))
+TARGETCLI_FB_LICENSE = Apache-2.0
+TARGETCLI_FB_LICENSE_FILES = COPYING
+TARGETCLI_FB_SETUP_TYPE = setuptools
+TARGETCLI_FB_DEPENDENCIES = python-configshell-fb python-rtslib-fb
+
+define TARGETCLI_FB_INSTALL_INIT_SYSV
+	$(INSTALL) -m 0755 -D package/targetcli-fb/S50target $(TARGET_DIR)/etc/init.d/S50target
+endef
+
+# Targetcli stores its configuration in /etc/target/saveconfig.json
+# and complains if the /etc/target/ directory does not exist.
+define TARGETCLI_FB_INSTALL_CONF_DIR
+	$(INSTALL) -m 0755 -d $(TARGET_DIR)/etc/target
+endef
+
+TARGETCLI_FB_POST_INSTALL_TARGET_HOOKS += TARGETCLI_FB_INSTALL_CONF_DIR
+
+$(eval $(python-package))
Signature · 1 line
2.1.0
#10 lore raw

PATCH v2 5/5 targetcli-fb: new package

Dear Christophe Vu-Brugier,

Quoted 11 lines · Christophe Vu-Brugier

targetcli-fb is a command-line interface for configuring the LIO generic SCSI target, present in 3.x Linux kernel versions.

---
Changes v1 -> v2:
- Merge "targetcli-fb: add sysv initscript" (as suggested by Thomas)
- Use TARGETCLI_FB_INSTALL_INIT_SYSV (as suggested by Thomas)
- Describe the purpose of creating "/etc/target/" (as suggested by Thomas)

Quoted 9 lines
---
 package/Config.in                    |  1 +
 package/targetcli-fb/Config.in       | 14 +++++++++++
 package/targetcli-fb/S50target       | 46 ++++++++++++++++++++++++++++++++++++
 package/targetcli-fb/targetcli-fb.mk | 26 ++++++++++++++++++++
 4 files changed, 87 insertions(+)
 create mode 100644 package/targetcli-fb/Config.in
 create mode 100755 package/targetcli-fb/S50target
 create mode 100644 package/targetcli-fb/targetcli-fb.mk

Applied, thanks.

Thomas

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