Commit 2535fa8edc8b30bf1987f5a6f1ae8b3881b48be9
1 parent
c5d9df77
Exists in
master
and in
39 other branches
Updated package build script
Showing
1 changed file
with
24 additions
and
8 deletions
Show diff stats
ci/build_rpm.sh
| 1 | 1 | #!/bin/bash |
| 2 | 2 | |
| 3 | 3 | if [ "$TRAVIS_BRANCH" == "master" ]; then |
| 4 | - REPO="colab-unstable" | |
| 4 | + repo="colab-unstable" | |
| 5 | 5 | elif [ "$TRAVIS_BRANCH" == "stable" ]; then |
| 6 | - REPO="colab-stable" | |
| 6 | + repo="colab-stable" | |
| 7 | 7 | elif [ "$TRAVIS_BRANCH" == "test" ]; then |
| 8 | - REPO="colab-testing" | |
| 8 | + repo="colab-testing" | |
| 9 | 9 | else |
| 10 | 10 | exit 0; |
| 11 | 11 | fi |
| 12 | 12 | |
| 13 | +repo_url="https://packagecloud.io/seocam/$repo/el/7/x86_64" | |
| 14 | + | |
| 15 | +version=`python setup.py --version` | |
| 13 | 16 | python setup.py sdist |
| 14 | 17 | |
| 15 | 18 | sudo apt-get install rinse > /dev/null |
| ... | ... | @@ -26,11 +29,24 @@ sudo cp ci/softwarepublico.key /tmp/centos-7/etc/yum.repos.d/ |
| 26 | 29 | |
| 27 | 30 | sudo chroot /tmp/centos-7/ yum install rpm-build -y > /dev/null |
| 28 | 31 | sudo chroot /tmp/centos-7/ yum install python-virtualenv colab-deps -y /dev/null |
| 29 | -sudo HOME=/root chroot /tmp/centos-7/ rpmbuild -ba /root/rpmbuild/SPECS/colab.spec > /dev/null | |
| 30 | -PACKAGE_PATH=`sudo find /tmp/centos-7/root/rpmbuild/RPMS/noarch/ -name "colab*.rpm"` | |
| 31 | -sudo cp $PACKAGE_PATH /tmp/ | |
| 32 | 32 | |
| 33 | -# Send to packagecloud | |
| 33 | +sudo chroot /tmp/centos-7/ repoquery --repofrompath="$repo,$repo_url" --repoid=$repo colab --info > /tmp/colab-latest-info | |
| 34 | + | |
| 35 | +latest_version=`grep -i version /tmp/colab-latest-info | awk '{ print $3 }'` | |
| 36 | +latest_release=`grep -i release /tmp/colab-latest-info | awk '{ print $3 }'` | |
| 37 | + | |
| 38 | +if [ "$version" == "$latest_version" ]; then | |
| 39 | + release=$((latest_release + 1)) | |
| 40 | +else | |
| 41 | + release=1 | |
| 42 | +fi | |
| 43 | + | |
| 44 | +echo "Building package: $version-$release" | |
| 45 | + | |
| 46 | +sudo HOME=/root chroot /tmp/centos-7/ rpmbuild -ba /root/rpmbuild/SPECS/colab.spec --define="release ${release}" | |
| 47 | +sudo cp /tmp/centos-7/root/rpmbuild/RPMS/noarch/colab-$version-$release.noarch.rpm . | |
| 48 | + | |
| 49 | +## Send to packagecloud | |
| 34 | 50 | |
| 35 | 51 | gem install package_cloud |
| 36 | -package_cloud push seocam/$REPO/el/7 /tmp/*.rpm | |
| 52 | +package_cloud push seocam/$repo/el/7 *.rpm | ... | ... |