Rebase mstflint to latest upstream release v4.11.0-2

Resolves: bz1671710

Signed-off-by: Honggang Li <honli@redhat.com>
This commit is contained in:
Honggang Li 2019-02-01 20:14:40 +08:00
parent 4ed35830e4
commit bbc2798aca
8 changed files with 209 additions and 85 deletions

1
.gitignore vendored
View File

@ -23,3 +23,4 @@ noarch/
/mstflint-4.6.0.tar.gz
/mstflint-4.8.0.tar.gz
/mstflint-4.10.0.tar.gz
/mstflint-4.11.0-2.tar.gz

View File

@ -1,47 +0,0 @@
From b947fc631d499fa6e041b6c460320bcd253f4671 Mon Sep 17 00:00:00 2001
From: Honggang Li <honli@redhat.com>
Date: Wed, 22 Feb 2017 01:42:25 -0500
Subject: [PATCH] Extend buffer for a few arrays
Signed-off-by: Honggang Li <honli@redhat.com>
---
mtcr_ul/mtcr_ul_com.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/mtcr_ul/mtcr_ul_com.c b/mtcr_ul/mtcr_ul_com.c
index 50a663f..1335b43 100644
--- a/mtcr_ul/mtcr_ul_com.c
+++ b/mtcr_ul/mtcr_ul_com.c
@@ -1353,7 +1353,7 @@ int mdevices_v_ul(char *buf, int len, int mask, int verbosity)
}
char inbuf[64];
- char fname[64];
+ char fname[300];
d = opendir("/sys/bus/pci/devices");
if (d == NULL) {
@@ -1369,7 +1369,7 @@ int mdevices_v_ul(char *buf, int len, int mask, int verbosity)
continue;
} else if (sz > 4 && strcmp(dir->d_name + sz - 4, "00.0") && !verbosity) {
// Skip virtual functions
- char physfn[64];
+ char physfn[300];
DIR* physfndir;
sprintf(physfn, "/sys/bus/pci/devices/%s/physfn", dir->d_name);
if ((physfndir = opendir(physfn)) != NULL) {
@@ -1993,9 +1993,9 @@ int mclose_ul(mfile *mf)
return 0;
}
-#define IBDR_MAX_NAME_SIZE 128
+#define IBDR_MAX_NAME_SIZE 300
#define BDF_NAME_SIZE 12
-#define DEV_DIR_MAX_SIZE 128
+#define DEV_DIR_MAX_SIZE 300
static
int get_inband_dev_from_pci(char* inband_dev, char* pci_dev)
{
--
2.7.4

View File

@ -0,0 +1,119 @@
From f12533225483f8c9bdc0d1ef7e7a04214571fab2 Mon Sep 17 00:00:00 2001
From: Honggang Li <honli@redhat.com>
Date: Fri, 1 Feb 2019 04:07:13 -0500
Subject: [PATCH] Fix shebang for python scripts
rhel-8 does not support python2. User '#!/usr/bin/python3' for all
python scripts which with a shebang.
The substitution was done with following bash script.
====
pys=$(find . -type f -name '*.py')
for f in $pys; do
sed -ne '1p' $f | grep -q -E '^#!/usr/bin'
if [ $? -eq 0 ]; then
echo $f
sed -e '/^#!\/usr\/bin/d' -i $f
sed -e '1 i\#!/usr/bin/python3' -i $f
fi
done
===
Signed-off-by: Honggang Li <honli@redhat.com>
---
mtcr_py/test.py | 2 +-
small_utils/mlxfwresetlib/mcra.py | 2 +-
small_utils/mlxfwresetlib/mlnx_peripheral_components.py | 2 +-
small_utils/mlxfwresetlib/mlxfwreset_mlnxdriver.py | 2 +-
small_utils/mlxfwresetlib/mlxfwreset_status_checker.py | 2 +-
small_utils/mlxfwresetlib/mlxfwreset_utils.py | 2 +-
small_utils/mlxfwresetlib/pci_device.py | 2 +-
small_utils/mstfwreset.py | 2 +-
8 files changed, 8 insertions(+), 8 deletions(-)
diff --git a/mtcr_py/test.py b/mtcr_py/test.py
index 74c5d28..1e44232 100755
--- a/mtcr_py/test.py
+++ b/mtcr_py/test.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/python3
# Copyright (c) 2004-2010 Mellanox Technologies LTD. All rights reserved.
#
# This software is available to you under a choice of one of two
diff --git a/small_utils/mlxfwresetlib/mcra.py b/small_utils/mlxfwresetlib/mcra.py
index 2144d43..bc44356 100644
--- a/small_utils/mlxfwresetlib/mcra.py
+++ b/small_utils/mlxfwresetlib/mcra.py
@@ -1,4 +1,4 @@
-#!/usr/bin/python
+#!/usr/bin/python3
# Copyright (c) 2004-2010 Mellanox Technologies LTD. All rights reserved.
#
diff --git a/small_utils/mlxfwresetlib/mlnx_peripheral_components.py b/small_utils/mlxfwresetlib/mlnx_peripheral_components.py
index 0ddf8d9..469e24b 100644
--- a/small_utils/mlxfwresetlib/mlnx_peripheral_components.py
+++ b/small_utils/mlxfwresetlib/mlnx_peripheral_components.py
@@ -1,4 +1,4 @@
-#!/usr/bin/python
+#!/usr/bin/python3
# Copyright (c) 2004-2010 Mellanox Technologies LTD. All rights reserved.
#
diff --git a/small_utils/mlxfwresetlib/mlxfwreset_mlnxdriver.py b/small_utils/mlxfwresetlib/mlxfwreset_mlnxdriver.py
index 4971b00..1f34925 100755
--- a/small_utils/mlxfwresetlib/mlxfwreset_mlnxdriver.py
+++ b/small_utils/mlxfwresetlib/mlxfwreset_mlnxdriver.py
@@ -1,4 +1,4 @@
-#!/usr/bin/python
+#!/usr/bin/python3
# Copyright (c) 2004-2010 Mellanox Technologies LTD. All rights reserved.
#
diff --git a/small_utils/mlxfwresetlib/mlxfwreset_status_checker.py b/small_utils/mlxfwresetlib/mlxfwreset_status_checker.py
index 36b82ff..6587e6a 100755
--- a/small_utils/mlxfwresetlib/mlxfwreset_status_checker.py
+++ b/small_utils/mlxfwresetlib/mlxfwreset_status_checker.py
@@ -1,4 +1,4 @@
-#!/usr/bin/python
+#!/usr/bin/python3
# Copyright (c) 2004-2010 Mellanox Technologies LTD. All rights reserved.
#
diff --git a/small_utils/mlxfwresetlib/mlxfwreset_utils.py b/small_utils/mlxfwresetlib/mlxfwreset_utils.py
index 9b07328..2c64044 100755
--- a/small_utils/mlxfwresetlib/mlxfwreset_utils.py
+++ b/small_utils/mlxfwresetlib/mlxfwreset_utils.py
@@ -1,4 +1,4 @@
-#!/usr/bin/python
+#!/usr/bin/python3
# Copyright (c) 2004-2010 Mellanox Technologies LTD. All rights reserved.
#
diff --git a/small_utils/mlxfwresetlib/pci_device.py b/small_utils/mlxfwresetlib/pci_device.py
index 69a65ed..04a6c9a 100644
--- a/small_utils/mlxfwresetlib/pci_device.py
+++ b/small_utils/mlxfwresetlib/pci_device.py
@@ -1,4 +1,4 @@
-#!/usr/bin/python
+#!/usr/bin/python3
# Copyright (c) 2004-2010 Mellanox Technologies LTD. All rights reserved.
#
diff --git a/small_utils/mstfwreset.py b/small_utils/mstfwreset.py
index 6d45200..f764de3 100755
--- a/small_utils/mstfwreset.py
+++ b/small_utils/mstfwreset.py
@@ -1,4 +1,4 @@
-#!/usr/bin/python
+#!/usr/bin/python3
# Copyright (c) 2004-2010 Mellanox Technologies LTD. All rights reserved.
#
--
2.18.1

View File

@ -1,33 +0,0 @@
From 1a097ee9a70a92dd8e81618e42ee3795e2dad004 Mon Sep 17 00:00:00 2001
From: Honggang Li <honli@redhat.com>
Date: Wed, 6 Dec 2017 23:59:43 -0500
Subject: [PATCH] Return zero when fread reach the end of vpd file
Fixes: 4201e56ec8e8 (Title: use mvpd in mstvpd)
Signed-off-by: Honggang Li <honli@redhat.com>
---
mtcr_ul/mtcr_ul_com.c | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/mtcr_ul/mtcr_ul_com.c b/mtcr_ul/mtcr_ul_com.c
index ddafd0a..9f328b5 100644
--- a/mtcr_ul/mtcr_ul_com.c
+++ b/mtcr_ul/mtcr_ul_com.c
@@ -2575,9 +2575,11 @@ int mvpd_read4_ul_int(mfile *mf, unsigned int offset, u_int8_t value[4]){
return errno;
}
if (fread(value, 1, 4, f) < 1) {
- //fprintf(stderr, "Failed to read from (%s): %s\n", proc_dev, strerror(errno));
- fclose(f);
- return errno;
+ if (!feof(f)) {
+ //fprintf(stderr, "Failed to read from (%s): %s\n", proc_dev, strerror(errno));
+ fclose(f);
+ return errno;
+ }
}
fclose(f);
return 0;
--
1.8.3.1

View File

@ -0,0 +1,52 @@
diff --git a/cmdif/Makefile.am b/cmdif/Makefile.am
index d4f89a2..46604f5 100644
--- a/cmdif/Makefile.am
+++ b/cmdif/Makefile.am
@@ -46,7 +46,7 @@ libcmdif_a_SOURCES = tools_cif.c tools_cif.h icmd_cif_common.c icmd_cif_common.h
cmdif_pylibdir = $(libdir)/mstflint/python_tools/
cmdif_pylib_DATA = ${CCMDIF_SO} cmdif.py
${CCMDIF_SO}: libcmdif.a
- $(CC) -g -Wall -pthread -shared ${CFLAGS} *.o -o ${CCMDIF_SO} \
+ $(CC) -g -Wall -pthread -shared ${CFLAGS} ${LDFLAGS} *.o -o ${CCMDIF_SO} \
-L$(USER_DIR)/tools_layouts -ltools_layouts -L$(USER_DIR)/${MTCR_CONF_DIR} -lmtcr_ul
CLEANFILES = ${CCMDIF_SO}
diff --git a/dev_mgt/Makefile.am b/dev_mgt/Makefile.am
index 907e5ce..a7e2249 100644
--- a/dev_mgt/Makefile.am
+++ b/dev_mgt/Makefile.am
@@ -50,7 +50,7 @@ dev_mgt_pylib_DATA = c_dev_mgt.so dev_mgt.py
dist_dev_mgt_pylib_DATA = dev_mgt.py
c_dev_mgt.so: libdev_mgt.a
- $(CC) -g -Wall -pthread -shared ${CFLAGS} tools_dev_types.o -o c_dev_mgt.so \
+ $(CC) -g -Wall -pthread -shared ${CFLAGS} ${LDFLAGS} tools_dev_types.o -o c_dev_mgt.so \
-L$(USER_DIR)/reg_access -lreg_access \
-L$(USER_DIR)/tools_layouts -ltools_layouts \
-L$(USER_DIR)/${MTCR_CONF_DIR} -lmtcr_ul
diff --git a/mtcr_py/Makefile.am b/mtcr_py/Makefile.am
index 5f5677d..566a870 100644
--- a/mtcr_py/Makefile.am
+++ b/mtcr_py/Makefile.am
@@ -39,7 +39,7 @@ MTCR_DIR = $(USER_DIR)/${MTCR_CONF_DIR}
mtcr_pylib_DATA = cmtcr.so mtcr.py
dist_mtcr_pylib_DATA = mtcr.py
cmtcr.so:
- $(CC) -g -Wall -pthread -shared ${CFLAGS} $(MTCR_DIR)/*.o -o cmtcr.so
+ $(CC) -g -Wall -pthread -shared ${CFLAGS} ${LDFLAGS} $(MTCR_DIR)/*.o -o cmtcr.so
CLEANFILES = cmtcr.so
diff --git a/reg_access/Makefile.am b/reg_access/Makefile.am
index 353fe02..7d70fd8 100644
--- a/reg_access/Makefile.am
+++ b/reg_access/Makefile.am
@@ -53,7 +53,7 @@ reg_access_pylib_DATA = ${RREG_ACCESS_SO} regaccess.py
dist_reg_access_pylib_DATA = regaccess.py
${RREG_ACCESS_SO}: libreg_access.a
- $(CC) -g -Wall -pthread -shared ${CFLAGS} *.o -o ${RREG_ACCESS_SO} \
+ $(CC) -g -Wall -pthread -shared ${CFLAGS} ${LDFLAGS} *.o -o ${RREG_ACCESS_SO} \
-L$(USER_DIR)/tools_layouts -ltools_layouts -L$(MTCR_DIR) -lmtcr_ul
CLEANFILES = ${RREG_ACCESS_SO}

13
extend-buffer.patch Normal file
View File

@ -0,0 +1,13 @@
diff --git a/ext_libs/iniParser/iniparser.c b/ext_libs/iniParser/iniparser.c
index 8bc0a18..f981775 100644
--- a/ext_libs/iniParser/iniparser.c
+++ b/ext_libs/iniParser/iniparser.c
@@ -572,7 +572,7 @@ dictionary * iniparser_load(const char * ininame)
char line [ASCIILINESZ+1] ;
char section [ASCIILINESZ+1] ;
char key [ASCIILINESZ+1] ;
- char tmp [ASCIILINESZ+1] ;
+ char tmp [(ASCIILINESZ+1)*2] ;
char val [ASCIILINESZ+1] ;
int last=0 ;

View File

@ -1,14 +1,23 @@
%global __remake_config 1
Name: mstflint
Summary: Mellanox firmware burning tool
Version: 4.10.0
Release: 4%{?dist}
Version: 4.11.0
Release: 2%{?dist}
License: GPLv2+ or BSD
Source: https://github.com/Mellanox/%{name}/files/1457191/%{name}-%{version}.tar.gz
Source: https://github.com/Mellanox/mstflint/releases/download/v4.11.0-2/mstflint-4.11.0-2.tar.gz
Patch1: extend-buffer.patch
Patch2: add-default-link-flags-for-shared-libraries.patch
Patch3: 0001-Fix-shebang-for-python-scripts.patch
Url: https://github.com/Mellanox/mstflint
BuildRequires: libstdc++-devel, zlib-devel, libibmad-devel, gcc-c++, gcc
BuildRequires: libcurl-devel, boost-devel, libxml2-devel, openssl-devel
%if %{__remake_config}
BuildRequires: libtool, autoconf, automake
%endif
Obsoletes: openib-mstflint <= 1.4 openib-tvflash <= 0.9.2 tvflash <= 0.9.0
ExcludeArch: s390 s390x %{arm}
Requires: python3
%description
This package contains firmware update tool, vpd dump and register dump tools
@ -16,12 +25,18 @@ for network adapters based on Mellanox Technologies chips.
%prep
%setup -q
%patch1 -p1
%patch2 -p1
%patch3 -p1
find . -type f -iname '*.[ch]' -exec chmod a-x '{}' ';'
find . -type f -iname '*.cpp' -exec chmod a-x '{}' ';'
%build
export CFLAGS="$RPM_OPT_FLAGS"
export CXXFLAGS="$RPM_OPT_FLAGS"
%if %{__remake_config}
./autogen.sh
%endif
%configure --enable-fw-mgr
%make_build
@ -30,7 +45,7 @@ make DESTDIR=%{buildroot} install
# Remove the devel files that we don't ship
rm -fr %{buildroot}%{_includedir}
find %{buildroot} -type f -name '*.la' -delete
find %{buildroot} -type f -name libmtcr_ul.a -delete
find %{buildroot} -type f -name '*.a' -delete
%files
%doc README
@ -42,6 +57,10 @@ find %{buildroot} -type f -name libmtcr_ul.a -delete
%{_mandir}/man1/*
%changelog
* Fri Feb 1 2019 Honggang Li <honli@redhat.com> - 4.11.0-2
- Rebase mstflint to latest upstream release v4.11.0-2
- Resolves: bz1671710
* Fri Feb 01 2019 Fedora Release Engineering <releng@fedoraproject.org> - 4.10.0-4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_30_Mass_Rebuild

View File

@ -1 +1 @@
SHA512 (mstflint-4.10.0.tar.gz) = c199d020a66dab0cfe578cd7158d75a86f8853cdc5aa8d683c0f15831bebe071fdcc0579d745aa794e08d9754590bef5d33210219fa9e4a0b33f47fb8349b49c
SHA512 (mstflint-4.11.0-2.tar.gz) = 0fa0152a427401bb9ff39c4d27f28dbfc9218c69f9bc0db003ceb3cd696d8875c90fd3bd0cd46c75719a4694c624fccfe7fcd0655c5d1d307f7c917a5b40a876