Browse Source

initial package creation

Signed-off-by: Toshaan Bharvani <toshaan@powerel.org>
master
Toshaan Bharvani 2 years ago
commit
67e2d9a382
  1. 27
      SOURCES/librtas-2.0.1-libversion.patch
  2. 141
      SOURCES/librtas-2.0.2-coverity.patch
  3. 257
      SPECS/librtas.spec

27
SOURCES/librtas-2.0.1-libversion.patch

@ -0,0 +1,27 @@ @@ -0,0 +1,27 @@
From 2c954feaa59657fd8a13cf6e7208c4bf8c46f0dc Mon Sep 17 00:00:00 2001
From: Sinny Kumari <sinny@redhat.com>
Date: Sun, 19 Mar 2017 00:21:22 +0530
Subject: [PATCH] Update library version to 2.0.1 to match with release version

---
Makefile.am | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/Makefile.am b/Makefile.am
index e02d007..5f819c3 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -19,7 +19,9 @@ AM_CFLAGS = -I$(top_srcdir)/librtas_src/ -I$(top_srcdir)/librtasevent_src/
library_includedir=$(includedir)
-LIBRTAS_LIBRARY_VERSION = 2:0:0
+# CURRENT:REVISION:AGE(C:R:A)
+# For calculating version number of library, formula used is (C - A).(A).(R)
+LIBRTAS_LIBRARY_VERSION = 2:2:0
lib_LTLIBRARIES += librtas.la
librtas_la_LDFLAGS = -version-info $(LIBRTAS_LIBRARY_VERSION)
--
2.9.3

141
SOURCES/librtas-2.0.2-coverity.patch

@ -0,0 +1,141 @@ @@ -0,0 +1,141 @@
diff -up librtas-2.0.2/librtasevent_src/get_rtas_event.c.me librtas-2.0.2/librtasevent_src/get_rtas_event.c
--- librtas-2.0.2/librtasevent_src/get_rtas_event.c.me 2021-03-25 11:26:19.754142871 +0100
+++ librtas-2.0.2/librtasevent_src/get_rtas_event.c 2021-03-25 11:29:24.322686995 +0100
@@ -29,6 +29,10 @@
#include "librtasevent.h"
#include "rtas_event.h"
+#if __GNUC__ >= 9
+#pragma GCC diagnostic ignored "-Waddress-of-packed-member"
+#endif
+
/**
* rtas_copy
* @brief front end for common memcpy calls
diff -up librtas-2.0.2/librtasevent_src/rtas_post.c.me librtas-2.0.2/librtasevent_src/rtas_post.c
--- librtas-2.0.2/librtasevent_src/rtas_post.c.me 2021-03-25 11:52:35.489805806 +0100
+++ librtas-2.0.2/librtasevent_src/rtas_post.c 2021-03-25 12:11:38.817324108 +0100
@@ -139,6 +139,7 @@ print_re_post_scn(struct scn_header *shd
len += rtas_print("Self-test error in firmware extended "
"diagnostics.\n");
+ /* coverity[invalid_type : FALSE] */
len += rtas_print("POST Error Code: %x\n", post->err_code);
len += rtas_print("Firmware Revision Code: %x\n", post->firmware_rev);
diff -up librtas-2.0.2/librtasevent_src/rtas_v6_misc.c.me librtas-2.0.2/librtasevent_src/rtas_v6_misc.c
--- librtas-2.0.2/librtasevent_src/rtas_v6_misc.c.me 2021-03-25 11:29:57.445143562 +0100
+++ librtas-2.0.2/librtasevent_src/rtas_v6_misc.c 2021-03-25 11:30:05.924260442 +0100
@@ -28,6 +28,10 @@
#include "librtasevent.h"
#include "rtas_event.h"
+#if __GNUC__ >= 9
+#pragma GCC diagnostic ignored "-Waddress-of-packed-member"
+#endif
+
/**
* months
* @brief array of month strings
diff -up librtas-2.0.2/librtas_src/syscall_calls.c.me librtas-2.0.2/librtas_src/syscall_calls.c
--- librtas-2.0.2/librtas_src/syscall_calls.c.me 2021-03-25 11:34:20.691775299 +0100
+++ librtas-2.0.2/librtas_src/syscall_calls.c 2021-03-25 11:49:03.830951225 +0100
@@ -886,7 +886,7 @@ int rtas_platform_dump(uint64_t dump_tag
uint32_t next_hi, next_lo;
uint32_t bytes_hi, bytes_lo;
uint32_t dump_tag_hi, dump_tag_lo;
- void *kernbuf;
+ void *kernbuf = NULL;
int rc, status;
rc = sanity_check();
@@ -927,6 +927,7 @@ int rtas_platform_dump(uint64_t dump_tag
if (buffer && (rc == 0))
memcpy(buffer, kernbuf, length);
+ /* coverity[uninit_use : FALSE] */
if (kernbuf)
(void)rtas_free_rmo_buffer(kernbuf, kernbuf_pa, length);
diff -up librtas-2.0.2/librtas_src/syscall_rmo.c.me librtas-2.0.2/librtas_src/syscall_rmo.c
--- librtas-2.0.2/librtas_src/syscall_rmo.c.me 2021-03-25 11:49:26.704266218 +0100
+++ librtas-2.0.2/librtas_src/syscall_rmo.c 2021-03-25 12:47:12.108229574 +0100
@@ -247,6 +247,7 @@ static int get_phys_region(size_t size,
if (bits == 0ll) {
if (acquire_file_lock(i, n_pages) == 0) {
set_bits(i, i + n_pages - 1,
+ /* coverity[overflow_before_widen : FALSE] */
(1 << n_pages) - 1,
&wa_config.pages_map);
addr = kregion->addr + (i * PAGE_SIZE);
@@ -289,6 +290,7 @@ static int release_phys_region(uint32_t
bits = get_bits(first_page, first_page + n_pages - 1,
wa_config.pages_map);
+ /* coverity[overflow_before_widen : FALSE] */
if (bits != ((1 << n_pages) - 1)) {
dbg("Invalid region [0x%x, 0x%zx]\n", phys_addr, size);
return RTAS_IO_ASSERT;
diff --git a/librtasevent_src/rtas_srcfru.c b/librtasevent_src/rtas_srcfru.c
index 23c8584..a2eac9a 100644
--- a/librtasevent_src/rtas_srcfru.c
+++ b/librtasevent_src/rtas_srcfru.c
@@ -74,13 +74,13 @@ parse_fru_id_scn(struct rtas_event *re)
re->offset += RE_FRU_HDR_SZ;
if (fruid_has_part_no(fru_id)) {
- strcpy(fru_id->part_no, RE_EVENT_OFFSET(re));
- re->offset += 8;
+ rtas_copy(fru_id->part_no, re, 7);
+ fru_id->part_no[7] = '\0';
}
if (fruid_has_proc_id(fru_id)) {
- strcpy(fru_id->procedure_id, RE_EVENT_OFFSET(re));
- re->offset += 8;
+ rtas_copy(fru_id->procedure_id, re, 7);
+ fru_id->procedure_id[7] = '\0';
}
if (fruid_has_ccin(fru_id)) {
@@ -238,9 +238,10 @@ parse_src_scn(struct rtas_event *re)
add_re_scn(re, src, re_scn_id(&src_raw->v6hdr));
- if (!src_subscns_included(src))
+ if (!src_subscns_included(src)) {
+ free (src_raw);
return 0;
-
+ }
rtas_copy( (char *) src_raw + RE_SRC_SCN_SZ + 4, re, RE_SRC_SUBSCN_SZ);
src->subscn_id = src_raw->subscn_id;
@@ -251,6 +252,7 @@ parse_src_scn(struct rtas_event *re)
total_len = RE_SRC_SUBSCN_SZ;
last_fru = NULL;
+ free(src_raw);
do {
uint32_t fru_len, fru_end;
@@ -288,6 +290,7 @@ parse_src_scn(struct rtas_event *re)
if (cur_fruhdr == NULL) {
cleanup_rtas_event(re);
+ free(fru);
return -1;
}
diff --git a/librtasevent_src/rtas_vend.c b/librtasevent_src/rtas_vend.c
index 6fa717e..2814726 100644
--- a/librtasevent_src/rtas_vend.c
+++ b/librtasevent_src/rtas_vend.c
@@ -116,6 +116,7 @@ parse_vend_errlog_scn(struct rtas_event *re)
ve->vendor_data = malloc(ve->vendor_data_sz);
if (ve->vendor_data == NULL) {
errno = ENOMEM;
+ free(ve);
return -1;
}

257
SPECS/librtas.spec

@ -0,0 +1,257 @@ @@ -0,0 +1,257 @@
Summary: Libraries to provide access to RTAS calls and RTAS events
Name: librtas
Version: 2.0.2
Release: 14%{?dist}
URL: https://github.com/nfont/librtas
License: LGPLv2+

Source0: https://github.com/nfont/librtas/archive/v%{version}.tar.gz

BuildRequires: autoconf
BuildRequires: libtool
BuildRequires: make

Patch0: librtas-2.0.1-libversion.patch
Patch1: librtas-2.0.2-coverity.patch

ExclusiveArch: %{power64}

%description
The librtas shared library provides userspace with an interface
through which certain RTAS calls can be made. The library uses
either of the RTAS User Module or the RTAS system call to direct
the kernel in making these calls.

The librtasevent shared library provides users with a set of
definitions and common routines useful in parsing and dumping
the contents of RTAS events.

%package devel
Summary: C header files for development with librtas
Requires: %{name}%{?_isa} = %{version}-%{release}

%description devel
The librtas-devel packages contains the header files necessary for
developing programs using librtas.

%prep
%autosetup -p1

%build
./autogen.sh
%configure --disable-silent-rules --disable-static
%make_build

%install
%make_install
find %{buildroot} -name '*.la' -exec rm -f {} ';'
rm -f %{buildroot}/%{_docdir}/librtas/*

%post -p /sbin/ldconfig

%postun -p /sbin/ldconfig

%files
%{!?_licensedir:%global license %%doc}
%license COPYING.LESSER
%doc README Changelog
%{_libdir}/librtas.so.*
%{_libdir}/librtasevent.so.*

%files devel
%{_libdir}/librtas.so
%{_libdir}/librtasevent.so
%{_libdir}/pkgconfig/librtas.pc
%{_includedir}/librtas.h
%{_includedir}/librtasevent.h
%{_includedir}/librtasevent_v4.h
%{_includedir}/librtasevent_v6.h

%changelog
* Wed Feb 09 2022 Than Ngo <than@redhat.com> - 2.0.2-14
- Resolves: #2039517, add librtas-devel to compose

* Mon Aug 09 2021 Mohan Boddu <mboddu@redhat.com> - 2.0.2-13
- Rebuilt for IMA sigs, glibc 2.34, aarch64 flags
Related: rhbz#1991688

* Mon May 10 2021 Than Ngo <than@redhat.com> - 2.0.2-12
- Resolves: #1958942, fix license tag

* Fri Apr 16 2021 Mohan Boddu <mboddu@redhat.com> - 2.0.2-11
- Rebuilt for RHEL 9 BETA on Apr 15th 2021. Related: rhbz#1947937

* Fri Mar 26 2021 Than Ngo <than@redhat.com> - 2.0.2-10
- clean up librtas by using rtas_copy

* Thu Mar 25 2021 Than Ngo <than@redhat.com> - 2.0.2-9
- Undo ExclusiveArch

* Thu Mar 25 2021 Than Ngo <than@redhat.com> - 2.0.2-8
- Resolves: #1938786, coverity issues

* Tue Jan 26 2021 Fedora Release Engineering <releng@fedoraproject.org> - 2.0.2-7
- Rebuilt for https://fedoraproject.org/wiki/Fedora_34_Mass_Rebuild

* Tue Jul 28 2020 Fedora Release Engineering <releng@fedoraproject.org> - 2.0.2-6
- Rebuilt for https://fedoraproject.org/wiki/Fedora_33_Mass_Rebuild

* Wed Jan 29 2020 Fedora Release Engineering <releng@fedoraproject.org> - 2.0.2-5
- Rebuilt for https://fedoraproject.org/wiki/Fedora_32_Mass_Rebuild

* Thu Jul 25 2019 Fedora Release Engineering <releng@fedoraproject.org> - 2.0.2-4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_31_Mass_Rebuild

* Fri Feb 01 2019 Fedora Release Engineering <releng@fedoraproject.org> - 2.0.2-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_30_Mass_Rebuild

* Fri Jul 13 2018 Fedora Release Engineering <releng@fedoraproject.org> - 2.0.2-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_29_Mass_Rebuild

* Fri Jul 06 2018 Sinny Kumari <sinnykumari@fedoraproject.org> - 2.0.2-1
- Rebase to 2.0.2

* Wed Feb 07 2018 Fedora Release Engineering <releng@fedoraproject.org> - 2.0.1-4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_28_Mass_Rebuild

* Thu Aug 03 2017 Fedora Release Engineering <releng@fedoraproject.org> - 2.0.1-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Binutils_Mass_Rebuild

* Wed Jul 26 2017 Fedora Release Engineering <releng@fedoraproject.org> - 2.0.1-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Mass_Rebuild

* Tue Apr 04 2017 Sinny Kumari <sinnykumari@fedoraproject.org> - 2.0.1-1
- Rebase to 2.0.1

* Fri Feb 10 2017 Fedora Release Engineering <releng@fedoraproject.org> - 2.0.0-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_26_Mass_Rebuild

* Mon Jul 11 2016 Peter Robinson <pbrobinson@fedoraproject.org> 2.0.0-2
- Package cleanup, update URLs
- Use %%license

* Wed Apr 06 2016 Sinny Kumari <sinnykumari@fedoraproject.org> - 2.0.0-1
- Update to upstream release 2.0.0
- do-not-enable-debug-message patch is available in this release

* Mon Mar 21 2016 Vasant Hegde <hegdevasant@linux.vnet.ibm.com> - 1.4.0-2
- Do not enable debug message by default

* Fri Mar 11 2016 Sinny Kumari <sinnykumari@fedoraproject.org> - 1.4.0-1
- Update to latest upstream 1.4.0
- License change from CPL to LGPL

* Thu Feb 04 2016 Fedora Release Engineering <releng@fedoraproject.org> - 1.3.14-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_24_Mass_Rebuild

* Mon Nov 16 2015 Vasant Hegde <hegdevasant@linux.vnet.ibm.com> - 1.3.14
- Update to latest upstream 1.3.14

* Fri Jul 03 2015 Jakub Čajka - 1.3.13-3
- Fix byteswapping see http://sourceforge.net/p/librtas/code/ci/4e46c718f42bf05e797c7fcfdd6cfc2a21fb4c91/

* Wed Jun 17 2015 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.3.13-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_23_Mass_Rebuild

* Mon Nov 03 2014 Vasant Hegde <hegdevasant@fedoraproject.org> - 1.3.13
- Update to latest upstream 1.3.13

* Mon Sep 22 2014 Vasant Hegde <hegdevasant@fedoraproject.org> - 1.3.12
- Update to latest upstream 1.3.12

* Fri Aug 01 2014 Brent Baude <bbaude@redhat.com> - 1.3.9-6
- NVR bump for Fedora 21 build on merged koji

* Sat Jun 07 2014 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.3.9-5
- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_Mass_Rebuild

* Mon May 26 2014 Jakub Čajka <jcajka@redhat.com> 1.3.9-4
- Spec file clean up

* Fri Mar 07 2014 Karsten Hopp <karsten@redhat.com> 1.3.9-3
- fix CFLAGS

* Thu Mar 06 2014 Vasant Hegde <hegdevasant@fedoraproject.org> - 1.3.9-2
- Disable "-Werror=format-security" gcc option

* Tue Mar 04 2014 Vasant Hegde <hegdevasant@fedoraproject.org> - 1.3.9
- Update to latest upstream 1.3.9

* Wed Oct 09 2013 Vasant Hegde <hegdevasant@linux.vnet.ibm.com> - 1.3.8-3
- Add ppc64le architecture

* Sat Aug 03 2013 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.3.8-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_20_Mass_Rebuild

* Thu May 16 2013 Vasant Hegde <hegdevasant@fedoraproject.org> - 1.3.8
- Update to latest upstream 1.3.8

* Thu Feb 14 2013 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.3.6-4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_19_Mass_Rebuild

* Thu Jul 19 2012 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.3.6-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_18_Mass_Rebuild

* Fri Jan 13 2012 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.3.6-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_17_Mass_Rebuild

* Thu Aug 11 2011 Jiri Skala <jskala@redhat.com> 1.3.6-1
- update to latest upstream 1.3.6

* Mon Aug 08 2011 Jiri Skala <jskala@redhat.com> 1.3.5-1
- update to latest upstream 1.3.5

* Tue Feb 08 2011 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.3.4-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_15_Mass_Rebuild

* Sat Sep 11 2010 Parag Nemade <paragn AT fedoraproject.org> 2.30.3-3
- Merge-review cleanup (#226059)

* Mon Sep 21 2009 Roman Rakus <rrakus@redhat.com> - 1.3.4-1
- Upstream release 1.3.4

* Sat Jul 25 2009 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.3.3-5
- Rebuilt for https://fedoraproject.org/wiki/Fedora_12_Mass_Rebuild

* Wed Feb 25 2009 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.3.3-4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_11_Mass_Rebuild

* Fri Feb 08 2008 David Cantrell <dcantrell@redhat.com> - 1.3.3-3
- Rebuild for gcc-4.3

* Tue Dec 18 2007 David Cantrell <dcantrell@redhat.com> - 1.3.3-2
- Spec cleanups

* Tue Dec 18 2007 David Cantrell <dcantrell@redhat.com> - 1.3.3-1
- Upgraded to librtas-1.3.3 (#253522)

* Mon Sep 10 2007 David Cantrell <dcantrell@redhat.com> - 1.3.2-1
- Upgraded to librtas-1.3.2
- Cleaned up spec file to conform to Fedora packaging guidelines

* Tue Aug 21 2007 David Cantrell <dcantrell@redhat.com> - 1.2.4-4
- Rebuild

* Sat Mar 31 2007 David Woodhouse <dwmw2@redhat.com> - 1.2.4-3
- Install libraries into /usr/lib64 on PPC64.

* Tue Aug 01 2006 Paul Nasrat <pnasrat@redhat.com> - 1.2.4-2
- Backport syscall fix from upstream

* Wed Jul 12 2006 Jesse Keating <jkeating@redhat.com> - 1.2.4-1.2.2
- rebuild

* Fri Feb 10 2006 Jesse Keating <jkeating@redhat.com> - 1.2.4-1.2.1
- bump again for double-long bug on ppc(64)

* Tue Feb 07 2006 Jesse Keating <jkeating@redhat.com> - 1.2.4-1.2
- rebuilt for new gcc4.1 snapshot and glibc changes

* Fri Dec 09 2005 Jesse Keating <jkeating@redhat.com>
- rebuilt

* Thu Nov 03 2005 Paul Nasrat <pnasrat@redhat.com> 1.2.4-1
- Update to latest version

* Thu Nov 03 2005 Paul Nasrat <pnasrat@redhat.com> 1.2.2-1
- Initial release
Loading…
Cancel
Save