Skip to contentSkip to conversation

package/python-web2py: clean package

PATCH New Angelo Compagnucci 2 participants 6 messages Jun 28, 2017 – Jul 31, 2017

lore
Share & tools
lore
#0 lore raw

cover package/python-web2py: clean package

This patch series cleans the web2py package.

Angelo Compagnucci (3):
package/python-web2py: cleaning installation
package/python-web2py: move password generation
package/python-web2py: remove admin panel

 package/python-web2py/Config.in        | 11 +++++++++++
 package/python-web2py/python-web2py.mk | 33 +++++++++++++++++++++++++++++++--
 2 files changed, 42 insertions(+), 2 deletions(-)
Signature · 1 line
2.7.4
#1 lore raw

PATCH 1/3 package/python-web2py: cleaning installation

This commit exclude some unuseful files from standard installation to save space on embedded systems.

---
 package/python-web2py/python-web2py.mk | 22 +++++++++++++++++++++-
 1 file changed, 21 insertions(+), 1 deletion(-)
package/python-web2py/python-web2py.mk +21 -1
index 9aadb30..074114b 100644
@@ -10,13 +10,33 @@ PYTHON_WEB2PY_LICENSE = LGPL-3.0
 PYTHON_WEB2PY_LICENSE_FILES = LICENSE
 PYTHON_WEB2PY_DEPENDENCIES = python python-pydal host-python-pydal
 
+PYTHON_WEB2PY_EXCLUSIONS = \
+	welcome.w2p \
+	applications/examples \
+	applications/welcome \
+	deposit \
+	docs \
+	examples \
+	extras \
+	handlers \
+	scripts \
+	ABOUT \
+	anyserver.py \
+	CHANGELOG \
+	Makefile \
+	MANIFEST.in \
+	README.markdown \
+	setup.py \
+	tox.ini
+
 define PYTHON_WEB2PY_INSTALL_TARGET_CMDS
 	$(HOST_DIR)/usr/bin/python2 -c 'import os; \
 		os.chdir("$(@D)"); \
 		from gluon.main import save_password; \
 		save_password($(BR2_PACKAGE_PYTHON_WEB2PY_PASSWORD),8000)'
 	mkdir -p $(TARGET_DIR)/var/www/web2py
-	cp -dpfr $(@D)/* $(TARGET_DIR)/var/www/web2py
+	rsync -a $(@D)/ $(TARGET_DIR)/var/www/web2py/ \
+		$(addprefix --exclude=,$(PYTHON_WEB2PY_EXCLUSIONS))
 endef
 
 define PYTHON_WEB2PY_INSTALL_INIT_SYSV
Signature · 1 line
2.7.4
#2 lore raw

PATCH 2/3 package/python-web2py: move password generation

In reply to Angelo Compagnucci

This commit moves the password generation as a post build step. This prepares the option to remove the admin panel from installation.

---
 package/python-web2py/python-web2py.mk | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
package/python-web2py/python-web2py.mk +6 -1
index 074114b..e0117fc 100644
@@ -29,11 +29,16 @@ PYTHON_WEB2PY_EXCLUSIONS = \
 	setup.py \
 	tox.ini
 
-define PYTHON_WEB2PY_INSTALL_TARGET_CMDS
+define PYTHON_WEB2PY_GENERATE_PASSWORD
 	$(HOST_DIR)/usr/bin/python2 -c 'import os; \
 		os.chdir("$(@D)"); \
 		from gluon.main import save_password; \
 		save_password($(BR2_PACKAGE_PYTHON_WEB2PY_PASSWORD),8000)'
+endef
+
+PYTHON_WEB2PY_POST_BUILD_HOOKS += PYTHON_WEB2PY_GENERATE_PASSWORD
+
+define PYTHON_WEB2PY_INSTALL_TARGET_CMDS
 	mkdir -p $(TARGET_DIR)/var/www/web2py
 	rsync -a $(@D)/ $(TARGET_DIR)/var/www/web2py/ \
 		$(addprefix --exclude=,$(PYTHON_WEB2PY_EXCLUSIONS))
Signature · 1 line
2.7.4
#3 lore raw

PATCH 3/3 package/python-web2py: remove admin panel

In reply to Angelo Compagnucci

This commmit adds an option to remove admin panel to save speace if not needed.

---
 package/python-web2py/Config.in        | 11 +++++++++++
 package/python-web2py/python-web2py.mk |  6 +++++-
 2 files changed, 16 insertions(+), 1 deletion(-)
package/python-web2py/Config.in +11 -0
index b10d3a4..3b55153 100644
@@ -14,6 +14,15 @@ config BR2_PACKAGE_PYTHON_WEB2PY
 
 if BR2_PACKAGE_PYTHON_WEB2PY
 
+config BR2_PACKAGE_PYTHON_WEB2PY_INSTALL_ADMIN
+	bool "install admin panel application"
+	default y
+	help
+	  This option install web2py admin panel application.
+	  It can be removed to save space on embedded systems.
+
+if BR2_PACKAGE_PYTHON_WEB2PY_INSTALL_ADMIN
+
 config BR2_PACKAGE_PYTHON_WEB2PY_PASSWORD
 	string "admin panel password"
 	default web2py
@@ -21,3 +30,5 @@ config BR2_PACKAGE_PYTHON_WEB2PY_PASSWORD
 	  Set the admin panel password.
 
 endif
+
+endif
package/python-web2py/python-web2py.mk +5 -1
index e0117fc..3dd4bee 100644
@@ -36,7 +36,11 @@ define PYTHON_WEB2PY_GENERATE_PASSWORD
 		save_password($(BR2_PACKAGE_PYTHON_WEB2PY_PASSWORD),8000)'
 endef
 
-PYTHON_WEB2PY_POST_BUILD_HOOKS += PYTHON_WEB2PY_GENERATE_PASSWORD
+ifeq ($(BR2_PACKAGE_PYTHON_WEB2PY_INSTALL_ADMIN),y)
+	PYTHON_WEB2PY_POST_BUILD_HOOKS += PYTHON_WEB2PY_GENERATE_PASSWORD
+else
+	PYTHON_WEB2PY_EXCLUSIONS += applications/admin
+endif
 
 define PYTHON_WEB2PY_INSTALL_TARGET_CMDS
 	mkdir -p $(TARGET_DIR)/var/www/web2py
Signature · 1 line
2.7.4
#4 lore raw

PATCH 3/3 package/python-web2py: remove admin panel

Hello,

package/python-web2py/python-web2py.mk define PYTHON_WEB2PY_GENERATE_PASSWORD · line 40

Quoted 3 lines · Angelo Compagnucci
package/python-web2py/python-web2py.mk +2 -1
-PYTHON_WEB2PY_POST_BUILD_HOOKS += PYTHON_WEB2PY_GENERATE_PASSWORD
+ifeq ($(BR2_PACKAGE_PYTHON_WEB2PY_INSTALL_ADMIN),y)
+	PYTHON_WEB2PY_POST_BUILD_HOOKS += PYTHON_WEB2PY_GENERATE_PASSWORD

FWIW, we don't indent such lines here...

package/python-web2py/python-web2py.mk define PYTHON_WEB2PY_GENERATE_PASSWORD · line 42

Quoted 2 lines
package/python-web2py/python-web2py.mk +2 -0
+else
+	PYTHON_WEB2PY_EXCLUSIONS += applications/admin

... and here.

So I've fixed that up when applying.

Thanks,

Thomas

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

cover package/python-web2py: clean package

In reply to Angelo Compagnucci

Hello,

Quoted 4 lines · Angelo Compagnucci

Angelo Compagnucci (3):
package/python-web2py: cleaning installation
package/python-web2py: move password generation
package/python-web2py: remove admin panel

Series applied. Thanks!

Thomas

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