Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package rpmrebuild for openSUSE:Factory checked in at 2021-07-27 14:32:07 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/rpmrebuild (Old) and /work/SRC/openSUSE:Factory/.rpmrebuild.new.1899 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "rpmrebuild" Tue Jul 27 14:32:07 2021 rev:27 rq:908453 version:2.16 Changes: -------- --- /work/SRC/openSUSE:Factory/rpmrebuild/rpmrebuild.changes 2020-09-08 22:47:56.903534487 +0200 +++ /work/SRC/openSUSE:Factory/.rpmrebuild.new.1899/rpmrebuild.changes 2021-07-27 14:32:25.623462405 +0200 @@ -1,0 +2,13 @@ +Sun Jul 25 15:08:13 UTC 2021 - Bruno Friedmann <[email protected]> + +- Update to version 2.16 + + fix bug if more than 10 args (thanks Dmitry V. Levin) + + add signal trapping to clean directory + + fix warnings from shellcheck + + fix problem when rebuild filesystem package (builroot not a directory) + + fix installation test for kernel and multi-arch packages +- Packaging: + + run spec-cleaner -m + + remove expired keyring and sig + +------------------------------------------------------------------- Old: ---- rpmrebuild-2.15.tar.gz rpmrebuild-2.15.tar.gz.sig rpmrebuild.keyring New: ---- rpmrebuild-2.16.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ rpmrebuild.spec ++++++ --- /var/tmp/diff_new_pack.QwEmte/_old 2021-07-27 14:32:26.215461820 +0200 +++ /var/tmp/diff_new_pack.QwEmte/_new 2021-07-27 14:32:26.219461816 +0200 @@ -1,7 +1,7 @@ # # spec file for package rpmrebuild # -# Copyright (c) 2020 SUSE LLC +# Copyright (c) 2021 SUSE LLC # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -17,15 +17,13 @@ Name: rpmrebuild -Version: 2.15 +Version: 2.16 Release: 0 Summary: A tool to build a rpm file from the rpm database License: GPL-2.0-or-later Group: System/Packages -URL: http://rpmrebuild.sourceforge.net -Source0: http://downloads.sourceforge.net/%{name}/%{name}-%{version}.tar.gz -Source1: http://downloads.sourceforge.net/%{name}/%{name}-%{version}.tar.gz.sig -Source2: %{name}.keyring +URL: https://rpmrebuild.sourceforge.net +Source0: https://downloads.sourceforge.net/%{name}/%{name}-%{version}.tar.gz Patch1: gpl-license.patch Patch2: gpl-COPYRIGHT-address.patch Patch3: rpmrebuild-fix-bashisms.patch ++++++ rpmrebuild-2.15.tar.gz -> rpmrebuild-2.16.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Changelog new/Changelog --- old/Changelog 2020-02-21 13:49:11.000000000 +0100 +++ new/Changelog 2021-01-17 10:44:29.000000000 +0100 @@ -1,3 +1,10 @@ +* Sun Jan 17 2021 <[email protected]> 2.16-1 +- fix bug if more than 10 args (thanks Dmitry V. Levin) +- add signal trapping to clean directory +- fix warnings from shellcheck +- fix problem when rebuild filesystem package (builroot not a directory) +- fix installation test for kernel and multi-arch packages + * Fri Feb 21 2020 <[email protected]> 2.15-1 - fix error on rpmrebuild_files.sh line 204 (verify tag) - use env in shebang to avoid path problemes (/bin versus /usr/bin) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/News new/News --- old/News 2020-02-21 11:12:08.000000000 +0100 +++ new/News 2021-01-17 10:51:50.000000000 +0100 @@ -1,3 +1,4 @@ +* 2021-01-17 : release 2.16, bugs fix (args, filesystem, multi-install) * 2020-02-21 : release 2.15, bugs fix, better diagnostics on errors * 2018-10-19 : release 2.14, compatibility with old rpm releases * 2018-09-12 : release 2.13, RECOMMENDS/SUPPLEMENTS rpm tag diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Todo new/Todo --- old/Todo 2020-02-21 12:11:06.000000000 +0100 +++ new/Todo 2021-01-03 10:43:16.000000000 +0100 @@ -11,23 +11,3 @@ -------------------------------------------------------- fix shell syntax with http://www.shellcheck.net/ --------------------------------------------------------- -fix pb with requires -example : -# rpm -qR NetworkManager-wifi -(wpa_supplicant >= 1:1.1 or iwd) - -and in spec : -Requires: (wpa_supplicant 1:1.1 or - -ex : annobin -$ rpm -qR annobin -(gcc >= 9 with gcc < 10) - -ex : lightdm -(lightdm-greeter = 1.2 if xorg-x11-server-Xorg) - -$ rpm -qR python3-requests -(python3.7dist(urllib3) < 1.25 or python3.7dist(urllib3) >= 1.25.0) -(python3.7dist(urllib3) < 1.25.1 or python3.7dist(urllib3) >= 1.25.1.0) - diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Version new/Version --- old/Version 2019-10-17 19:03:20.000000000 +0200 +++ new/Version 2021-01-08 10:22:58.000000000 +0100 @@ -1 +1 @@ -2.15 +2.16 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/locale/en/rpmrebuild.lang new/locale/en/rpmrebuild.lang --- old/locale/en/rpmrebuild.lang 2018-10-19 18:06:06.000000000 +0200 +++ new/locale/en/rpmrebuild.lang 2021-01-08 10:22:58.000000000 +0100 @@ -11,6 +11,7 @@ InternalError='Internal error' InstallFailed="the install failed" InstallCannot="you must be root to install package" +LinkFailed='symbolic link failed' MissingTag='can not find rpm tag' ModificationFailed='modification failed' MoreInformation='For more information, try ' diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/locale/fr_FR/rpmrebuild.lang new/locale/fr_FR/rpmrebuild.lang --- old/locale/fr_FR/rpmrebuild.lang 2018-10-19 18:06:06.000000000 +0200 +++ new/locale/fr_FR/rpmrebuild.lang 2021-01-08 10:22:58.000000000 +0100 @@ -11,6 +11,7 @@ InternalError="erreur interne" InstallFailed="l'installation a ?chou?" InstallCannot="vous devez ?tre root pour installer le package" +LinkFailed='lien symbolique a echou?' MissingTag="impossible de trouver le tag rpm" ModificationFailed="la modification a ?chou?" MoreInformation="pour plus d'information, tapez" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/locale/fr_FR.UTF-8/rpmrebuild.lang new/locale/fr_FR.UTF-8/rpmrebuild.lang --- old/locale/fr_FR.UTF-8/rpmrebuild.lang 2018-10-19 18:06:06.000000000 +0200 +++ new/locale/fr_FR.UTF-8/rpmrebuild.lang 2021-01-08 10:22:58.000000000 +0100 @@ -11,6 +11,7 @@ InternalError="erreur interne" InstallFailed="l'installation a ??chou??" InstallCannot="vous devez ??tre root pour installer le package" +LinkFailed='lien symbolique a echou??' MissingTag="impossible de trouver le tag rpm" ModificationFailed="la modification a ??chou??" MoreInformation="pour plus d'information, tapez" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/processing_func.src new/processing_func.src --- old/processing_func.src 2020-02-21 13:53:22.000000000 +0100 +++ new/processing_func.src 2021-01-17 15:04:00.000000000 +0100 @@ -2,7 +2,7 @@ ############################################################################### # Copyright (C) 2004 by Valery Reznic # This file is a part of the rpmrebuild project -# $Id: rpmrebuild-2.15 | processing_func.src | Mon Feb 17 14:17:27 2020 +0100 | Eric Gerbier $ +# $Id: rpmrebuild-2.16 | processing_func.src | Sun Jan 3 10:43:49 2021 +0100 | Eric Gerbier $ # # 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 @@ -71,10 +71,11 @@ function processing_spec_change { local Func="processing_spec_change" - [ $# -ne 1 -o "x$1" = "x" ] && { + if [ $# -ne 1 ] || [ "x$1" = "x" ] + then Error "(processing_spec_change) Usage: $0 $Func <operation>" return 1 - } + fi need_change_spec="yes" @@ -93,140 +94,140 @@ Xchange-spec-changelog | \ Xedit-changelog) SPEC_IN=$SPEC_CHANGELOG.$si_changelog - si_changelog=$[si_changelog + 1] + si_changelog=$(( si_changelog + 1 )) SPEC_OUT=$SPEC_CHANGELOG.$si_changelog ;; Xchange-spec-conflicts | \ Xedit-conflicts) SPEC_IN=$SPEC_CONFLICTS.$si_conflicts - si_conflicts=$[si_conflicts + 1] + si_conflicts=$(( si_conflicts + 1 )) SPEC_OUT=$SPEC_CONFLICTS.$si_conflicts ;; Xchange-spec-description | \ Xedit-description) SPEC_IN=$SPEC_DESCRIPTION.$si_description - si_description=$[si_description + 1] + si_description=$(( si_description + 1 )) SPEC_OUT=$SPEC_DESCRIPTION.$si_description ;; Xchange-spec-files | \ Xedit-files) SPEC_IN=$SPEC_FILES.$si_files - si_files=$[si_files + 1] + si_files=$(( si_files + 1 )) SPEC_OUT=$SPEC_FILES.$si_files ;; Xchange-spec-obsoletes | \ Xedit-obsoletes) SPEC_IN=$SPEC_OBSOLETES.$si_obsoletes - si_obsoletes=$[si_obsoletes + 1] + si_obsoletes=$(( si_obsoletes + 1 )) SPEC_OUT=$SPEC_OBSOLETES.$si_obsoletes ;; Xchange-spec-post | \ Xedit-post) SPEC_IN=$SPEC_POST.$si_post - si_post=$[si_post + 1] + si_post=$(( si_post + 1 )) SPEC_OUT=$SPEC_POST.$si_post ;; Xchange-spec-posttrans | \ Xedit-posttrans) SPEC_IN=$SPEC_POSTTRANS.$si_posttrans - si_posttrans=$[si_posttrans + 1] + si_posttrans=$(( si_posttrans + 1 )) SPEC_OUT=$SPEC_POSTTRANS.$si_posttrans ;; Xchange-spec-postun | \ Xedit-postun) SPEC_IN=$SPEC_POSTUN.$si_postun - si_postun=$[si_postun + 1] + si_postun=$(( si_postun + 1 )) SPEC_OUT=$SPEC_POSTUN.$si_postun ;; Xchange-spec-pre | \ Xedit-pre) SPEC_IN=$SPEC_PRE.$si_pre - si_pre=$[si_pre + 1] + si_pre=$(( si_pre + 1 )) SPEC_OUT=$SPEC_PRE.$si_pre ;; Xchange-spec-pretrans | \ Xedit-pretrans) SPEC_IN=$SPEC_PRETRANS.$si_pretrans - si_pretrans=$[si_pretrans + 1] + si_pretrans=$(( si_pretrans + 1 )) SPEC_OUT=$SPEC_PRETRANS.$si_pretrans ;; Xchange-spec-preamble | \ Xedit-preamble) SPEC_IN=$SPEC_PREAMBLE.$si_preamble - si_preamble=$[si_preamble + 1] + si_preamble=$(( si_preamble + 1 )) SPEC_OUT=$SPEC_PREAMBLE.$si_preamble ;; Xchange-spec-preun | \ Xedit-preun) SPEC_IN=$SPEC_PREUN.$si_preun - si_preun=$[si_preun + 1] + si_preun=$(( si_preun + 1 )) SPEC_OUT=$SPEC_PREUN.$si_preun ;; Xchange-spec-provides | \ Xedit-provides) SPEC_IN=$SPEC_PROVIDES.$si_provides - si_provides=$[si_provides + 1] + si_provides=$(( si_provides + 1 )) SPEC_OUT=$SPEC_PROVIDES.$si_provides ;; Xchange-spec-requires | \ Xedit-requires) SPEC_IN=$SPEC_REQUIRES.$si_requires - si_requires=$[si_requires + 1] + si_requires=$(( si_requires + 1 )) SPEC_OUT=$SPEC_REQUIRES.$si_requires ;; Xchange-spec-suggests | \ Xedit-suggests) SPEC_IN=$SPEC_SUGGESTS.$si_suggests - si_suggests=$[si_suggests + 1] + si_suggests=$(( si_suggests + 1 )) SPEC_OUT=$SPEC_SUGGESTS.$si_suggests ;; Xchange-spec-enhances | \ Xedit-enhances) SPEC_IN=$SPEC_ENHANCES.$si_enhances - si_enhances=$[si_enhances + 1] + si_enhances=$(( si_enhances + 1 )) SPEC_OUT=$SPEC_ENHANCES.$si_enhances ;; Xchange-spec-recommends | \ Xedit-recommends) SPEC_IN=$SPEC_RECOMMENDS.$si_recommends - si_recommends=$[si_recommends + 1] + si_recommends=$(( si_recommends + 1 )) SPEC_OUT=$SPEC_RECOMMENDS.$si_recommends ;; Xchange-spec-supplements | \ Xedit-supplements) SPEC_IN=$SPEC_SUPPLEMENTS.$si_supplements - si_supplements=$[si_supplements + 1] + si_supplements=$(( si_supplements + 1 )) SPEC_OUT=$SPEC_SUPPLEMENTS.$si_supplements ;; Xchange-spec-triggers | \ Xedit-triggers) SPEC_IN=$SPEC_TRIGGERS.$si_triggers - si_triggers=$[si_triggers + 1] + si_triggers=$(( si_triggers + 1 )) SPEC_OUT=$SPEC_TRIGGERS.$si_triggers ;; Xchange-spec-verifyscript | \ Xedit-verifyscript) SPEC_IN=$SPEC_VERIFYSCRIPT.$si_verifyscript - si_verifyscript=$[si_verifyscript + 1] + si_verifyscript=$(( si_verifyscript + 1 )) SPEC_OUT=$SPEC_VERIFYSCRIPT.$si_verifyscript ;; @@ -234,7 +235,7 @@ Xedit-whole) $Func "concatenate" || Error "(processing_spec_change) $Func concatenate" || return SPEC_IN=$FIC_SPEC.$spec_index - spec_index=$[spec_index + 1] + spec_index=$(( spec_index + 1 )) SPEC_OUT=$FIC_SPEC.$spec_index ;; @@ -246,7 +247,7 @@ case "X$operation" in Xchange-spec-*) - cat <<-CMD_CHANGE >> $Output || return + cat <<-CMD_CHANGE >> "$Output" || return # $operation ( PATH="\$RPMREBUILD_PLUGINS_DIR:\$PATH" && @@ -258,18 +259,18 @@ ;; Xedit-*) - cat <<-CMD_EDIT >> $Output || return + cat <<-CMD_EDIT >> "$Output" || return # $operation - cp -f $SPEC_IN $SPEC_OUT || return - SpecEdit $SPEC_OUT || return + cp -f "$SPEC_IN" "$SPEC_OUT" || return + SpecEdit "$SPEC_OUT" || return CMD_EDIT ;; Xconcatenate) - cat <<-CMD_CONCATENATE >> $Output || return + cat <<-CMD_CONCATENATE >> "$Output" || return # $operation - spec_concatenate > $SPEC_OUT || return + spec_concatenate > "$SPEC_OUT" || return CMD_CONCATENATE ;; @@ -310,7 +311,7 @@ esac || return fi - cat <<-CMD_FINI >> $Output || return + cat <<-CMD_FINI >> "$Output" || return # fini $cmd || return CMD_FINI @@ -320,10 +321,11 @@ function CreateProcessing { - [ $# -ne 1 -o "x$1" = "x" ] && { + if [ $# -ne 1 ] || [ "x$1" = "x" ] + then Error "(CreateProcessing) <operation>" return 1 - } + fi local operation="$1" local Output="$RPMREBUILD_PROCESSING" @@ -347,7 +349,7 @@ Xchange-files) need_change_files="yes" - cat <<-CMD_FILES >> $Output || return + cat <<-CMD_FILES >> "$Output" || return # $operation ( PATH="\$RPMREBUILD_PLUGINS_DIR:\$PATH" && diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/rpmrebuild new/rpmrebuild --- old/rpmrebuild 2020-02-21 13:53:22.000000000 +0100 +++ new/rpmrebuild 2021-01-17 15:03:59.000000000 +0100 @@ -4,7 +4,7 @@ # # Copyright (C) 2002 by Eric Gerbier # Bug reports to: [email protected] -# $Id: rpmrebuild-2.15 | rpmrebuild | Thu Oct 17 15:14:23 2019 +0200 | Eric Gerbier $ +# $Id: rpmrebuild-2.16 | rpmrebuild | Thu Oct 17 15:14:23 2019 +0200 | Eric Gerbier $ # # 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 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/rpmrebuild.lsm new/rpmrebuild.lsm --- old/rpmrebuild.lsm 2020-02-21 11:11:15.000000000 +0100 +++ new/rpmrebuild.lsm 2021-01-17 10:50:06.000000000 +0100 @@ -1,7 +1,7 @@ Begin4 Title: rpmrebuild -Version: 2.15 -Entered-date: 2020-02-21 +Version: 2.16 +Entered-date: 2021-01-17 Description: rpmrebuild creates spec files used by the Red Hat Package Manager in building RPM packages. It uses the information it can determine (from the rpm database) to fill in the proper spec file fields. @@ -12,7 +12,7 @@ Author: [email protected] (Eric Gerbier) [email protected] (Valery Reznic) Primary-site: http://rpmrebuild.sourceforge.net - 90 ko rpmrebuild-2.15-1.noarch.rpm + 90 ko rpmrebuild-2.16-1.noarch.rpm Platforms: linux, works with bash and rpm >= 3.x Copying-policy: GPL End diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/rpmrebuild.sh new/rpmrebuild.sh --- old/rpmrebuild.sh 2020-02-21 13:53:22.000000000 +0100 +++ new/rpmrebuild.sh 2021-01-17 15:03:59.000000000 +0100 @@ -4,7 +4,7 @@ # # Copyright (C) 2002 by Eric Gerbier # Bug reports to: [email protected] -# $Id: rpmrebuild-2.15 | rpmrebuild.sh | Mon Feb 17 14:17:27 2020 +0100 | Eric Gerbier $ +# $Id: rpmrebuild-2.16 | rpmrebuild.sh | Sun Jan 17 13:08:25 2021 +0100 | Eric Gerbier $ # # 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 @@ -25,7 +25,7 @@ { if [ -f "$MY_LIB_DIR/Version" ] then - VERSION=$( cat $MY_LIB_DIR/Version ) + VERSION=$( cat "$MY_LIB_DIR"/Version ) else Warning "(GetVersion) $FileNotFound Version" fi @@ -36,13 +36,14 @@ function SpecEdit { Debug '(SpecEdit)' - [ $# -ne 1 -o "x$1" = "x" ] && { + if [ $# -ne 1 ] || [ "x$1" = "x" ] + then Error "(SpecEdit) Usage: $0 SpecEdit <file>" return 1 - } + fi # -e option : edit the spec file local File=$1 - ${VISUAL:-${EDITOR:-vi}} $File + ${VISUAL:-${EDITOR:-vi}} "$File" AskYesNo "$WantContinue" || { Aborted="yes" export Aborted @@ -56,7 +57,7 @@ function VerifyPackage { Debug "(VerifyPackage) ${PAQUET}" - rpm --verify --nodeps ${PAQUET} # Don't return here, st=1 - verify fail + rpm --verify --nodeps "$PAQUET" # Don't return here, st=1 - verify fail return 0 } ############################################################################### @@ -86,7 +87,7 @@ { Debug '(IsPackageInstalled)' # test if package exists - local output="$( rpm --query ${PAQUET} 2>&1 )" # Don't return here - use output + local output=$( rpm --query "${PAQUET}" 2>&1 ) # Don't return here - use output if [ "$?" -eq 1 ] then # no such package in rpm database @@ -119,14 +120,14 @@ return 1 } local CPIO_TEMP=$TMPDIR_WORK/${PAQUET_NAME}.cpio - rm --force $CPIO_TEMP || return - rpm2cpio ${PAQUET} > $CPIO_TEMP || Error "(RpmUnpack) rpm2cpio" || return - rm --force --recursive $BUILDROOT || return - Mkdir_p $BUILDROOT || return - (cd $BUILDROOT && cpio --quiet -idmu --no-absolute-filenames ) < $CPIO_TEMP || Error "(RpmUnpack) cpio" || return - rm --force $CPIO_TEMP || return + rm --force "$CPIO_TEMP" || return + rpm2cpio "${PAQUET}" > "$CPIO_TEMP" || Error "(RpmUnpack) rpm2cpio" || return + rm --force --recursive "$BUILDROOT" || return + Mkdir_p "$BUILDROOT" || return + (cd "$BUILDROOT" && cpio --quiet -idmu --no-absolute-filenames ) < "$CPIO_TEMP" || Error "(RpmUnpack) cpio" || return + rm --force "$CPIO_TEMP" || return # Process ghost files - /bin/bash $MY_LIB_DIR/rpmrebuild_ghost.sh $BUILDROOT < $FILES_IN || return + /bin/bash "$MY_LIB_DIR"/rpmrebuild_ghost.sh "$BUILDROOT" < "$FILES_IN" || return return 0 } ############################################################################### @@ -137,7 +138,7 @@ if [ "x$package_flag" = "x" ]; then # installed package if [ "X$need_change_files" = "Xyes" ]; then - /bin/bash $MY_LIB_DIR/rpmrebuild_buildroot.sh $BUILDROOT < $FILES_IN || Error "(CreateBuildRoot) rpmrebuild_buildroot.sh $BUILDROOT" || return + /bin/bash "$MY_LIB_DIR"/rpmrebuild_buildroot.sh "$BUILDROOT" < "$FILES_IN" || Error "(CreateBuildRoot) rpmrebuild_buildroot.sh $BUILDROOT" || return else : # Do nothing (avoid a copy) fi @@ -167,7 +168,7 @@ # pac_arch is got from RpmArch RpmArch case $pac_arch in - $cur_arch) + "$cur_arch") change_arch="";; noarch) change_arch="";; @@ -199,12 +200,21 @@ # rpm 4.6 ignore BuildRoot in the spec file, # so I have to provide define on the command line # Worse, it disallow buildroot "/", so I have to trick it. + # a first easy answer is with a symbolic link + # but it fails for filesystem package who owned / directory + # this is fixed in rpmrebuild_files.sh + # another may be with : mount --bind -o ro / $BUILDROOT + # but if does not work if not superuser + # and need also to mount all other filesystems (/usr /var ...) if [ "x$BUILDROOT" = "x/" ]; then - BUILDROOT="$RPMREBUILD_TMPDIR/my_root" + BUILDROOT="${RPMREBUILD_TMPDIR}/my_root" # Just in case previous link is here - rm -f $BUILDROOT || return + rm -f "$BUILDROOT" || return # Trick rpm (I hope :) - ln -s / $BUILDROOT || return + ln -s / "$BUILDROOT" || { + Error "(RpmBuild) ${BUILDROOT} $LinkFailed" + return 1 + } fi eval $change_arch $BUILDCMD --define "'buildroot $BUILDROOT'" $rpm_defines -bb $rpm_verbose $additional ${FIC_SPEC} || { Error "(RpmBuild) package '${PAQUET}' $BuildFailed" @@ -225,7 +235,7 @@ # workaround for redhat 6.x / rpm 3.x local arch=$(eval $change_arch rpm $rpm_defines --specfile --query --queryformat "%{ARCH}" ${FIC_SPEC}) - if [ $arch = "(none)" ] + if [ "$arch" = "(none)" ] then Debug ' workaround for rpm 3.x' # get info from original paquet @@ -240,20 +250,38 @@ if [ ! -f "${RPMFILENAME}" ] then Error "(RpmFileName) $FileNotFound rpm $RPMFILENAME" - ls -ltr ${rpmdir}/${pac_arch}/${PAQUET}* + ls -ltr "${rpmdir}/${pac_arch}/${PAQUET}*" return 1 fi return 0 } ############################################################################### +# -U or -i option ? : -U does work if only a version is installed +function IsMultiInstall +{ + # get package name + local package_name=$( rpm -qp --queryformat '%{NAME}' ${RPMFILENAME} ) + # count installs + rpm -q ${package_name} 2> /dev/null | wc -l +} +############################################################################### # test if build package can be installed function InstallationTest { Debug '(InstallationTest)' # installation test # force is necessary to avoid the message : already installed - rpm -U --test --force ${RPMFILENAME} || { + local rpm_options='--test --force' + local nb=$( IsMultiInstall ) + if [ "$nb" -le 1 ] + then + rpm_options="$rpm_options -U" + else + Debug "multi-installed package" + rpm_options="$rpm_options -i" + fi + rpm ${rpm_options} "${RPMFILENAME}" || { Error "(InstallationTest) package '${PAQUET}' $TestFailed" return 1 } @@ -269,7 +297,15 @@ local ID=$( id -u ) if [ "$ID" -eq 0 ] then - rpm -Uvh --force ${RPMFILENAME} || { + local rpm_options='-v -h --force' + local nb=$( IsMultiInstall ) + if [ "$nb" -le 1 ] + then + rpm_options="$rpm_options -U" + else + rpm_options="$rpm_options -i" + fi + rpm ${rpm_options} "${RPMFILENAME}" || { Error "(Installation) package '${PAQUET}' $InstallFailed" return 1 } @@ -287,9 +323,9 @@ #local Aborted="no" local MsgFail - source $RPMREBUILD_PROCESSING && return 0 + source "$RPMREBUILD_PROCESSING" && return 0 - if [ "X$need_change_spec" = "Xyes" -o "X$need_change_files" = "Xyes" ]; then + if [ "X$need_change_spec" = "Xyes" ] || [ "X$need_change_files" = "Xyes" ]; then [ "X$Aborted" = "Xyes" ] || Error "(Processing) package '$PAQUET' $ModificationFailed." else Error "(Processing) package '$PAQUET' $SpecFailed." @@ -320,7 +356,7 @@ Debug '(SendBugReport)' [ "X$batch" = "Xyes" ] && return 0 ## batch mode, skip report - [ -s $RPMREBUILD_BUGREPORT ] || return 0 ## empty report + [ -s "$RPMREBUILD_BUGREPORT" ] || return 0 ## empty report AskYesNo "$WantSendBugReport" || return # build default mail address @@ -329,12 +365,12 @@ echo -n "$EnterEmail" read from } - GetInformations $from >> $RPMREBUILD_BUGREPORT 2>&1 + GetInformations "$from" >> "$RPMREBUILD_BUGREPORT" 2>&1 AskYesNo "$WantEditReport" && { - ${VISUAL:-${EDITOR:-vi}} $RPMREBUILD_BUGREPORT + ${VISUAL:-${EDITOR:-vi}} "$RPMREBUILD_BUGREPORT" } AskYesNo "$WantStillSend" && { - mail -s "[rpmrebuild] bug report" [email protected] < $RPMREBUILD_BUGREPORT + mail -s "[rpmrebuild] bug report" [email protected] < "$RPMREBUILD_BUGREPORT" } return } @@ -361,9 +397,9 @@ Debug "(ChangeRpmQf) $1" local SED_PAR=$1 local input_rpmqf=$TMPDIR_WORK/rpmrebuild_rpmqf.src.$si_rpmqf - si_rpmqf=$[si_rpmqf + 1] + si_rpmqf=$(( si_rpmqf + 1 )) local output_rpmqf=$TMPDIR_WORK/rpmrebuild_rpmqf.src.$si_rpmqf - sed -e "$SED_PAR" < $input_rpmqf > $output_rpmqf + sed -e "$SED_PAR" < "$input_rpmqf" > "$output_rpmqf" return 0 } @@ -378,7 +414,7 @@ RPM_TAGS=$( rpm --querytags ) || return # base code - cp $MY_LIB_DIR/rpmrebuild_rpmqf.src $TMPDIR_WORK/rpmrebuild_rpmqf.src.$si_rpmqf + cp "${MY_LIB_DIR}"/rpmrebuild_rpmqf.src "${TMPDIR_WORK}"/rpmrebuild_rpmqf.src.$si_rpmqf local optional_file=$MY_LIB_DIR/optional_tags.cfg if [ -f "$optional_file" ] @@ -389,7 +425,7 @@ local tst_comment=$( echo "$tag1" | grep '#' ) if [ -z "$tst_comment" ] then - SearchTag $tag1 || { + SearchTag "$tag1" || { case "$type" in d_line) ChangeRpmQf "/%{$tag1}/d" @@ -401,7 +437,7 @@ ;; replacedby) #Echo "tag1=$tag1 type=$type tag2=$tag2" - [ -n "$tag2" ] && SearchTag $tag2 && ChangeRpmQf "s/$tag1/$tag2/g" && Echo "(GenRpmQf) $ReplaceTag $tag1 => $tag2" + [ -n "$tag2" ] && SearchTag "$tag2" && ChangeRpmQf "s/$tag1/$tag2/g" && Echo "(GenRpmQf) $ReplaceTag $tag1 => $tag2" ;; *) Warning "(GenRpmQf) $UnknownType $type" @@ -410,7 +446,7 @@ } fi - done < $optional_file + done < "$optional_file" else Warning "(GenRpmQf) $FileNotFound $optional_file" fi @@ -426,18 +462,18 @@ Debug '(CheckTags)' # list of used tags #Echo "(CheckTags) search tags in rpmrebuild_rpmqf.src.$si_rpmqf" - local rpmrebuild_tags=$( $MY_LIB_DIR/rpmrebuild_extract_tags.sh $TMPDIR_WORK/rpmrebuild_rpmqf.src.$si_rpmqf ) + local rpmrebuild_tags=$( "${MY_LIB_DIR}"/rpmrebuild_extract_tags.sh "${TMPDIR_WORK}"/rpmrebuild_rpmqf.src.$si_rpmqf ) # check for all rpmrebuild tags local errors=0 for tag in $rpmrebuild_tags do - SearchTag $tag || { + SearchTag "$tag" || { Warning "(CheckTags) $MissingTag $tag" - let errors="$errors + 1" + errors=$(( errors + 1 )) } done - if [ $errors -ge 1 ] + if [ "$errors" -ge 1 ] then Warning "$CannotWork" return 1 @@ -458,6 +494,25 @@ fi } ############################################################## +# in debug mode , we do not clean temp files +function clean_exit +{ + if [ -z "$debug" ] + then + RmDir "$RPMREBUILD_TMPDIR" + else + Debug "workdir : $TMPDIR_WORK" + ls -altr "$TMPDIR_WORK" + fi +} +############################################################## +# on signal clean as usual +function sig_prgm +{ + clean_exit + exit 1 +} +############################################################## # Main Part # ############################################################## # shell pour refabriquer un fichier rpm a partir de la base rpm @@ -466,31 +521,31 @@ function Main { RPMREBUILD_TMPDIR=${RPMREBUILD_TMPDIR:-~/.tmp/rpmrebuild.$$} - RPMREBUILD_BUGREPORT=$RPMREBUILD_TMPDIR/bugreport + RPMREBUILD_BUGREPORT=${RPMREBUILD_TMPDIR}/bugreport export RPMREBUILD_BUGREPORT export RPMREBUILD_TMPDIR - TMPDIR_WORK=$RPMREBUILD_TMPDIR/work + TMPDIR_WORK=${RPMREBUILD_TMPDIR}/work - MY_LIB_DIR=`dirname $0` || ( echo "ERROR rpmrebuild.sh dirname $0"; exit 1) - MY_BASENAME=`basename $0` - source $MY_LIB_DIR/rpmrebuild_lib.src || ( echo "ERROR rpmrebuild.sh source $MY_LIB_DIR/rpmrebuild_lib.src" ; exit 1) + MY_LIB_DIR=$( dirname "$0" ) || ( echo "ERROR rpmrebuild.sh dirname $0"; exit 1) + MY_BASENAME=$( basename "$0" ) + source "${MY_LIB_DIR}/rpmrebuild_lib.src" || ( echo "ERROR rpmrebuild.sh source $MY_LIB_DIR/rpmrebuild_lib.src" ; exit 1) # create tempory directories before any work/test RmDir "$RPMREBUILD_TMPDIR" || Error "RmDir $RPMREBUILD_TMPDIR" || return - Mkdir_p $TMPDIR_WORK || Error "Mkdir_p $TMPDIR_WORK" || return + Mkdir_p "$TMPDIR_WORK" || Error "Mkdir_p $TMPDIR_WORK" || return # get VERSION GetVersion - FIC_SPEC=$TMPDIR_WORK/spec - FILES_IN=$TMPDIR_WORK/files.in + FIC_SPEC=${TMPDIR_WORK}/spec + FILES_IN=${TMPDIR_WORK}/files.in # I need it here just in case user specify # plugins for fs modification (--change-files) - BUILDROOT=$TMPDIR_WORK/root + BUILDROOT=${TMPDIR_WORK}/root - source $MY_LIB_DIR/rpmrebuild_parser.src || Error "source $MY_LIB_DIR/rpmrebuild_parser.src" || return - source $MY_LIB_DIR/spec_func.src || Error "source $MY_LIB_DIR/spec_func.src" || return - source $MY_LIB_DIR/processing_func.src || Error "source $MY_LIB_DIR/processing_func.src" || return + source "$MY_LIB_DIR"/rpmrebuild_parser.src || Error "source $MY_LIB_DIR/rpmrebuild_parser.src" || return + source "$MY_LIB_DIR"/spec_func.src || Error "source $MY_LIB_DIR/spec_func.src" || return + source "$MY_LIB_DIR"/processing_func.src || Error "source $MY_LIB_DIR/processing_func.src" || return # check language case "$LANG" in @@ -500,7 +555,7 @@ *) real_lang=en;; esac # load translation file - source $MY_LIB_DIR/locale/$real_lang/rpmrebuild.lang + source "$MY_LIB_DIR/locale/$real_lang/rpmrebuild.lang" RPMREBUILD_PROCESSING=$TMPDIR_WORK/PROCESSING processing_init || return @@ -516,7 +571,7 @@ # check it CheckTags || return # and load it - source $TMPDIR_WORK/rpmrebuild_rpmqf.src.$si_rpmqf || return + source "${TMPDIR_WORK}/rpmrebuild_rpmqf.src.$si_rpmqf" || return export RPMREBUILD_PLUGINS_DIR=${MY_LIB_DIR}/plugins @@ -567,6 +622,8 @@ } ############################################################################### +trap 'sig_prgm' 1 2 3 15 + Main "$@" st=$? # save status @@ -577,13 +634,7 @@ fi # in debug mode , we do not clean temp files -if [ -z "$debug" ] -then - RmDir "$RPMREBUILD_TMPDIR" -else - Debug "workdir : $TMPDIR_WORK" - ls -altr $TMPDIR_WORK -fi +clean_exit exit $st diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/rpmrebuild.spec new/rpmrebuild.spec --- old/rpmrebuild.spec 2020-02-21 13:53:22.000000000 +0100 +++ new/rpmrebuild.spec 2021-01-17 15:03:59.000000000 +0100 @@ -1,4 +1,4 @@ -Version: 2.15 +Version: 2.16 %define release 1 # get rpm version %define rpm_ver %( rpm -q --queryformat='%{VERSION}' rpm | cut -f 1 -d.) @@ -80,6 +80,13 @@ %files -f rpmrebuild.files %changelog +* Sun Jan 17 2021 <[email protected]> 2.16-1 +- fix bug if more than 10 args (thanks Dmitry V. Levin) +- add signal trapping to clean directory +- fix warnings from shellcheck +- fix problem when rebuild filesystem package (builroot not a directory) +- fix installation test for kernel and multi-arch packages + * Fri Feb 21 2020 <[email protected]> 2.15-1 - fix error on rpmrebuild_files.sh line 204 (verify tag) - use env in shebang to avoid path problemes (/bin versus /usr/bin) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/rpmrebuild_buildroot.sh new/rpmrebuild_buildroot.sh --- old/rpmrebuild_buildroot.sh 2020-02-21 13:53:22.000000000 +0100 +++ new/rpmrebuild_buildroot.sh 2021-01-17 15:04:00.000000000 +0100 @@ -6,7 +6,7 @@ # Copyright (C) 2002, 2003, 2013 by Valery Reznic # Bug reports to: [email protected] # or : [email protected] -# $Id: rpmrebuild-2.15 | rpmrebuild_buildroot.sh | Mon Feb 17 13:54:44 2020 +0100 | Eric Gerbier $ +# $Id: rpmrebuild-2.16 | rpmrebuild_buildroot.sh | Sun Jan 3 10:43:49 2021 +0100 | Eric Gerbier $ # # 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 @@ -36,13 +36,14 @@ # rpmrebuild_files.sh rpmrebuild_ghost.sh rpmrebuild_buildroot.sh ################################################################ -MY_LIB_DIR=`dirname $0` || ( echo "ERROR $0 dirname $0"; exit 1) -MY_BASENAME=`basename $0` -source $MY_LIB_DIR/rpmrebuild_lib.src || ( echo "ERROR $0 source $MY_LIB_DIR/rpmrebuild_lib.src" ; exit 1) +MY_LIB_DIR=$( dirname "$0" ) || ( echo "ERROR $0 dirname $0"; exit 1) +MY_BASENAME=$( basename "$0" ) +source "$MY_LIB_DIR/rpmrebuild_lib.src" || ( echo "ERROR $0 source $MY_LIB_DIR/rpmrebuild_lib.src" ; exit 1) -[ $# -ne 1 -o "x$1" = "x" ] && { +if [ $# -ne 1 ] || [ "x$1" = "x" ] +then Critical "Usage: $0 <buildroot>" -} +fi BuildRoot="$1" @@ -72,15 +73,15 @@ # of the string. # result will be 4 permissions characters file_perm="${file_perm#${not_perm}}" - Mkdir_p $BuildRoot/$file || Critical "$MY_BASENAME Mkdir_p $BuildRoot/$file" - chmod $file_perm $BuildRoot/$file || Critical "$MY_BASENAME chmod $file_perm $BuildRoot/$file" + Mkdir_p "$BuildRoot/$file" || Critical "$MY_BASENAME Mkdir_p $BuildRoot/$file" + chmod "$file_perm $BuildRoot/$file" || Critical "$MY_BASENAME chmod $file_perm $BuildRoot/$file" ;; *) # Not directory DirName=${file%/*} - Mkdir_p $BuildRoot/$DirName || Critical "$MY_BASENAME Mkdir_p $BuildRoot/$DirName" - cp --preserve --no-dereference $file $BuildRoot/$file || Critical "$MY_BASENAME cp --preserve $file" + Mkdir_p "$BuildRoot/$DirName" || Critical "$MY_BASENAME Mkdir_p $BuildRoot/$DirName" + cp --preserve --no-dereference "$file" "$BuildRoot/$file" || Critical "$MY_BASENAME cp --preserve $file" ;; esac || Critical "$MY_BASENAME esac" done || Critical "$MY_BASENAME done" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/rpmrebuild_extract_tags.sh new/rpmrebuild_extract_tags.sh --- old/rpmrebuild_extract_tags.sh 2020-02-21 13:53:22.000000000 +0100 +++ new/rpmrebuild_extract_tags.sh 2021-01-17 15:04:00.000000000 +0100 @@ -2,7 +2,7 @@ ############################################################################### # Copyright (C) 2002 by Eric Gerbier # Bug reports to: [email protected] -# $Id: rpmrebuild-2.15 | rpmrebuild_extract_tags.sh | Thu Oct 17 15:14:23 2019 +0200 | Eric Gerbier $ +# $Id: rpmrebuild-2.16 | rpmrebuild_extract_tags.sh | Sun Jan 3 10:43:49 2021 +0100 | Eric Gerbier $ # # 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 @@ -45,4 +45,4 @@ line = new_line pos_begin = index(line, "%{") } -}' < $1 | sort -u +}' < "$1" | sort -u diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/rpmrebuild_files.sh new/rpmrebuild_files.sh --- old/rpmrebuild_files.sh 2020-02-21 13:53:22.000000000 +0100 +++ new/rpmrebuild_files.sh 2021-01-17 15:04:00.000000000 +0100 @@ -6,7 +6,7 @@ # Copyright (C) 2002, 2003, 2013 by Valery Reznic # Bug reports to: [email protected] # or : [email protected] -# $Id: rpmrebuild-2.15 | rpmrebuild_files.sh | Mon Feb 17 13:54:44 2020 +0100 | Eric Gerbier $ +# $Id: rpmrebuild-2.16 | rpmrebuild_files.sh | Thu Jan 7 13:49:47 2021 +0100 | Eric Gerbier $ # # 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 @@ -42,9 +42,9 @@ # it is used in the 3 scripts : rpmrebuild_files.sh rpmrebuild_ghost.sh rpmrebuild_buildroot.sh ################################################################ -MY_LIB_DIR=`dirname $0` || ( echo "ERROR $0 dirname $0"; exit 1) -MY_BASENAME=`basename $0` -source $MY_LIB_DIR/rpmrebuild_lib.src || ( echo "ERROR $0 source $MY_LIB_DIR/rpmrebuild_lib.src" ; exit 1) +MY_LIB_DIR=$( dirname "$0" ) || ( echo "ERROR $0 dirname $0"; exit 1) +MY_BASENAME=$( basename "$0" ) +source "$MY_LIB_DIR/rpmrebuild_lib.src" || ( echo "ERROR $0 source $MY_LIB_DIR/rpmrebuild_lib.src" ; exit 1) FFLAGS="d c s m n g" d_val="%doc " # doc flag @@ -81,6 +81,11 @@ read file_cap read file + # on fedora 33, centos 7, 8, the root directory "/" is owned by filesystem package + # but for rpmrebuild, BUILDROOT is juste a symlink, not a directory (cf RpmBuild in rpmrebuild.sh) + # so the build fails, the only simple way is to skip the root directory + [ "$file" = "/" ] && continue + # bash 2 syntaxe #[[ $file = *\** ]] && file=$(echo "$file"|sed 's/\*/\\*/') # bash 1 but with a fork (grep) @@ -88,7 +93,7 @@ #[ -n "$wild" ] && file=$(echo "$file"|sed 's/\*/\\*/') # quick and portable case "x$file" in - x*\**) file=$(echo "$file" | sed 's/\*/\\*/');; + x*\**) file=${file//\*/\\*} ;; x*) ;; esac miss_str="" @@ -184,7 +189,7 @@ # %caps handling if [ "X$RPMREBUILD_CAP_FROM_FS" = "Xyes" ]; then - file_cap=$( getcap $file | cut -f2 -d= ) + file_cap=$( getcap "$file" | cut -f2 -d= ) else # get capability from rpm query [ "X$file_cap" = "X(none)" ] && file_cap="" @@ -207,18 +212,18 @@ else file_verify="0$file_verify" # make it octal for shell for verify_flag in $VERIFY_FLAGS; do - if [ $[$file_verify & $Bit] -eq 0 ]; then + if [ $(( file_verify & Bit )) -eq 0 ]; then non_verify_par="$non_verify_par$verify_flag " else verify_par="$verify_par$verify_flag " fi - Bit=$[ $Bit << 1 ] + Bit=$(( Bit << 1 )) done # if bit after last verify bit is off I assume that # %verify( ...) was used # otherwise I assume %verify(not ...) was used. - if [ $[$file_verify & $Bit] -eq 0 ]; then ## Use "verify_par" + if [ $(( file_verify & Bit )) -eq 0 ]; then ## Use "verify_par" # If verify_par not empty, set verify_str to %verify($verify_par) # Strip last character from verify_par verify_str="${verify_par:+%verify(${verify_par%?}) }" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/rpmrebuild_ghost.sh new/rpmrebuild_ghost.sh --- old/rpmrebuild_ghost.sh 2020-02-21 13:53:22.000000000 +0100 +++ new/rpmrebuild_ghost.sh 2021-01-17 15:04:00.000000000 +0100 @@ -6,7 +6,7 @@ # Copyright (C) 2002, 2003, 2013 by Valery Reznic # Bug reports to: [email protected] # or : [email protected] -# $Id: rpmrebuild-2.15 | rpmrebuild_ghost.sh | Mon Feb 17 13:54:44 2020 +0100 | Eric Gerbier $ +# $Id: rpmrebuild-2.16 | rpmrebuild_ghost.sh | Sun Jan 3 10:43:49 2021 +0100 | Eric Gerbier $ # # 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 @@ -38,13 +38,14 @@ # rpmrebuild_files.sh rpmrebuild_ghost.sh rpmrebuild_buildroot.sh ################################################################ -MY_LIB_DIR=`dirname $0` || ( echo "ERROR $0 dirname $0"; exit 1) -MY_BASENAME=`basename $0` -source $MY_LIB_DIR/rpmrebuild_lib.src || ( echo "ERROR $0 source $MY_LIB_DIR/rpmrebuild_lib.src" ; exit 1) +MY_LIB_DIR=$( dirname "$0" ) || ( echo "ERROR $0 dirname $0"; exit 1) +MY_BASENAME=$( basename "$0" ) +source "$MY_LIB_DIR/rpmrebuild_lib.src" || ( echo "ERROR $0 source $MY_LIB_DIR/rpmrebuild_lib.src" ; exit 1) -[ $# -ne 1 -o "x$1" = "x" ] && { +if [ $# -ne 1 ] || [ "x$1" = "x" ] +then Critical "Usage: $0 <buildroot>" -} +fi BuildRoot="$1" @@ -77,16 +78,16 @@ case "X$file_type" in Xd*) # Directory. Ghost directory ? - Mkdir_p $File || Critical "$MY_BASENAME Mkdir_p $File" + Mkdir_p "$File" || Critical "$MY_BASENAME Mkdir_p $File" ;; *) # Not directory # Just in case dir for ghost file not exist create it DirName=${File%/*} - Mkdir_p $DirName || Critical "$MY_BASENAME Mkdir_p $DirName" + Mkdir_p "$DirName" || Critical "$MY_BASENAME Mkdir_p $DirName" # Create file itself - > $File || Critical "$MY_BASENAME create $File" + > "$File" || Critical "$MY_BASENAME create $File" ;; esac || Critical "$MY_BASENAME esac" done || Critical "$MY_BASENAME done" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/rpmrebuild_lib.src new/rpmrebuild_lib.src --- old/rpmrebuild_lib.src 2020-02-21 13:53:22.000000000 +0100 +++ new/rpmrebuild_lib.src 2021-01-17 15:04:00.000000000 +0100 @@ -2,7 +2,7 @@ ############################################################################### # Copyright (C) 2011 by Eric Gerbier # This file is a part of the rpmrebuild project -# $Id: rpmrebuild-2.15 | rpmrebuild_lib.src | Mon Feb 17 13:54:44 2020 +0100 | Eric Gerbier $ +# $Id: rpmrebuild-2.16 | rpmrebuild_lib.src | Sun Jan 3 10:43:49 2021 +0100 | Eric Gerbier $ # # 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 @@ -81,14 +81,15 @@ ############################################################################### function RmDir { - [ $# -ne 1 -o "x$1" = "x" ] && { + if [ $# -ne 1 ] || [ "x$1" = "x" ] + then Warning "Usage: RmDir <dir>" return 1 - } + fi # to ensure tmpdir is really emptied by rm -rf local Dir Dir="$1" - if [ -d $Dir ] + if [ -d "$Dir" ] then rm -rf "$Dir" 2>/dev/null && return chmod -R 700 "$Dir" 2>/dev/null # no return here !!! @@ -103,15 +104,16 @@ # is not allways the same function Mkdir_p { - [ $# -ne 1 -o "x$1" = "x" ] && { + if [ $# -ne 1 ] || [ "x$1" = "x" ] + then Warning "Usage: Mkdir_p <dir>" return 1 - } + fi local Dir Dir="$1" - mkdir -p $Dir + mkdir -p "$Dir" # test result - if [ -d $Dir ] + if [ -d "$Dir" ] then return 0 else diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/rpmrebuild_parser.src new/rpmrebuild_parser.src --- old/rpmrebuild_parser.src 2020-02-21 13:53:22.000000000 +0100 +++ new/rpmrebuild_parser.src 2021-01-17 15:04:00.000000000 +0100 @@ -4,7 +4,7 @@ # # Copyright (C) 2002 by Eric Gerbier # Bug reports to: [email protected] -# $Id: rpmrebuild-2.15 | rpmrebuild_parser.src | Mon Feb 17 14:17:27 2020 +0100 | Eric Gerbier $ +# $Id: rpmrebuild-2.16 | rpmrebuild_parser.src | Sun Jan 3 10:43:49 2021 +0100 | Eric Gerbier $ # # 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 @@ -122,15 +122,15 @@ ############################################################################### function List_Plugins { - local plugindir=$( dirname $0)/plugins - for f in $plugindir/*.plug + local plugindir=$( dirname "$0" )/plugins + for f in "$plugindir"/*.plug do - local plug=$(basename $f) + local plug=$( basename "$f" ) # use man to force localisation # line number may vary #text=$(man $plug | awk 'NR==7{print}' ) # filter by name of plugin - local text=$(man $plug | awk "/$plug +- /{print}" ) + local text=$(man "$plug" | awk "/$plug +- /{print}" ) if [ -n "$text" ] then echo "$text" @@ -164,7 +164,7 @@ [ "x$SHORT_OPTION" = "x-" ] || return 0 # we use short option, # do nothing if [ "$OPTARG_EXIST" ]; then - [ "$OPTIND_INCR" ] && OPTIND=$[OPTIND + 1] + [ "$OPTIND_INCR" ] && OPTIND=$(( OPTIND + 1 )) return 0 fi @@ -191,7 +191,7 @@ ProcessLongOptions || return ;; esac || return - done < $INCLUDE_FILE + done < "$INCLUDE_FILE" } ############################################################################### function ProcessLongOptions @@ -1245,30 +1245,30 @@ while getopts "5a:bc:d:D:ef:hi:Iklm:npPRrs:vVwy:-:" opt; do OPTIND_INCR="" case "$opt" in - 5) LONG_OPTION=md5-compat-digest;; - a) LONG_OPTION=additional;; - b) LONG_OPTION=batch;; - c) LONG_OPTION=comment-missing;; - d) LONG_OPTION=dir;; - D) LONG_OPTION=define;; - e) LONG_OPTION=edit-spec;; - f) LONG_OPTION=filter;; - i) LONG_OPTION=include;; - I) LONG_OPTION=install;; - k) LONG_OPTION=keep-perm;; - l) LONG_OPTION=list-plugin;; - m) LONG_OPTION=modify;; - n) LONG_OPTION=notest-install;; - p) LONG_OPTION=package;; - P) LONG_OPTION=autoprovide;; - r) LONG_OPTION=release;; - R) LONG_OPTION=autorequire;; - s) LONG_OPTION=spec-only;; - h) LONG_OPTION=help;; - v) LONG_OPTION=verbose;; - V) LONG_OPTION=version;; - w) LONG_OPTION=warning;; - y) LONG_OPTION=verify;; + 5) LONG_OPTION="md5-compat-digest";; + a) LONG_OPTION="additional";; + b) LONG_OPTION="batch";; + c) LONG_OPTION="comment-missing";; + d) LONG_OPTION="dir";; + D) LONG_OPTION="define";; + e) LONG_OPTION="edit-spec";; + f) LONG_OPTION="filter";; + i) LONG_OPTION="include";; + I) LONG_OPTION="install";; + k) LONG_OPTION="keep-perm";; + l) LONG_OPTION="list-plugin";; + m) LONG_OPTION="modify";; + n) LONG_OPTION="notest-install";; + p) LONG_OPTION="package";; + P) LONG_OPTION="autoprovide";; + r) LONG_OPTION="release";; + R) LONG_OPTION="autorequire";; + s) LONG_OPTION="spec-only";; + h) LONG_OPTION="help";; + v) LONG_OPTION="verbose";; + V) LONG_OPTION="version";; + w) LONG_OPTION="warning";; + y) LONG_OPTION="verify";; -) case "x$OPTARG" in @@ -1281,7 +1281,7 @@ *) LONG_OPTION="$OPTARG" if [ $OPTIND -le $# ]; then - eval OPTARG=\$$OPTIND + eval OPTARG=\${$OPTIND} OPTARG_EXIST=1 OPTIND_INCR=1 else @@ -1307,10 +1307,11 @@ CheckOptions CreateProcessing "fini" || return - [ "X$spec_only" = "Xyes" -a "X$need_change_files" = "Xyes" ] && { + if [ "X$spec_only" = "Xyes" ] && [ "X$need_change_files" = "Xyes" ] + then Echo "$NotCompatibleOption '--spec_only' , '--change-files'" return 1 - } + fi shift $((OPTIND - 1)) case $# in @@ -1323,16 +1324,16 @@ 1) # One argument, it's ok PAQUET="$1" if [ "x$package_flag" = "x" ]; then - PAQUET_NAME=$( basename $PAQUET ) + PAQUET_NAME=$( basename "$PAQUET" ) else # argument should be a file - if [ -f $PAQUET ]; then - PAQUET_NAME=$( basename $PAQUET) + if [ -f "$PAQUET" ]; then + PAQUET_NAME=$( basename "$PAQUET" ) # check if it is an rpm file # rem : 'file' sometimes does not return # "RPM" because some other magic triggers # before the RPM magic check runs - tst_rpm=$( rpm -qp $PAQUET 2>/dev/null ) + tst_rpm=$( rpm -qp "$PAQUET" 2>/dev/null ) if [ $? -eq 0 ]; then : #ok else @@ -1363,7 +1364,7 @@ # Let us find it's absolute path. # Yeah, a bit ugly, but simple and seems to work... Mkdir_p "$rpmdir" # Not check exit status here - rpmdir="$(cd $rpmdir && echo $PWD)" || { + rpmdir="$( cd "$rpmdir" && echo "$PWD" )" || { Error "(CommandLineParsing) $CannotChdir '$rpmdir'" return 1 } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/rpmrebuild_rpmqf.src new/rpmrebuild_rpmqf.src --- old/rpmrebuild_rpmqf.src 2020-02-21 13:53:22.000000000 +0100 +++ new/rpmrebuild_rpmqf.src 2021-01-17 15:04:00.000000000 +0100 @@ -2,7 +2,7 @@ ############################################################################### # Copyright (C) 2002 by Eric Gerbier # Bug reports to: [email protected] -# $Id: rpmrebuild-2.15 | rpmrebuild_rpmqf.src | Fri Feb 21 13:50:26 2020 +0100 | Eric Gerbier $ +# $Id: rpmrebuild-2.16 | rpmrebuild_rpmqf.src | Fri Feb 21 13:50:26 2020 +0100 | Eric Gerbier $ # # 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 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/spec_func.src new/spec_func.src --- old/spec_func.src 2020-02-21 13:53:22.000000000 +0100 +++ new/spec_func.src 2021-01-17 15:04:00.000000000 +0100 @@ -2,7 +2,7 @@ ############################################################################### # Copyright (C) 2004, 2009 by Valery Reznic # This file is a part of the rpmrebuild project -# $Id: rpmrebuild-2.15 | spec_func.src | Fri Feb 21 13:50:26 2020 +0100 | Eric Gerbier $ +# $Id: rpmrebuild-2.16 | spec_func.src | Sun Jan 3 10:43:49 2021 +0100 | Eric Gerbier $ # # 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 @@ -54,16 +54,16 @@ { rpm_qf=$( $1 ) local RPM_QUERY="rpm --query $i18ndomains $package_flag --queryformat " - $RPM_QUERY "$rpm_qf" $PAQUET || Error "(spec_query) $rpm_qf" || return + $RPM_QUERY "$rpm_qf" "$PAQUET" || Error "(spec_query) $rpm_qf" || return return 0 } # build the list of files in package function spec_files { - rm -f $FILES_IN || Erro "spec_files rm $FILES_IN" || return - spec_query qf_spec_files > $FILES_IN || Error "(spec_files) spec_query qf_spec_files" || return - /bin/bash $MY_LIB_DIR/rpmrebuild_files.sh < $FILES_IN || Error "(spec_files) rpmrebuild_files.sh" || return + rm -f "$FILES_IN" || Erro "spec_files rm $FILES_IN" || return + spec_query qf_spec_files > "$FILES_IN" || Error "(spec_files) spec_query qf_spec_files" || return + /bin/bash "$MY_LIB_DIR"/rpmrebuild_files.sh < "$FILES_IN" || Error "(spec_files) rpmrebuild_files.sh" || return return 0 } @@ -158,26 +158,26 @@ local sed_comment=';s/^/#/' local i=1 - spec_preamble > $SPEC_PREAMBLE.$i || Error "(SpecGeneration) spec_preamble" || return - spec_query qf_spec_conflicts > $SPEC_CONFLICTS.$i || Error "(SpecGeneration) qf_spec_conflicts" || return - spec_query qf_spec_obsoletes > $SPEC_OBSOLETES.$i || Error "(SpecGeneration) qf_spec_obsoletes" || return - spec_provides > $SPEC_PROVIDES.$i || Error "(SpecGeneration) spec_provides" || return - spec_requires > $SPEC_REQUIRES.$i || Error "(SpecGeneration) spec_requires" || return - spec_query qf_spec_suggest > $SPEC_SUGGESTS.$i || Error "(SpecGeneration) qf_spec_suggest" || return - spec_query qf_spec_enhance > $SPEC_ENHANCES.$i || Error "(SpecGeneration) qf_spec_enhance" || return - spec_query qf_spec_recommends > $SPEC_RECOMMENDS.$i || Error "(SpecGeneration) qf_spec_recommends" || return - spec_query qf_spec_supplements > $SPEC_SUPPLEMENTS.$i || Error "(SpecGeneration) qf_spec_supplements" || return - spec_query qf_spec_description > $SPEC_DESCRIPTION.$i || Error "(SpecGeneration) qf_spec_description" || return - spec_files > $SPEC_FILES.$i || Error "(SpecGeneration) spec_files" || return - spec_query qf_spec_triggers > $SPEC_TRIGGERS.$i || Error "(SpecGeneration) qf_spec_triggers" || return - spec_query qf_spec_pre > $SPEC_PRE.$i || Error "(SpecGeneration) qf_spec_pre" || return - spec_query qf_spec_pretrans > $SPEC_PRETRANS.$i || Error "(SpecGeneration) qf_spec_pretrans" || return - spec_query qf_spec_post > $SPEC_POST.$i || Error "(SpecGeneration) qf_spec_post" || return - spec_query qf_spec_posttrans > $SPEC_POSTTRANS.$i || Error "(SpecGeneration) qf_spec_posttrans" || return - spec_query qf_spec_preun > $SPEC_PREUN.$i || Error "(SpecGeneration) qf_spec_preun" || return - spec_query qf_spec_postun > $SPEC_POSTUN.$i || Error "(SpecGeneration) qf_spec_postun" || return - spec_query qf_spec_verifyscript > $SPEC_VERIFYSCRIPT.$i || Error "(SpecGeneration) qf_spec_verifyscript" || return - spec_query qf_spec_changelog > $SPEC_CHANGELOG.$i || Error "(SpecGeneration) qf_spec_changelog" || return + spec_preamble > "$SPEC_PREAMBLE.$i" || Error "(SpecGeneration) spec_preamble" || return + spec_query qf_spec_conflicts > "$SPEC_CONFLICTS.$i" || Error "(SpecGeneration) qf_spec_conflicts" || return + spec_query qf_spec_obsoletes > "$SPEC_OBSOLETES.$i" || Error "(SpecGeneration) qf_spec_obsoletes" || return + spec_provides > "$SPEC_PROVIDES.$i" || Error "(SpecGeneration) spec_provides" || return + spec_requires > "$SPEC_REQUIRES.$i" || Error "(SpecGeneration) spec_requires" || return + spec_query qf_spec_suggest > "$SPEC_SUGGESTS.$i" || Error "(SpecGeneration) qf_spec_suggest" || return + spec_query qf_spec_enhance > "$SPEC_ENHANCES.$i" || Error "(SpecGeneration) qf_spec_enhance" || return + spec_query qf_spec_recommends > "$SPEC_RECOMMENDS.$i" || Error "(SpecGeneration) qf_spec_recommends" || return + spec_query qf_spec_supplements > "$SPEC_SUPPLEMENTS.$i" || Error "(SpecGeneration) qf_spec_supplements" || return + spec_query qf_spec_description > "$SPEC_DESCRIPTION.$i" || Error "(SpecGeneration) qf_spec_description" || return + spec_files > "$SPEC_FILES.$i" || Error "(SpecGeneration) spec_files" || return + spec_query qf_spec_triggers > "$SPEC_TRIGGERS.$i" || Error "(SpecGeneration) qf_spec_triggers" || return + spec_query qf_spec_pre > "$SPEC_PRE.$i" || Error "(SpecGeneration) qf_spec_pre" || return + spec_query qf_spec_pretrans > "$SPEC_PRETRANS.$i" || Error "(SpecGeneration) qf_spec_pretrans" || return + spec_query qf_spec_post > "$SPEC_POST.$i" || Error "(SpecGeneration) qf_spec_post" || return + spec_query qf_spec_posttrans > "$SPEC_POSTTRANS.$i" || Error "(SpecGeneration) qf_spec_posttrans" || return + spec_query qf_spec_preun > "$SPEC_PREUN.$i" || Error "(SpecGeneration) qf_spec_preun" || return + spec_query qf_spec_postun > "$SPEC_POSTUN.$i" || Error "(SpecGeneration) qf_spec_postun" || return + spec_query qf_spec_verifyscript > "$SPEC_VERIFYSCRIPT.$i" || Error "(SpecGeneration) qf_spec_verifyscript" || return + spec_query qf_spec_changelog > "$SPEC_CHANGELOG.$i" || Error "(SpecGeneration) qf_spec_changelog" || return return 0 } @@ -213,26 +213,26 @@ SPEC_DEFS sed -e "$sed_double_percent" \ - $SPEC_PREAMBLE.$si_preamble \ - $SPEC_CONFLICTS.$si_conflicts \ - $SPEC_OBSOLETES.$si_obsoletes \ - $SPEC_PROVIDES.$si_provides \ - $SPEC_REQUIRES.$si_requires \ - $SPEC_SUGGESTS.$si_suggests \ - $SPEC_ENHANCES.$si_enhances \ - $SPEC_RECOMMENDS.$si_recommends \ - $SPEC_SUPPLEMENTS.$si_supplements \ + "$SPEC_PREAMBLE.$si_preamble" \ + "$SPEC_CONFLICTS.$si_conflicts" \ + "$SPEC_OBSOLETES.$si_obsoletes" \ + "$SPEC_PROVIDES.$si_provides" \ + "$SPEC_REQUIRES.$si_requires" \ + "$SPEC_SUGGESTS.$si_suggests" \ + "$SPEC_ENHANCES.$si_enhances" \ + "$SPEC_RECOMMENDS.$si_recommends" \ + "$SPEC_SUPPLEMENTS.$si_supplements" \ || Error "(spec_concatenate) sed1 error" || return echo || return echo "%description" || return sed -e "$sed_double_percent" \ - $SPEC_DESCRIPTION.$si_description \ + "$SPEC_DESCRIPTION.$si_description" \ || return echo "%files" || return cat \ - $SPEC_FILES.$si_files \ + "$SPEC_FILES.$si_files" \ || return # %%triger -> %trigger (in begin of line) @@ -252,19 +252,19 @@ -e "$sed_post" \ -e "$sed_verifyscript" \ -e "$sed_global" \ - $SPEC_TRIGGERS.$si_triggers \ - $SPEC_PRE.$si_pre \ - $SPEC_PRETRANS.$si_pretrans \ - $SPEC_POST.$si_post \ - $SPEC_POSTTRANS.$si_posttrans \ - $SPEC_PREUN.$si_preun \ - $SPEC_POSTUN.$si_postun \ - $SPEC_VERIFYSCRIPT.$si_verifyscript \ + "$SPEC_TRIGGERS.$si_triggers" \ + "$SPEC_PRE.$si_pre" \ + "$SPEC_PRETRANS.$si_pretrans" \ + "$SPEC_POST.$si_post" \ + "$SPEC_POSTTRANS.$si_posttrans" \ + "$SPEC_PREUN.$si_preun" \ + "$SPEC_POSTUN.$si_postun" \ + "$SPEC_VERIFYSCRIPT.$si_verifyscript" \ || Error "(spec_concatenate) sed2 error" || return echo "%changelog" || return sed -e "$sed_double_percent" \ - $SPEC_CHANGELOG.$si_changelog \ + "$SPEC_CHANGELOG.$si_changelog" \ || return return 0 }
