package/python-web2py: cleaning for space saving
PATCH v2 1/1 package/python-web2py: cleaning for space saving
This patch removes web2py folder from welcome and examples application, furthermore, it cleans the admin interface if unneeded.
---
Changes:
v1->v2:
* Reworked otion sequence as suggested by Thomas.
* Changed to a makefile based conditional as suggested by Thomas.
package/python-web2py/Config.in | 10 ++++++++++ package/python-web2py/python-web2py.mk | 18 +++++++++++++----- 2 files changed, 23 insertions(+), 5 deletions(-)
package/python-web2py/Config.in +10 -0
@@ -14,6 +14,14 @@ config BR2_PACKAGE_PYTHON_WEB2PY if BR2_PACKAGE_PYTHON_WEB2PY +config BR2_PACKAGE_PYTHON_WEB2PY_REMOVE_ADMIN + bool "remove admin panel application" + help + This option removes admin panel application form web2py, + useful for deploy on embedded systems. + +if ! BR2_PACKAGE_PYTHON_WEB2PY_REMOVE_ADMIN + config BR2_PACKAGE_PYTHON_WEB2PY_PASSWORD string "admin panel password" default web2py
@@ -21,3 +29,5 @@ config BR2_PACKAGE_PYTHON_WEB2PY_PASSWORD Set the admin panel password. endif + +endif
package/python-web2py/python-web2py.mk +13 -5
@@ -11,13 +11,21 @@ PYTHON_WEB2PY_LICENSE_FILES = LICENSE PYTHON_WEB2PY_DEPENDENCIES = python python-pydal host-python-pydal define PYTHON_WEB2PY_INSTALL_TARGET_CMDS - $(HOST_DIR)/usr/bin/python2 -c 'import os; \ + mkdir -p $(TARGET_DIR)/var/www/web2py; + cp -dpfr $(@D)/* $(TARGET_DIR)/var/www/web2py; + rm -rf $(TARGET_DIR)/var/www/web2py/welcome.w2p; + rm -rf $(TARGET_DIR)/var/www/web2py/applications/examples; + rm -rf $(TARGET_DIR)/var/www/web2py/applications/welcome; +endef + +ifeq ($(BR2_PACKAGE_PYTHON_WEB2PY_REMOVE_ADMIN),y) + PYTHON_WEB2PY_INSTALL_TARGET_CMDS += rm -rf $(TARGET_DIR)/var/www/web2py/applications/admin; +else + 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 -endef + save_password($(BR2_PACKAGE_PYTHON_WEB2PY_PASSWORD),8000)'; +endif define PYTHON_WEB2PY_INSTALL_INIT_SYSV $(INSTALL) -m 0755 -D package/python-web2py/S51web2py \
Signature · 1 line
1.9.1
PATCH v2 1/1 package/python-web2py: cleaning for space saving
Dear Angelo Compagnucci,
Quoted 20 lines · Angelo Compagnucci
This patch removes web2py folder from welcome and examples application, furthermore, it cleans the admin interface if unneeded.
Signed-off-by Angelo Compagnucci <[email protected]>---
Changes:
v1->v2:
* Reworked otion sequence as suggested by Thomas.
* Changed to a makefile based conditional as suggested by Thomas.package/python-web2py/Config.in | 10 ++++++++++ package/python-web2py/python-web2py.mk | 18 +++++++++++++----- 2 files changed, 23 insertions(+), 5 deletions(-)package/python-web2py/Config.in +0
-0
package/python-web2py/Config.in config BR2_PACKAGE_PYTHON_WEB2PY · line 18
Quoted 5 lines
package/python-web2py/Config.in +2
-0@@ -14,6 +14,14 @@ config BR2_PACKAGE_PYTHON_WEB2PY if BR2_PACKAGE_PYTHON_WEB2PY +config BR2_PACKAGE_PYTHON_WEB2PY_REMOVE_ADMIN + bool "remove admin panel application"
Can we use positive logic instead?
config BR2_PACKAGE_PYTHON_WEB2PY_INSTALL_ADMIN
Quoted 20 lines
package/python-web2py/Config.in +8
-0+ help + This option removes admin panel application form web2py, + useful for deploy on embedded systems. + +if ! BR2_PACKAGE_PYTHON_WEB2PY_REMOVE_ADMIN + config BR2_PACKAGE_PYTHON_WEB2PY_PASSWORD string "admin panel password" default web2py@@ -21,3 +29,5 @@ config BR2_PACKAGE_PYTHON_WEB2PY_PASSWORD Set the admin panel password. endif + +endifpackage/python-web2py/python-web2py.mk +0
-0
package/python-web2py/python-web2py.mk PYTHON_WEB2PY_LICENSE_FILES = LICENSE · line 15
Quoted 6 lines
package/python-web2py/python-web2py.mk +2
-1@@ -11,13 +11,21 @@ PYTHON_WEB2PY_LICENSE_FILES = LICENSE PYTHON_WEB2PY_DEPENDENCIES = python python-pydal host-python-pydal define PYTHON_WEB2PY_INSTALL_TARGET_CMDS - $(HOST_DIR)/usr/bin/python2 -c 'import os; \ + mkdir -p $(TARGET_DIR)/var/www/web2py; + cp -dpfr $(@D)/* $(TARGET_DIR)/var/www/web2py;
So here you copy everything.
package/python-web2py/python-web2py.mk PYTHON_WEB2PY_LICENSE_FILES = LICENSE · line 17
Quoted 12 lines
package/python-web2py/python-web2py.mk +9
-1+ rm -rf $(TARGET_DIR)/var/www/web2py/welcome.w2p; + rm -rf $(TARGET_DIR)/var/www/web2py/applications/examples; + rm -rf $(TARGET_DIR)/var/www/web2py/applications/welcome; +endef + +ifeq ($(BR2_PACKAGE_PYTHON_WEB2PY_REMOVE_ADMIN),y) + PYTHON_WEB2PY_INSTALL_TARGET_CMDS += rm -rf $(TARGET_DIR)/var/www/web2py/applications/admin; +else + 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)'
*and* after, you generate the password. Bottom line: the generated password file is not installed in the target.
Plus your solution of using semi-colon to separate commands and use += is really not common in Buildroot. Please do:
ifeq ($(BR2_PACKAGE_PYTHON_WEB2PY_INSTALL_ADMIN),y)
define PYTHON_WEB2PY_GENERATE_PASSWORD
... generate password here ...
endefPYTHON_WEB2PY_POST_BUILD_HOOKS += PYTHON_WEB2PY_GENERATE_PASSWORD else
define PYTHON_WEB2PY_REMOVE_ADMIN
.. remove admin stuff here ..
endefPYTHON_WEB2PY_POST_INSTALL_TARGET_HOOKS += PYTHON_WEB2PY_REMOVE_ADMIN endif
and then remove all the ; from the PYTHON_WEB2PY_INSTALL_TARGET_CMDS definition.
I've marked your patch as Changes Requested in patchwork, so can you resend an updated version?
Thanks,
Thomas
Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons Embedded Linux, Kernel and Android engineering http://free-electrons.com