smartsnmpd: Update to 2015-02-22 version 9690/head
authorRosen Penev <rosenp@gmail.com>
Sun, 11 Aug 2019 00:12:40 +0000 (17:12 -0700)
committerRosen Penev <rosenp@gmail.com>
Thu, 12 Sep 2019 22:11:49 +0000 (15:11 -0700)
Ran through 2to3 to get it to compile.

Ran init script through shellcheck. Grouped several file writes.

Signed-off-by: Rosen Penev <rosenp@gmail.com>
net/smartsnmpd/Makefile
net/smartsnmpd/files/smartsnmpd.init
net/smartsnmpd/patches/010-2to3.patch [new file with mode: 0644]
net/smartsnmpd/patches/020-flags.patch [new file with mode: 0644]

index 2bc26a3d86afbb2d5740274b4af839ddde2a2ee6..f54189670b8ea226bc6f8ad21fd6016a4a3f418b 100644 (file)
@@ -8,21 +8,19 @@
 include $(TOPDIR)/rules.mk
 
 PKG_NAME:=smartsnmpd
-PKG_VERSION:=2014-08-13
-PKG_RELEASE=$(PKG_SOURCE_VERSION)
+PKG_VERSION:=2015-02-22
+PKG_RELEASE:=1
 
 PKG_SOURCE_PROTO:=git
-PKG_SOURCE_URL:=https://github.com/credosemi/smartsnmp.git
-PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)
-PKG_SOURCE_VERSION:=fb93473d895f058b2d8975d3cfa280ae2a8ae98d
-PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz
-PKG_MIRROR_HASH:=fc7f3eef8341163e21aecf6abf2492fa90362877093baef9987af3c703baa6ea
-
+PKG_SOURCE_URL:=https://github.com/credosemi/smartsnmp
+PKG_SOURCE_VERSION:=ca1d455fd06748caa629fe7ad16a47cec8877b93
+PKG_MIRROR_HASH:=fda89ec37944b4f800eb3c0147678745b57f08c87f10d246d3c9d165a43418b4
 
 PKG_MAINTAINER:=Xiongfei Guo <xfguo@credosemi.com>
-PKG_LICENSE:=GPL-2.0
+PKG_LICENSE:=GPL-2.0-or-later
 PKG_LICENSE_FILES:=LICENSE
 
+PKG_BUILD_DEPENDS:=scons/host
 
 include $(INCLUDE_DIR)/package.mk
 include $(INCLUDE_DIR)/scons.mk
@@ -38,10 +36,16 @@ endef
 define Package/smartsnmpd/description
 smartsnmpd is an implementation of SNMP Agent. Its goal is "Easily
 writing boring SNMP MIB with Lua". This package add native support
-for OpenWrt. Include using ubus and uci to get system info/status. 
+for OpenWrt. Include using ubus and uci to get system info/status.
 And, it use libubox/uloop as low level event-driven library.
 endef
 
+ifeq ($(CONFIG_BIG_ENDIAN),y)
+       TARGET_CFLAGS += -DBIG_ENDIAN
+else
+       TARGET_CFLAGS += -DLITTLE_ENDIAN
+endif
+
 SCONS_OPTIONS += --transport=uloop
 
 define Build/Configure
@@ -64,7 +68,7 @@ define Package/smartsnmpd/install
 
        $(INSTALL_DIR) $(1)/usr/lib/lua/smartsnmp/mibs
        $(INSTALL_BIN) ./files/mibs/*.lua $(1)/usr/lib/lua/smartsnmp/mibs/
-       
+
        $(INSTALL_DIR) $(1)/etc/config
        $(INSTALL_DATA) ./files/smartsnmpd.conf $(1)/etc/config/smartsnmpd
 
index dbe3af8586dd9fb866b8fa6c2ca5ebeb4365c7cd..8cad81418b489c4c20c11cdaf7e6e326e750d556 100755 (executable)
@@ -24,24 +24,26 @@ start_service() {
        procd_set_param file $CONFIGFILE
        procd_set_param respawn
        procd_close_instance
-       
+
        # before we can call xappend
-       mkdir -p $(dirname $CONFIGFILE)
+       mkdir -p "$(dirname $CONFIGFILE)"
 
        echo "-- auto-generated config file from /etc/config/smartsnmpd" > $CONFIGFILE
-       
-       config_get PORT smartsnmpd port 161
-       echo "port = $PORT" >> $CONFIGFILE
-       
-       config_get RO_COMMUNITY smartsnmpd ro_community 'public'
-       config_get RW_COMMUNITY smartsnmpd rw_community 'private'
-       echo "ro_community = '$RO_COMMUNITY'" >> $CONFIGFILE
-       echo "rw_community = '$RW_COMMUNITY'" >> $CONFIGFILE
-
-       config_get MIB_MODULE_PATH smartsnmpd mib_module_path '/usr/lib/lua/smartsnmp/mibs/'
-       echo "mib_module_path = '$MIB_MODULE_PATH'" >> $CONFIGFILE
-
-       echo "mib_modules = {" >> $CONFIGFILE
-       config_foreach smartsnmpd_mib_module smartsnmpd_module 
-       echo "}" >> $CONFIGFILE
+
+       {
+               config_get PORT smartsnmpd port 161
+               echo "port = $PORT"
+
+               config_get RO_COMMUNITY smartsnmpd ro_community 'public'
+               config_get RW_COMMUNITY smartsnmpd rw_community 'private'
+               echo "ro_community = '$RO_COMMUNITY'"
+               echo "rw_community = '$RW_COMMUNITY'"
+
+               config_get MIB_MODULE_PATH smartsnmpd mib_module_path '/usr/lib/lua/smartsnmp/mibs/'
+               echo "mib_module_path = '$MIB_MODULE_PATH'"
+
+               echo "mib_modules = {"
+               config_foreach smartsnmpd_mib_module smartsnmpd_module
+               echo "}"
+       } >> $CONFIGFILE
 }
diff --git a/net/smartsnmpd/patches/010-2to3.patch b/net/smartsnmpd/patches/010-2to3.patch
new file mode 100644 (file)
index 0000000..4acca31
--- /dev/null
@@ -0,0 +1,82 @@
+--- a/SConstruct
++++ b/SConstruct
+@@ -133,21 +133,21 @@ env = Environment(
+ )
+ # handle options/environment varibles.
+-if os.environ.has_key('CC'):
++if 'CC' in os.environ:
+   env.Replace(CC = os.environ['CC'])
+ # CFLAGS
+ if GetOption("cflags") != "":
+   env.Append(CFLAGS = GetOption("cflags"))
+-elif os.environ.has_key('CFLAGS'):
++elif 'CFLAGS' in os.environ:
+   env.Append(CFLAGS = os.environ['CFLAGS'])
+ # LDFLAGS
+ if GetOption("ldflags") != "":
+   env.Replace(LINKFLAGS = GetOption("ldflags"))
+-elif os.environ.has_key('LDFLAGS'):
++elif 'LDFLAGS' in os.environ:
+   env.Replace(LINKFLAGS = os.environ['LDFLAGS'])
+-elif os.environ.has_key('LINKFLAGS'):
++elif 'LINKFLAGS' in os.environ:
+   env.Replace(LINKFLAGS = os.environ['LINKFLAGS'])
+ # LIBS
+@@ -183,10 +183,10 @@ elif GetOption("transport") == 'built-in' or GetOption("transport") == '':
+   elif GetOption("evloop") == 'select' or GetOption("evloop") == '':
+     pass
+   else:
+-    print "Error: Not the right event driving type"
++    print("Error: Not the right event driving type")
+     Exit(1)
+ else:
+-  print "Error: Transport not found!"
++  print("Error: Transport not found!")
+   Exit(1)
+ # autoconf
+@@ -205,18 +205,18 @@ else:
+ if GetOption("transport") == 'built-in' or GetOption("transport") == '':
+   if GetOption("evloop") == 'epoll':
+     if not conf.CheckEpoll():
+-      print "Error: epoll failed"
++      print("Error: epoll failed")
+       Exit(1)
+   elif GetOption("evloop") == 'kqueue':
+     if not conf.CheckKqueue():
+-      print "Error: Kqueue failed"
++      print("Error: Kqueue failed")
+       Exit(1)
+   elif GetOption("evloop") == 'select' or GetOption("evloop") == '':
+     if not conf.CheckSelect():
+-      print "Error: select failed"
++      print("Error: select failed")
+       Exit(1)
+   else:
+-    print "Error: Not the right event driving type"
++    print("Error: Not the right event driving type")
+     Exit(1)
+ # CFLAGS
+@@ -232,7 +232,7 @@ if conf.CheckLib('lua'):
+ elif conf.CheckLib('lua5.1'):
+   env.Append(LIBS = ['lua5.1'])
+ else:
+-  print "Error: liblua or liblua5.1 not found!"
++  print("Error: liblua or liblua5.1 not found!")
+   Exit(1)
+ # find lua header files
+@@ -241,7 +241,7 @@ if conf.CheckCHeader('lua.h'):
+ elif conf.CheckCHeader('lua5.1/lua.h'):
+   env.Append(CFLAGS = ['-I/usr/include/lua5.1'])
+ else:
+-  print "Error: lua.h not found"
++  print("Error: lua.h not found")
+   Exit(1)
+ env = conf.Finish()
diff --git a/net/smartsnmpd/patches/020-flags.patch b/net/smartsnmpd/patches/020-flags.patch
new file mode 100644 (file)
index 0000000..05d0971
--- /dev/null
@@ -0,0 +1,44 @@
+--- a/SConstruct
++++ b/SConstruct
+@@ -134,21 +134,21 @@ env = Environment(
+ # handle options/environment varibles.
+ if 'CC' in os.environ:
+-  env.Replace(CC = os.environ['CC'])
++  env.Replace(CC = Split(os.environ['CC']))
+ # CFLAGS
+ if GetOption("cflags") != "":
+   env.Append(CFLAGS = GetOption("cflags"))
+ elif 'CFLAGS' in os.environ:
+-  env.Append(CFLAGS = os.environ['CFLAGS'])
++  env.Append(CFLAGS = Split(os.environ['CFLAGS']))
+ # LDFLAGS
+ if GetOption("ldflags") != "":
+   env.Replace(LINKFLAGS = GetOption("ldflags"))
+ elif 'LDFLAGS' in os.environ:
+-  env.Replace(LINKFLAGS = os.environ['LDFLAGS'])
++  env.Replace(LINKFLAGS = Split(os.environ['LDFLAGS']))
+ elif 'LINKFLAGS' in os.environ:
+-  env.Replace(LINKFLAGS = os.environ['LINKFLAGS'])
++  env.Replace(LINKFLAGS = Split(os.environ['LINKFLAGS']))
+ # LIBS
+ if GetOption("libs") != "":
+@@ -192,15 +192,6 @@ else:
+ # autoconf
+ conf = Configure(env, custom_tests = {'CheckEpoll' : CheckEpoll, 'CheckSelect' : CheckSelect, 'CheckKqueue' : CheckKqueue, 'CheckEndian' : CheckEndian})
+-# Endian check
+-endian = conf.CheckEndian()
+-if endian == 'Big':
+-  env.Append(CFLAGS = ["-DBIG_ENDIAN"])
+-elif endian == 'Little':
+-  env.Append(CFLAGS = ["-DLITTLE_ENDIAN"])
+-else:
+-  raise SConfError("Error when testing the endian.")
+-
+ # built-in event loop check
+ if GetOption("transport") == 'built-in' or GetOption("transport") == '':
+   if GetOption("evloop") == 'epoll':