Join GitHub today
GitHub is home to over 20 million developers working together to host and review code, manage projects, and build software together.
tests/lib: generalize RPM build support #3449
Conversation
added some commits
Jun 8, 2017
| + cp $rpm_dir/RPMS/$arch/snap*.rpm $GOPATH | ||
| + if [[ "$SPREAD_SYSTEM" = fedora-* ]]; then | ||
| + # On Fedora we have an additional package for SELinux | ||
| + cp $rpm_dir/RPMS/noarch/snap*.rpm $GOPATH |
zyga
Jun 9, 2017
Contributor
Could you use the more precise package name here in case we get some other packages and this matches them by accident?
morphis
Jun 9, 2017
Contributor
We will only ever get other packages in $rpm_dir/RPMS which are build by snapd.spec so this is fairly safe to do. We also do a cleanup of $rpm_dir a bit higher up.
| + rpm_dir=$HOME/rpmbuild | ||
| + ;; | ||
| + opensuse-*) | ||
| + rpm_dir=/usr/src/packages |
Conan-Kudo
Jun 9, 2017
Contributor
You can set rpmbuild to use the same path in both places.
just write the following to ~/.rpmmacros:
%_topdir %(echo $HOME)/rpmbuild
Conan-Kudo
Jun 9, 2017
Contributor
Alternatively, you can just do rpm --eval "%_topdir" to get what the topdir is.
| deps=() | ||
| n=0 | ||
| IFS=$'\n' | ||
| - for dep in $(rpm -qpR /usr/src/packages/SRPMS/snapd-1337.*.src.rpm); do | ||
| + for dep in $(rpm -qpR $rpm_dir/SRPMS/snapd-1337.*.src.rpm); do |
Conan-Kudo
Jun 9, 2017
Contributor
You can install builddeps pretty easily in Fedora and openSUSE.
- Fedora:
dnf builddep </path/to/package.src.rpm> - openSUSE:
zypper si -d </path/to/package.src.rpm>
You may want to ensure builddep is available by doing dnf install 'dnf-command(builddep)', since I'm not sure whether the Linode VM has the package that provides it installed already...
Conan-Kudo
Jun 12, 2017
Contributor
I talked to @morphis about this on IRC, apparently Zypper is dumb and doesn't let you do source-install with local SRPMs. Whatever...
codecov-io
commented
Jun 12, 2017
•
Codecov Report
@@ Coverage Diff @@
## master #3449 +/- ##
==========================================
- Coverage 77.16% 77.16% -0.01%
==========================================
Files 373 373
Lines 25793 25793
==========================================
- Hits 19904 19902 -2
- Misses 4132 4133 +1
- Partials 1757 1758 +1
Continue to review full report at Codecov.
|
| @@ -83,8 +81,10 @@ build_rpm() { | ||
| # Cleanup all artifacts from previous builds | ||
| rm -rf $rpm_dir/BUILD/* | ||
| - # Install all necessary build dependencies | ||
| + # Build our source package | ||
| rpmbuild --with testkeys --nocheck -bs $packaging_path/snapd.spec |
Conan-Kudo
Jun 12, 2017
Contributor
--nocheck has no effect with rpmbuild -bs, so this is a useless parameter.
| + | ||
| + # And now build our binary package | ||
| + rpmbuild \ | ||
| + --with testkeys \ |
| + | ||
| + cp $rpm_dir/RPMS/$arch/snap*.rpm $GOPATH | ||
| + if [[ "$SPREAD_SYSTEM" = fedora-* ]]; then | ||
| + # On Fedora we have an additional package for SELinux |
added some commits
Jun 13, 2017
|
Test seems broken. |
morphis commentedJun 9, 2017
We had two independent functions before to build the RPM for Fedora and openSUSE. This PR combines both into a single function which uses rpmbuild.