Re: [pve-devel] [PATCH xtermjs] termproxy: rewrite in rust
On July 7, 2020 8:36 am, Thomas Lamprecht wrote: > On 07.07.20 08:24, Fabian Grünbichler wrote: >> On July 7, 2020 6:42 am, Dietmar Maurer wrote: so we have a 'termproxy' crate+binary and a binary package with name 'pve-xtermjs' >>> >>> This is quite confusing ... >> >> well, it replaces a 'pve-xtermjs' binary package that ships a 'termproxy' >> binary (/CLIHandler). the alternative is to bump the old pve-xtermjs to >> become a transitional package depending on a new 'termproxy' >> (pve-termproxy? proxmox-termproxy?) package that ships the termproxy >> binary and breaks+replaces the old pve-xtermjs package.. > > the name is OK, IMO, it's just the same as before. The source package name > is the only thing confusing to me, but I told Dominik already that we can > do that like proxmox-backup, with our own control(.in) - but as we do not > really use source package names yet, that confusion is now a bit secondary > to me. yes, but we only do control.in in proxmox-backup because debcargo does not support multiple binary packages (yet) ;) if we can avoid it, I'd avoid it.. if we absolutely have to, we can also just keep the changelog as it is and sed the 'Source' line in the generated d/control file.. ___ pve-devel mailing list pve-devel@pve.proxmox.com https://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel
Re: [pve-devel] [PATCH xtermjs] termproxy: rewrite in rust
On 07.07.20 08:24, Fabian Grünbichler wrote: > On July 7, 2020 6:42 am, Dietmar Maurer wrote: >>> so we have a 'termproxy' crate+binary and a binary package with name >>> 'pve-xtermjs' >> >> This is quite confusing ... > > well, it replaces a 'pve-xtermjs' binary package that ships a 'termproxy' > binary (/CLIHandler). the alternative is to bump the old pve-xtermjs to > become a transitional package depending on a new 'termproxy' > (pve-termproxy? proxmox-termproxy?) package that ships the termproxy > binary and breaks+replaces the old pve-xtermjs package.. the name is OK, IMO, it's just the same as before. The source package name is the only thing confusing to me, but I told Dominik already that we can do that like proxmox-backup, with our own control(.in) - but as we do not really use source package names yet, that confusion is now a bit secondary to me. ___ pve-devel mailing list pve-devel@pve.proxmox.com https://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel
Re: [pve-devel] [PATCH xtermjs] termproxy: rewrite in rust
On July 7, 2020 6:42 am, Dietmar Maurer wrote: >> so we have a 'termproxy' crate+binary and a binary package with name >> 'pve-xtermjs' > > This is quite confusing ... well, it replaces a 'pve-xtermjs' binary package that ships a 'termproxy' binary (/CLIHandler). the alternative is to bump the old pve-xtermjs to become a transitional package depending on a new 'termproxy' (pve-termproxy? proxmox-termproxy?) package that ships the termproxy binary and breaks+replaces the old pve-xtermjs package.. ___ pve-devel mailing list pve-devel@pve.proxmox.com https://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel
Re: [pve-devel] [PATCH xtermjs] termproxy: rewrite in rust
> so we have a 'termproxy' crate+binary and a binary package with name > 'pve-xtermjs' This is quite confusing ... ___ pve-devel mailing list pve-devel@pve.proxmox.com https://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel
Re: [pve-devel] [PATCH xtermjs] termproxy: rewrite in rust
On 06.07.20 12:57, Dominik Csapak wrote: > termproxy is now completely written in rust (instead of perl) but > it is a drop-in replacement > > this contains all other necessary changes to the build-system > for it to successfully build > > Signed-off-by: Dominik Csapak > --- > > changelog needs to be adapted to have 'rust-termproxy' as src > package, since it seems that you cannot have a 'pve-xtermjs' package with > a 'pve-xtermjs' crate but the binary is named 'termproxy' > > so we have a 'termproxy' crate+binary and a binary package with name > 'pve-xtermjs' > > also the version in Cargo.toml needs then to be bumped to 4.7.0 > Looks good to me, single real issue I have with this is that lots of stuff gets pulled in to compile only to be thrown away during linking - most of tokio, hyper, ... Needing over 1.5 minutes build time for such a simple tool is not really acceptable, IMO. But as it's not often build I could live with that for now, if improving it is not easy/quick. @Wolfgang, can you please use your rust wizard-hat and eyes and take a closer look at the code? ___ pve-devel mailing list pve-devel@pve.proxmox.com https://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel
[pve-devel] [PATCH xtermjs] termproxy: rewrite in rust
termproxy is now completely written in rust (instead of perl) but it is a drop-in replacement this contains all other necessary changes to the build-system for it to successfully build Signed-off-by: Dominik Csapak --- changelog needs to be adapted to have 'rust-termproxy' as src package, since it seems that you cannot have a 'pve-xtermjs' package with a 'pve-xtermjs' crate but the binary is named 'termproxy' so we have a 'termproxy' crate+binary and a binary package with name 'pve-xtermjs' also the version in Cargo.toml needs then to be bumped to 4.7.0 .cargo/config | 5 + Cargo.toml | 14 ++ Makefile| 52 +++-- debian/compat | 1 - debian/control | 16 -- debian/debcargo.toml| 14 ++ debian/install | 1 + debian/rules| 7 +- debian/source/format| 1 - debian/source/lintian-overrides | 4 +- src/Makefile| 7 - src/PVE/CLI/Makefile| 8 - src/PVE/CLI/termproxy.pm| 250 - src/PVE/Makefile| 3 - src/bin/Makefile| 7 - src/bin/termproxy | 8 - src/main.rs | 378 src/www/Makefile| 21 -- 18 files changed, 458 insertions(+), 339 deletions(-) create mode 100644 .cargo/config create mode 100644 Cargo.toml delete mode 100644 debian/compat delete mode 100644 debian/control create mode 100644 debian/debcargo.toml create mode 100644 debian/install delete mode 100644 debian/source/format delete mode 100644 src/Makefile delete mode 100644 src/PVE/CLI/Makefile delete mode 100644 src/PVE/CLI/termproxy.pm delete mode 100644 src/PVE/Makefile delete mode 100644 src/bin/Makefile delete mode 100755 src/bin/termproxy create mode 100644 src/main.rs delete mode 100644 src/www/Makefile diff --git a/.cargo/config b/.cargo/config new file mode 100644 index 000..3b5b6e4 --- /dev/null +++ b/.cargo/config @@ -0,0 +1,5 @@ +[source] +[source.debian-packages] +directory = "/usr/share/cargo/registry" +[source.crates-io] +replace-with = "debian-packages" diff --git a/Cargo.toml b/Cargo.toml new file mode 100644 index 000..028ca23 --- /dev/null +++ b/Cargo.toml @@ -0,0 +1,14 @@ +[package] +name = "termproxy" +version = "4.3.0" +authors = ["Dominik Csapak "] +edition = "2018" +license = "AGPL-3" + +exclude = [ "build", "debian" ] + +[dependencies] +mio = "0.6" +curl = "0.4" +clap = "2.33" +proxmox = "0.1.42" diff --git a/Makefile b/Makefile index d4aeee4..7a73fe7 100644 --- a/Makefile +++ b/Makefile @@ -1,6 +1,8 @@ include /usr/share/dpkg/pkg-info.mk +include /usr/share/dpkg/architecture.mk PACKAGE=pve-xtermjs +CRATENAME=termproxy export VERSION=${DEB_VERSION_UPSTREAM_REVISION} @@ -11,31 +13,53 @@ FITADDONVER=0.4.0 FITADDONTGZ=xterm-addon-fit-${FITADDONVER}.tgz SRCDIR=src -BUILDDIR ?= ${PACKAGE}-${DEB_VERSION_UPSTREAM} GITVERSION:=$(shell git rev-parse HEAD) -DEB=${PACKAGE}_${VERSION}_all.deb -DSC=${PACKAGE}_${VERSION}.dsc +DEB=${PACKAGE}_${DEB_VERSION_UPSTREAM_REVISION}_${DEB_BUILD_ARCH}.deb +DSC=rust-${CRATENAME}_${DEB_VERSION_UPSTREAM_REVISION}.dsc -all: ${DEB} - @echo ${DEB} +ifeq ($(BUILD_MODE), release) +CARGO_BUILD_ARGS += --release +COMPILEDIR := target/release +else +COMPILEDIR := target/debug +endif + +all: cargo-build $(SRCIDR) + +.PHONY: $(SUBDIRS) +$(SUBDIRS): + make -C $@ + +.PHONY: cargo-build +cargo-build: + cargo build $(CARGO_BUILD_ARGS) -${BUILDDIR}: ${SRCDIR} debian - rm -rf ${BUILDDIR} - rsync -a ${SRCDIR}/ debian ${BUILDDIR} - echo "git clone git://git.proxmox.com/git/pve-xtermjs.git\\ngit checkout ${GITVERSION}" > ${BUILDDIR}/debian/SOURCE +.PHONY: build +build: + rm -rf build + debcargo package \ + --config debian/debcargo.toml \ + --changelog-ready \ + --no-overlay-write-back \ + --directory build \ + $(CRATENAME) \ + $(shell dpkg-parsechangelog -l debian/changelog -SVersion | sed -e 's/-.*//') + rm build/Cargo.lock + find build/debian -name "*.hint" -delete + echo "git clone git://git.proxmox.com/git/pve-xtermjs.git\\ngit checkout ${GITVERSION}" > build/debian/SOURCE .PHONY: deb deb: ${DEB} -${DEB}: ${BUILDDIR} - cd ${BUILDDIR}; dpkg-buildpackage -b -uc -us +$(DEB): build + cd build; dpkg-buildpackage -b -uc -us --no-pre-clean lintian ${DEB} @echo ${DEB} .PHONY: dsc dsc: ${DSC} -${DSC}: ${BUILDDIR} - cd ${BUILDDIR}; dpkg-buildpackage -S -us -uc -d +$(DSC): build + cd build; dpkg-buildpackage -S -us -uc -d -nc lintian ${DSC} X_EXCLUSIONS=--exclude=addons/attach --exclude=addons/fullscreen --exclude=addons/search \ @@ -59,7 +83,7 @@ distclean: clean .PHONY: clean clean: - rm -rf *~ debian/*~ ${PACKAGE}-*/ *.deb *.changes *.dsc *.tar.gz