Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
scripts
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Docker Build Images
scripts
Commits
5dd11eec
Commit
5dd11eec
authored
5 years ago
by
Markus Frosch
Browse files
Options
Downloads
Patches
Plain Diff
rpm: Make sure to exit on subshell errors
For older versions of bash...
parent
4261f85f
No related branches found
No related tags found
No related merge requests found
Pipeline
#9059
passed
5 years ago
Stage: lint
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
icinga-build-rpm-binary
+6
-6
6 additions, 6 deletions
icinga-build-rpm-binary
icinga-build-rpm-source
+7
-8
7 additions, 8 deletions
icinga-build-rpm-source
with
13 additions
and
14 deletions
icinga-build-rpm-binary
+
6
−
6
View file @
5dd11eec
...
...
@@ -20,7 +20,7 @@ case "$ICINGA_BUILD_OS" in
# Note: force rebuilding here, because zypper is a bit dumb
run-retry-timeout
sudo
zypper
--non-interactive
clean
--all
run-retry-timeout
sudo
zypper
--non-interactive
--no-gpg-checks
--gpg-auto-import-keys
ref
-fs
)
)
||
exit
1
;;
*
)
(
...
...
@@ -33,7 +33,7 @@ case "$ICINGA_BUILD_OS" in
run-retry-timeout
sudo
yum clean expire-cache
run-retry-timeout
sudo
yum makecache fast
fi
)
)
||
exit
1
;;
esac
...
...
@@ -44,7 +44,7 @@ case "$ICINGA_BUILD_OS" in
set
-ex
# shellcheck disable=SC2046
run-retry-timeout
sudo
zypper
--non-interactive
install
$(
rpm
-qpR
"
${
source_rpm
}
"
)
)
)
||
exit
1
;;
*
)
(
...
...
@@ -55,7 +55,7 @@ case "$ICINGA_BUILD_OS" in
set
-ex
run-retry-timeout
sudo
yum-builddep
-y
"
${
source_rpm
}
"
fi
)
)
||
exit
1
;;
esac
...
...
@@ -87,7 +87,7 @@ eval "$(get_rpmbuild --rebuild "${source_rpm}")"
else
"
${
RPMBUILD
[@]
}
"
fi
)
)
||
exit
1
if
command
-v
ccache &>/dev/null
&&
[
-d
"
${
CCACHE_DIR
}
"
]
;
then
cached_files
=
"
$(
find
"
${
CCACHE_DIR
}
"
-type
f
!
-name
ccache.conf
!
-name
stats |
wc
-l
)
"
...
...
@@ -121,4 +121,4 @@ echo "[ Running rpmlint ]"
)
||
lintrc
=
$?
done
[
"
$lintrc
"
-eq
0
]
)
||
[
"
${
ICINGA_BUILD_IGNORE_LINT
}
"
-eq
1
]
)
||
(
[
"
${
ICINGA_BUILD_IGNORE_LINT
}
"
-eq
1
]
&&
exit
1
)
||
exit
1
This diff is collapsed.
Click to expand it.
icinga-build-rpm-source
+
7
−
8
View file @
5dd11eec
...
...
@@ -7,7 +7,7 @@ set -e
(
set
-ex
rm
-rf
"
${
BUILDDIR
:?
}
/"
)
)
||
exit
1
echo
"[ git show ]"
GIT_PAGER
=
'cat'
git show
-s
||
true
...
...
@@ -22,7 +22,7 @@ echo
mkdir
"
${
BUILDDIR
}
"
/
{
,SPECS,SOURCES,BUILD,SRPMS,RPMS
}
cp
-v
./
*
.spec
"
${
BUILDDIR
}
/SPECS/"
find
.
-maxdepth
1
-type
f
!
-name
"*.spec"
-exec
cp
-vt
"
${
BUILDDIR
}
/SOURCES/"
{}
\;
)
)
||
exit
1
if
[
-d
/etc/rpmdevtools
]
;
then
if
!
grep
-Pq
^--netrc /etc/rpmdevtools/curlrc
;
then
...
...
@@ -45,14 +45,14 @@ if [ "$ICINGA_BUILD_TYPE" == "release" ] ; then
set
-ex
cd
"
${
BUILDDIR
}
/SOURCES/"
run-retry-timeout spectool
-g
../SPECS/
*
.spec
)
)
||
exit
1
else
echo
"[ Creating snapshot tarball ]"
(
set
-ex
UPSTREAM_GIT_BRANCH
=
"
$ICINGA_BUILD_UPSTREAM_BRANCH
"
run-retry-timeout ./get_snapshot
mv
-t
"
${
BUILDDIR
}
/SOURCES/"
./
*
.version ./
*
.tar
*
)
)
||
exit
1
echo
"[ Building snapshot version ]"
(
...
...
@@ -70,7 +70,7 @@ else
-e
'0,/^Source0\?: /{s/\(Source0\?\): .*/Source0: '
"
${
tarball
}
"
'/}'
\
-e
'0,/^%global\s\+\(git_\)\?commit /{s/\(%global\s\+\(git_\)\?commit\).*/%global commit '
"
${
git_commit
}
"
'/}'
\
"SPECS/
${
ICINGA_BUILD_PROJECT
}
.spec"
)
)
||
exit
1
fi
...
...
@@ -84,8 +84,7 @@ echo "[ Building source RPM ]"
# (he could test the package in repository)
rpm
-qp
--queryformat
"%{VERSION}-%{RELEASE}"
"SRPMS/"
*
"
${
ICINGA_BUILD_PROJECT
}
"
*
".src.rpm"
\
>
"
${
ICINGA_BUILD_PROJECT
}
-package.version"
)
)
||
exit
1
echo
"[ Running rpmlint ]"
lintconf
=(
--info
--verbose
-o
"NetworkEnabled True"
)
...
...
@@ -107,4 +106,4 @@ fi
|
tee
"
${
BUILDDIR
}
/"
rpmlint-srpm.log
||
lintrc
=
$?
[
"
$lintrc
"
-eq
0
]
)
||
[
"
${
ICINGA_BUILD_IGNORE_LINT
}
"
-eq
1
]
)
||
(
[
"
${
ICINGA_BUILD_IGNORE_LINT
}
"
-eq
1
]
&&
exit
1
)
||
exit
1
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment