undo rust workspace change in preparation for .dsc builds

The library ending up a level above the actual code just
makes .dsc/sbuild building very inconvenient, and pve-rs and
pmg-rs often grow independently from one another.

All we need is the common code available.

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
This commit is contained in:
Wolfgang Bumiller 2023-05-17 09:03:49 +02:00
parent b56f09dbaa
commit 34a0068618
4 changed files with 60 additions and 135 deletions

View File

@ -1,45 +0,0 @@
[workspace]
exclude = [ "build", "common-src", "perl", "scripts" ]
members = [
"pve-rs",
"pmg-rs",
]
[workspace.package]
authors = ["Proxmox Support Team <support@proxmox.com>"]
edition = "2021"
license = "AGPL-3"
repository = "https://git.proxmox.com/?p=proxmox.git"
[workspace.dependencies]
anyhow = "1.0"
base32 = "0.4"
base64 = "0.13"
env_logger = "0.9"
hex = "0.4"
http = "0.2.7"
libc = "0.2"
nix = "0.26"
openssl = "0.10.40"
serde = "1.0"
serde_bytes = "0.11"
serde_json = "1.0"
url = "2"
perlmod = { version = "0.13", features = [ "exporter" ] }
proxmox-acme-rs = { version = "0.4", features = ["client"] }
proxmox-apt = "0.9"
proxmox-http = { version = "0.8", features = ["client-sync", "client-trait"] }
proxmox-openid = "0.9.8"
proxmox-resource-scheduling = "0.2.1"
proxmox-subscription = "0.3"
proxmox-sys = "0.4.2"
proxmox-tfa = { version = "4", features = ["api"] }
proxmox-time = "1.1.3"
[patch.crates-io]
# proxmox-tfa requires -time and -uuid as well, so enable *all* or *none* of them
#proxmox-tfa = { path = "../proxmox/proxmox-tfa" }
#proxmox-time = { path = "../proxmox/proxmox-time" }
#proxmox-uuid = { path = "../proxmox/proxmox-uuid" }

View File

@ -2,19 +2,9 @@ CARGO ?= cargo
ifeq ($(BUILD_MODE), release) ifeq ($(BUILD_MODE), release)
CARGO_BUILD_ARGS += --release CARGO_BUILD_ARGS += --release
DEBUG_LIBPATH :=
else else
DEBUG_LIBPATH := "-L./target/debug",
endif endif
define upload_template
cd build; \
dcmd --deb lib$(1)-rs-perl*.changes \
| grep -v '.changes$$' \
| tar -cf "$@.tar" -T-; \
cat "$@.tar" | ssh -X repoman@repo.proxmox.com upload --product $(2) --dist bullseye
endef
.PHONY: all .PHONY: all
all: all:
ifeq ($(BUILD_TARGET), pve) ifeq ($(BUILD_TARGET), pve)
@ -27,10 +17,6 @@ else
@echo " - make pmg" @echo " - make pmg"
endif endif
.PHONY: pve pmg
pve pmg:
$(CARGO) build $(CARGO_BUILD_ARGS) -p $@-rs
build: build:
rm -rf build rm -rf build
mkdir build mkdir build
@ -47,30 +33,13 @@ build:
done done
# So the common packages end up in ./build, rather than ./build/common # So the common packages end up in ./build, rather than ./build/common
mv ./build/common/pkg ./build/common-pkg mv ./build/common/pkg ./build/common-pkg
# Copy the workspace root into the sources
pve-deb: build mkdir build/pve-rs/.workspace
cd ./build/pve-rs && dpkg-buildpackage -b -uc -us cp -t build/pve-rs/.workspace Cargo.toml
touch $@ sed -i -e '/\[package\]/a\workspace = ".workspace"' build/pve-rs/Cargo.toml
# Clear the member array and replace it with ".."
pmg-deb: build sed -i -e '/^members = \[/,/^]$$/d' build/pve-rs/.workspace/Cargo.toml
cd ./build/pmg-rs && dpkg-buildpackage -b -uc -us sed -i -e '/^\[workspace\]/a\members = [ ".." ]' build/pve-rs/.workspace/Cargo.toml
touch $@ # Copy the cargo config
mkdir build/pve-rs/.cargo
common-deb: build cp -t build/pve-rs/.cargo .cargo/config
cd ./build/common-pkg && dpkg-buildpackage -b -uc -us
touch $@
pve-upload: pve-deb
$(call upload_template,pve,pve)
pmg-upload: pmg-deb
$(call upload_template,pmg,pmg)
# need to put into variable to ensure comma isn't interpreted as param separator on call
common_target=pve,pmg
common-upload: common-deb
$(call upload_template,proxmox,$(common_target))
.PHONY: clean
clean:
cargo clean
rm -rf ./build ./PVE ./PMG ./pve-deb ./pmg-deb ./common-deb

View File

@ -2,10 +2,11 @@
name = "pmg-rs" name = "pmg-rs"
version = "0.6.2" version = "0.6.2"
description = "PMG parts which have been ported to rust" description = "PMG parts which have been ported to rust"
authors.workspace = true homepage = "https://www.proxmox.com"
edition.workspace = true authors = ["Proxmox Support Team <support@proxmox.com>"]
license.workspace = true edition = "2021"
repository.workspace = true license = "AGPL-3"
repository = "https://git.proxmox.com/?p=proxmox.git"
exclude = [ exclude = [
"build", "build",
@ -17,24 +18,24 @@ exclude = [
crate-type = [ "cdylib" ] crate-type = [ "cdylib" ]
[dependencies] [dependencies]
anyhow.workspace = true anyhow = "1.0"
env_logger.workspace = true env_logger = "0.9"
hex.workspace = true hex = "0.4"
http.workspace = true http = "0.2.7"
libc.workspace = true libc = "0.2"
nix.workspace = true nix = "0.26"
openssl.workspace = true openssl = "0.10.40"
serde.workspace = true serde = "1.0"
serde_bytes.workspace = true serde_bytes = "0.11"
serde_json.workspace = true serde_json = "1.0"
url.workspace = true url = "2"
perlmod.workspace = true perlmod = { version = "0.13", features = [ "exporter" ] }
proxmox-acme-rs.workspace = true proxmox-acme-rs = { version = "0.4", features = ["client"] }
proxmox-apt.workspace = true proxmox-apt = "0.9"
proxmox-http.workspace = true proxmox-http = { version = "0.8", features = ["client-sync", "client-trait"] }
proxmox-subscription.workspace = true proxmox-subscription = "0.3"
proxmox-sys.workspace = true proxmox-sys = "0.4.2"
proxmox-tfa.workspace = true proxmox-tfa = { version = "4", features = ["api"] }
proxmox-time.workspace = true proxmox-time = "1.1.3"

View File

@ -3,10 +3,10 @@ name = "pve-rs"
version = "0.7.6" version = "0.7.6"
description = "PVE parts which have been ported to Rust" description = "PVE parts which have been ported to Rust"
homepage = "https://www.proxmox.com" homepage = "https://www.proxmox.com"
authors.workspace = true authors = ["Proxmox Support Team <support@proxmox.com>"]
edition.workspace = true edition = "2021"
license.workspace = true license = "AGPL-3"
repository.workspace = true repository = "https://git.proxmox.com/?p=proxmox.git"
exclude = [ exclude = [
"debian", "debian",
@ -16,27 +16,27 @@ exclude = [
crate-type = [ "cdylib" ] crate-type = [ "cdylib" ]
[dependencies] [dependencies]
anyhow.workspace = true anyhow = "1.0"
base32.workspace = true base32 = "0.4"
base64.workspace = true base64 = "0.13"
env_logger.workspace = true env_logger = "0.9"
hex.workspace = true hex = "0.4"
http.workspace = true http = "0.2.7"
libc.workspace = true libc = "0.2"
nix.workspace = true nix = "0.26"
openssl.workspace = true openssl = "0.10.40"
serde.workspace = true serde = "1.0"
serde_bytes.workspace = true serde_bytes = "0.11"
serde_json.workspace = true serde_json = "1.0"
url.workspace = true url = "2"
perlmod.workspace = true perlmod = { version = "0.13", features = [ "exporter" ] }
proxmox-apt.workspace = true proxmox-apt = "0.9"
proxmox-http.workspace = true proxmox-http = { version = "0.8", features = ["client-sync", "client-trait"] }
proxmox-openid.workspace = true proxmox-openid = "0.9.8"
proxmox-resource-scheduling.workspace = true proxmox-resource-scheduling = "0.3.0"
proxmox-subscription.workspace = true proxmox-subscription = "0.3"
proxmox-sys.workspace = true proxmox-sys = "0.4.2"
proxmox-tfa.workspace = true proxmox-tfa = { version = "4", features = ["api"] }
proxmox-time.workspace = true proxmox-time = "1.1.3"