add RPMBUILD_BASE_DIR to configure the base dir used for rpmbuild
Some checks failed
continuous-integration/drone/push Build is failing
Some checks failed
continuous-integration/drone/push Build is failing
This commit is contained in:
parent
a87cecf558
commit
5be7bae090
@ -6,6 +6,8 @@ LABEL maintainer="Robert Kaussow <mail@geeklabor.de>" \
|
|||||||
org.label-schema.vendor="Robert Kaussow" \
|
org.label-schema.vendor="Robert Kaussow" \
|
||||||
org.label-schema.schema-version="1.0"
|
org.label-schema.schema-version="1.0"
|
||||||
|
|
||||||
|
ENV RPMBUILD_BASE_DIR=/drone/src
|
||||||
|
|
||||||
RUN yum install -q -y \
|
RUN yum install -q -y \
|
||||||
dash \
|
dash \
|
||||||
gcc gcc-c++ \
|
gcc gcc-c++ \
|
||||||
@ -35,11 +37,12 @@ RUN yum install -q -y \
|
|||||||
yum-utils rpm-build rpmdevtools \
|
yum-utils rpm-build rpmdevtools \
|
||||||
epel-release && \
|
epel-release && \
|
||||||
rpm --import https://dl.fedoraproject.org/pub/epel/RPM-GPG-KEY-EPEL-7 && \
|
rpm --import https://dl.fedoraproject.org/pub/epel/RPM-GPG-KEY-EPEL-7 && \
|
||||||
|
ln -s dash /bin/sh && \
|
||||||
yum clean all
|
yum clean all
|
||||||
|
|
||||||
ADD overlay/ /
|
ADD overlay/ /
|
||||||
|
|
||||||
USER root
|
USER root
|
||||||
|
|
||||||
WORKDIR /drone/src
|
WORKDIR ${RPMBUILD_BASE_DIR}
|
||||||
CMD []
|
CMD []
|
||||||
|
18
README.md
18
README.md
@ -6,18 +6,24 @@
|
|||||||
|
|
||||||
Simple Docker image based on CentOS 7 to build RPM packages.
|
Simple Docker image based on CentOS 7 to build RPM packages.
|
||||||
|
|
||||||
|
## Environment variables
|
||||||
|
|
||||||
|
```Shell
|
||||||
|
RPMBUILD_BASE_DIR=/drone/src
|
||||||
|
```
|
||||||
|
|
||||||
## How to use
|
## How to use
|
||||||
|
|
||||||
There are two wrapper scripts around the rpmbuild command you could use:
|
There are two wrapper scripts around the rpmbuild command you could use:
|
||||||
|
|
||||||
- `/bin/rpmbuild-official`: This will simply forward your command to the official binary at `/usr/bin/rpmbuild`
|
- `/usr/local/bin/rpmbuild-official`: This will simply forward your command to the official binary at `/usr/bin/rpmbuild`
|
||||||
- `/bin/rpmbuil`: This is a modified wrapper to prepare the environment before calling rpmbuil
|
- `/usr/local/bin/rpmbuil`: This is a modified wrapper to prepare the environment before calling rpmbuil
|
||||||
|
|
||||||
The wrapper `/bin/rpmbuil` will do the following:
|
The wrapper `/usr/local/bin/rpmbuil` will do the following:
|
||||||
|
|
||||||
- create `$(pwd)/dist`
|
- create `$RPMBUILD_BASE_DIR/dist`
|
||||||
- create rpmbuild folder structure (`BUILDRPMS|SOURCES|SPECS|SRPMS`) under `$(pwd)/dist`
|
- create rpmbuild folder structure (`BUILDRPMS|SOURCES|SPECS|SRPMS`) under `$RPMBUILD_BASE_DIR/dist`
|
||||||
- sync local patchfiles from `$(pwd)/patch` to `$(pwd)/dist/SOURCES`
|
- sync local patchfiles from `$RPMBUILD_BASE_DIR/patch` to `$RPMBUILD_BASE_DIR/dist/SOURCES` if the `patch` folder exist
|
||||||
- call `/bin/rpmbuil` with the given parameters
|
- call `/bin/rpmbuil` with the given parameters
|
||||||
|
|
||||||
## License
|
## License
|
||||||
|
@ -1,11 +1,14 @@
|
|||||||
#!/usr/bin/env sh
|
#!/usr/bin/env sh
|
||||||
set -eo pipefail
|
set -eo pipefail
|
||||||
|
|
||||||
DIR=$(pwd)
|
mkdir -p "${RPMBUILD_BASE_DIR%/}/dist"
|
||||||
|
mkdir -p "${RPMBUILD_BASE_DIR%/}/dist"
|
||||||
|
|
||||||
mkdir -p ./dist
|
echo '%_topdir '"${RPMBUILD_BASE_DIR%/}"'/dist' > /root/.rpmmacros
|
||||||
echo '%_topdir '"${DIR%/}"'/dist' > /root/.rpmmacros
|
|
||||||
rpmdev-setuptree
|
rpmdev-setuptree
|
||||||
rsync -q -av "${DIR%/}/patch/" "${DIR%/}/dist/SOURCES"
|
|
||||||
|
if [ -d "$DIR" ]; then
|
||||||
|
rsync -q -av "${RPMBUILD_BASE_DIR%/}/patch/" "${RPMBUILD_BASE_DIR%/}/dist/SOURCES"
|
||||||
|
fi
|
||||||
|
|
||||||
exec /usr/bin/rpmbuild "$@"
|
exec /usr/bin/rpmbuild "$@"
|
||||||
|
Reference in New Issue
Block a user