Skip to content

Commit 2d7716a

Browse files
Add support for nightly and unstable builds (#94)
1 parent ca10c8b commit 2d7716a

File tree

4 files changed

+88
-28
lines changed

4 files changed

+88
-28
lines changed

packages/obs-push.sh

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
#!/usr/bin/env bash
2+
3+
# $ ./obs-push.sh PROJECT VERSION SNAPSHOT COMMIT_HASH CRYSTAL_LINUX64_TARGZ CRYSTAL_LINUX32_TARGZ CRYSTAL_DOCS_TARGZ
4+
5+
# This script uses osc to check out PROJECT, update the version information
6+
# (VERSION, SNAPSHOT, COMMIT_HASH) and build artifacts (*_TARGZ arguments),
7+
# and commit the changes to OBS.
8+
#
9+
# Requirements:
10+
# * packages: osc build which
11+
# * configured ~/.oscrc with credentials
12+
13+
set -eu
14+
15+
PACKAGE="crystal"
16+
17+
PROJECT=$1
18+
VERSION=$2
19+
SNAPSHOT=$3
20+
COMMIT_HASH=$4
21+
CRYSTAL_LINUX64_TARGZ=$5
22+
CRYSTAL_LINUX32_TARGZ=$6
23+
CRYSTAL_DOCS_TARGZ=$7
24+
25+
# Checkout OBS package
26+
osc checkout "$PROJECT" "$PACKAGE"
27+
28+
pushd "$PROJECT/$PACKAGE"
29+
30+
# Copy build artifacts
31+
cp "$CRYSTAL_LINUX64_TARGZ" "$PACKAGE-snapshot-linux-x86_64.tar.gz"
32+
cp "$CRYSTAL_LINUX32_TARGZ" "$PACKAGE-snapshot-linux-i686.tar.gz"
33+
cp "$CRYSTAL_DOCS_TARGZ" "$PACKAGE-snapshot-docs.tar.gz"
34+
35+
# Update version in *.dsc and *.spec
36+
PACKAGE_VERSION="${VERSION}~${SNAPSHOT}.git.${COMMIT_HASH:0:8}"
37+
sed -i -e "s/^Version: .*/Version: ${PACKAGE_VERSION}-1/" *.dsc
38+
sed -i -e "s/^Version: .*/Version: ${PACKAGE_VERSION}/" *.spec
39+
40+
# Commit changes to OBS
41+
message="Update $PROJECT to $SNAPSHOT"
42+
osc vc -m "$message"
43+
osc diff
44+
osc commit -m "$message"
45+
46+
# Remove OSC working dir
47+
popd
48+
rm -r "$PROJECT/$PACKAGE"

packages/obs-setup.sh

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
#!/usr/bin/env bash
2+
3+
# This script configures OSC credentials for
4+
# https://api.opensuse.org
5+
#
6+
# Environment variables:
7+
# * OBS_USER: username
8+
# * OBS_PASSWORD: password
9+
10+
# Configure OSC
11+
cat > ~/.oscrc <<EOF
12+
[general]
13+
apiurl = https://api.opensuse.org
14+
15+
[https://api.opensuse.org]
16+
user=$OBS_USER
17+
pass=$OBS_PASSWORD
18+
EOF

packages/scripts/install.sh

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -167,6 +167,18 @@ case $i in
167167
esac
168168
done
169169

170+
case $CHANNEL in
171+
stable)
172+
;;
173+
nightly | unstable)
174+
OBS_PROJECT="${OBS_PROJECT}:${CHANNEL}"
175+
;;
176+
*)
177+
_error "Unsupported channel $CHANNEL"
178+
exit 1
179+
;;
180+
esac
181+
170182
if [[ -z "${DISTRO_REPO}" ]]; then
171183
_discover_distro_repo
172184
fi

packages/support/test-install.sh

Lines changed: 10 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,16 @@ crystal --version
1414
shards --version
1515
crystal eval 'puts "Hello World!"'
1616

17+
../scripts/install.sh --channel=unstable
18+
crystal --version
19+
shards --version
20+
crystal eval 'puts "Hello World!"'
21+
22+
../scripts/install.sh --channel=nightly
23+
crystal --version
24+
shards --version
25+
crystal eval 'puts "Hello World!"'
26+
1727
# OBS doesn't have any fully valid older releases yet, so skipping the following
1828
# checks for now.
1929
exit 0
@@ -38,31 +48,3 @@ shards --version
3848
crystal --version
3949
shards --version
4050
crystal eval 'puts "Hello World!"'
41-
42-
../scripts/install.sh --channel=unstable
43-
crystal --version
44-
shards --version
45-
crystal eval 'puts "Hello World!"'
46-
47-
../scripts/install.sh --channel=nightly
48-
crystal --version
49-
shards --version
50-
crystal eval 'puts "Hello World!"'
51-
52-
# Additional packages needed on docker images to run scripts/install.sh
53-
#
54-
# | Docker Image | gnupg | ca-certificates | apt-transport-https |
55-
# |------------------------|-------|-----------------|---------------------|
56-
# | ubuntu:focal | x | | |
57-
# | ubuntu:eoan | x | | |
58-
# | ubuntu:bionic | x | | |
59-
# | ubuntu:xenial | x | | x |
60-
# | ubuntu:trusty | x | | x |
61-
# | i386/ubuntu:xenial | x | | x |
62-
# |------------------------|-------|-----------------|---------------------|
63-
# | debian:10 (buster) | x | x | |
64-
# | debian:9 (stretch) | x | x | x |
65-
# | debian:8 (jessie) | x | x | x |
66-
# | i386/debian:8 (jessie) | x | x | x |
67-
# |------------------------|-------|-----------------|---------------------|
68-
#

0 commit comments

Comments
 (0)