Skip to content

Commit 9689bb4

Browse files
Convert obsolete egrep/fgrep calls to grep -E/-F, respectively (openSUSE#869)
1 parent fabb8e5 commit 9689bb4

File tree

4 files changed

+13
-9
lines changed

4 files changed

+13
-9
lines changed

build

+7-6
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
################################################################
99
#
1010
# Copyright (c) 1995-2014 SUSE Linux Products GmbH
11+
# Copyright (c) 2022 Andreas Stieger <[email protected]>
1112
#
1213
# This program is free software; you can redistribute it and/or modify
1314
# it under the terms of the GNU General Public License version 2 or 3 as
@@ -1682,9 +1683,9 @@ for RECIPEPATH in "${RECIPEFILES[@]}" ; do
16821683
test -n "$SUSE_VERSION" -a "${SUSE_VERSION:-0}" -le 1020 && BUILD_USER=root
16831684
fi
16841685
if test "$BUILD_USER" = abuild ; then
1685-
egrep '^#[[:blank:]]*needsrootforbuild[[:blank:]]*$' >/dev/null <$RECIPEPATH && BUILD_USER=root
1686+
grep -E '^#[[:blank:]]*needsrootforbuild[[:blank:]]*$' >/dev/null <$RECIPEPATH && BUILD_USER=root
16861687
else
1687-
egrep '^#[[:blank:]]*norootforbuild[[:blank:]]*$' >/dev/null <$RECIPEPATH && BUILD_USER=abuild
1688+
grep -E '^#[[:blank:]]*norootforbuild[[:blank:]]*$' >/dev/null <$RECIPEPATH && BUILD_USER=abuild
16881689
fi
16891690
test -n "$NOROOTFORBUILD" && BUILD_USER=abuild
16901691

@@ -1700,18 +1701,18 @@ for RECIPEPATH in "${RECIPEFILES[@]}" ; do
17001701

17011702
# fixup passwd/group
17021703
if test $BUILD_USER = abuild ; then
1703-
if ! egrep '^abuild:' >/dev/null <$BUILD_ROOT/etc/passwd ; then
1704+
if ! grep -E '^abuild:' >/dev/null <$BUILD_ROOT/etc/passwd ; then
17041705
echo "abuild:x:${ABUILD_UID}:${ABUILD_GID}:Autobuild:/home/abuild:/bin/bash" >>$BUILD_ROOT/etc/passwd
17051706
echo 'abuild:*:::::::' >>$BUILD_ROOT/etc/shadow # This is needed on Mandriva 2009
17061707
echo 'abuild:*::' >>$BUILD_ROOT/etc/gshadow # This is needed on Ubuntu
17071708
echo "abuild:x:${ABUILD_GID}:" >>$BUILD_ROOT/etc/group
17081709
mkdir -p $BUILD_ROOT/home/abuild
17091710
chown "$ABUILD_UID:$ABUILD_GID" $BUILD_ROOT/home/abuild
17101711
else
1711-
if ! egrep "^abuild:x?:${ABUILD_UID}:${ABUILD_GID}" >/dev/null <$BUILD_ROOT/etc/passwd ; then
1712+
if ! grep -E "^abuild:x?:${ABUILD_UID}:${ABUILD_GID}" >/dev/null <$BUILD_ROOT/etc/passwd ; then
17121713
echo "abuild user present in the buildroot ($BUILD_ROOT) but uid:gid does not match"
17131714
echo "buildroot currently using:"
1714-
egrep "^abuild:" <$BUILD_ROOT/etc/passwd
1715+
grep -E "^abuild:" <$BUILD_ROOT/etc/passwd
17151716
echo "build script attempting to use:"
17161717
echo "abuild::${ABUILD_UID}:${ABUILD_GID}:..."
17171718
echo "build aborting"
@@ -1729,7 +1730,7 @@ for RECIPEPATH in "${RECIPEFILES[@]}" ; do
17291730
# building as root
17301731
ABUILD_UID=0
17311732
ABUILD_GID=0
1732-
if egrep '^abuild:' >/dev/null <$BUILD_ROOT/etc/passwd ; then
1733+
if grep -E '^abuild:' >/dev/null <$BUILD_ROOT/etc/passwd ; then
17331734
rm -rf "$BUILD_ROOT/home/abuild"
17341735
sed -i -e '/^abuild:/d' $BUILD_ROOT/etc/passwd
17351736
sed -i -e '/^abuild:/d' $BUILD_ROOT/etc/group

build-recipe-docker

+2-1
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
#
77
# Copyright (c) 2017 SUSE Linux Products GmbH
88
# Copyright (c) 2021 SUSE LLC
9+
# Copyright (c) 2022 Andreas Stieger <[email protected]>
910
#
1011
# This program is free software; you can redistribute it and/or modify
1112
# it under the terms of the GNU General Public License version 2 or 3 as
@@ -198,7 +199,7 @@ recipe_build_docker() {
198199
done
199200
# if we did not find a tag, look info a file called TAG
200201
if test -z "$FIRSTTAG" -a -f TAG ; then
201-
for t in $(egrep -v '^#' TAG) ; do
202+
for t in $(grep -E -v '^#' TAG) ; do
202203
test -n "$FIRSTTAG" || FIRSTTAG="$t"
203204
ALLTAGS="$ALLTAGS $t"
204205
done

build-recipe-spec

+2-1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
################################################################
55
#
66
# Copyright (c) 1995-2014 SUSE Linux Products GmbH
7+
# Copyright (c) 2022 Andreas Stieger <[email protected]>
78
#
89
# This program is free software; you can redistribute it and/or modify
910
# it under the terms of the GNU General Public License version 2 or 3 as
@@ -154,7 +155,7 @@ recipe_build_spec() {
154155
test "$BUILDTYPE" = debbuild && rpmbuild=debbuild
155156

156157
HAVE_DYNAMIC_BUILDREQUIRES=
157-
if egrep '^%generate_buildrequires' "$BUILD_ROOT$TOPDIR/SOURCES/$RECIPEFILE" >/dev/null ; then
158+
if grep -E '^%generate_buildrequires' "$BUILD_ROOT$TOPDIR/SOURCES/$RECIPEFILE" >/dev/null ; then
158159
HAVE_DYNAMIC_BUILDREQUIRES=true
159160
fi
160161

build-vm-nspawn

+2-1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
################################################################
55
#
66
# Copyright (c) 2019 Oleg Girko
7+
# Copyright (c) 2022 Andreas Stieger <[email protected]>
78
#
89
# This program is free software; you can redistribute it and/or modify
910
# it under the terms of the GNU General Public License version 2 or 3 as
@@ -31,7 +32,7 @@ vm_startup_nspawn() {
3132
name="obsbuild.${name//_/-}"
3233
local pipe_opt=
3334
local privileged_opt=
34-
if test -z "$RUN_SHELL" && systemd-nspawn --help | fgrep -q -e --pipe; then
35+
if test -z "$RUN_SHELL" && systemd-nspawn --help | grep -F -q -e --pipe; then
3536
pipe_opt=--pipe
3637
fi
3738
if test -n "$VM_TYPE_PRIVILEGED"; then

0 commit comments

Comments
 (0)