diff --git a/.fmf/version b/.fmf/version new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/.fmf/version @@ -0,0 +1 @@ +1 diff --git a/gating.yaml b/gating.yaml new file mode 100644 index 0000000..4fab4ec --- /dev/null +++ b/gating.yaml @@ -0,0 +1,13 @@ +--- !Policy +product_versions: + - fedora-* +decision_context: bodhi_update_push_stable +subject_type: koji_build +rules: + - !PassingTestCaseRule {test_case_name: fedora-ci.koji-build.tier0.functional} +--- !Policy +product_versions: + - rhel-9 +decision_context: osci_compose_gate +rules: + - !PassingTestCaseRule {test_case_name: baseos-ci.brew-build.tier1.functional} diff --git a/plans/ci.fmf b/plans/ci.fmf new file mode 100644 index 0000000..3fd3ab7 --- /dev/null +++ b/plans/ci.fmf @@ -0,0 +1,5 @@ +summary: CI Gating Plan +discover: + how: fmf +execute: + how: tmt diff --git a/spindown-0.4.0-gcc-14.x.patch b/spindown-0.4.0-gcc-14.x.patch new file mode 100644 index 0000000..4e4da62 --- /dev/null +++ b/spindown-0.4.0-gcc-14.x.patch @@ -0,0 +1,140 @@ +diff -up spindown-0.4.0/src/disk.cpp.orig spindown-0.4.0/src/disk.cpp +--- spindown-0.4.0/src/disk.cpp.orig 2024-05-30 15:03:42.968395337 -0400 ++++ spindown-0.4.0/src/disk.cpp 2024-05-30 15:11:42.618736160 -0400 +@@ -23,6 +23,7 @@ + #include + #include + #include ++#include + #include + #include + #include +@@ -138,7 +139,7 @@ void Disk::findDevName( string dev ) + //the path to the device + dev = DEVID_PATH + dev; + //read target of the link +- readlink( (char*)dev.data(), (char*)buffer.data(), CHAR_BUF); ++ (void) readlink( (char*)dev.data(), (char*)buffer.data(), CHAR_BUF); + //remove empty characters + buffer.resize( buffer.find_first_of((char)0) ); + //remove ../../ from the link target +@@ -165,6 +166,8 @@ bool Disk::spindown() + throw SpindownException( oss.str() ); + } + } ++ ++ return false; + } + + string Disk::getName() const +diff -up spindown-0.4.0/src/diskset.cpp.orig spindown-0.4.0/src/diskset.cpp +--- spindown-0.4.0/src/diskset.cpp.orig 2009-04-18 12:32:59.000000000 -0400 ++++ spindown-0.4.0/src/diskset.cpp 2024-05-30 15:03:55.457378169 -0400 +@@ -36,7 +36,7 @@ DiskSet::DiskSet(unsigned int sgTime) : + DiskSet::~DiskSet() + { + // remove all stored disks +- for( int i=0 ; i < this->size() ; i++ ) ++ for( long unsigned int i=0 ; i < this->size() ; i++ ) + { + Disk* disk = this->at(i); + +@@ -49,7 +49,7 @@ DiskSet::~DiskSet() + + void DiskSet::setStatsFrom(DiskSet const & set) + { +- for( int i=0 ; i < set.size() ; i++ ) ++ for( long unsigned int i=0 ; i < set.size() ; i++ ) + { + if (!set[i]) + continue; +@@ -78,7 +78,7 @@ Disk* DiskSet::find(Disk const & disk) + { + Disk* found = 0; + +- for( int i=0 ; !found && i < this->size() ; i++ ) ++ for( long unsigned int i=0 ; !found && i < this->size() ; i++ ) + { + Disk* check = this->at(i); + +@@ -95,7 +95,7 @@ int DiskSet::countEntries(Disk const & s + { + int count = 0; + +- for( int i=0 ; i < this->size() ; i++ ) ++ for( long unsigned int i=0 ; i < this->size() ; i++ ) + { + if( this->at(i)->getName() == search.getName() ) + count++; +diff -up spindown-0.4.0/src/spindown.cpp.orig spindown-0.4.0/src/spindown.cpp +--- spindown-0.4.0/src/spindown.cpp.orig 2009-04-18 12:32:59.000000000 -0400 ++++ spindown-0.4.0/src/spindown.cpp 2024-05-30 15:11:19.040768574 -0400 +@@ -20,6 +20,7 @@ + * Contact: Dimitri Michaux + */ + ++#include + #include + + #include +@@ -60,9 +61,9 @@ void Spindown::updateDevNames(DiskSet* s + + if ( (dp = opendir (DEVID_PATH)) != NULL) + { +- while (ep = readdir (dp)) ++ while ((ep = readdir (dp))) + { +- for( int i=0 ; i < set->size() ; i++ ) ++ for( long unsigned int i=0 ; i < set->size() ; i++ ) + set->at(i)->findDevName(ep->d_name); + } + (void) closedir (dp); +@@ -79,9 +80,8 @@ void Spindown::updateDiskStats(DiskSet* + ifstream fin(STATS_PATH, ios::in); + string devNameInp; //the name of the device read from the configuration + unsigned int newRead, newWritten; +- unsigned long int blocks; + char str[CHAR_BUF]; +- int i; ++ long unsigned int i; + + if(fin) + { +@@ -160,7 +160,7 @@ void Spindown::spinDownIdleDisks() + // Commit buffer cache to disk + sync(); + +- for( int i=0 ; i < disks->size() ; i++ ) ++ for( long unsigned int i=0 ; i < disks->size() ; i++ ) + { + disk = disks->at(i); + +@@ -207,7 +207,7 @@ string Spindown::getStatusString( bool a + { + ostringstream status; + +- for( int i=0 ; i < disks->size() ; i++ ) ++ for( long unsigned int i=0 ; i < disks->size() ; i++ ) + { + Disk* disk = disks->at(i); + +diff -up spindown-0.4.0/src/spindownd.cpp.orig spindown-0.4.0/src/spindownd.cpp +--- spindown-0.4.0/src/spindownd.cpp.orig 2024-05-30 15:03:42.968395337 -0400 ++++ spindown-0.4.0/src/spindownd.cpp 2024-05-30 15:12:06.606703184 -0400 +@@ -23,6 +23,7 @@ + #include + #include + #include ++#include + #include + + #include +@@ -118,7 +119,7 @@ void Spindownd::sigHandlerPipe(int) + if(errno==0) + { + string status = spindown->getStatusString(); +- write (file, status.data(), status.size()); ++ (void) write (file, status.data(), status.size()); + } + else + Log::get()->message(LOG_INFO, "Failed to write to the fifo."); diff --git a/spindown-0.4.0-iniparser.patch b/spindown-0.4.0-iniparser.patch index 152b13f..a0d5292 100644 --- a/spindown-0.4.0-iniparser.patch +++ b/spindown-0.4.0-iniparser.patch @@ -1,51 +1,58 @@ -diff --git a/src/disk.cpp b/src/disk.cpp -index 4ed7845..1d72a06 100644 ---- a/src/disk.cpp -+++ b/src/disk.cpp -@@ -38,7 +38,9 @@ using std::ostringstream; +diff -up spindown-0.4.0/src/disk.cpp.orig spindown-0.4.0/src/disk.cpp +--- spindown-0.4.0/src/disk.cpp.orig 2009-04-18 12:32:59.000000000 -0400 ++++ spindown-0.4.0/src/disk.cpp 2024-05-30 13:31:25.270211392 -0400 +@@ -25,6 +25,7 @@ + #include + #include + #include ++#include + + #include + #include +@@ -38,7 +39,6 @@ using std::ostringstream; #include "general.h" #include "log.h" #include "exceptions.h" -#include "ininiparser3.0b/iniparser.h" -+extern "C" { -+#include "iniparser.h" -+} #include "disk.h" -diff --git a/src/disk.h b/src/disk.h -index 4cc7d1e..475f281 100644 ---- a/src/disk.h -+++ b/src/disk.h -@@ -28,7 +28,9 @@ +diff -up spindown-0.4.0/src/disk.h.orig spindown-0.4.0/src/disk.h +--- spindown-0.4.0/src/disk.h.orig 2009-04-18 12:32:59.000000000 -0400 ++++ spindown-0.4.0/src/disk.h 2024-05-30 13:39:01.583311861 -0400 +@@ -28,7 +28,7 @@ #ifndef DISC_CLASS_H #define DISC_CLASS_H -#include "ininiparser3.0b/iniparser.h" -+extern "C" { -+#include "iniparser.h" -+} ++#include #include using std::string; -diff --git a/src/spindownd.cpp b/src/spindownd.cpp -index 6517b61..16cc6bc 100644 ---- a/src/spindownd.cpp -+++ b/src/spindownd.cpp -@@ -41,8 +41,10 @@ using std::ofstream; +diff -up spindown-0.4.0/src/spindownd.cpp.orig spindown-0.4.0/src/spindownd.cpp +--- spindown-0.4.0/src/spindownd.cpp.orig 2009-04-18 12:32:59.000000000 -0400 ++++ spindown-0.4.0/src/spindownd.cpp 2024-05-30 13:32:16.962107796 -0400 +@@ -25,6 +25,9 @@ + #include + #include + ++#include ++#include ++ + #include + #include + #include +@@ -41,9 +44,6 @@ using std::ofstream; #include "diskset.h" #include "spindown.h" -#include "ininiparser3.0b/iniparser.h" -#include "ininiparser3.0b/dictionary.h" -+extern "C" { -+#include "iniparser.h" -+#include "dictionary.h" -+} - +- #include "spindownd.h" -@@ -339,4 +341,4 @@ string Spindownd::relToAbs( string path ) + string Spindownd::fifoPath; +@@ -339,4 +339,4 @@ string Spindownd::relToAbs( string path path.insert( 0, runPath+"/" ); return path; diff --git a/spindown.spec b/spindown.spec index a6932a1..098441e 100644 --- a/spindown.spec +++ b/spindown.spec @@ -1,22 +1,25 @@ Summary: Daemon that can spin idle disks down Name: spindown Version: 0.4.0 -Release: 27%{?dist} -License: GPLv3+ +Release: 43%{?dist} +# Automatically converted from old format: GPLv3+ - review is highly recommended. +License: GPL-3.0-or-later Url: http://code.google.com/p/spindown Source0: http://spindown.googlecode.com/files/spindown-%{version}.tar.gz Source1: spindown.service Source2: 01spindown -Patch0: spindown-0.4.0-Makefile.patch -Patch1: spindown-0.4.0-iniparser.patch -Patch2: spindown-0.4.0-iniparser-3.0-1.patch -Patch3: spindown-0.4.0-bz1037334.patch +Patch0: spindown-0.4.0-Makefile.patch +Patch1: spindown-0.4.0-iniparser.patch +Patch2: spindown-0.4.0-iniparser-3.0-1.patch +Patch3: spindown-0.4.0-bz1037334.patch +Patch4: spindown-0.4.0-gcc-14.x.patch Requires(preun): systemd-units -BuildRequires: gcc-c++ -BuildRequires: iniparser-devel +BuildRequires: make +BuildRequires: gcc-c++ +BuildRequires: iniparser-devel >= 4.2.2 BuildRequires: systemd-units %description @@ -29,36 +32,84 @@ the device name (hda, sdb, ...), but the device ID. This means that it doesn't matter if the disk is swapped while the daemon is running. %prep -%setup -q +%autosetup -p1 rm -rf src/ininiparser3.0b cp -pf %{SOURCE1} spindown.service cp -pf %{SOURCE2} 01spindown -%patch0 -p1 -%patch1 -p1 -%patch2 -p1 -%patch3 -p1 %build -make %{?_smp_mflags} OPT="$RPM_OPT_FLAGS" +sed -i 's/sbin/bin/' Makefile +%make_build OPT="$RPM_OPT_FLAGS" %install -make DESTDIR="$RPM_BUILD_ROOT" install -mkdir -p $RPM_BUILD_ROOT/%{_libdir}/pm-utils/sleep.d -mkdir -p $RPM_BUILD_ROOT/%{_unitdir} -install -p -m 755 01spindown $RPM_BUILD_ROOT/%{_libdir}/pm-utils/sleep.d/01spindown -install -p -m 755 spindown.service $RPM_BUILD_ROOT/%{_unitdir}/spindown.service +%make_install +mkdir -p %{buildroot}%{_libdir}/pm-utils/sleep.d +mkdir -p %{buildroot}%{_unitdir} +install -p -m 755 01spindown %{buildroot}%{_libdir}/pm-utils/sleep.d/01spindown +install -p -m 755 spindown.service %{buildroot}%{_unitdir}/spindown.service %preun %systemd_preun spindown.service %files -%doc COPYING CHANGELOG README +%doc CHANGELOG README +%license COPYING %{_unitdir}/spindown.service -%{_sbindir}/spindownd +%{_bindir}/spindownd %{_libdir}/pm-utils/sleep.d/01spindown %config(noreplace) %{_sysconfdir}/spindown.conf %changelog +* Fri Jul 25 2025 Fedora Release Engineering - 0.4.0-43 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_43_Mass_Rebuild + +* Wed Feb 19 2025 Martin Cermak - 0.4.0-42 +- Fix for FTBFS #2341373 + +* Sun Jan 19 2025 Fedora Release Engineering - 0.4.0-41 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_42_Mass_Rebuild + +* Thu Jul 25 2024 Miroslav Suchý - 0.4.0-40 +- convert license to SPDX + +* Sat Jul 20 2024 Fedora Release Engineering - 0.4.0-39 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_41_Mass_Rebuild + +* Tue Jun 18 2024 David Cantrell - 0.4.0-38 +- Rebuild against iniparser-4.2.4 + +* Thu May 30 2024 David Cantrell - 0.4.0-37 +- Rebuild against latest iniparser +- Update spec file macro use +- Fix compile issues with latest gcc + +* Sat Jan 27 2024 Fedora Release Engineering - 0.4.0-36 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild + +* Sat Jul 22 2023 Fedora Release Engineering - 0.4.0-35 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_39_Mass_Rebuild + +* Sat Jan 21 2023 Fedora Release Engineering - 0.4.0-34 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_38_Mass_Rebuild + +* Sat Jul 23 2022 Fedora Release Engineering - 0.4.0-33 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_37_Mass_Rebuild + +* Sat Jan 22 2022 Fedora Release Engineering - 0.4.0-32 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_36_Mass_Rebuild + +* Fri Jul 23 2021 Fedora Release Engineering - 0.4.0-31 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_35_Mass_Rebuild + +* Wed Jan 27 2021 Fedora Release Engineering - 0.4.0-30 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_34_Mass_Rebuild + +* Fri Nov 27 2020 Martin Cermak - 0.4.0-29 +- NVR Bump and rebuild for CI gating updates + +* Wed Jul 29 2020 Fedora Release Engineering - 0.4.0-28 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_33_Mass_Rebuild + * Fri Jan 31 2020 Fedora Release Engineering - 0.4.0-27 - Rebuilt for https://fedoraproject.org/wiki/Fedora_32_Mass_Rebuild diff --git a/tests/Sanity/basic/main.fmf b/tests/Sanity/basic/main.fmf new file mode 100644 index 0000000..ffe00a5 --- /dev/null +++ b/tests/Sanity/basic/main.fmf @@ -0,0 +1,15 @@ +summary: a smoke test +description: '' +contact: +- Martin Cermak +component: +- spindown +test: ./runtest.sh +framework: beakerlib +recommend: +- spindown +- rpm-build +- make +duration: 48h +extra-summary: /tools/spindown/Sanity/basic +extra-task: /tools/spindown/Sanity/basic diff --git a/tests/Sanity/basic/runtest.sh b/tests/Sanity/basic/runtest.sh new file mode 100755 index 0000000..0bb0a92 --- /dev/null +++ b/tests/Sanity/basic/runtest.sh @@ -0,0 +1,58 @@ +#!/bin/bash +# vim: dict+=/usr/share/beakerlib/dictionary.vim cpt=.,w,b,u,t,i,k +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +# +# runtest.sh of /tools/spindown/Sanity/basic +# Description: a smoke test +# Author: Martin Cermak +# +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +# +# Copyright (c) 2020 Red Hat, Inc. +# +# This program is free software: you can redistribute it and/or +# modify it under the terms of the GNU General Public License as +# published by the Free Software Foundation, either version 2 of +# the License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be +# useful, but WITHOUT ANY WARRANTY; without even the implied +# warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR +# PURPOSE. See the GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see http://www.gnu.org/licenses/. +# +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +# Include Beaker environment +. /usr/share/beakerlib/beakerlib.sh || exit 1 + +PACKAGE="spindown" + +rlJournalStart + rlPhaseStartSetup + rlAssertRpm $PACKAGE + rlRun "TmpDir=$(mktemp -d)" + rlRun "pushd $TmpDir" + rlPhaseEnd + + rlPhaseStart FAIL "Smoke test" + rlRun "spindownd -h | fgrep 'spindownd is a daemon'" + rlPhaseEnd + + rlPhaseStart FAIL "Rebuild test" + # This is a Fedora CI infrastructure test basically. + # It is meant as a proof of concept for more complex + # glibc gating. + rlFetchSrcForInstalled spindown + rlRun "dnf builddep -y spindown*src.rpm" + rlRun "rpmbuild --rebuild spindown*src.rpm" + rlPhaseEnd + + rlPhaseStartCleanup + rlRun "popd" + rlRun "rm -r $TmpDir" + rlPhaseEnd +rlJournalPrintText +rlJournalEnd