Start seriously screwing around with GBS.js
This commit is contained in:
parent
bcd8551e55
commit
6c678c73ce
36
Makefile
36
Makefile
|
@ -96,28 +96,17 @@ repkg: script # L=<lang> T=<type> : Build fresh .deb and install into live conta
|
||||||
$(MAKE_QUIETLY) shell I=packaging CMD="make pkg L=$(L) T=$(T)"
|
$(MAKE_QUIETLY) shell I=packaging CMD="make pkg L=$(L) T=$(T)"
|
||||||
ctr="$$(docker container ls -f label="riju-install-target=yes" -l -q)"; test "$${ctr}" || (echo "no valid container is live"; exit 1); docker exec "$${ctr}" make install L=$(L) T=$(T)
|
ctr="$$(docker container ls -f label="riju-install-target=yes" -l -q)"; test "$${ctr}" || (echo "no valid container is live"; exit 1); docker exec "$${ctr}" make install L=$(L) T=$(T)
|
||||||
|
|
||||||
## This is equivalent to 'make repkg T=lang', 'make repkg T=config'.
|
|
||||||
## For shared dependencies, use 'make repkg T=shared' directly.
|
|
||||||
|
|
||||||
repkgs: # L=<lang> : Build and install fresh lang and config .debs
|
|
||||||
@: $${L}
|
|
||||||
node tools/make-foreach.js --types repkg L=$(L)
|
|
||||||
|
|
||||||
### Build packaging scripts
|
### Build packaging scripts
|
||||||
|
|
||||||
script: # L=<lang> T=<type> : Generate a packaging script
|
script: # L=<lang> T=<type> : Generate a packaging script
|
||||||
@: $${L} $${T}
|
@: $${L} $${T}
|
||||||
mkdir -p $(BUILD)
|
mkdir -p $(BUILD)
|
||||||
node tools/generate-build-script.js --lang $(L) --type $(T) > $(BUILD)/build.bash
|
node tools/generate-build-script.js --lang $(L) --type $(T) > $(BUILD)/build.bash
|
||||||
|
ifeq ($(T),lang)
|
||||||
|
node tools/generate-build-script.js --lang $(L) --type install > $(BUILD)/install.bash
|
||||||
|
endif
|
||||||
chmod +x $(BUILD)/build.bash
|
chmod +x $(BUILD)/build.bash
|
||||||
|
|
||||||
scripts: # L=<lang> : Generate both lang and config packaging scripts
|
|
||||||
@: $${L}
|
|
||||||
node tools/make-foreach.js --types script L=$(L)
|
|
||||||
|
|
||||||
## This is equivalent to 'make script T=lang', 'make script T=config'.
|
|
||||||
## For shared dependencies, use 'make script T=shared' directly.
|
|
||||||
|
|
||||||
all-scripts: # Generate packaging scripts for all languages
|
all-scripts: # Generate packaging scripts for all languages
|
||||||
node tools/write-all-build-scripts.js
|
node tools/write-all-build-scripts.js
|
||||||
|
|
||||||
|
@ -146,20 +135,9 @@ pkg-deb: # L=<lang> T=<type> [Z=gzip|xz] : Build .deb from packaging environment
|
||||||
@: $${L} $${T}
|
@: $${L} $${T}
|
||||||
fakeroot dpkg-deb --build -Z$(Z) $(BUILD)/pkg $(BUILD)/$(DEB)
|
fakeroot dpkg-deb --build -Z$(Z) $(BUILD)/pkg $(BUILD)/$(DEB)
|
||||||
|
|
||||||
## This is equivalent to the sequence 'script', 'pkg-clean', 'pkg-build', 'pkg-deb'.
|
## This is equivalent to the sequence 'pkg-clean', 'pkg-build', 'pkg-deb'.
|
||||||
|
|
||||||
pkg: script pkg-clean pkg-build pkg-deb # L=<lang> T=<type> [Z=gzip|xz] : Build fresh .deb
|
pkg: pkg-clean pkg-build pkg-deb # L=<lang> T=<type> [Z=gzip|xz] : Build fresh .deb
|
||||||
|
|
||||||
## This is equivalent to 'make pkg T=lang', 'make pkg T=config'. For
|
|
||||||
## shared dependencies, use 'make pkg T=shared' directly.
|
|
||||||
#
|
|
||||||
## Z is the compression type to use; defaults to none. Higher
|
|
||||||
## compression levels (gzip is moderate, xz is high) take much longer
|
|
||||||
## but produce much smaller packages.
|
|
||||||
|
|
||||||
pkgs: # L=<lang> [Z=gzip|xz] : Build both lang and config .debs
|
|
||||||
@: $${L}
|
|
||||||
node tools/make-foreach.js --types pkg L=$(L)
|
|
||||||
|
|
||||||
### Install packages
|
### Install packages
|
||||||
|
|
||||||
|
@ -168,10 +146,6 @@ install: # L=<lang> T=<type> : Install built .deb
|
||||||
if [[ -z "$$(ls -A /var/lib/apt/lists)" ]]; then sudo apt update; fi
|
if [[ -z "$$(ls -A /var/lib/apt/lists)" ]]; then sudo apt update; fi
|
||||||
DEBIAN_FRONTEND=noninteractive sudo -E apt reinstall -y ./$(BUILD)/$(DEB)
|
DEBIAN_FRONTEND=noninteractive sudo -E apt reinstall -y ./$(BUILD)/$(DEB)
|
||||||
|
|
||||||
installs: # L=<lang> : Install both lang and config .debs
|
|
||||||
@: $${L}
|
|
||||||
node tools/make-foreach.js --types install L=$(L)
|
|
||||||
|
|
||||||
### Build and run application code
|
### Build and run application code
|
||||||
|
|
||||||
frontend: # Compile frontend assets for production
|
frontend: # Compile frontend assets for production
|
||||||
|
|
|
@ -11,99 +11,30 @@ pushd /tmp/riju-work
|
||||||
|
|
||||||
export DEBIAN_FRONTEND=noninteractive
|
export DEBIAN_FRONTEND=noninteractive
|
||||||
|
|
||||||
dpkg --add-architecture i386
|
|
||||||
|
|
||||||
apt-get update
|
apt-get update
|
||||||
|
apt-get dist-upgrade -y
|
||||||
(yes || true) | unminimize
|
(yes || true) | unminimize
|
||||||
|
|
||||||
apt-get install -y curl gnupg lsb-release wget
|
apt-get install -y curl gnupg lsb-release wget
|
||||||
|
|
||||||
# Ceylon
|
|
||||||
wget https://cacerts.digicert.com/DigiCertTLSRSASHA2562020CA1.crt.pem -O /usr/local/share/ca-certificates/DigiCertTLSRSASHA2562020CA1.crt
|
|
||||||
|
|
||||||
# D
|
|
||||||
wget https://letsencrypt.org/certs/lets-encrypt-r3.pem -O /usr/local/share/ca-certificates/lets-encrypt-r3.crt
|
|
||||||
|
|
||||||
update-ca-certificates
|
|
||||||
|
|
||||||
ubuntu_ver="$(lsb_release -rs)"
|
|
||||||
ubuntu_name="$(lsb_release -cs)"
|
ubuntu_name="$(lsb_release -cs)"
|
||||||
|
|
||||||
cran_repo="$(curl -fsSL https://cran.r-project.org/bin/linux/ubuntu/ | grep -Eo 'cran[0-9]+' | head -n1)"
|
|
||||||
node_repo="$(curl -fsSL https://deb.nodesource.com/setup_current.x | grep NODEREPO= | grep -Eo 'node_[0-9]+\.x' | head -n1)"
|
node_repo="$(curl -fsSL https://deb.nodesource.com/setup_current.x | grep NODEREPO= | grep -Eo 'node_[0-9]+\.x' | head -n1)"
|
||||||
|
|
||||||
# .NET
|
|
||||||
wget "https://packages.microsoft.com/config/ubuntu/${ubuntu_ver}/packages-microsoft-prod.deb"
|
|
||||||
apt-get install ./packages-microsoft-prod.deb
|
|
||||||
|
|
||||||
# Ceylon
|
|
||||||
curl -fsSL https://downloads.ceylon-lang.org/apt/ceylon-debian-repo.gpg.key | apt-key add -
|
|
||||||
|
|
||||||
# Crystal
|
|
||||||
curl -fsSL https://keybase.io/crystal/pgp_keys.asc | apt-key add -
|
|
||||||
|
|
||||||
# Dart
|
|
||||||
curl -fsSL https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add -
|
|
||||||
|
|
||||||
# Hack
|
|
||||||
apt-key adv --keyserver keyserver.ubuntu.com --recv-keys B4112585D386EB94
|
|
||||||
|
|
||||||
# MongoDB
|
|
||||||
curl -fsSL https://www.mongodb.org/static/pgp/server-4.4.asc | apt-key add -
|
|
||||||
|
|
||||||
# Node.js
|
# Node.js
|
||||||
curl -fsSL https://deb.nodesource.com/gpgkey/nodesource.gpg.key | apt-key add -
|
curl -fsSL https://deb.nodesource.com/gpgkey/nodesource.gpg.key | apt-key add -
|
||||||
|
|
||||||
# R
|
|
||||||
apt-key adv --keyserver keyserver.ubuntu.com --recv-keys E298A3A825C0D65DFD57CBB651716619E084DAB9
|
|
||||||
|
|
||||||
# Yarn
|
# Yarn
|
||||||
curl -fsSL https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add -
|
curl -fsSL https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add -
|
||||||
|
|
||||||
tee -a /etc/apt/sources.list.d/custom.list >/dev/null <<EOF
|
tee -a /etc/apt/sources.list.d/custom.list >/dev/null <<EOF
|
||||||
# Ceylon
|
|
||||||
deb [arch=amd64] https://downloads.ceylon-lang.org/apt/ unstable main
|
|
||||||
|
|
||||||
# Crystal
|
|
||||||
deb [arch=amd64] https://dist.crystal-lang.org/apt crystal main
|
|
||||||
|
|
||||||
# Dart
|
|
||||||
deb [arch=amd64] https://storage.googleapis.com/download.dartlang.org/linux/debian stable main
|
|
||||||
|
|
||||||
# Hack
|
|
||||||
deb [arch=amd64] https://dl.hhvm.com/ubuntu ${ubuntu_name} main
|
|
||||||
|
|
||||||
# MongoDB
|
|
||||||
deb [arch=amd64] https://repo.mongodb.org/apt/ubuntu focal/mongodb-org/4.4 multiverse
|
|
||||||
|
|
||||||
# Node.js
|
# Node.js
|
||||||
deb [arch=amd64] https://deb.nodesource.com/${node_repo} ${ubuntu_name} main
|
deb [arch=amd64] https://deb.nodesource.com/${node_repo} ${ubuntu_name} main
|
||||||
|
|
||||||
# R
|
|
||||||
deb [arch=amd64] https://cloud.r-project.org/bin/linux/ubuntu ${ubuntu_name}-${cran_repo}/
|
|
||||||
|
|
||||||
# Yarn
|
# Yarn
|
||||||
deb [arch=amd64] https://dl.yarnpkg.com/debian/ stable main
|
deb [arch=amd64] https://dl.yarnpkg.com/debian/ stable main
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
# Work around brutal packaging error courtesy of Microsoft.
|
|
||||||
# Unfortunately, the Microsoft repo includes a duplicate version of
|
|
||||||
# the libodbc1 package whose version is not in sync with the one
|
|
||||||
# shipped by the corresponding release of Ubuntu. If this one happens
|
|
||||||
# to be newer, then it can cause horrifyingly difficult to diagnose
|
|
||||||
# errors later on because there's a conflict between the
|
|
||||||
# default-available versions of libodbc1 and libodbc1:i386, which has
|
|
||||||
# in the past surfaced as an inability to install dependencies for
|
|
||||||
# Erlang. Thanks Microsoft. Please don't. Anyway, solution is to pin
|
|
||||||
# this repository at a lower priority than the Ubuntu standard
|
|
||||||
# packages, so the correct version of libodbc1 gets installed by
|
|
||||||
# default.
|
|
||||||
tee -a /etc/apt/preferences.d/riju >/dev/null <<EOF
|
|
||||||
Package: *
|
|
||||||
Pin: origin packages.microsoft.com
|
|
||||||
Pin-Priority: 1
|
|
||||||
EOF
|
|
||||||
|
|
||||||
apt-get update
|
apt-get update
|
||||||
apt-get install -y dctrl-tools
|
apt-get install -y dctrl-tools
|
||||||
|
|
||||||
|
|
|
@ -14,6 +14,7 @@ function riju-curl {
|
||||||
|
|
||||||
export DEBIAN_FRONTEND=noninteractive
|
export DEBIAN_FRONTEND=noninteractive
|
||||||
|
|
||||||
|
riju-curl "build/lang/${LANG}/install.bash" > "install-lang-${LANG}.bash"
|
||||||
riju-curl "build/lang/${LANG}/riju-lang-${LANG}.deb" > "riju-lang-${LANG}.deb"
|
riju-curl "build/lang/${LANG}/riju-lang-${LANG}.deb" > "riju-lang-${LANG}.deb"
|
||||||
|
|
||||||
(
|
(
|
||||||
|
@ -21,6 +22,7 @@ riju-curl "build/lang/${LANG}/riju-lang-${LANG}.deb" > "riju-lang-${LANG}.deb"
|
||||||
(grep -Eo 'riju-shared-[^, ]+' || true) |
|
(grep -Eo 'riju-shared-[^, ]+' || true) |
|
||||||
sed 's/riju-shared-//'
|
sed 's/riju-shared-//'
|
||||||
) | while read name; do
|
) | while read name; do
|
||||||
|
riju-curl "build/shared/${name}/install.bash" > "install-shared-${name}.bash"
|
||||||
riju-curl "build/shared/${name}/riju-shared-${name}.deb" > "riju-shared-${name}.deb"
|
riju-curl "build/shared/${name}/riju-shared-${name}.deb" > "riju-shared-${name}.deb"
|
||||||
done
|
done
|
||||||
|
|
||||||
|
@ -28,12 +30,19 @@ if dpkg-deb -f "riju-lang-${LANG}.deb" -f Depends | grep .; then
|
||||||
apt-get update
|
apt-get update
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if compgen -G "./install-shared-*.bash"; then
|
||||||
|
for file in ./install-shared-*.bash; do
|
||||||
|
"${file}"
|
||||||
|
done
|
||||||
|
fi
|
||||||
|
|
||||||
if compgen -G "./riju-shared-*.deb"; then
|
if compgen -G "./riju-shared-*.deb"; then
|
||||||
for file in ./riju-shared-*.deb; do
|
for file in ./riju-shared-*.deb; do
|
||||||
apt-get install -y "${file}"
|
apt-get install -y "${file}"
|
||||||
done
|
done
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
"./install-lang-${LANG}.bash"
|
||||||
apt-get install -y "./riju-lang-${LANG}.deb"
|
apt-get install -y "./riju-lang-${LANG}.deb"
|
||||||
|
|
||||||
popd
|
popd
|
||||||
|
|
|
@ -10,42 +10,24 @@ pushd /tmp/riju-work
|
||||||
|
|
||||||
export DEBIAN_FRONTEND=noninteractive
|
export DEBIAN_FRONTEND=noninteractive
|
||||||
|
|
||||||
dpkg --add-architecture i386
|
|
||||||
|
|
||||||
apt-get update
|
apt-get update
|
||||||
|
apt-get dist-upgrade -y
|
||||||
(yes || true) | unminimize
|
(yes || true) | unminimize
|
||||||
|
|
||||||
apt-get install -y curl gnupg lsb-release wget
|
apt-get install -y curl gnupg lsb-release wget
|
||||||
|
|
||||||
wget https://cacerts.digicert.com/DigiCertTLSRSASHA2562020CA1.crt.pem -O /usr/local/share/ca-certificates/DigiCertTLSRSASHA2562020CA1.crt
|
|
||||||
wget https://letsencrypt.org/certs/lets-encrypt-r3.pem -O /usr/local/share/ca-certificates/lets-encrypt-r3.crt
|
|
||||||
|
|
||||||
update-ca-certificates
|
|
||||||
|
|
||||||
ubuntu_ver="$(lsb_release -rs)"
|
|
||||||
ubuntu_name="$(lsb_release -cs)"
|
ubuntu_name="$(lsb_release -cs)"
|
||||||
|
|
||||||
node_repo="$(curl -sS https://deb.nodesource.com/setup_current.x | grep NODEREPO= | grep -Eo 'node_[0-9]+\.x' | head -n1)"
|
node_repo="$(curl -sS https://deb.nodesource.com/setup_current.x | grep NODEREPO= | grep -Eo 'node_[0-9]+\.x' | head -n1)"
|
||||||
|
|
||||||
wget "https://packages.microsoft.com/config/ubuntu/${ubuntu_ver}/packages-microsoft-prod.deb"
|
|
||||||
apt-get install ./packages-microsoft-prod.deb
|
|
||||||
|
|
||||||
curl -fsSL https://downloads.ceylon-lang.org/apt/ceylon-debian-repo.gpg.key | apt-key add -
|
|
||||||
curl -fsSL https://deb.nodesource.com/gpgkey/nodesource.gpg.key | apt-key add -
|
curl -fsSL https://deb.nodesource.com/gpgkey/nodesource.gpg.key | apt-key add -
|
||||||
curl -fsSL https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add -
|
curl -fsSL https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add -
|
||||||
|
|
||||||
tee -a /etc/apt/sources.list.d/custom.list >/dev/null <<EOF
|
tee -a /etc/apt/sources.list.d/custom.list >/dev/null <<EOF
|
||||||
deb [arch=amd64] https://downloads.ceylon-lang.org/apt/ unstable main
|
|
||||||
deb [arch=amd64] https://deb.nodesource.com/${node_repo} ${ubuntu_name} main
|
deb [arch=amd64] https://deb.nodesource.com/${node_repo} ${ubuntu_name} main
|
||||||
deb [arch=amd64] https://dl.yarnpkg.com/debian/ stable main
|
deb [arch=amd64] https://dl.yarnpkg.com/debian/ stable main
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
tee -a /etc/apt/preferences.d/riju >/dev/null <<EOF
|
|
||||||
Package: *
|
|
||||||
Pin: origin packages.microsoft.com
|
|
||||||
Pin-Priority: 1
|
|
||||||
EOF
|
|
||||||
|
|
||||||
packages="
|
packages="
|
||||||
|
|
||||||
# compilation tools
|
# compilation tools
|
||||||
|
|
|
@ -20,6 +20,14 @@ info:
|
||||||
usage: []
|
usage: []
|
||||||
|
|
||||||
install:
|
install:
|
||||||
|
prepare: &add-ceylon-repo
|
||||||
|
cert:
|
||||||
|
- "https://cacerts.digicert.com/DigiCertTLSRSASHA2562020CA1.crt.pem"
|
||||||
|
aptKey:
|
||||||
|
- "https://downloads.ceylon-lang.org/apt/ceylon-debian-repo.gpg.key"
|
||||||
|
aptRepo:
|
||||||
|
- "https://downloads.ceylon-lang.org/apt/ unstable main"
|
||||||
|
<<: *add-ceylon-repo
|
||||||
apt:
|
apt:
|
||||||
- $(grep-aptavail -F Package ceylon -s Package -n | sort -rV | head -n1)
|
- $(grep-aptavail -F Package ceylon -s Package -n | sort -rV | head -n1)
|
||||||
- openjdk-8-jdk-headless
|
- openjdk-8-jdk-headless
|
||||||
|
|
|
@ -20,6 +20,10 @@ info:
|
||||||
usage: []
|
usage: []
|
||||||
|
|
||||||
install:
|
install:
|
||||||
|
aptKey:
|
||||||
|
- "https://keybase.io/crystal/pgp_keys.asc"
|
||||||
|
aptRepo:
|
||||||
|
- "https://dist.crystal-lang.org/apt crystal main"
|
||||||
apt:
|
apt:
|
||||||
- crystal
|
- crystal
|
||||||
|
|
||||||
|
|
|
@ -4,11 +4,14 @@ aliases:
|
||||||
name: "D"
|
name: "D"
|
||||||
|
|
||||||
install:
|
install:
|
||||||
prepare:
|
prepare: &add-d-cert
|
||||||
|
cert:
|
||||||
|
- "https://letsencrypt.org/certs/lets-encrypt-r3.pem"
|
||||||
manual: |
|
manual: |
|
||||||
file="$(curl -fsSL https://dlang.org/download.html | grep -Eo '"https://[^"]+amd64.deb"' | grep -v pre-release | tr -d '"')"
|
file="$(curl -fsSL https://dlang.org/download.html | grep -Eo '"https://[^"]+amd64.deb"' | grep -v pre-release | tr -d '"')"
|
||||||
wget "${file}" -O dmd.deb
|
wget "${file}" -O dmd.deb
|
||||||
sudo apt-get install -y ./dmd.deb
|
sudo --preserve-env=DEBIAN_FRONTEND apt-get install -y ./dmd.deb
|
||||||
|
<<: *add-d-cert
|
||||||
manual: |
|
manual: |
|
||||||
install -d "${pkg}/usr/local/bin"
|
install -d "${pkg}/usr/local/bin"
|
||||||
dub fetch dfmt@~master
|
dub fetch dfmt@~master
|
||||||
|
|
|
@ -3,6 +3,10 @@ name: "Dart"
|
||||||
monacoLang: dart
|
monacoLang: dart
|
||||||
|
|
||||||
install:
|
install:
|
||||||
|
aptKey:
|
||||||
|
- "https://dl-ssl.google.com/linux/linux_signing_key.pub"
|
||||||
|
aptRepo:
|
||||||
|
- "https://storage.googleapis.com/download.dartlang.org/linux/debian stable main"
|
||||||
apt:
|
apt:
|
||||||
- dart
|
- dart
|
||||||
|
|
||||||
|
|
|
@ -6,6 +6,10 @@ aliases:
|
||||||
name: "Hack"
|
name: "Hack"
|
||||||
|
|
||||||
install:
|
install:
|
||||||
|
aptKey:
|
||||||
|
- "B4112585D386EB94"
|
||||||
|
aptRepo:
|
||||||
|
- "https://dl.hhvm.com/ubuntu ${ubuntu_name} main"
|
||||||
apt:
|
apt:
|
||||||
- hhvm
|
- hhvm
|
||||||
|
|
||||||
|
|
|
@ -2,17 +2,14 @@ id: "mongodb"
|
||||||
aliases:
|
aliases:
|
||||||
- "mongo"
|
- "mongo"
|
||||||
- "mongod"
|
- "mongod"
|
||||||
|
- "webscale"
|
||||||
name: "MongoDB"
|
name: "MongoDB"
|
||||||
|
|
||||||
install:
|
install:
|
||||||
prepare:
|
prepare:
|
||||||
|
aptRepo:
|
||||||
|
- "http://archive.ubuntu.com/ubuntu/ focal main universe"
|
||||||
manual: |
|
manual: |
|
||||||
sudo tee -a /etc/apt/sources.list.d/focal.list >/dev/null <<EOF
|
|
||||||
deb [arch=amd64] http://archive.ubuntu.com/ubuntu/ focal main universe
|
|
||||||
EOF
|
|
||||||
|
|
||||||
sudo apt-get update
|
|
||||||
|
|
||||||
for name in mongodb mongodb-clients mongodb-server mongodb-server-core; do
|
for name in mongodb mongodb-clients mongodb-server mongodb-server-core; do
|
||||||
apt-get download "${name}"
|
apt-get download "${name}"
|
||||||
mv "${name}"_*.deb "${name}.deb"
|
mv "${name}"_*.deb "${name}.deb"
|
||||||
|
|
|
@ -7,11 +7,14 @@ name: "Q#"
|
||||||
install:
|
install:
|
||||||
# Apparently, the Q# project template is hardcoded to use version
|
# Apparently, the Q# project template is hardcoded to use version
|
||||||
# 3.x of the .NET SDK. Not sure why.
|
# 3.x of the .NET SDK. Not sure why.
|
||||||
prepare:
|
prepare: &install-dotnet
|
||||||
|
preface: |
|
||||||
|
sudo --preserve-env=DEBIAN_FRONTEND apt-get update
|
||||||
|
wget "https://packages.microsoft.com/config/ubuntu/${ubuntu_ver}/packages-microsoft-prod.deb"
|
||||||
|
sudo --preserve-env=DEBIAN_FRONTEND apt-get install ./packages-microsoft-prod.deb
|
||||||
apt:
|
apt:
|
||||||
- $(grep-aptavail -wF Package "dotnet-sdk-3\.[0-9.]+" -s Package -n | sort -Vr | head -n1)
|
- $(grep-aptavail -wF Package "dotnet-sdk-3\.[0-9.]+" -s Package -n | sort -Vr | head -n1)
|
||||||
apt:
|
<<: *install-dotnet
|
||||||
- $(grep-aptavail -wF Package "dotnet-sdk-3\.[0-9.]+" -s Package -n | sort -Vr | head -n1)
|
|
||||||
# We should cache the .dotnet directory to avoid a .NET banner being
|
# We should cache the .dotnet directory to avoid a .NET banner being
|
||||||
# printed, and we should cache the main directory because there is a
|
# printed, and we should cache the main directory because there is a
|
||||||
# generated main.csproj file that is needed by .NET. Finally we
|
# generated main.csproj file that is needed by .NET. Finally we
|
||||||
|
|
|
@ -5,6 +5,10 @@ name: "R"
|
||||||
monacoLang: r
|
monacoLang: r
|
||||||
|
|
||||||
install:
|
install:
|
||||||
|
aptKey:
|
||||||
|
- "E298A3A825C0D65DFD57CBB651716619E084DAB9"
|
||||||
|
aptRepo:
|
||||||
|
- "https://cloud.r-project.org/bin/linux/ubuntu ${ubuntu_name}-$(curl -fsSL https://cran.r-project.org/bin/linux/ubuntu/ | grep -Eo 'cran[0-9]+' | head -n1)/"
|
||||||
apt:
|
apt:
|
||||||
- r-base
|
- r-base
|
||||||
|
|
||||||
|
|
33
lib/yaml.js
33
lib/yaml.js
|
@ -14,7 +14,9 @@ import YAML from "yaml";
|
||||||
// * we are using bash with 'set -euxo pipefail'
|
// * we are using bash with 'set -euxo pipefail'
|
||||||
|
|
||||||
async function readJSONSchemaFromDisk() {
|
async function readJSONSchemaFromDisk() {
|
||||||
return YAML.parse(await fs.readFile("tools/jsonschema.yaml", "utf-8"));
|
return YAML.parse(await fs.readFile("tools/jsonschema.yaml", "utf-8"), {
|
||||||
|
merge: true,
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
const jsonSchemaPromise = readJSONSchemaFromDisk();
|
const jsonSchemaPromise = readJSONSchemaFromDisk();
|
||||||
|
@ -38,8 +40,8 @@ export async function getSharedDeps() {
|
||||||
// Return a list of objects representing the packages to be built. See
|
// Return a list of objects representing the packages to be built. See
|
||||||
// the function implementation for the full list of keys.
|
// the function implementation for the full list of keys.
|
||||||
export async function getPackages() {
|
export async function getPackages() {
|
||||||
// The order (shared, lang, config) is important to get dependencies
|
// The order (shared, then lang) is important to get dependencies
|
||||||
// correct due to poor abstractions in plan-publish.js.
|
// correct when building artifacts.
|
||||||
const packages = [];
|
const packages = [];
|
||||||
for (const lang of await getSharedDeps()) {
|
for (const lang of await getSharedDeps()) {
|
||||||
const type = "shared";
|
const type = "shared";
|
||||||
|
@ -53,16 +55,15 @@ export async function getPackages() {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
for (const lang of await getLangs()) {
|
for (const lang of await getLangs()) {
|
||||||
for (const type of ["lang", "config"]) {
|
const type = "lang";
|
||||||
const name = `riju-${type}-${lang}`;
|
const name = `riju-${type}-${lang}`;
|
||||||
packages.push({
|
packages.push({
|
||||||
lang,
|
lang,
|
||||||
type,
|
type,
|
||||||
name,
|
name,
|
||||||
buildScriptPath: `build/${type}/${lang}/build.bash`,
|
buildScriptPath: `build/${type}/${lang}/build.bash`,
|
||||||
debPath: `build/${type}/${lang}/${name}.deb`,
|
debPath: `build/${type}/${lang}/${name}.deb`,
|
||||||
});
|
});
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return packages;
|
return packages;
|
||||||
}
|
}
|
||||||
|
@ -90,7 +91,8 @@ function fixupLangConfig(langConfig) {
|
||||||
// and return it as an object.
|
// and return it as an object.
|
||||||
export async function readLangConfig(lang) {
|
export async function readLangConfig(lang) {
|
||||||
const langConfig = YAML.parse(
|
const langConfig = YAML.parse(
|
||||||
await fs.readFile(`langs/${lang}.yaml`, "utf-8")
|
await fs.readFile(`langs/${lang}.yaml`, "utf-8"),
|
||||||
|
{ merge: true }
|
||||||
);
|
);
|
||||||
validateJSONSchema(langConfig, await jsonSchemaPromise, { throwAll: true });
|
validateJSONSchema(langConfig, await jsonSchemaPromise, { throwAll: true });
|
||||||
if (langConfig.id !== lang) {
|
if (langConfig.id !== lang) {
|
||||||
|
@ -105,7 +107,8 @@ export async function readLangConfig(lang) {
|
||||||
// string ID and return it as an object.
|
// string ID and return it as an object.
|
||||||
export async function readSharedDepConfig(lang) {
|
export async function readSharedDepConfig(lang) {
|
||||||
const langConfig = YAML.parse(
|
const langConfig = YAML.parse(
|
||||||
await fs.readFile(`shared/${lang}.yaml`, "utf-8")
|
await fs.readFile(`shared/${lang}.yaml`, "utf-8"),
|
||||||
|
{ merge: true }
|
||||||
);
|
);
|
||||||
if (langConfig.id !== lang) {
|
if (langConfig.id !== lang) {
|
||||||
throw new Error(
|
throw new Error(
|
||||||
|
|
|
@ -349,7 +349,6 @@ async function executeDepGraph({
|
||||||
yes,
|
yes,
|
||||||
targets,
|
targets,
|
||||||
}) {
|
}) {
|
||||||
await runCommand(`make all-scripts`);
|
|
||||||
const artifacts = {};
|
const artifacts = {};
|
||||||
for (const artifact of depgraph.artifacts) {
|
for (const artifact of depgraph.artifacts) {
|
||||||
for (const dep of artifact.dependencies) {
|
for (const dep of artifact.dependencies) {
|
||||||
|
|
|
@ -18,9 +18,11 @@ import { readLangConfig, readSharedDepConfig } from "../lib/yaml.js";
|
||||||
// package.
|
// package.
|
||||||
function makeLangScript(langConfig, isShared) {
|
function makeLangScript(langConfig, isShared) {
|
||||||
const { id, name, install } = langConfig;
|
const { id, name, install } = langConfig;
|
||||||
|
let prefaceParts = [];
|
||||||
let parts = [];
|
let parts = [];
|
||||||
let depends = [];
|
let depends = [];
|
||||||
const dependsCfg = (install && install.depends) || {};
|
const dependsCfg = (install && install.depends) || {};
|
||||||
|
let needsAptGetUpdate = false;
|
||||||
if (
|
if (
|
||||||
install &&
|
install &&
|
||||||
((install.prepare &&
|
((install.prepare &&
|
||||||
|
@ -30,8 +32,21 @@ function makeLangScript(langConfig, isShared) {
|
||||||
install.apt.filter((pkg) => pkg.includes("$")).length > 0))
|
install.apt.filter((pkg) => pkg.includes("$")).length > 0))
|
||||||
) {
|
) {
|
||||||
parts.push(`\
|
parts.push(`\
|
||||||
export DEBIAN_FRONTEND=noninteractive
|
export DEBIAN_FRONTEND=noninteractive`);
|
||||||
sudo --preserve-env=DEBIAN_FRONTEND apt-get update`);
|
if (
|
||||||
|
install.prepare &&
|
||||||
|
((install.prepare.manual &&
|
||||||
|
install.prepare.manual.includes("apt-get") &&
|
||||||
|
install.prepare.manual.includes(":i386")) ||
|
||||||
|
(install.prepare.apt &&
|
||||||
|
install.prepare.apt.filter((pkg) => pkg.includes(":i386")).length >
|
||||||
|
0))
|
||||||
|
) {
|
||||||
|
parts.push(`\
|
||||||
|
dpkg --add-architecture i386`);
|
||||||
|
}
|
||||||
|
parts.push(`\
|
||||||
|
sudo --preserve-env=DEBIAN_FRONTEND apt-get update`);
|
||||||
}
|
}
|
||||||
if (install) {
|
if (install) {
|
||||||
const {
|
const {
|
||||||
|
@ -49,23 +64,67 @@ sudo --preserve-env=DEBIAN_FRONTEND apt-get update`);
|
||||||
deb,
|
deb,
|
||||||
} = install;
|
} = install;
|
||||||
if (prepare) {
|
if (prepare) {
|
||||||
const { apt, npm, opam, manual } = prepare;
|
const {
|
||||||
|
preface,
|
||||||
|
cert,
|
||||||
|
aptKey,
|
||||||
|
aptRepo,
|
||||||
|
apt,
|
||||||
|
npm,
|
||||||
|
opam,
|
||||||
|
manual,
|
||||||
|
} = prepare;
|
||||||
|
if (preface) {
|
||||||
|
prefaceParts.push(preface);
|
||||||
|
}
|
||||||
|
if (cert && cert.length > 0) {
|
||||||
|
prefaceParts.push(
|
||||||
|
cert
|
||||||
|
.map(
|
||||||
|
(url, idx) =>
|
||||||
|
`sudo wget "${url}" -O /usr/local/share/ca-certificates/riju-${id}-${idx}.crt`
|
||||||
|
)
|
||||||
|
.join("\n")
|
||||||
|
);
|
||||||
|
prefaceParts.push(`sudo update-ca-certificates`);
|
||||||
|
}
|
||||||
|
if (aptKey && aptKey.length > 0) {
|
||||||
|
prefaceParts.push(
|
||||||
|
aptKey
|
||||||
|
.map((src) => {
|
||||||
|
if (src.startsWith("http://") || src.startsWith("https://")) {
|
||||||
|
return `curl -fsSL "${src}" | sudo apt-key add -`;
|
||||||
|
} else if (/^[0-9A-F]+$/.match(src)) {
|
||||||
|
return `sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys "${src}"`;
|
||||||
|
} else {
|
||||||
|
throw new Error(`unknown aptKey format: ${src}`);
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.join("\n")
|
||||||
|
);
|
||||||
|
}
|
||||||
|
if (aptRepo && aptRepo.length > 0) {
|
||||||
|
prefaceParts.push(`sudo tee -a /etc/apt/sources.list.d/custom.list >/dev/null <<EOF
|
||||||
|
${aptRepo.join("\n")}
|
||||||
|
EOF`);
|
||||||
|
}
|
||||||
if (apt && apt.length > 0) {
|
if (apt && apt.length > 0) {
|
||||||
parts.push(`\
|
needsAptGetUpdate = true;
|
||||||
|
prefaceParts.push(`\
|
||||||
sudo --preserve-env=DEBIAN_FRONTEND apt-get install -y ${apt.join(" ")}`);
|
sudo --preserve-env=DEBIAN_FRONTEND apt-get install -y ${apt.join(" ")}`);
|
||||||
}
|
}
|
||||||
if (npm && npm.length > 0) {
|
if (npm && npm.length > 0) {
|
||||||
parts.push(`\
|
prefaceParts.push(`\
|
||||||
sudo npm install -g ${npm.join(" ")}`);
|
sudo npm install -g ${npm.join(" ")}`);
|
||||||
}
|
}
|
||||||
if (opam && opam.length > 0) {
|
if (opam && opam.length > 0) {
|
||||||
parts.push(`\
|
prefaceParts.push(`\
|
||||||
sudo opam init -n --disable-sandboxing --root /opt/opam
|
sudo opam init -n --disable-sandboxing --root /opt/opam
|
||||||
sudo opam install "${opam.join(" ")}" -y --root /opt/opam
|
sudo opam install "${opam.join(" ")}" -y --root /opt/opam
|
||||||
sudo ln -s /opt/opam/default/bin/* /usr/local/bin/`);
|
sudo ln -s /opt/opam/default/bin/* /usr/local/bin/`);
|
||||||
}
|
}
|
||||||
if (manual) {
|
if (manual) {
|
||||||
parts.push(manual);
|
prefaceParts.push(manual);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (npm && npm.length > 0) {
|
if (npm && npm.length > 0) {
|
||||||
|
@ -215,6 +274,9 @@ chmod +x "${path}"`);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (manual) {
|
if (manual) {
|
||||||
|
if (manual.includes("apt-get")) {
|
||||||
|
needsAptGetUpdate = true;
|
||||||
|
}
|
||||||
parts.push(manual);
|
parts.push(manual);
|
||||||
}
|
}
|
||||||
if (deb) {
|
if (deb) {
|
||||||
|
@ -223,6 +285,9 @@ chmod +x "${path}"`);
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
if (apt) {
|
if (apt) {
|
||||||
|
if (apt.filter((pkg) => pkg.includes("$")).length > 0) {
|
||||||
|
needsAptGetUpdate = true;
|
||||||
|
}
|
||||||
depends = depends.concat(apt);
|
depends = depends.concat(apt);
|
||||||
}
|
}
|
||||||
if (dependsCfg.unpin) {
|
if (dependsCfg.unpin) {
|
||||||
|
@ -237,6 +302,13 @@ chmod +x "${path}"`);
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (needsAptGetUpdate) {
|
||||||
|
prefaceParts.unshift(`\
|
||||||
|
export DEBIAN_FRONTEND=noninteractive`);
|
||||||
|
prefaceParts.push(`\
|
||||||
|
sudo --preserve-env=DEBIAN_FRONTEND apt-get update`);
|
||||||
|
}
|
||||||
|
parts = prefaceParts.concat(parts);
|
||||||
parts.push(`depends=(${depends.map((dep) => `"${dep}"`).join(" ")})`);
|
parts.push(`depends=(${depends.map((dep) => `"${dep}"`).join(" ")})`);
|
||||||
let stripDependsFilter = "";
|
let stripDependsFilter = "";
|
||||||
const stripDepends = (dependsCfg.strip || []).concat(dependsCfg.unpin || []);
|
const stripDepends = (dependsCfg.strip || []).concat(dependsCfg.unpin || []);
|
||||||
|
@ -280,40 +352,6 @@ set -euxo pipefail`);
|
||||||
return parts.join("\n\n");
|
return parts.join("\n\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
// Given a language config object, return the text of a Bash script
|
|
||||||
// that will build the (unpacked) riju-config-foo Debian package into
|
|
||||||
// ${pkg} when run in an appropriate environment. This is a package
|
|
||||||
// that will install configuration files and/or small scripts that
|
|
||||||
// encode the language configuration so that Riju can operate on any
|
|
||||||
// installed languages without knowing their configuration in advance.
|
|
||||||
function makeConfigScript(langConfig) {
|
|
||||||
const { id, name } = langConfig;
|
|
||||||
let parts = [];
|
|
||||||
parts.push(`\
|
|
||||||
#!/usr/bin/env bash
|
|
||||||
|
|
||||||
set -euxo pipefail`);
|
|
||||||
let debianControlData = `\
|
|
||||||
Package: riju-config-${id}
|
|
||||||
Version: \$(date +%s%3N)
|
|
||||||
Architecture: all
|
|
||||||
Maintainer: Radon Rosborough <radon.neon@gmail.com>
|
|
||||||
Description: Riju configuration for the ${name} language
|
|
||||||
Depends: riju-lang-${id}
|
|
||||||
Riju-Script-Hash: \$(sha1sum "$0" | awk '{ print $1 }')`;
|
|
||||||
parts.push(`\
|
|
||||||
install -d "\${pkg}/DEBIAN"
|
|
||||||
cat <<EOF > "\${pkg}/DEBIAN/control"
|
|
||||||
${debianControlData}
|
|
||||||
EOF`);
|
|
||||||
parts.push(`\
|
|
||||||
install -d "\${pkg}/opt/riju/langs"
|
|
||||||
cat <<"EOF" > "\${pkg}/opt/riju/langs/${id}.json"
|
|
||||||
${JSON.stringify(langConfig, null, 2)}
|
|
||||||
EOF`);
|
|
||||||
return parts.join("\n\n");
|
|
||||||
}
|
|
||||||
|
|
||||||
// Given a language config object, return the text of a Bash script
|
// Given a language config object, return the text of a Bash script
|
||||||
// that will build the (unpacked) riju-shared-foo Debian package into
|
// that will build the (unpacked) riju-shared-foo Debian package into
|
||||||
// ${pkg} when run in an appropriate environment. This is a package
|
// ${pkg} when run in an appropriate environment. This is a package
|
||||||
|
@ -323,20 +361,66 @@ function makeSharedScript(langConfig) {
|
||||||
return makeLangScript(langConfig, true);
|
return makeLangScript(langConfig, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Given a language ID, return the text of a Bash script that will do
|
||||||
|
// any necessary setup before the language package is installed (along
|
||||||
|
// with its shared dependencies, if any).
|
||||||
|
function makeInstallScript(lang) {
|
||||||
|
let parts = [];
|
||||||
|
if (install) {
|
||||||
|
const { apt, cert, aptKey, aptRepo } = install;
|
||||||
|
if (apt && apt.filter((pkg) => pkg.includes(":i386")).length > 0) {
|
||||||
|
parts.push(`\
|
||||||
|
dpkg --add-architecture i386`);
|
||||||
|
}
|
||||||
|
if (cert && cert.length > 0) {
|
||||||
|
parts.push(
|
||||||
|
cert
|
||||||
|
.map(
|
||||||
|
(url, idx) =>
|
||||||
|
`sudo wget "${url}" -O /usr/local/share/ca-certificates/riju-${id}-${idx}.crt`
|
||||||
|
)
|
||||||
|
.join("\n")
|
||||||
|
);
|
||||||
|
parts.push(`sudo update-ca-certificates`);
|
||||||
|
}
|
||||||
|
if (aptKey && aptKey.length > 0) {
|
||||||
|
parts.push(
|
||||||
|
aptKey
|
||||||
|
.map((src) => {
|
||||||
|
if (src.startsWith("http://") || src.startsWith("https://")) {
|
||||||
|
return `curl -fsSL "${src}" | sudo apt-key add -`;
|
||||||
|
} else if (/^[0-9A-F]+$/.match(src)) {
|
||||||
|
return `sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys "${src}"`;
|
||||||
|
} else {
|
||||||
|
throw new Error(`unknown aptKey format: ${src}`);
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.join("\n")
|
||||||
|
);
|
||||||
|
}
|
||||||
|
if (aptRepo && aptRepo.length > 0) {
|
||||||
|
parts.push(`sudo tee -a /etc/apt/sources.list.d/custom.list >/dev/null <<EOF
|
||||||
|
${aptRepo.join("\n")}
|
||||||
|
EOF`);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
parts.unshift(`\
|
||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
set -euxo pipefail`);
|
||||||
|
return parts.join("\n\n");
|
||||||
|
}
|
||||||
|
|
||||||
export async function generateBuildScript({ lang, type }) {
|
export async function generateBuildScript({ lang, type }) {
|
||||||
const scriptMaker = {
|
const scriptMaker = {
|
||||||
lang: makeLangScript,
|
lang: async () => makeLangScript(await readLangConfig(lang)),
|
||||||
config: makeConfigScript,
|
shared: async () => makeSharedScript(await readSharedDepConfig(lang)),
|
||||||
shared: makeSharedScript,
|
install: async () => await makeInstallScript(lang),
|
||||||
}[type];
|
}[type];
|
||||||
if (!scriptMaker) {
|
if (!scriptMaker) {
|
||||||
throw new Error(`unsupported script type ${type}`);
|
throw new Error(`unsupported script type ${type}`);
|
||||||
}
|
}
|
||||||
return scriptMaker(
|
return scriptMaker();
|
||||||
type === "shared"
|
|
||||||
? await readSharedDepConfig(lang)
|
|
||||||
: await readLangConfig(lang)
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Parse command-line arguments, run main functionality, and exit.
|
// Parse command-line arguments, run main functionality, and exit.
|
||||||
|
@ -346,7 +430,7 @@ async function main() {
|
||||||
.requiredOption("--lang <id>", "language ID")
|
.requiredOption("--lang <id>", "language ID")
|
||||||
.requiredOption(
|
.requiredOption(
|
||||||
"--type <value>",
|
"--type <value>",
|
||||||
"package category (lang, config, shared)"
|
"package category (lang, shared, install)"
|
||||||
);
|
);
|
||||||
program.parse(process.argv);
|
program.parse(process.argv);
|
||||||
console.log(await generateBuildScript(program.opts()));
|
console.log(await generateBuildScript(program.opts()));
|
||||||
|
|
|
@ -511,6 +511,31 @@ properties:
|
||||||
type: object
|
type: object
|
||||||
additionalProperties: false
|
additionalProperties: false
|
||||||
properties:
|
properties:
|
||||||
|
preface: &preface
|
||||||
|
type: string
|
||||||
|
minLength: 1
|
||||||
|
cert: &cert
|
||||||
|
type: array
|
||||||
|
items:
|
||||||
|
type: string
|
||||||
|
pattern: "^https?://"
|
||||||
|
examples:
|
||||||
|
- "https://cacerts.digicert.com/DigiCertTLSRSASHA2562020CA1.crt.pem"
|
||||||
|
aptKey: &aptKey
|
||||||
|
type: array
|
||||||
|
items:
|
||||||
|
type: string
|
||||||
|
pattern: "^https?://|^[0-9A-F]+$"
|
||||||
|
examples:
|
||||||
|
- "https://downloads.ceylon-lang.org/apt/ceylon-debian-repo.gpg.key"
|
||||||
|
- "B4112585D386EB94"
|
||||||
|
aptRepo: &aptRepo
|
||||||
|
type: array
|
||||||
|
items:
|
||||||
|
type: string
|
||||||
|
pattern: "^https?://"
|
||||||
|
examples:
|
||||||
|
- "https://downloads.ceylon-lang.org/apt/ unstable main"
|
||||||
apt:
|
apt:
|
||||||
type: array
|
type: array
|
||||||
items:
|
items:
|
||||||
|
@ -529,6 +554,10 @@ properties:
|
||||||
manual:
|
manual:
|
||||||
type: string
|
type: string
|
||||||
minLength: 1
|
minLength: 1
|
||||||
|
preface: *preface
|
||||||
|
cert: *cert
|
||||||
|
aptKey: *aptKey
|
||||||
|
aptRepo: *aptRepo
|
||||||
apt:
|
apt:
|
||||||
type: array
|
type: array
|
||||||
items:
|
items:
|
||||||
|
|
|
@ -20,11 +20,6 @@ async function main() {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case "--types":
|
|
||||||
for (const type of ["lang", "config"]) {
|
|
||||||
await runCommand(`MAKELEVEL= make ${targets.join(" ")} T=${type}`);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
default:
|
default:
|
||||||
console.error(`make-foreach.js: unknown selector: ${selector}`);
|
console.error(`make-foreach.js: unknown selector: ${selector}`);
|
||||||
process.exit(1);
|
process.exit(1);
|
||||||
|
|
Loading…
Reference in New Issue