-
Notifications
You must be signed in to change notification settings - Fork 17
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Adding check_rpmspec_collection.sh #63
Conversation
@@ -0,0 +1,50 @@ | |||
#!/bin/bash | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please use set -euo pipefail
check_rpmspec_collection.sh
Outdated
exit 0 | ||
fi | ||
|
||
if [ ! -f *.spec ]; then |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if there is more than one spec file you will get an error like this:
bash: [: another.spec: binary operator expected
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe something like this:
if ls -1 *.spec | wc -l | grep -q '^1$'; then
echo good
else
echo there must exactly 1 spec file in $(pwd)
exit 1
fi
if there are no spec files the output looks like this:
ls: cannot access '*.spec': No such file or directory
there must exactly 1 spec file in /home/rmeggins/fedpkg/linux-system-roles
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if there is more than one spec file you will get an error like this:
bash: [: another.spec: binary operator expected
Thanks for the solution. I was wondering if there were such case having multiple spec files (and hoping there isn't... :). But, there could be?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But, there could be?
There should only ever be one file matching *.spec
- so if you want to keep if [ -f *.spec ]
that's fine - it should be pretty obvious to a developer what the problem is.
check_rpmspec_collection.sh
Outdated
local option=$1 | ||
local ext=$2 | ||
local expect=$3 | ||
\rm -rf noarch |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
extra backslash?
check_rpmspec_collection.sh
Outdated
fi | ||
|
||
filename=$( $pkgcmd --release $branch verrel ) | ||
rval=$( rpm -ql noarch/${filename}*.rpm | egrep '.html' | egrep collection | egrep -v '/usr/share/doc/' || : ) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you don't need rpm -qlp
here? I guess rpm is now smart enough to know that the given argument is the name of a package filename instead of a package.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
did you mean fgrep
(literal match e.g. match the literal .
in .html
instead of treating .
as "match any char") here instead of egrep
(extended regular expression match)?
check_rpmspec_collection.sh
Outdated
|
||
filename=$( $pkgcmd --release $branch verrel ) | ||
rval=$( rpm -ql noarch/${filename}*.rpm | egrep '.html' | egrep collection | egrep -v '/usr/share/doc/' || : ) | ||
if [ "$rval" = "" ]; then |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if rpm -ql noarch/${filename}*.rpm | egrep '.html' | egrep collection | egrep -v '/usr/share/doc/'; then
echo FAILED - '.html' files are in noarch/${filename}*.rpm other than doc
else
echo OK - '.html' files are only in doc in noarch/${filename}*.rpm
fi
6b1e6b0
to
53fdb4c
Compare
Description - Verify rpm package count with various combination of ansible and collection_artifact options. - Check there is no README.html files in /usr/share/andible/collections. Usage: ./check_rpmspec_collection.sh [ -h | --help ] | [ fedpkg | rhpkg [ branch_name ] ] Fixed the issues found in the review and tox -e shellcheck.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm
What is the intended use of this tool? It seems that it makes plenty of restrictive assumptions about the build environment (only dist-git build supported). |
That is correct. I'm going to use this script to verify the collection is properly packaged using the spec file. Luckily, the entire auto-maintenance is available in dist-git, I took advantage of it. So far, it checks |
Description
collection_artifact options.
Usage: ./check_rpmspec_collection.sh [ -h | --help ] | [ fedpkg | rhpkg [ branch_name ] ]