Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 38cb9cd

Browse filesBrowse files
authored
Montana/package (#1671)
1 parent 9954aa2 commit 38cb9cd
Copy full SHA for 38cb9cd

File tree

6 files changed

+180
-76
lines changed
Filter options

6 files changed

+180
-76
lines changed

‎packages/postgresml-dashboard/build.sh

Copy file name to clipboardExpand all lines: packages/postgresml-dashboard/build.sh
+17-4Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,24 @@
11
#!/bin/bash
22
set -e
33

4+
# Parse arguments
5+
PACKAGE_VERSION=${1:-"2.10.0"}
6+
UBUNTU_VERSION=${2:-"22.04"}
7+
8+
if [[ -z "$PACKAGE_VERSION" ]]; then
9+
echo "postgresml dashboard build script"
10+
echo "Usage: $0 <package version> [ubuntu version]"
11+
echo "Example: $0 2.10.0 22.04"
12+
exit 1
13+
fi
14+
15+
SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
416
dir="/tmp/postgresml-dashboard"
517
deb_dir="$dir/deb-build"
618
source_dir="$dir/source"
7-
SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
8-
export PACKAGE_VERSION=${1:-"2.10.0"}
19+
20+
export PACKAGE_VERSION
21+
export UBUNTU_VERSION
922
export GITHUB_STARS=$(curl -s "https://api.github.com/repos/postgresml/postgresml" | grep stargazers_count | cut -d : -f 2 | tr -d " " | tr -d ",")
1023
if [[ $(arch) == "x86_64" ]]; then
1124
export ARCH=amd64
@@ -27,7 +40,7 @@ rm "$deb_dir/release.sh"
2740
cp -R static "$deb_dir/usr/share/pgml-dashboard/dashboard-static" && \
2841
cp -R ../pgml-cms "$deb_dir/usr/share/pgml-cms" )
2942

30-
(cat ${SCRIPT_DIR}/DEBIAN/control | envsubst) > "$deb_dir/DEBIAN/control"
43+
(cat ${SCRIPT_DIR}/DEBIAN/control | envsubst '${PACKAGE_VERSION} ${UBUNTU_VERSION} ${ARCH}') > "$deb_dir/DEBIAN/control"
3144
(cat ${SCRIPT_DIR}/etc/systemd/system/pgml-dashboard.service | envsubst) > "$deb_dir/etc/systemd/system/pgml-dashboard.service"
3245

3346
chmod 755 ${deb_dir}/DEBIAN/post*
@@ -36,6 +49,6 @@ chmod 755 ${deb_dir}/DEBIAN/pre*
3649
dpkg-deb \
3750
--root-owner-group \
3851
--build "$deb_dir" \
39-
postgresml-dashboard-${PACKAGE_VERSION}-ubuntu22.04-${ARCH}.deb
52+
"postgresml-dashboard-${PACKAGE_VERSION}-ubuntu${UBUNTU_VERSION}-${ARCH}.deb"
4053

4154
rm -rf "$dir"

‎packages/postgresml-dashboard/release.sh

Copy file name to clipboardExpand all lines: packages/postgresml-dashboard/release.sh
+41-16Lines changed: 41 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -5,35 +5,60 @@ SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
55
package_version="$1"
66

77
if [[ -z "$package_version" ]]; then
8+
echo "postgresml dashboard package build and release script"
89
echo "Usage: $0 <package version, e.g. 2.10.0>"
910
exit 1
1011
fi
1112

12-
if [[ $(arch) == "x86_64" ]]; then
13-
export ARCH=amd64
14-
else
15-
export ARCH=arm64
16-
fi
13+
# Active LTS Ubuntu versions and their codenames
14+
declare -A ubuntu_versions=(
15+
["20.04"]="focal"
16+
["22.04"]="jammy"
17+
["24.04"]="noble"
18+
)
19+
20+
# Supported architectures
21+
declare -a architectures=("amd64" "arm64")
1722

23+
# Install deb-s3 if not present
1824
if ! which deb-s3; then
1925
curl -sLO https://github.com/deb-s3/deb-s3/releases/download/0.11.4/deb-s3-0.11.4.gem
2026
sudo gem install deb-s3-0.11.4.gem
2127
deb-s3
2228
fi
2329

2430
function package_name() {
25-
echo "postgresml-dashboard-${package_version}-ubuntu22.04-${ARCH}.deb"
31+
local ubuntu_version=$1
32+
local arch=$2
33+
echo "postgresml-dashboard-${package_version}-ubuntu${ubuntu_version}-${arch}.deb"
2634
}
2735

28-
bash ${SCRIPT_DIR}/build.sh "$package_version"
36+
# Loop through Ubuntu versions
37+
for ubuntu_version in "${!ubuntu_versions[@]}"; do
38+
codename=${ubuntu_versions[$ubuntu_version]}
39+
echo "Building packages for Ubuntu ${ubuntu_version} (${codename})"
2940

30-
if [[ ! -f $(package_name) ]]; then
31-
echo "File $(package_name) doesn't exist"
32-
exit 1
33-
fi
41+
# Loop through architectures
42+
for arch in "${architectures[@]}"; do
43+
echo "Building for architecture: ${arch}"
44+
export ARCH=${arch}
45+
46+
# Build the dashboard package
47+
bash ${SCRIPT_DIR}/build.sh "$package_version" "$ubuntu_version"
48+
49+
if [[ ! -f $(package_name ${ubuntu_version} ${arch}) ]]; then
50+
echo "File $(package_name ${ubuntu_version} ${arch}) doesn't exist"
51+
exit 1
52+
fi
53+
54+
# Upload to S3
55+
deb-s3 upload \
56+
--lock \
57+
--bucket apt.postgresml.org \
58+
$(package_name ${ubuntu_version} ${arch}) \
59+
--codename ${codename}
3460

35-
deb-s3 upload \
36-
--lock \
37-
--bucket apt.postgresml.org \
38-
$(package_name) \
39-
--codename $(lsb_release -cs)
61+
# Clean up the package file
62+
rm $(package_name ${ubuntu_version} ${arch})
63+
done
64+
done

‎packages/postgresml-python/build.sh

Copy file name to clipboard
+23-11Lines changed: 23 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,40 +1,52 @@
11
#!/bin/bash
2-
#
3-
#
4-
#
52
set -e
3+
64
SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
75
deb_dir="/tmp/postgresml-python/deb-build"
8-
major=${1:-"14"}
96

7+
# Parse arguments with defaults
108
export PACKAGE_VERSION=${1:-"2.10.0"}
11-
export PYTHON_VERSION=${2:-"3.10"}
9+
export UBUNTU_VERSION=${2:-"22.04"}
10+
export PYTHON_VERSION=${3:-"3.10"}
1211

12+
# Handle architecture
1313
if [[ $(arch) == "x86_64" ]]; then
1414
export ARCH=amd64
1515
else
1616
export ARCH=arm64
1717
fi
1818

19+
# Map Ubuntu versions to Python versions if needed
20+
# For example: Ubuntu 20.04 uses Python 3.8 by default
21+
declare -A ubuntu_python_versions=(
22+
["20.04"]="3.8"
23+
["22.04"]="3.10"
24+
["24.04"]="3.11"
25+
)
26+
27+
if [[ -z "$3" ]]; then
28+
PYTHON_VERSION=${ubuntu_python_versions[$UBUNTU_VERSION]:-"3.10"}
29+
fi
30+
1931
rm -rf "$deb_dir"
2032
mkdir -p "$deb_dir"
2133

2234
cp -R ${SCRIPT_DIR}/* "$deb_dir"
2335
rm "$deb_dir/build.sh"
2436
rm "$deb_dir/release.sh"
2537

26-
(cat ${SCRIPT_DIR}/DEBIAN/control | envsubst) > "$deb_dir/DEBIAN/control"
27-
(cat ${SCRIPT_DIR}/DEBIAN/postinst | envsubst '${PGVERSION}') > "$deb_dir/DEBIAN/postinst"
28-
(cat ${SCRIPT_DIR}/DEBIAN/prerm | envsubst '${PGVERSION}') > "$deb_dir/DEBIAN/prerm"
29-
(cat ${SCRIPT_DIR}/DEBIAN/postrm | envsubst '${PGVERSION}') > "$deb_dir/DEBIAN/postrm"
38+
(cat ${SCRIPT_DIR}/DEBIAN/control | envsubst '${PACKAGE_VERSION} ${UBUNTU_VERSION} ${ARCH} ${PYTHON_VERSION}') > "$deb_dir/DEBIAN/control"
39+
(cat ${SCRIPT_DIR}/DEBIAN/postinst | envsubst '${PGVERSION} ${PYTHON_VERSION}') > "$deb_dir/DEBIAN/postinst"
40+
(cat ${SCRIPT_DIR}/DEBIAN/prerm | envsubst '${PGVERSION} ${PYTHON_VERSION}') > "$deb_dir/DEBIAN/prerm"
41+
(cat ${SCRIPT_DIR}/DEBIAN/postrm | envsubst '${PGVERSION} ${PYTHON_VERSION}') > "$deb_dir/DEBIAN/postrm"
3042

3143
if [[ "$ARCH" == "amd64" ]]; then
3244
cp ${SCRIPT_DIR}/../../pgml-extension/requirements.linux.txt "$deb_dir/etc/postgresml-python/requirements.txt"
3345
else
3446
cp ${SCRIPT_DIR}/../../pgml-extension/requirements.macos.txt "$deb_dir/etc/postgresml-python/requirements.txt"
3547
fi
3648

37-
virtualenv --python="python$PYTHON_VERSION" "$deb_dir/var/lib/postgresml-python/pgml-venv"
49+
virtualenv --python="python${PYTHON_VERSION}" "$deb_dir/var/lib/postgresml-python/pgml-venv"
3850
source "$deb_dir/var/lib/postgresml-python/pgml-venv/bin/activate"
3951

4052
python -m pip install -r "${deb_dir}/etc/postgresml-python/requirements.txt"
@@ -48,6 +60,6 @@ dpkg-deb \
4860
--root-owner-group \
4961
-z1 \
5062
--build "$deb_dir" \
51-
postgresml-python-${PACKAGE_VERSION}-ubuntu22.04-${ARCH}.deb
63+
"postgresml-python-${PACKAGE_VERSION}-ubuntu${UBUNTU_VERSION}-${ARCH}.deb"
5264

5365
rm -rf "$deb_dir"

‎packages/postgresml-python/release.sh

Copy file name to clipboardExpand all lines: packages/postgresml-python/release.sh
+47-24Lines changed: 47 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -4,41 +4,64 @@ set -e
44
SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
55
package_version="$1"
66

7-
if [[ $(arch) == "x86_64" ]]; then
8-
arch=amd64
9-
else
10-
arch=arm64
11-
fi
12-
137
if [[ -z "$package_version" ]]; then
14-
echo "postgresml-python package build and release script"
15-
echo "usage: $0 <package version, e.g. 2.10.0>"
16-
exit 1
8+
echo "postgresml-python package build and release script"
9+
echo "Usage: $0 <package version, e.g. 2.10.0>"
10+
exit 1
1711
fi
1812

13+
# Active LTS Ubuntu versions and their codenames
14+
declare -A ubuntu_versions=(
15+
["20.04"]="focal"
16+
["22.04"]="jammy"
17+
["24.04"]="noble"
18+
)
19+
20+
# Supported architectures
21+
declare -a architectures=("amd64" "arm64")
22+
23+
# Install deb-s3 if not present
1924
if ! which deb-s3; then
20-
curl -sLO https://github.com/deb-s3/deb-s3/releases/download/0.11.4/deb-s3-0.11.4.gem
21-
sudo gem install deb-s3-0.11.4.gem
22-
deb-s3
25+
curl -sLO https://github.com/deb-s3/deb-s3/releases/download/0.11.4/deb-s3-0.11.4.gem
26+
sudo gem install deb-s3-0.11.4.gem
27+
deb-s3
2328
fi
2429

30+
# Install Python dependencies
2531
sudo apt install python3-pip python3 python3-virtualenv -y
2632

2733
function package_name() {
28-
echo "postgresml-python-$package_version-ubuntu22.04-${arch}.deb"
34+
local ubuntu_version=$1
35+
local arch=$2
36+
echo "postgresml-python-${package_version}-ubuntu${ubuntu_version}-${arch}.deb"
2937
}
3038

31-
bash ${SCRIPT_DIR}/build.sh ${package_version}
39+
# Loop through Ubuntu versions
40+
for ubuntu_version in "${!ubuntu_versions[@]}"; do
41+
codename=${ubuntu_versions[$ubuntu_version]}
42+
echo "Building packages for Ubuntu ${ubuntu_version} (${codename})"
3243

33-
if [[ ! -f $(package_name ${pg}) ]]; then
34-
echo "File $(package_name ${pg}) doesn't exist"
35-
exit 1
36-
fi
44+
# Loop through architectures
45+
for arch in "${architectures[@]}"; do
46+
echo "Building for architecture: ${arch}"
47+
export ARCH=${arch}
48+
49+
# Build the Python package
50+
bash ${SCRIPT_DIR}/build.sh "$package_version" "$ubuntu_version"
51+
52+
if [[ ! -f $(package_name ${ubuntu_version} ${arch}) ]]; then
53+
echo "File $(package_name ${ubuntu_version} ${arch}) doesn't exist"
54+
exit 1
55+
fi
3756

38-
deb-s3 upload \
39-
--lock \
40-
--bucket apt.postgresml.org \
41-
$(package_name ${pg}) \
42-
--codename $(lsb_release -cs)
57+
# Upload to S3
58+
deb-s3 upload \
59+
--lock \
60+
--bucket apt.postgresml.org \
61+
$(package_name ${ubuntu_version} ${arch}) \
62+
--codename ${codename}
4363

44-
rm $(package_name ${pg})
64+
# Clean up the package file
65+
rm $(package_name ${ubuntu_version} ${arch})
66+
done
67+
done

‎packages/postgresml/build.sh

Copy file name to clipboardExpand all lines: packages/postgresml/build.sh
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ set -e
44
SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
55

66
export PACKAGE_VERSION=${1:-"2.10.0"}
7-
export PGVERSION=${2:-"14"}
7+
export PGVERSION=${2:-"17"}
88
export UBUNTU_VERSION=${3:-"24.04"}
99

1010
deb_dir="/tmp/postgresml/deb-build"

‎packages/postgresql-pgml/release.sh

Copy file name to clipboardExpand all lines: packages/postgresql-pgml/release.sh
+51-20Lines changed: 51 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,18 @@ if [[ -z "${1}" ]]; then
99
fi
1010

1111
export PACKAGE_VERSION=${1}
12-
if [[ $(arch) == "x86_64" ]]; then
13-
export ARCH=amd64
14-
else
15-
export ARCH=arm64
16-
fi
1712

13+
# Active LTS Ubuntu versions and their codenames
14+
declare -A ubuntu_versions=(
15+
["20.04"]="focal"
16+
["22.04"]="jammy"
17+
["24.04"]="noble"
18+
)
19+
20+
# Supported architectures
21+
declare -a architectures=("amd64" "arm64")
22+
23+
# Install deb-s3 if not present
1824
if ! which deb-s3; then
1925
curl -sLO https://github.com/deb-s3/deb-s3/releases/download/0.11.4/deb-s3-0.11.4.gem
2026
sudo gem install deb-s3-0.11.4.gem
@@ -24,25 +30,50 @@ fi
2430
extension_dir="${SCRIPT_DIR}/../../pgml-extension"
2531

2632
function package_name() {
27-
echo "postgresql-pgml-${1}_${PACKAGE_VERSION}-ubuntu22.04-${ARCH}.deb"
33+
local pg_version=$1
34+
local ubuntu_version=$2
35+
local arch=$3
36+
echo "postgresql-pgml-${pg_version}_${PACKAGE_VERSION}-ubuntu${ubuntu_version}-${arch}.deb"
2837
}
2938

30-
for pg in {12..16}; do
31-
release_dir="$extension_dir/target/release/pgml-pg${pg}"
39+
# Loop through Ubuntu versions
40+
for ubuntu_version in "${!ubuntu_versions[@]}"; do
41+
codename=${ubuntu_versions[$ubuntu_version]}
42+
echo "Building packages for Ubuntu ${ubuntu_version} (${codename})"
43+
44+
# Loop through architectures
45+
for arch in "${architectures[@]}"; do
46+
echo "Building for architecture: ${arch}"
47+
export ARCH=${arch}
48+
49+
# Loop through PostgreSQL versions
50+
for pg in {11..17}; do
51+
echo "Building PostgreSQL ${pg} package..."
52+
53+
release_dir="$extension_dir/target/release/pgml-pg${pg}"
54+
mkdir -p "$release_dir/DEBIAN"
3255

33-
mkdir -p "$release_dir/DEBIAN"
56+
export PGVERSION=${pg}
57+
# Update control file with Ubuntu version
58+
(cat ${SCRIPT_DIR}/DEBIAN/control |
59+
envsubst '${PGVERSION} ${PACKAGE_VERSION} ${ARCH}') > "$release_dir/DEBIAN/control"
3460

35-
export PGVERSION=${pg}
36-
(cat ${SCRIPT_DIR}/DEBIAN/control | envsubst '${PGVERSION} ${PACKAGE_VERSION} ${ARCH}') > "$release_dir/DEBIAN/control"
61+
# Build the package
62+
dpkg-deb \
63+
--root-owner-group \
64+
-z1 \
65+
--build "$release_dir" \
66+
$(package_name ${pg} ${ubuntu_version} ${arch})
3767

38-
dpkg-deb \
39-
--root-owner-group \
40-
-z1 \
41-
--build "$release_dir" \
42-
$(package_name ${pg})
68+
# Upload to S3
69+
deb-s3 upload \
70+
--lock \
71+
--bucket apt.postgresml.org \
72+
$(package_name ${pg} ${ubuntu_version} ${arch}) \
73+
--codename ${codename}
4374

44-
deb-s3 upload \
45-
--bucket apt.postgresml.org \
46-
$(package_name ${pg}) \
47-
--codename $(lsb_release -cs)
75+
# Clean up the package file
76+
rm $(package_name ${pg} ${ubuntu_version} ${arch})
77+
done
78+
done
4879
done

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.