Skip to content

Commit

Permalink
speedup : do not cleanup chroot when building from spec + Output dir …
Browse files Browse the repository at this point in the history
…per arch target
  • Loading branch information
Laurent Licour committed May 3, 2015
1 parent a5edb78 commit 6a5b169
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions build-rpm.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@ if [ -z "$MOCK_CONFIG" ]; then
echo "MOCK_CONFIG is empty. Should bin one of: "
ls -l $MOCK_CONF_FOLDER
fi
if [ ! -f "${MOCK_CONF_FOLDER}/${MOCK_CONFIG}.cfg" ]; then
echo "MOCK_CONFIG is invalid. Should bin one of: "
ls -l $MOCK_CONF_FOLDER
fi
if [ -z "$SOURCE_RPM" ] && [ -z "$SPEC_FILE" ]; then
echo "You need to provide the src.rpm or spec file to build"
echo "Set SOURCE_RPM or SPEC_FILE environment variables"
Expand All @@ -30,6 +34,7 @@ if [ ! -z "$HTTP_PROXY" ] || [ ! -z "$http_proxy" ]; then
sed s/\\[main\\]/\[main\]\\\nproxy=$TEMP_PROXY/g /tmp/$MOCK_CONFIG.cfg > /etc/mock/$MOCK_CONFIG.cfg
fi

OUTPUT_FOLDER=${OUTPUT_FOLDER}/${MOCK_CONFIG}
if [ ! -d "$OUTPUT_FOLDER" ]; then
mkdir -p $OUTPUT_FOLDER
else
Expand All @@ -41,6 +46,7 @@ echo " MOCK_CONFIG: $MOCK_CONFIG"
#Priority to SOURCE_RPM if both source and spec file env variable are set
if [ ! -z "$SOURCE_RPM" ]; then
echo " SOURCE_RPM: $SOURCE_RPM"
echo " OUTPUT_FOLDER: $OUTPUT_FOLDER"
echo "========================================================================"
$MOCK_BIN -r $MOCK_CONFIG --rebuild $MOUNT_POINT/$SOURCE_RPM --resultdir=$OUTPUT_FOLDER
elif [ ! -z "$SPEC_FILE" ]; then
Expand All @@ -50,9 +56,11 @@ elif [ ! -z "$SPEC_FILE" ]; then
fi
echo " SPEC_FILE: $SPEC_FILE"
echo " SOURCES: $SOURCES"
echo " OUTPUT_FOLDER: $OUTPUT_FOLDER"
echo "========================================================================"
$MOCK_BIN -r $MOCK_CONFIG --buildsrpm --spec=$MOUNT_POINT/$SPEC_FILE --sources=$MOUNT_POINT/$SOURCES --resultdir=$OUTPUT_FOLDER
$MOCK_BIN -r $MOCK_CONFIG --rebuild $(find $OUTPUT_FOLDER -type f -name "*.src.rpm") --resultdir=$OUTPUT_FOLDER
# do not cleanup chroot between both mock calls as 1st does not alter it
$MOCK_BIN -r $MOCK_CONFIG --buildsrpm --spec=$MOUNT_POINT/$SPEC_FILE --sources=$MOUNT_POINT/$SOURCES --resultdir=$OUTPUT_FOLDER --no-cleanup-after
$MOCK_BIN -r $MOCK_CONFIG --rebuild $(find $OUTPUT_FOLDER -type f -name "*.src.rpm") --resultdir=$OUTPUT_FOLDER --no-clean
fi

echo "Build finished. Check results inside the mounted volume folder."

0 comments on commit 6a5b169

Please sign in to comment.