-
Notifications
You must be signed in to change notification settings - Fork 375
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add rpmtests wrapper for container use
This script replaces the role of mktree.rootfs in the podman image where it serves as a wrapper for the bundled rpmtests that makes it store its working files in the current directory (bind mounted from host) by using an ugly symlink hack. The built in -C option can't be used here because it looks for atlocal in the destination directory where it obviously isn't, hence the hack. However, calling "mktree check" in the container is pretty confusing so move the hack out into a separate rpmtests wrapper so that we can just call "rpmtests" as one would expect. This also makes the hack more explicit and obvious. For consistency, use the same wrapper when running from the build dir (mktree.fedora) as well. Still prefer the locally built test scripts, though, and don't print the test log if not asked.
- Loading branch information
Showing
5 changed files
with
55 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
#!/bin/bash | ||
# | ||
# Wrapper for rpmtests that looks for atlocal in the script's directory instead | ||
# of $PWD or the one specified with -C. In addition, implements the -L | --log | ||
# option to print the test log when done. | ||
|
||
SCRIPT_DIR=$(dirname $(readlink -f $0)) | ||
SCRIPT_FILES="rpmtests atlocal mktree.common" | ||
|
||
TARGET_DIR=$PWD | ||
PRINT_LOG=0 | ||
|
||
cd "$SCRIPT_DIR" | ||
|
||
while [ $# != 0 ]; do | ||
case $1 in | ||
-C | --directory ) | ||
TARGET_DIR="$2" | ||
shift | ||
;; | ||
-L | --log ) | ||
PRINT_LOG=1 | ||
;; | ||
*) | ||
break | ||
;; | ||
esac | ||
shift | ||
done | ||
|
||
# Symlink script files into $TARGET_DIR, prefer local versions though | ||
for file in $SCRIPT_FILES; do | ||
[ -f "$TARGET_DIR/$file" ] || ln -s $PWD/$file $TARGET_DIR/ | ||
done | ||
|
||
cd "$TARGET_DIR" | ||
|
||
# Run the test suite | ||
./rpmtests "$@"; RC=$? | ||
[ $PRINT_LOG == 1 ] && cat rpmtests.log | ||
|
||
# Clean up the symlinks | ||
for file in $SCRIPT_FILES; do | ||
[ -L "$file" ] && rm "$file" | ||
done | ||
|
||
exit $RC |