From b116c29cbbe0bf16f4198a8be8fd7e32c30b7385 Mon Sep 17 00:00:00 2001 From: Rob Sanders Date: Tue, 18 Sep 2018 12:55:14 -0400 Subject: [PATCH 1/5] Update Makefile/spec file - Updated Makefile rpm and clean targets - Bumped version on spec file to match Makefile - Added changelog entries for my just merged commits - Fixed dates on existing changelog entries to fix rpmbuild errors/warnings - Updates spec file similar to EPEL's version to generate regular and devel packages --- Makefile | 7 +++--- libcli.spec | 66 ++++++++++++++++++++++++++++++++++++++++++----------- 2 files changed, 57 insertions(+), 16 deletions(-) diff --git a/Makefile b/Makefile index 51a984f..ec02b0a 100644 --- a/Makefile +++ b/Makefile @@ -61,7 +61,7 @@ clitest.exe: clitest.c libcli.o $(CC) $(CPPFLAGS) $(CFLAGS) -o $@ $< libcli.o -lws2_32 clean: - rm -f *.o $(LIB)* $(LIB_STATIC) clitest + rm -f *.o $(LIB)* $(LIB_STATIC) clitest libcli-$(MAJOR).$(MINOR).$(REVISION) install: $(TARGET_LIBS) install -d $(DESTDIR)$(PREFIX)/include $(DESTDIR)$(PREFIX)/lib @@ -77,8 +77,9 @@ install: $(TARGET_LIBS) endif rpm: + rm -rf libcli-$(MAJOR).$(MINOR).$(REVISION) mkdir libcli-$(MAJOR).$(MINOR).$(REVISION) - cp -R *.c *.h Makefile Doc README *.spec libcli-$(MAJOR).$(MINOR).$(REVISION) + cp -R libcli.{c,h} libcli.spec clitest.c Makefile COPYING README libcli-$(MAJOR).$(MINOR).$(REVISION) tar zcvf libcli-$(MAJOR).$(MINOR).$(REVISION).tar.gz --exclude CVS --exclude *.tar.gz libcli-$(MAJOR).$(MINOR).$(REVISION) rm -rf libcli-$(MAJOR).$(MINOR).$(REVISION) - rpm -ta libcli-$(MAJOR).$(MINOR).$(REVISION).tar.gz --clean + rpmbuild -ta libcli-$(MAJOR).$(MINOR).$(REVISION).tar.gz --clean diff --git a/libcli.spec b/libcli.spec index 4d459a3..bc74e7d 100644 --- a/libcli.spec +++ b/libcli.spec @@ -1,4 +1,4 @@ -Version: 1.9.7 +Version: 1.9.8 Summary: Cisco-like telnet command-line library Name: libcli Release: 1 @@ -8,35 +8,75 @@ Source: %{name}-%{version}.tar.gz URL: http://code.google.com/p/libcli Packager: David Parrish BuildRoot: %{_tmppath}/%{name}-%{version}-%(%__id -un) + +%package devel +Summary: Development files for libcli +Group: Development/Libraries +Requires: %{name} = %{version}-%{release} + %description libcli provides a shared library for including a Cisco-like command-line interface into other software. It's a telnet interface which supports command-line editing, history, authentication and callbacks for a user-definable function tree. +%description devel +libcli provides a shared library for including a Cisco-like command-line +interface into other software. It's a telnet interface which supports +command-line editing, history, authentication and callbacks for a +user-definable function tree. +This package contains the devel files. + %prep -%setup +%setup -q %build make %install rm -rf $RPM_BUILD_ROOT -make DESTDIR=$RPM_BUILD_ROOT PREFIX=/usr install -find $RPM_BUILD_ROOT/usr ! -type d -print | grep -v '\/(README|\.html)$' | \ - sed "s@^$RPM_BUILD_ROOT@@g" | sed "s/^\(.*\)$/\1\*/" > %{name}-%{version}-filelist +install -d -p %{buildroot}%{_includedir} +install -p -m 644 libcli*.h %{buildroot}%{_includedir}/ +install -d -p %{buildroot}%{_libdir} +install -p -m 755 libcli.so.1.9.8 %{buildroot}%{_libdir}/ +install -p -m 755 libcli.a %{buildroot}%{_libdir}/ +ln -s %{_libdir}/libcli.so.1.9.8 %{buildroot}%{_libdir}/libcli.so.1.9 +ln -s %{_libdir}/libcli.so.1.9 %{buildroot}%{_libdir}/libcli.so -%post -ldconfig +%post -p /sbin/ldconfig + +%postun -p /sbin/ldconfig %clean rm -rf $RPM_BUILD_ROOT -%files -f %{name}-%{version}-filelist +%files +%doc COPYING +%{_libdir}/*\.so.* +%defattr(-, root, root) + +%files devel +%doc README +%{_libdir}/*.so* +%{_libdir}/*.a +%{_includedir}/*.h %defattr(-, root, root) %changelog -* Mon Feb 1 2010 David Parrish 1.9.7-1 +* Tue Sep 18 2018 Rob Sanders 1.9.8-3 +- Update spec file similar to EPEL's for regular and devel pacakges +- Update Makefile rpm target to build both regular and devel pacakges +- Update changelog for new fixes) +- Update changelog (fix dates on several commits to avoid rpmbuild complaint) + +* Sun Sep 16 2018 David Parrish 1.9.8-2 +- Reformat patches with clang-format + +* Thu Sep 13 2018 Rob Sanders 1.9.8-1 +- Fix segfaults processing long lines in cli_loop() +- Fix Coverity identified issues at the 'low' aggressive level + +* Sun Jul 22 2012 David Parrish 1.9.7-1 - Fix memory leak in cli_get_completions - fengxj325@gmail.com * Tue Jun 5 2012 Teemu Karimerto 1.9.6-1 @@ -55,13 +95,13 @@ rm -rf $RPM_BUILD_ROOT - Migrate development to Google Code - Remove docs as they were out of date and now migrated to Google Code wiki -* Fri Jul 28 2008 David Parrish 1.9.3-1 +* Sun Jul 27 2008 David Parrish 1.9.3-1 - Add support for compiling on WIN32 (Thanks Hamish Coleman) - Fix cli_build_shortest() length handling - Don't call cli_build_shortest() when registering every command - Disable TAB completion during username entry -* Fri Jun 2 2008 David Parrish 1.9.2-1 +* Fri May 2 2008 David Parrish 1.9.2-1 - Add configurable timeout for cli_regular() - defaults to 1 second - Add idle timeout support @@ -77,10 +117,10 @@ rm -rf $RPM_BUILD_ROOT - Many code cleanups and optimisations - Fix memory leak calling cli_loop() repeatedly - Thanks Qiang Wu -* Mon Jan 19 2007 David Parrish 1.8.8-1 +* Sun Feb 18 2007 David Parrish 1.8.8-1 - Fix broken auth_callback logic - Thanks Ben Menchaca -* Sat Jun 17 2006 Brendan O'Dea 1.8.7-1 +* Thu Jun 22 2006 Brendan O'Dea 1.8.7-1 - Code cleanups. - Declare internal functions static. - Use private data in cli_def rather than static buffers for do_print From 603f1dd8b732faa7b636bc2b15958ec1f65202aa Mon Sep 17 00:00:00 2001 From: Rob Sanders Date: Tue, 18 Sep 2018 15:52:54 -0400 Subject: [PATCH 2/5] Tweak makefile slightly to avoid message about debug packages --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index ec02b0a..d3ae44c 100644 --- a/Makefile +++ b/Makefile @@ -82,4 +82,4 @@ rpm: cp -R libcli.{c,h} libcli.spec clitest.c Makefile COPYING README libcli-$(MAJOR).$(MINOR).$(REVISION) tar zcvf libcli-$(MAJOR).$(MINOR).$(REVISION).tar.gz --exclude CVS --exclude *.tar.gz libcli-$(MAJOR).$(MINOR).$(REVISION) rm -rf libcli-$(MAJOR).$(MINOR).$(REVISION) - rpmbuild -ta libcli-$(MAJOR).$(MINOR).$(REVISION).tar.gz --clean + rpmbuild -ta libcli-$(MAJOR).$(MINOR).$(REVISION).tar.gz --define "debug_package %{nil}" --clean From 63e2d919d496bd67ebd6d173a44de00408362b8d Mon Sep 17 00:00:00 2001 From: Rob Sanders Date: Tue, 18 Sep 2018 16:36:03 -0400 Subject: [PATCH 3/5] Fix missing suffix in clean target for rpm tarball --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index d3ae44c..f263ce5 100644 --- a/Makefile +++ b/Makefile @@ -61,7 +61,7 @@ clitest.exe: clitest.c libcli.o $(CC) $(CPPFLAGS) $(CFLAGS) -o $@ $< libcli.o -lws2_32 clean: - rm -f *.o $(LIB)* $(LIB_STATIC) clitest libcli-$(MAJOR).$(MINOR).$(REVISION) + rm -f *.o $(LIB)* $(LIB_STATIC) clitest libcli-$(MAJOR).$(MINOR).$(REVISION).tar.gz install: $(TARGET_LIBS) install -d $(DESTDIR)$(PREFIX)/include $(DESTDIR)$(PREFIX)/lib From 46d7d37f40547d05d443190e8e1192858a31356b Mon Sep 17 00:00:00 2001 From: Rob Sanders Date: Tue, 18 Sep 2018 18:03:48 -0400 Subject: [PATCH 4/5] Split 'rpm' target into a 'rpmprep' and 'rpm' Need to have tarball built seperately to allow external control of build artifacts from rpmbuild --- Makefile | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index f263ce5..b082edf 100644 --- a/Makefile +++ b/Makefile @@ -76,10 +76,12 @@ install: $(TARGET_LIBS) ln -fs $(LIB).$(MAJOR).$(MINOR) $(LIB) endif -rpm: +rpmprep: rm -rf libcli-$(MAJOR).$(MINOR).$(REVISION) mkdir libcli-$(MAJOR).$(MINOR).$(REVISION) cp -R libcli.{c,h} libcli.spec clitest.c Makefile COPYING README libcli-$(MAJOR).$(MINOR).$(REVISION) tar zcvf libcli-$(MAJOR).$(MINOR).$(REVISION).tar.gz --exclude CVS --exclude *.tar.gz libcli-$(MAJOR).$(MINOR).$(REVISION) rm -rf libcli-$(MAJOR).$(MINOR).$(REVISION) + +rpm: rpmprep rpmbuild -ta libcli-$(MAJOR).$(MINOR).$(REVISION).tar.gz --define "debug_package %{nil}" --clean From 28262d7290a5005b6249fd241faf40cfcd340145 Mon Sep 17 00:00:00 2001 From: Rob Sanders Date: Wed, 19 Sep 2018 08:34:13 -0400 Subject: [PATCH 5/5] Fix typo in spec, programatically get Major.Minor number from version for dynamic library link --- libcli.spec | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/libcli.spec b/libcli.spec index bc74e7d..1db9b9d 100644 --- a/libcli.spec +++ b/libcli.spec @@ -9,6 +9,8 @@ URL: http://code.google.com/p/libcli Packager: David Parrish BuildRoot: %{_tmppath}/%{name}-%{version}-%(%__id -un) +%define verMajMin %(echo %{version} | cut -d '.' -f 1,2) + %package devel Summary: Development files for libcli Group: Development/Libraries @@ -38,10 +40,10 @@ rm -rf $RPM_BUILD_ROOT install -d -p %{buildroot}%{_includedir} install -p -m 644 libcli*.h %{buildroot}%{_includedir}/ install -d -p %{buildroot}%{_libdir} -install -p -m 755 libcli.so.1.9.8 %{buildroot}%{_libdir}/ +install -p -m 755 libcli.so.%{version} %{buildroot}%{_libdir}/ install -p -m 755 libcli.a %{buildroot}%{_libdir}/ -ln -s %{_libdir}/libcli.so.1.9.8 %{buildroot}%{_libdir}/libcli.so.1.9 -ln -s %{_libdir}/libcli.so.1.9 %{buildroot}%{_libdir}/libcli.so +ln -s %{_libdir}/libcli.so.%{version} %{buildroot}%{_libdir}/libcli.so.%{verMajMin} +ln -s %{_libdir}/libcli.so.%{verMajMin} %{buildroot}%{_libdir}/libcli.so %post -p /sbin/ldconfig @@ -72,7 +74,7 @@ rm -rf $RPM_BUILD_ROOT * Sun Sep 16 2018 David Parrish 1.9.8-2 - Reformat patches with clang-format -* Thu Sep 13 2018 Rob Sanders 1.9.8-1 +* Thu Sep 13 2018 Rob Sanders 1.9.8-1 - Fix segfaults processing long lines in cli_loop() - Fix Coverity identified issues at the 'low' aggressive level