Skip to content

Commit

Permalink
Add v3.0.2
Browse files Browse the repository at this point in the history
  • Loading branch information
ayufan committed Aug 27, 2023
1 parent d203cd9 commit 7da8692
Show file tree
Hide file tree
Showing 14 changed files with 427 additions and 7 deletions.
16 changes: 9 additions & 7 deletions scripts/strip-cargo.bash
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,15 @@ set -eo pipefail
for package in *; do
[[ ! -d "$package" ]] && continue

if [[ -f "$package/.cargo/config" ]]; then
git -C "$package" rm "$(realpath "$package/.cargo/config")" || rm -f ""$package/.cargo/config""
fi
while read cargo_config; do
echo -n > "$cargo_config"
git -C "$package" add "$(realpath "$cargo_config")"
done < <(find "$package" -wholename '*/.cargo/config')

while read cargo_config; do
echo -n > "$cargo_config"
git -C "$package" add "$(realpath "$cargo_config")"
done < <(find "$package" -wholename '*/debian/cargo_home/config')

while read debian_control; do
echo "Stripping '$debian_control'..."
Expand All @@ -26,10 +32,6 @@ for package in *; do
git -C "$package" add "$(realpath "$debian_control")" || true
done < <(find "$package" -wholename '*/debian/control')

while read cargo_config; do
git -C "$package" rm -f "$(realpath "$cargo_config")" || rm -f "$cargo_config"
done < <(find "$package" -wholename '*/debian/cargo_home/config')

if ! git -C "$package" diff --cached --exit-code --quiet; then
git -C "$package" diff --cached | cat
git -C "$package" commit -m "strip-cargo.bash"
Expand Down
100 changes: 100 additions & 0 deletions versions/v3.0.2/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
ARG ARCH=
FROM ${ARCH}debian:bookworm AS toolchain

RUN apt-get -y update && \
apt-get -y install \
build-essential git-core \
lintian pkg-config quilt patch cargo \
nodejs node-colors node-commander \
libudev-dev libapt-pkg-dev \
libacl1-dev libpam0g-dev libfuse3-dev \
libsystemd-dev uuid-dev libssl-dev \
libclang-dev libjson-perl libcurl4-openssl-dev \
dh-exec dh-nodejs wget

RUN wget https://static.rust-lang.org/rustup/rustup-init.sh && \
chmod +x rustup-init.sh && \
./rustup-init.sh -y --default-toolchain nightly

ENV RUSTUP_TOOLCHAIN=nightly

WORKDIR /src

RUN for tool in /root/.cargo/bin/*; do ln -vsf $tool /usr/bin/; done
RUN /usr/bin/rustc --version
RUN git config --global user.email "docker@compile.dev" && \
git config --global user.name "Docker Compile"

FROM toolchain as builder

# Clone all sources
ARG VERSION=master
ADD /versions/${VERSION}/ /patches/
RUN /patches/clone.bash

# Apply all patches
ADD /scripts/ /scripts/
RUN /scripts/apply-patches.bash /patches/server/*.patch
RUN /scripts/strip-cargo.bash
RUN /scripts/resolve-dependencies.bash

# A first required dep
RUN apt-get -y build-dep $PWD/pve-eslint
RUN cd pve-eslint/ && make dinstall

# A proxmox-perl-rs required deps
RUN apt-get -y build-dep $PWD/perlmod/perlmod $PWD/perlmod/perlmod-bin $PWD/perlmod/perlmod-macro
RUN cd perlmod/perlmod-bin && dpkg-buildpackage -us -uc -b && dpkg -i ../perlmod-bin*.deb

# A pve-common required deps
RUN apt-get -y build-dep $PWD/proxmox-perl-rs/pve-rs
RUN cd proxmox-perl-rs/pve-rs && make dinstall
RUN cd proxmox-perl-rs/common/pkg && make deb && dpkg -i *.deb
RUN apt-get -y build-dep $PWD/pve-common
RUN cd pve-common/ && ( make dinstall || apt-get -f -y install && make dinstall )

# Install dev dependencies of widget toolkit
RUN apt-get -y build-dep $PWD/proxmox-widget-toolkit
RUN cd proxmox-widget-toolkit/ && make deb && dpkg -i proxmox-widget-toolkit-dev*.deb

# Deps for all rest
RUN apt-get -y build-dep $PWD/proxmox-acme
RUN apt-get -y build-dep $PWD/proxmox-backup
RUN apt-get -y build-dep $PWD/proxmox-mini-journalreader
RUN apt-get -y build-dep $PWD/extjs
RUN apt-get -y build-dep $PWD/proxmox-i18n
RUN apt-get -y build-dep $PWD/pve-xtermjs
RUN apt-get -y build-dep $PWD/libjs-qrcodejs

# Compile ALL
RUN cd proxmox-backup/ && make deb
RUN cd extjs/ && make deb
RUN cd proxmox-i18n/ && make deb
RUN cd pve-xtermjs/ && make deb
RUN cd proxmox-mini-journalreader/ && make deb
RUN cd libjs-qrcodejs/ && make deb
RUN cd proxmox-acme/ && make deb

# Copy all debian packages
RUN mkdir -p /deb && \
find /src/ -name '*.deb' -exec cp -av {} /deb/ \;

#=================================

FROM ${ARCH}debian:bookworm
COPY --from=builder /deb/ /deb/

# Install all packages
RUN export DEBIAN_FRONTEND=noninteractive && \
apt-get -y update && \
apt install -y runit ssmtp /deb/*.deb

# Add default configs
ADD /pbs/ /etc/proxmox-backup-default/

VOLUME /etc/proxmox-backup
VOLUME /var/log/proxmox-backup
VOLUME /var/lib/proxmox-backup

ADD runit/ /runit/
CMD ["runsvdir", "/runit"]
50 changes: 50 additions & 0 deletions versions/v3.0.2/Dockerfile.client
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
ARG DOCKER_ARCH
FROM ${DOCKER_ARCH}/debian:bookworm AS builder

RUN apt-get -y update && \
apt-get -y install \
build-essential git-core \
lintian pkg-config quilt patch cargo \
nodejs node-colors node-commander \
libudev-dev libapt-pkg-dev \
libacl1-dev libpam0g-dev libfuse3-dev \
libsystemd-dev uuid-dev libssl-dev \
libclang-dev libjson-perl libcurl4-openssl-dev \
dh-exec wget

WORKDIR /src

RUN /usr/bin/rustc --version
RUN git config --global user.email "docker@compile.dev" && \
git config --global user.name "Docker Compile"

# Clone all sources
ARG VERSION=master
ADD /versions/${VERSION}/ /patches/
RUN /patches/clone.bash

# Install valid rust toolchain
ARG DOCKER_ARCH
RUN \
if [ "${DOCKER_ARCH}" != "arm32v7" ]; then \
wget https://static.rust-lang.org/rustup/rustup-init.sh && \
chmod +x rustup-init.sh && \
./rustup-init.sh -y --default-toolchain nightly && \
for tool in /root/.cargo/bin/*; do ln -vsf $tool /usr/bin/; done; \
fi

# Apply all patches
ADD /scripts/ /scripts/
RUN /scripts/apply-patches.bash /patches/server/*.patch /patches/client/*.patch /patches/client-${DOCKER_ARCH}/*.patch
RUN /scripts/strip-cargo.bash
RUN /scripts/experimental-cargo.bash
RUN /scripts/resolve-dependencies.bash

# Build
RUN \
. /root/.cargo/env; \
cargo build --manifest-path proxmox-backup/proxmox-backup-client/Cargo.toml --release && \
cargo build --manifest-path proxmox-backup/pxar-bin/Cargo.toml --release

# Bundle client
RUN /scripts/bundle-client.bash
56 changes: 56 additions & 0 deletions versions/v3.0.2/clone.bash
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
#!/bin/bash

set -eo pipefail

SCRIPT_DIR="$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )"

if [[ "$1" == "show-sha" ]]; then
VERSION="${2:-master}"
VERSION_DATE=""

tmp_dir=$(mktemp -d -t ci-XXXXXXXXXX)
cd "$tmp_dir/"
trap 'cd ; rm -rf $tmp_dir' EXIT

perform() {
git clone "git://git.proxmox.com/git/$1.git" 2>/dev/null
if [[ -z "$VERSION_TIMESTAMP" ]]; then
REVISION=$(git -C "$1" rev-parse "$VERSION")
VERSION_TIMESTAMP=$(git -C "$1" log -1 --format=%ct "$VERSION")
else
while read TIMESTAMP REVISION; do
if [[ $TIMESTAMP -le $VERSION_TIMESTAMP ]]; then
break
fi
done < <(git -C "$1" log --format="%ct %H")
fi

CHANGE_TIME=$(git -C "$1" log -1 --format="%cd" $REVISION)

echo "$1 $REVISION # $CHANGE_TIME"
}
else
if [[ -n "$1" ]]; then
cd "$1"
fi

perform() {
if [[ ! -d "$1" ]]; then
git clone "git://git.proxmox.com/git/$1.git"
else
git -C "$1" fetch
fi
git -C "$1" checkout "$2" -f
git -C "$1" clean -fdx
}
fi

if [[ ! -e "$SCRIPT_DIR/versions" ]]; then
echo "Missing 'versions' file."
exit 1
fi

while read REPO COMMIT_SHA REST; do
echo "$REPO $COMMIT_SHA..." 1>&2
perform "$REPO" "$COMMIT_SHA"
done < "$SCRIPT_DIR/versions"
17 changes: 17 additions & 0 deletions versions/v3.0.2/server/proxmox-backup~hide-shell.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
diff --git a/www/NavigationTree.js b/www/NavigationTree.js
index 576d05ab..7ba9955a 100644
--- a/www/NavigationTree.js
+++ b/www/NavigationTree.js
@@ -77,12 +77,6 @@ Ext.define('PBS.store.NavigationStore', {
expanded: true,
leaf: false,
children: [
- {
- text: gettext('Shell'),
- iconCls: 'fa fa-terminal',
- path: 'pbsXtermJsConsole',
- leaf: true,
- },
{
text: gettext('Storage / Disks'),
iconCls: 'fa fa-hdd-o',
61 changes: 61 additions & 0 deletions versions/v3.0.2/server/proxmox-backup~multi-arch.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
commit 1b425b8fd31147524f81c549ccbf0318a75f1c9e
Author: Kamil Trzciński <ayufan@ayufan.eu>
Date: Sat May 1 14:40:06 2021 +0200

Support local compile

diff --git a/debian/proxmox-backup-file-restore.install b/debian/proxmox-backup-file-restore.install
old mode 100644
new mode 100755
index d952836e..e6888c5f
--- a/debian/proxmox-backup-file-restore.install
+++ b/debian/proxmox-backup-file-restore.install
@@ -1,4 +1,5 @@
+#! /usr/bin/dh-exec
usr/bin/proxmox-file-restore
-usr/lib/x86_64-linux-gnu/proxmox-backup/file-restore/proxmox-restore-daemon
+usr/lib/${DEB_HOST_MULTIARCH}/proxmox-backup/file-restore/proxmox-restore-daemon
usr/share/man/man1/proxmox-file-restore.1
usr/share/zsh/vendor-completions/_proxmox-file-restore
diff --git a/debian/proxmox-backup-server.install b/debian/proxmox-backup-server.install
old mode 100644
new mode 100755
index cebf84a3..fa96f93e
--- a/debian/proxmox-backup-server.install
+++ b/debian/proxmox-backup-server.install
@@ -1,17 +1,18 @@
+#! /usr/bin/dh-exec
etc/pbs-enterprise.list /etc/apt/sources.list.d/
etc/proxmox-backup-banner.service /lib/systemd/system/
etc/proxmox-backup-daily-update.service /lib/systemd/system/
etc/proxmox-backup-daily-update.timer /lib/systemd/system/
etc/proxmox-backup-proxy.service /lib/systemd/system/
etc/proxmox-backup.service /lib/systemd/system/
usr/bin/pmt
usr/bin/pmtx
usr/bin/proxmox-tape
-usr/lib/x86_64-linux-gnu/proxmox-backup/proxmox-backup-api
-usr/lib/x86_64-linux-gnu/proxmox-backup/proxmox-backup-banner
-usr/lib/x86_64-linux-gnu/proxmox-backup/proxmox-backup-proxy
-usr/lib/x86_64-linux-gnu/proxmox-backup/proxmox-daily-update
-usr/lib/x86_64-linux-gnu/proxmox-backup/sg-tape-cmd
+usr/lib/${DEB_HOST_MULTIARCH}/proxmox-backup/proxmox-backup-api
+usr/lib/${DEB_HOST_MULTIARCH}/proxmox-backup/proxmox-backup-banner
+usr/lib/${DEB_HOST_MULTIARCH}/proxmox-backup/proxmox-backup-proxy
+usr/lib/${DEB_HOST_MULTIARCH}/proxmox-backup/proxmox-daily-update
+usr/lib/${DEB_HOST_MULTIARCH}/proxmox-backup/sg-tape-cmd
usr/sbin/pbs2to3
usr/sbin/proxmox-backup-debug
usr/sbin/proxmox-backup-manager
diff --git a/debian/rules b/debian/rules
index 4fc6de8f..fcbf7e93 100755
--- a/debian/rules
+++ b/debian/rules
@@ -2,6 +2,7 @@
# See debhelper(7) (uncomment to enable)
# output every command that modifies files on the build system.
DH_VERBOSE = 1
+DEB_HOST_MULTIARCH ?= $(shell dpkg-architecture -qDEB_HOST_MULTIARCH)

include /usr/share/dpkg/pkg-info.mk
include /usr/share/rustc/architecture.mk
19 changes: 19 additions & 0 deletions versions/v3.0.2/server/proxmox-backup~no-cargo.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
commit 1b425b8fd31147524f81c549ccbf0318a75f1c9e
Author: Kamil Trzciński <ayufan@ayufan.eu>
Date: Sat May 1 14:40:06 2021 +0200

Support local compile

diff --git a/debian/rules b/debian/rules
index 4fc6de8f..fcbf7e93 100755
--- a/debian/rules
+++ b/debian/rules
@@ -21,7 +22,7 @@ export DEB_CARGO_PACKAGE=proxmox-backup
override_dh_auto_configure:
@perl -ne 'if (/^version\s*=\s*"(\d+(?:\.\d+)+)"/) { my $$v_cargo = $$1; my $$v_deb = "$(DEB_VERSION_UPSTREAM)"; \
die "ERROR: d/changelog <-> Cargo.toml version mismatch: $$v_cargo != $$v_deb\n" if $$v_cargo ne $$v_deb; exit(0); }' Cargo.toml
- $(CARGO) prepare-debian $(CURDIR)/debian/cargo_registry --link-from-system
+ #$(CARGO) prepare-debian --help $(CURDIR)/debian/cargo_registry --link-from-system
dh_auto_configure

override_dh_auto_build:
13 changes: 13 additions & 0 deletions versions/v3.0.2/server/proxmox-mini-journalreader.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
diff --git a/src/Makefile b/src/Makefile
index ea8af24..d7f1351 100644
--- a/src/Makefile
+++ b/src/Makefile
@@ -2,7 +2,7 @@ PROGRAM=mini-journalreader
SOURCES=mini-journalreader.c

LIBS := libsystemd
-CFLAGS += -Werror -Wall -Wextra -Wl,-z,relro -g -O2 --std=gnu11
+CFLAGS += -Wall -Wextra -Wl,-z,relro -g -O2 --std=gnu11
CFLAGS += -fstack-protector-strong -D_FORTIFY_SOURCE=2
CFLAGS += $(shell pkg-config --cflags ${LIBS})
LFLAGS += $(shell pkg-config --libs ${LIBS})
11 changes: 11 additions & 0 deletions versions/v3.0.2/server/proxmox-perl-rs~no-cargo.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
diff --git a/pve-rs/debian/rules b/pve-rs/debian/rules
index bddb889..4e15f38 100755
--- a/pve-rs/debian/rules
+++ b/pve-rs/debian/rules
@@ -21,5 +21,5 @@ export DEB_CARGO_PACKAGE=pve-rs
override_dh_auto_configure:
@perl -ne 'if (/^version\s*=\s*"(\d+(?:\.\d+)+)"/) { my $$v_cargo = $$1; my $$v_deb = "$(DEB_VERSION_UPSTREAM)"; \
die "ERROR: d/changelog <-> Cargo.toml version mismatch: $$v_cargo != $$v_deb\n" if $$v_cargo ne $$v_deb; exit(0); }' Cargo.toml
- $(CARGO) prepare-debian $(CURDIR)/debian/cargo_registry --link-from-system
+ #$(CARGO) prepare-debian $(CURDIR)/debian/cargo_registry --link-from-system
dh_auto_configure
30 changes: 30 additions & 0 deletions versions/v3.0.2/server/proxmox~fix-result-ok.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
diff --git a/proxmox-router/src/cli/command.rs b/proxmox-router/src/cli/command.rs
index 906ec0c..2a396e2 100644
--- a/proxmox-router/src/cli/command.rs
+++ b/proxmox-router/src/cli/command.rs
@@ -2,6 +2,7 @@ use anyhow::*;
use serde_json::Value;
use std::cell::RefCell;
use std::sync::Arc;
+use std::result::Result::Ok;

use proxmox_schema::*;
use proxmox_schema::format::DocumentationFormat;
diff --git a/proxmox-sys/src/linux/procfs/mod.rs b/proxmox-sys/src/linux/procfs/mod.rs
index 5784e0e..e503b5f 100644
--- a/proxmox-sys/src/linux/procfs/mod.rs
+++ b/proxmox-sys/src/linux/procfs/mod.rs
@@ -1,3 +1,4 @@
+use std::result::Result::Ok;
use std::collections::HashSet;
use std::convert::TryFrom;
use std::fmt;
diff --git a/proxmox/src/sys/linux/tty.rs b/proxmox-sys/src/sys/linux/tty.rs
index 0b4a3c1..e7a7847 100644
--- a/proxmox-sys/src/linux/tty.rs
+++ b/proxmox-sys/src/linux/tty.rs
@@ -1,3 +1,4 @@
+use std::result::Result::Ok;
use std::io::{self, Read, Write};
use std::mem::MaybeUninit;
use std::os::unix::io::AsRawFd;
Loading

0 comments on commit 7da8692

Please sign in to comment.