micropython: Update to 1.21.0, refresh/redo patches
authorJeffery To <jeffery.to@gmail.com>
Sun, 15 Oct 2023 14:16:44 +0000 (22:16 +0800)
committerRosen Penev <rosenp@gmail.com>
Wed, 1 Nov 2023 22:57:40 +0000 (15:57 -0700)
Removed 050-py-stackctrl-fix-gcc-13.patch as it has been merged in the
new version.

This also:

* Add STRIP= (empty value) to skip micropython's stripping step, letting
  the OpenWrt build system control stripping.

* Add a workaround for "variable might be clobbered" warning leading to
  build error on riscv64
  (https://github.com/micropython/micropython/issues/12838).

* Change Build/InstallDev to install host tools into an unversioned
  directory, and update micropython-lib to use the unversioned path.
  There is no need to keep available multiple versions of the host
  tools.

* Add a test.sh script for the packages feed CI.

Signed-off-by: Jeffery To <jeffery.to@gmail.com>
lang/python/micropython-lib/Makefile
lang/python/micropython/Makefile
lang/python/micropython/patches/030-target-no-darwin.patch
lang/python/micropython/patches/040-extmod-use-external-mbedtls.patch
lang/python/micropython/patches/050-py-stackctrl-fix-gcc-13.patch [deleted file]
lang/python/micropython/src/ports/unix/variants/standard/manifest-nossl.py
lang/python/micropython/test.sh [new file with mode: 0644]

index 490e6e2e7d3549f07d59a50799895cb352275c5f..095b89010498e31b3468643e58ba4cb4638df99f 100644 (file)
@@ -24,7 +24,6 @@ PKG_BUILD_DEPENDS:=python3/host
 PKG_BUILD_PARALLEL:=1
 
 # keep in sync with micropython
-MP_VERSION:=1.20.0
 MP_MPY_FILE_VERSION:=6
 
 include $(INCLUDE_DIR)/package.mk
@@ -88,7 +87,7 @@ This contains source files for packages specific to the MicroPython Unix
 port.
 endef
 
-MP_INSTALLDEV_PATH:=$(STAGING_DIR)/host/lib/micropython-$(MP_VERSION)
+MP_INSTALLDEV_PATH:=$(STAGING_DIR)/host/lib/micropython
 
 define MicroPythonLib/Compile
        cd "$(PKG_BUILD_DIR)" && python3 tools/build.py \
index 6e129c15d6329fa027953e73bf06613b35dbf6fe..17b0bdd0c521e5e02b5342cd549021ed03711c11 100644 (file)
@@ -8,12 +8,12 @@
 include $(TOPDIR)/rules.mk
 
 PKG_NAME:=micropython
-PKG_VERSION:=1.20.0
+PKG_VERSION:=1.21.0
 PKG_RELEASE:=1
 
 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz
 PKG_SOURCE_URL:=https://github.com/micropython/micropython/releases/download/v$(PKG_VERSION)
-PKG_HASH:=098ef8e40abdc62551b5460d0ffe9489074240c0cb5589ca3c3a425551beb9bf
+PKG_HASH:=abd2152613559d3f44728668346e78be9d93458133a03b700baf222c322fd4d5
 
 PKG_MAINTAINER:=Jeffery To <jeffery.to@gmail.com>
 PKG_LICENSE:=MIT
@@ -70,14 +70,20 @@ $(call Package/micropython/Default/description)
 This version is built without TLS and mip.
 endef
 
-MAKE_FLAGS += BUILD_VERBOSE=1
+MAKE_FLAGS += BUILD_VERBOSE=1 STRIP=
 
 ifneq ($(CONFIG_DEBUG),)
   MAKE_FLAGS += DEBUG=1
 endif
 
 ifeq ($(BUILD_VARIANT),nossl)
-  MAKE_FLAGS += MICROPY_PY_USSL=0 FROZEN_MANIFEST=variants/standard/manifest-nossl.py
+  MAKE_FLAGS += MICROPY_PY_SSL=0 FROZEN_MANIFEST=variants/standard/manifest-nossl.py
+endif
+
+# Work around "variable might be clobbered" warning leading to build error
+# https://github.com/micropython/micropython/issues/12838
+ifeq ($(ARCH),riscv64)
+  MAKE_FLAGS += CFLAGS_EXTRA=-Wno-error=clobbered
 endif
 
 MAKE_PATH = ports/unix
@@ -89,20 +95,20 @@ define Build/Configure
 endef
 
 define Build/InstallDev
-       $(INSTALL_DIR) $(2)/lib/micropython-$(PKG_VERSION)/mpy-cross
+       $(INSTALL_DIR) $(2)/lib/micropython/mpy-cross
        $(CP) \
                $(PKG_BUILD_DIR)/mpy-cross/mpy_cross \
-               $(2)/lib/micropython-$(PKG_VERSION)/mpy-cross/
+               $(2)/lib/micropython/mpy-cross/
 
-       $(INSTALL_DIR) $(2)/lib/micropython-$(PKG_VERSION)/mpy-cross/build
+       $(INSTALL_DIR) $(2)/lib/micropython/mpy-cross/build
        $(INSTALL_BIN) \
                $(PKG_BUILD_DIR)/mpy-cross/build/mpy-cross \
-               $(2)/lib/micropython-$(PKG_VERSION)/mpy-cross/build/
+               $(2)/lib/micropython/mpy-cross/build/
 
-       $(INSTALL_DIR) $(2)/lib/micropython-$(PKG_VERSION)/tools
+       $(INSTALL_DIR) $(2)/lib/micropython/tools
        $(INSTALL_DATA) \
                $(PKG_BUILD_DIR)/tools/manifestfile.py \
-               $(2)/lib/micropython-$(PKG_VERSION)/tools/
+               $(2)/lib/micropython/tools/
 endef
 
 define Package/micropython/Default/install
index a847e96b44b1c797fa9807e9fdea97c702730437..9dc4c59bc7f033503659a2d0285aebc513911bf8 100644 (file)
@@ -1,7 +1,7 @@
 --- a/ports/unix/Makefile
 +++ b/ports/unix/Makefile
-@@ -31,7 +31,7 @@ QSTR_DEFS = qstrdefsport.h
- QSTR_GLOBAL_DEPENDENCIES = $(VARIANT_DIR)/mpconfigvariant.h
+@@ -31,7 +31,7 @@ QSTR_DEFS += qstrdefsport.h
+ QSTR_GLOBAL_DEPENDENCIES += $(VARIANT_DIR)/mpconfigvariant.h
  
  # OS name, for simple autoconfig
 -UNAME_S := $(shell uname -s)
index dccd5ba51f48102370fe016260f7cbaee040d4d7..3399412e4acf4b17ab5ccac63c5babad8c1fc33a 100644 (file)
@@ -9,7 +9,7 @@ Subject: [PATCH 06/10] extmod: Use system mbedtls
 
 --- a/extmod/extmod.mk
 +++ b/extmod/extmod.mk
-@@ -131,84 +131,8 @@ SRC_THIRDPARTY_C += $(addprefix $(AXTLS_
+@@ -131,85 +131,8 @@ SRC_THIRDPARTY_C += $(addprefix $(AXTLS_
        crypto/sha1.c \
        )
  else ifeq ($(MICROPY_SSL_MBEDTLS),1)
@@ -54,7 +54,6 @@ Subject: [PATCH 06/10] extmod: Use system mbedtls
 -      md4.c \
 -      md5.c \
 -      md.c \
--      md_wrap.c \
 -      oid.c \
 -      padlock.c \
 -      pem.c \
@@ -79,9 +78,11 @@ Subject: [PATCH 06/10] extmod: Use system mbedtls
 -      ssl_cli.c \
 -      ssl_cookie.c \
 -      ssl_srv.c \
+-      ssl_msg.c \
 -      ssl_ticket.c \
 -      ssl_tls.c \
 -      timing.c \
+-      constant_time.c \
 -      x509.c \
 -      x509_create.c \
 -      x509_crl.c \
diff --git a/lang/python/micropython/patches/050-py-stackctrl-fix-gcc-13.patch b/lang/python/micropython/patches/050-py-stackctrl-fix-gcc-13.patch
deleted file mode 100644 (file)
index 8cd7df6..0000000
+++ /dev/null
@@ -1,31 +0,0 @@
-From f1c6cb7725960487195daa5c5c196fd8d3563811 Mon Sep 17 00:00:00 2001
-From: Damien George <damien@micropython.org>
-Date: Wed, 3 May 2023 15:23:24 +1000
-Subject: [PATCH] py/stackctrl: Add gcc pragmas to ignore dangling-pointer
- warning.
-
-This warning became apparent in gcc 13.
-
-Signed-off-by: Damien George <damien@micropython.org>
----
- py/stackctrl.c | 7 +++++++
- 1 file changed, 7 insertions(+)
-
---- a/py/stackctrl.c
-+++ b/py/stackctrl.c
-@@ -28,8 +28,15 @@
- #include "py/stackctrl.h"
- void mp_stack_ctrl_init(void) {
-+    #if __GNUC__ >= 13
-+    #pragma GCC diagnostic push
-+    #pragma GCC diagnostic ignored "-Wdangling-pointer"
-+    #endif
-     volatile int stack_dummy;
-     MP_STATE_THREAD(stack_top) = (char *)&stack_dummy;
-+    #if __GNUC__ >= 13
-+    #pragma GCC diagnostic pop
-+    #endif
- }
- void mp_stack_set_top(void *top) {
index 21f53bddddc453b73c592118d7a157aa8af518de..ee2b4620dd46a586c84c932f7187e7fd4898f13f 100644 (file)
@@ -1 +1 @@
-include("$(MPY_DIR)/extmod/uasyncio")
+include("$(MPY_DIR)/extmod/asyncio")
diff --git a/lang/python/micropython/test.sh b/lang/python/micropython/test.sh
new file mode 100644 (file)
index 0000000..82cf2ec
--- /dev/null
@@ -0,0 +1,6 @@
+#!/bin/sh
+
+nl="
+"
+
+micropython -c "import sys${nl}print(sys.version)" | grep -F " MicroPython v${PKG_VERSION} "