diff --git a/coreutils.spec b/coreutils.spec index 5979119..359b1cb 100644 --- a/coreutils.spec +++ b/coreutils.spec @@ -1,11 +1,12 @@ Summary: A set of basic GNU tools commonly used in shell scripts Name: coreutils Version: 8.27 -Release: 5%{?dist} +Release: 5.1%{?dist} License: GPLv3+ Group: System Environment/Base Url: https://www.gnu.org/software/coreutils/ Source0: https://ftp.gnu.org/gnu/%{name}/%{name}-%{version}.tar.xz +Source1: usleep Source50: supported_utils Source105: coreutils-colorls.sh Source106: coreutils-colorls.csh @@ -171,6 +172,16 @@ Summary: coreutils common optional components Optional though recommended components, including documentation and translations. +%package usleep +# TODO: confilict with initscripts releases containing the usleep binary +#Conflicts: initscripts < version-release +Requires: bc +Requires: %{name} +Summary: usleep(1) compatibility wrapper over sleep(1) +%description usleep +Compatibility package providing the deprecated usleep(1) utility implemented +as a wrapper on the of the sleep(1) utility. + %prep %autosetup -N @@ -248,6 +259,8 @@ for type in separate single; do fi done +install -p -v -m755 %SOURCE1 $RPM_BUILD_ROOT%{_bindir} + mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/profile.d install -p -c -m644 DIR_COLORS{,.256color,.lightbgcolor} \ $RPM_BUILD_ROOT%{_sysconfdir} @@ -306,7 +319,13 @@ fi %doc ABOUT-NLS NEWS README THANKS TODO %license COPYING +%files usleep +%{_bindir}/usleep + %changelog +* Fri Apr 28 2017 Kamil Dudka - 8.27-5.1 +- introduce the coreutils-usleep subpackage providing usleep(1) (#1189877) + * Fri Apr 28 2017 Sebastian Kisela - 8.27-5 - tail: revert to polling if a followed directory is replaced diff --git a/usleep b/usleep new file mode 100755 index 0000000..6dc0c71 --- /dev/null +++ b/usleep @@ -0,0 +1,54 @@ +#!/bin/sh + +# Copyright (C) 2017 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 3 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 . + +# print deprecation warning +warn() +{ + echo "$0: warning: usleep(1) is deprecated, use sleep(1) instead!" >&2 +} + +# simplified option handling +for arg; do + case $arg in + -v|--version) + warn + sleep --version + exit 0 + ;; + -o|--oot|-\?|--help) + warn + exit 0 + ;; + -*) + warn + echo "$0: bad argument: $arg" >&2 + exit 1 + ;; + esac +done + +# check that there is at most one argument +if [ $# -ge 2 ]; then + warn + echo "$0: too many arguments: $#" >&2 +fi + +# convert microseconds to seconds using bc(1) +secs="$(printf '%s\n' scale=9 "${1:-1}/1000000" | bc;)" + +# use sleep(1) as the actual implementation +exec sleep "$secs"