Skip to content

Commit

Permalink
Cleanify ppa package source
Browse files Browse the repository at this point in the history
  • Loading branch information
lepapareil authored and hurl-bot committed Nov 9, 2024
1 parent 9f565f9 commit 64ef4e1
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 40 deletions.
71 changes: 35 additions & 36 deletions contrib/ppa/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,11 @@ gpg --import /tmp/myprivatekey.asc
## Export gpg key

```
mkdir -p /tmp/gpg
chmod 777 /tmp/gpg
gpg_keyid=$(gpg --list-keys | grep -E "^ " | tr -d ' ')
gpg --armor --export "${gpg_keyid}" > /tmp/mypublickey.asc
gpg --armor --export-secret-keys "${gpg_keyid}" > /tmp/myprivatekey.asc
gpg --armor --export "${gpg_keyid}" > /tmp/gpg/mypublickey.asc
gpg --armor --export-secret-keys "${gpg_keyid}" > /tmp/gpg/myprivatekey.asc
```
## Choose Hurl version and Ubuntu codename
Expand All @@ -47,23 +49,17 @@ echo -n "Ubuntu codename=" && read -r codename
## Run ubuntu container

```
docker run -it --rm --env gpg_keyid="${gpg_keyid}" --env hurl_version="${hurl_version}" --env codename="${codename}" --env date="$(date -u "+%a, %d %b %Y %H:%M:%S")" --volume "/tmp:/tmp" ubuntu:"${codename}" bash
docker run -it --rm --env gpg_keyid="${gpg_keyid}" --env hurl_version="${hurl_version}" --env codename="${codename}" --env date="$(date -u "+%a, %d %b %Y %H:%M:%S")" --volume "/tmp/gpg:/tmp" ubuntu:"${codename}" bash
```

## Install user prerequisites
## Install user prerequisites and build dependencies

```
export DEBIAN_FRONTEND=noninteractive
apt update
apt install -y gpg git curl wget vim xz-utils gettext moreutils
```

## Install build dependencies

```
apt install -y pkg-config gcc curl libxml2-dev libssl-dev devscripts debhelper
apt update && \
apt install -y gpg git curl wget vim xz-utils gettext moreutils && \
apt install -y pkg-config gcc curl libxml2-dev libssl-dev devscripts debhelper
```

Expand Down Expand Up @@ -121,15 +117,17 @@ done < <(find docs -type f | grep -Ev "manual/")
rust_version=$(grep '^rust-version' packages/hurl/Cargo.toml | cut -f2 -d'"')
for arch in x86_64 aarch64 ; do
package="rust-${rust_version}-${arch}-unknown-linux-gnu"
wget -O "${package}.tar.xz" "https://static.rust-lang.org/dist/${package}.tar.xz"
packagelight="${package}-light"
wget "https://static.rust-lang.org/dist/${package}.tar.xz"
xz -T0 -vd "${package}.tar.xz"
tar -xf "${package}.tar"
dirs_to_delete=$(find "${package}" -type d | cut --delimiter "/" --field 1,2 | grep "/" | grep -Ev "/cargo$|/llvm-bitcode-linker-preview$|/llvm-tools-preview$|/rust-std-${arch}-unknown-linux-gnu$|/rustc$" | sort -u | tr '\n' ' ')
dirs_to_delete=$(find "${package}" -type d | cut --delimiter "/" --field 1,2 | grep "/" | grep -Ev "/cargo$|/rust-std-${arch}-unknown-linux-gnu$|/rustc$" | sort -u | tr '\n' ' ')
rm -fr $dirs_to_delete
grep -E "^cargo$|^llvm-bitcode-linker-preview$|^llvm-tools-preview$|^rust-std-${arch}-unknown-linux-gnu$|^rustc$" "${package}/components" | sponge "${package}/components"
tar cf "${package}.tar" "${package}"
xz -T0 -9 -v "${package}.tar"
rm -fr "${package}"
grep -E "^cargo$|^rust-std-${arch}-unknown-linux-gnu$|^rustc$" "${package}/components" | sponge "${package}/components"
mv "${package}" "${packagelight}"
tar cf "${packagelight}.tar" "${packagelight}"
xz -T0 -9 -v "${packagelight}.tar"
rm -fr "${package}.tar" "${packagelight}"
done
```

Expand All @@ -138,8 +136,9 @@ done
```
arch=$(uname -m)
package="rust-${rust_version}-${arch}-unknown-linux-gnu"
tar xf "${package}".tar.xz
./"${package}"/install.sh --destdir=/tmp/rust --disable-ldconfig
packagelight="${package}-light"
tar xf "${packagelight}".tar.xz
./"${packagelight}"/install.sh --destdir=/tmp/rust --disable-ldconfig
export PATH="/tmp/rust/usr/local/bin:$PATH"
rustc --version
cargo --version
Expand All @@ -165,17 +164,11 @@ echo "{\"package\": \"${sum}\",\"files\": {}}" > debian/cargo-checksum.json
```

## Create debian/cargo_home/config
## Create debian/cargo_home/config and update .cargo/config

```
mkdir -p debian/cargo_home
cp Cargo.toml debian/cargo_home/config
```

## Create .cargo/config

```
{
cat .cargo/config.toml
echo
Expand Down Expand Up @@ -224,26 +217,32 @@ rm -fr hurl_"${hurl_version}"*
## Install and test Hurl from PPA

```shell
echo -n "hurl_version=" && read -r hurl_version
echo -n "Ubuntu codename=" && read -r codename
docker run -it --rm --env hurl_version="${hurl_version}" --env codename="${codename}" --volume "/tmp:/tmp" "ubuntu:${codename}" bash

```

```
export DEBIAN_FRONTEND=noninteractive
yes | unminimize
apt install -y git sudo man-db curl software-properties-common
# apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 1550DC447B95F03B
apt-add-repository -y ppa:lepapareil/hurl
apt install -y hurl
apt install -y git sudo man-db curl software-properties-common && \
apt-add-repository -y ppa:lepapareil/hurl && \
apt install -y hurl
```

```
hurl --version
hurlfmt --version
man hurl | head -1
man hurlfmt | head -1
git clone --depth 1 --branch "${hurl_version}" https://github.com/Orange-OpenSource/hurl.git /tmp/hurl-"${hurl_version}"
cd /tmp/hurl-"${hurl_version}"
./bin/install_prerequisites_ubuntu.sh
./bin/install_python3_venv.sh
./bin/test/test_prerequisites.sh
./bin/test/test_integ.sh
cd /tmp/hurl-"${hurl_version}" && \
./bin/install_prerequisites_ubuntu.sh && \
./bin/install_python3_venv.sh && \
./bin/test/test_prerequisites.sh && \
./bin/test/test_integ.sh
```
7 changes: 4 additions & 3 deletions contrib/ppa/debian/bin/prerequisites.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,13 @@ echo "## install rustc and cargo"
rust_version=$(grep '^rust-version' packages/hurl/Cargo.toml | cut -f2 -d'"')
arch=$(uname -m)
package="rust-${rust_version}-${arch}-unknown-linux-gnu"
packagelight="${package}-light"
echo "rust_version=${rust_version}"
echo "architecture=${arch}"
echo "package=${package}"
tar xf "${package}.tar.xz"
echo "packagelight=${packagelight}"
tar xf "${packagelight}.tar.xz"
mkdir -p /tmp/rust
./"${package}"/install.sh --verbose --destdir=/tmp/rust --disable-ldconfig
./"${packagelight}"/install.sh --verbose --destdir=/tmp/rust --disable-ldconfig
export PATH="/tmp/rust/usr/local/bin:$PATH"
which rustc
which cargo
Expand Down
2 changes: 1 addition & 1 deletion contrib/ppa/debian/changelog.template
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
hurl (${hurl_version}-0ubuntu+${codename}) ${codename}; urgency=medium

* New ${hurl_version} Release.
* New upstream release.

-- lepapareil <[email protected]> ${date} +0200

0 comments on commit 64ef4e1

Please sign in to comment.