yapsnmp library for python

git-svn-id: svn://svn.openwrt.org/openwrt/packages@8133 3c298f89-4303-0410-b956-a3cf2f4a3e73
This commit is contained in:
pavlov 2007-07-23 17:39:06 +00:00
parent 0e27176e51
commit 472d3ee8eb
2 changed files with 485 additions and 0 deletions

60
libs/yapsnmp/Makefile Normal file
View File

@ -0,0 +1,60 @@
#
#
include $(TOPDIR)/rules.mk
PKG_NAME:=yapsnmp
PKG_VERSION:=0.7.8
PKG_RELEASE:=1
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
PKG_SOURCE_URL:=@SF/$(PKG_NAME)
PKG_MD5SUM:=8a3e9a5b814388d7907c639105cb2365
PKG_CAT:=zcat
PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)
include $(INCLUDE_DIR)/package.mk
define Package/yapsnmp
SECTION:=libs
CATEGORY:=Libraries
TITLE:=Python SNMP module
DEPENDS:=+libnetsnmp
DESCRIPTION:=\
yapsnmp is a Python SNMP module based on the net-snmp (formerly known \\\
as ucd-snmp) library. It's composed of a low level interface to the \\\
library, created using SWIG, and a higher level python module \\\
removing all the complexity out of dealing with SNMP.
URL:=http://yapsnmp.sourceforge.net/
endef
define Build/Configure
$(call Build/Configure/Default, \
--includedir="$(STAGING_DIR)/usr/include" \
--oldincludedir="$(STAGING_DIR)/usr/include" \
--enable-shared \
--enable-static \
)
endef
define Build/Compile
$(SED) 's#^oldincludedir.*#oldincludedir = $(STAGING_DIR)/usr/include#' \
$(PKG_BUILD_DIR)/src/Makefile
$(SED) 's#^sys_lib_search_path_spec.*#sys_lib_search_path_spec="$(STAGING_DIR)/lib $(STAGING_DIR)/usr/lib"#' \
$(PKG_BUILD_DIR)/libtool
$(MAKE) -C $(PKG_BUILD_DIR) \
SNMPINCDIR="$(STAGING_DIR)/usr/include/net-snmp/library" \
includedir="$(STAGING_DIR)/usr/include" \
DESTDIR=$(PKG_INSTALL_DIR) \
all install
endef
pylibdir:=$(shell $(STAGING_DIR)/usr/bin/hostpython $(SCRIPT_DIR)/pylibdir.py)
define Package/yapsnmp/install
$(INSTALL_DIR) $(1)$(pylibdir)
$(CP) -a $(PKG_INSTALL_DIR)/* $(1)$(pylibdir)
endef
$(eval $(call BuildPackage,yapsnmp))

View File

@ -0,0 +1,425 @@
--- yapsnmp-0.7.8/configure 2004-03-08 05:21:26.000000000 -0600
+++ yapsnmp-0.7.8.new/configure 2007-07-19 15:19:03.712465556 -0500
@@ -9291,7 +9291,7 @@
done
-for PYTHONINCPATH in python2.3 python2.2 python2.1 python2.0 python1.6 python1.5
+for PYTHONINCPATH in python2.5 python2.4 python2.3 python2.2 python2.1 python2.0 python1.6 python1.5
do
as_ac_Header=`echo "ac_cv_header_$PYTHONINCPATH/Python.h" | $as_tr_sh`
if eval "test \"\${$as_ac_Header+set}\" = set"; then
--- yapsnmp-0.7.8/src/mib.h-patch 2004-03-07 17:09:53.000000000 -0600
+++ yapsnmp-0.7.8.new/src/mib.h-patch 2007-07-19 15:12:46.266956163 -0500
@@ -1,36 +1,11 @@
-*** /usr/include/net-snmp/library/mib.h 2003-11-11 08:37:02.000000000 -0800
---- mib.h 2004-03-07 14:59:47.000000000 -0800
-***************
-*** 127,133 ****
- int get_wild_node(const char *, oid *, size_t *);
- int get_node(const char *, oid *, size_t *);
- oid *snmp_parse_oid(const char *, oid *, size_t *);
-! struct tree *get_symbol(oid *, size_t, struct tree *, char *);
- struct tree *get_tree(const oid *, size_t, struct tree *);
- struct tree *get_tree_head(void);
- void set_function(struct tree *);
---- 127,133 ----
- int get_wild_node(const char *, oid *, size_t *);
- int get_node(const char *, oid *, size_t *);
- oid *snmp_parse_oid(const char *, oid *, size_t *);
-! /* struct tree *get_symbol(oid *, size_t, struct tree *, char *);*/
- struct tree *get_tree(const oid *, size_t, struct tree *);
- struct tree *get_tree_head(void);
- void set_function(struct tree *);
-***************
-*** 482,488 ****
- const char *parse_octet_hint(const char *hint, const char *value,
- unsigned char **new_val, int *new_val_len);
-
-! void clear_tree_flags(register struct tree *tp);
-
- char *snmp_out_toggle_options(char *);
- void snmp_out_toggle_options_usage(const char *, FILE *);
---- 482,488 ----
- const char *parse_octet_hint(const char *hint, const char *value,
- unsigned char **new_val, int *new_val_len);
-
-! /* void clear_tree_flags(register struct tree *tp);*/
-
- char *snmp_out_toggle_options(char *);
- void snmp_out_toggle_options_usage(const char *, FILE *);
+--- mib.h.old 2007-07-19 15:11:03.917123577 -0500
++++ mib.h 2007-07-19 15:10:44.804034380 -0500
+@@ -498,7 +498,7 @@
+ const char *parse_octet_hint(const char *hint, const char *value,
+ unsigned char **new_val, int *new_val_len);
+
+- void clear_tree_flags(register struct tree *tp);
++ /* void clear_tree_flags(register struct tree *tp); */
+
+ char *snmp_out_toggle_options(char *);
+ void snmp_out_toggle_options_usage(const char *, FILE *);
--- yapsnmp-0.7.8/src/snmp_api.h-patch 2004-03-07 17:09:53.000000000 -0600
+++ yapsnmp-0.7.8.new/src/snmp_api.h-patch 2007-07-19 14:59:23.653217810 -0500
@@ -1,147 +1,100 @@
-*** /usr/include/net-snmp/library/snmp_api.h 2003-11-11 08:37:07.000000000 -0800
---- snmp_api.h 2004-03-07 15:02:18.000000000 -0800
-***************
-*** 82,91 ****
-
- /*
- * The actual transport domain. This SHOULD NOT BE FREE()D.
-- */
-
- const oid *tDomain;
- size_t tDomainLen;
-
- netsnmp_variable_list *variables;
-
---- 82,91 ----
-
- /*
- * The actual transport domain. This SHOULD NOT BE FREE()D.
-
- const oid *tDomain;
- size_t tDomainLen;
-+ */
-
- netsnmp_variable_list *variables;
-
-***************
-*** 152,158 ****
- /*
- * Authentication function or NULL if null authentication is used
- */
-! u_char *(*authenticator) (u_char *, size_t *, u_char *, size_t);
- netsnmp_callback callback; /* Function to interpret incoming data */
- /*
- * Pointer to data that the callback function may consider important
---- 152,158 ----
- /*
- * Authentication function or NULL if null authentication is used
- */
-! /* u_char *(*authenticator) (u_char *, size_t *, u_char *, size_t);*/
- netsnmp_callback callback; /* Function to interpret incoming data */
- /*
- * Pointer to data that the callback function may consider important
-***************
-*** 384,391 ****
---- 384,393 ----
-
- #define SNMPERR_MAX (-63)
-
-+ /*
- #define non_repeaters errstat
- #define max_repetitions errindex
-+ */
-
- struct variable_list {
- struct variable_list *next_variable; /* NULL for last variable */
-***************
-*** 410,416 ****
- oid name_loc[MAX_OID_LEN]; /* 90 percentile < 24. */
- u_char buf[40]; /* 90 percentile < 40. */
- void *data; /* (Opaque) hook for additional data */
-! void (*dataFreeHook)(void *); /* callback to free above */
- int index;
- };
-
---- 412,418 ----
- oid name_loc[MAX_OID_LEN]; /* 90 percentile < 24. */
- u_char buf[40]; /* 90 percentile < 40. */
- void *data; /* (Opaque) hook for additional data */
-! /* void (*dataFreeHook)(void *); */ /* callback to free above */
- int index;
- };
-
-***************
-*** 601,608 ****
- size_t);
- int netsnmp_oid_equals(const oid *, size_t, const oid *,
- size_t);
-! int netsnmp_oid_tree_equals(const oid *, size_t, const oid *,
-! size_t);
- int netsnmp_oid_is_subtree(const oid *, size_t, const oid *,
- size_t);
- int netsnmp_oid_find_prefix(const oid * in_name1, size_t len1,
---- 603,610 ----
- size_t);
- int netsnmp_oid_equals(const oid *, size_t, const oid *,
- size_t);
-! /* int netsnmp_oid_tree_equals(const oid *, size_t, const oid *,
-! size_t);*/
- int netsnmp_oid_is_subtree(const oid *, size_t, const oid *,
- size_t);
- int netsnmp_oid_find_prefix(const oid * in_name1, size_t len1,
-***************
-*** 619,629 ****
---- 621,633 ----
+--- snmp_api.h.orig Fri Jan 7 17:06:46 2005
++++ snmp_api.h Fri Jan 7 17:10:01 2005
+@@ -112,10 +112,10 @@
+
+ /**
+ * The actual transport domain. This SHOULD NOT BE FREE()D.
+- */
+
+ const oid *tDomain;
+ size_t tDomainLen;
++ */
+
+ netsnmp_variable_list *variables;
+
+@@ -209,7 +209,7 @@
+ /**
+ * Authentication function or NULL if null authentication is used
+ */
+- u_char *(*authenticator) (u_char *, size_t *, u_char *, size_t);
++ /* u_char *(*authenticator) (u_char *, size_t *, u_char *, size_t); */
+ /** Function to interpret incoming data */
+ netsnmp_callback callback;
+ /**
+@@ -487,8 +487,10 @@
+
+ #define SNMPERR_MAX (-63)
+
++/*
+ #define non_repeaters errstat
+ #define max_repetitions errindex
++*/
+
+ typedef union {
+ long *integer;
+@@ -530,7 +532,7 @@
+ /** (Opaque) hook for additional data */
+ void *data;
+ /** callback to free above */
+- void (*dataFreeHook)(void *);
++ /* void (*dataFreeHook)(void *); */
+ int index;
+ };
+
+@@ -721,8 +723,8 @@
+ size_t);
+ int netsnmp_oid_equals(const oid *, size_t, const oid *,
+ size_t);
+- int netsnmp_oid_tree_equals(const oid *, size_t, const oid *,
+- size_t);
++/* int netsnmp_oid_tree_equals(const oid *, size_t, const oid *,
++ size_t);*/
+ int netsnmp_oid_is_subtree(const oid *, size_t, const oid *,
+ size_t);
+ int netsnmp_oid_find_prefix(const oid * in_name1, size_t len1,
+@@ -739,11 +741,13 @@
+ size_t * out_length,
+ u_char * pdu_data,
+ size_t pdu_data_len);
++/*
+ int snmpv3_packet_rbuild(netsnmp_session *,
+ netsnmp_pdu *pdu, u_char * packet,
size_t * out_length,
u_char * pdu_data,
size_t pdu_data_len);
-+ /*
- int snmpv3_packet_rbuild(netsnmp_session *,
- netsnmp_pdu *pdu, u_char * packet,
- size_t * out_length,
- u_char * pdu_data,
- size_t pdu_data_len);
-+ */
- int snmpv3_make_report(netsnmp_pdu *pdu, int error);
- int snmpv3_get_report_type(netsnmp_pdu *pdu);
- int snmp_pdu_parse(netsnmp_pdu *pdu, u_char * data,
-***************
-*** 672,677 ****
---- 676,682 ----
- * Extended open; fpre_parse has changed.
- */
-
-+ /*
- netsnmp_session *snmp_open_ex(netsnmp_session *,
- int (*fpre_parse) (netsnmp_session *,
- struct
-***************
-*** 689,694 ****
---- 694,700 ----
- netsnmp_pdu *, u_char **,
- size_t *, size_t *),
- int (*fcheck) (u_char *, size_t));
-+ */
-
- /*
- * provided for backwards compatability. Don't use these functions.
-***************
-*** 770,775 ****
---- 776,782 ----
- *
- */
-
-+ /*
- void *snmp_sess_add_ex(netsnmp_session *,
- struct netsnmp_transport_s *,
- int (*fpre_parse) (netsnmp_session *,
-***************
-*** 836,841 ****
---- 843,849 ----
- *, void *,
- size_t)
- );
-+ */
-
- /*
- * use return value from snmp_sess_open as void * parameter
++*/
+ int snmpv3_make_report(netsnmp_pdu *pdu, int error);
+ int snmpv3_get_report_type(netsnmp_pdu *pdu);
+ int snmp_pdu_parse(netsnmp_pdu *pdu, u_char * data,
+@@ -793,6 +797,7 @@
+ * Extended open; fpre_parse has changed.
+ */
+
++ /*
+ netsnmp_session *snmp_open_ex(netsnmp_session *,
+ int (*fpre_parse) (netsnmp_session *,
+ struct
+@@ -810,6 +815,7 @@
+ netsnmp_pdu *, u_char **,
+ size_t *, size_t *),
+ int (*fcheck) (u_char *, size_t));
++ */
+
+ /*
+ * provided for backwards compatability. Don't use these functions.
+@@ -891,6 +897,7 @@
+ *
+ */
+
++ /*
+ void *snmp_sess_add_ex(netsnmp_session *,
+ struct netsnmp_transport_s *,
+ int (*fpre_parse) (netsnmp_session *,
+@@ -957,6 +964,7 @@
+ *, void *,
+ size_t)
+ );
++ */
+
+ /*
+ * use return value from snmp_sess_open as void * parameter
--- yapsnmp-0.7.8/configure.old 2007-07-19 16:27:36.126818690 -0500
+++ yapsnmp-0.7.8/configure 2007-07-19 16:28:12.692902474 -0500
@@ -8816,7 +8816,7 @@
#define HAVE_LIBSNMP 1
_ACEOF
- LIBS="-lsnmp $LIBS"
+ LIBS="-lnetsnmp $LIBS"
else
{ { echo "$as_me:$LINENO: error: Couldn't find libsnmp" >&5
--- yapsnmp-0.7.8/configure.old 2007-07-19 16:30:48.185763508 -0500
+++ yapsnmp-0.7.8/configure 2007-07-19 16:30:52.021982121 -0500
@@ -8757,13 +8757,13 @@
fi
-echo "$as_me:$LINENO: checking for init_snmp in -lsnmp" >&5
-echo $ECHO_N "checking for init_snmp in -lsnmp... $ECHO_C" >&6
+echo "$as_me:$LINENO: checking for init_snmp in -lnetsnmp" >&5
+echo $ECHO_N "checking for init_snmp in -lnetsnmp... $ECHO_C" >&6
if test "${ac_cv_lib_snmp_init_snmp+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
ac_check_lib_save_LIBS=$LIBS
-LIBS="-lsnmp $LIBS"
+LIBS="-lnetsnmp $LIBS"
cat >conftest.$ac_ext <<_ACEOF
#line $LINENO "configure"
/* confdefs.h. */
--- yapsnmp-0.7.8/configure.old 2007-07-19 16:31:52.277415884 -0500
+++ yapsnmp-0.7.8/configure 2007-07-19 16:36:41.477896480 -0500
@@ -9262,35 +9262,6 @@
done
-
-for TEMP in $oldincludedir $ac_default_prefix/include $prefix/include
-do
- SNMPINCDIR=$TEMP/$NETINCL
- as_ac_File=`echo "ac_cv_file_$SNMPINCDIR" | $as_tr_sh`
-echo "$as_me:$LINENO: checking for $SNMPINCDIR" >&5
-echo $ECHO_N "checking for $SNMPINCDIR... $ECHO_C" >&6
-if eval "test \"\${$as_ac_File+set}\" = set"; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
- test "$cross_compiling" = yes &&
- { { echo "$as_me:$LINENO: error: cannot check for file existence when cross compiling" >&5
-echo "$as_me: error: cannot check for file existence when cross compiling" >&2;}
- { (exit 1); exit 1; }; }
-if test -r "$SNMPINCDIR"; then
- eval "$as_ac_File=yes"
-else
- eval "$as_ac_File=no"
-fi
-fi
-echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_File'}'`" >&5
-echo "${ECHO_T}`eval echo '${'$as_ac_File'}'`" >&6
-if test `eval echo '${'$as_ac_File'}'` = yes; then
- break
-fi
-
-done
-
-
for PYTHONINCPATH in python2.5 python2.4 python2.3 python2.2 python2.1 python2.0 python1.6 python1.5
do
as_ac_Header=`echo "ac_cv_header_$PYTHONINCPATH/Python.h" | $as_tr_sh`
--- yapsnmp-0.7.8/configure.old 2007-07-19 16:37:52.729956905 -0500
+++ yapsnmp-0.7.8/configure 2007-07-19 16:39:47.880518956 -0500
@@ -9406,35 +9406,6 @@
if test "${enable_site_packages_prefix+set}" = set; then
enableval="$enable_site_packages_prefix"
SITEPACKAGE=\$\(exec_prefix\)/lib/$PYTHONINCPATH/site-packages
-else
-
-for TEMP in /usr/lib $ac_default_prefix/lib $prefix/lib
-do
- SITEPACKAGE=$TEMP/$PYTHONINCPATH/site-packages
- as_ac_File=`echo "ac_cv_file_$SITEPACKAGE" | $as_tr_sh`
-echo "$as_me:$LINENO: checking for $SITEPACKAGE" >&5
-echo $ECHO_N "checking for $SITEPACKAGE... $ECHO_C" >&6
-if eval "test \"\${$as_ac_File+set}\" = set"; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
- test "$cross_compiling" = yes &&
- { { echo "$as_me:$LINENO: error: cannot check for file existence when cross compiling" >&5
-echo "$as_me: error: cannot check for file existence when cross compiling" >&2;}
- { (exit 1); exit 1; }; }
-if test -r "$SITEPACKAGE"; then
- eval "$as_ac_File=yes"
-else
- eval "$as_ac_File=no"
-fi
-fi
-echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_File'}'`" >&5
-echo "${ECHO_T}`eval echo '${'$as_ac_File'}'`" >&6
-if test `eval echo '${'$as_ac_File'}'` = yes; then
- break
-fi
-
-done
-
fi;
--- yapsnmp-0.7.8/src/Makefile.in.old 2007-07-19 21:38:20.589306061 -0500
+++ yapsnmp-0.7.8/src/Makefile.in 2007-07-19 21:38:37.290257791 -0500
@@ -180,7 +180,7 @@
rm -f "$${dir}/so_locations"; \
done
netsnmpc.la: $(netsnmpc_la_OBJECTS) $(netsnmpc_la_DEPENDENCIES)
- $(LINK) -rpath $(libdir) $(netsnmpc_la_LDFLAGS) $(netsnmpc_la_OBJECTS) $(netsnmpc_la_LIBADD) $(LIBS)
+ $(LINK) -rpath /usr/lib $(netsnmpc_la_LDFLAGS) $(netsnmpc_la_OBJECTS) $(netsnmpc_la_LIBADD) $(LIBS)
mostlyclean-compile:
-rm -f *.$(OBJEXT) core *.core