packaging cleanup

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
This commit is contained in:
Fabian Grünbichler 2020-02-28 11:58:09 +01:00
parent 0fff9ce39f
commit abd7fe2d82
7 changed files with 28 additions and 43 deletions

1
debian/compat vendored
View File

@ -1 +0,0 @@
12

View File

@ -4,8 +4,6 @@ crate_src_path = ".."
[source]
maintainer = "Proxmox Support Team <support@proxmox.com>"
section = "admin"
build_depends = [ "debhelper (>= 12~)" ]
build_depends_excludes = [ "debhelper (>=11)" ]
homepage = "http://www.proxmox.com"
# TODO:
vcs_git = ""

29
debian/rules vendored
View File

@ -1,29 +0,0 @@
#!/usr/bin/make -f
# See debhelper(7) (uncomment to enable)
# output every command that modifies files on the build system.
DH_VERBOSE = 1
include /usr/share/dpkg/pkg-info.mk
include /usr/share/rustc/architecture.mk
export BUILD_MODE=release
CARGO=/usr/share/cargo/bin/cargo
export CFLAGS CXXFLAGS CPPFLAGS LDFLAGS
export DEB_HOST_RUST_TYPE DEB_HOST_GNU_TYPE
export CARGO_HOME = $(CURDIR)/debian/cargo_home
export DEB_CARGO_CRATE=pmg-log-tracker$(DEB_VERSION_UPSTREAM)
export DEB_CARGO_PACKAGE=pmg-log-tracker
%:
dh $@
override_dh_auto_configure:
$(CARGO) prepare-debian $(CURDIR)/debian/cargo_registry --link-from-system
dh_auto_configure
override_dh_missing:
dh_missing --fail-missing

View File

@ -1 +0,0 @@
3.0 (quilt)

View File

@ -1,11 +1,12 @@
use std::fs::File;
use std::io::BufReader;
use std::process::Command;
mod utils;
#[test]
fn after_queue_start_end_time_string() {
let output = Command::new("./target/debug/pmg-log-tracker")
let output = Command::new(utils::log_tracker_path())
.arg("-vv")
.arg("-s")
.arg("2020-12-18 15:40:00")
@ -26,7 +27,7 @@ fn after_queue_start_end_time_string() {
#[test]
fn after_queue_start_end_timestamp() {
let output = Command::new("./target/debug/pmg-log-tracker")
let output = Command::new(utils::log_tracker_path())
.arg("-vv")
.arg("-s")
.arg("1608302400")
@ -47,7 +48,7 @@ fn after_queue_start_end_timestamp() {
#[test]
fn after_queue_qid() {
let output = Command::new("./target/debug/pmg-log-tracker")
let output = Command::new(utils::log_tracker_path())
.arg("-vv")
.arg("-s")
.arg("1608302400")
@ -70,7 +71,7 @@ fn after_queue_qid() {
#[test]
fn after_queue_host() {
let output = Command::new("./target/debug/pmg-log-tracker")
let output = Command::new(utils::log_tracker_path())
.arg("-vv")
.arg("-s")
.arg("1608302400")
@ -93,7 +94,7 @@ fn after_queue_host() {
#[test]
fn after_queue_search_string() {
let output = Command::new("./target/debug/pmg-log-tracker")
let output = Command::new(utils::log_tracker_path())
.arg("-vv")
.arg("-s")
.arg("1608302400")

View File

@ -5,7 +5,7 @@ mod utils;
#[test]
fn before_queue_start_end_time_string() {
let output = Command::new("./target/debug/pmg-log-tracker")
let output = Command::new(utils::log_tracker_path())
.arg("-vv")
.arg("-s")
.arg("2020-12-18 15:00:00")
@ -26,7 +26,7 @@ fn before_queue_start_end_time_string() {
#[test]
fn before_queue_start_end_timestamp() {
let output = Command::new("./target/debug/pmg-log-tracker")
let output = Command::new(utils::log_tracker_path())
.arg("-vv")
.arg("-s")
.arg("1608300000")
@ -47,7 +47,7 @@ fn before_queue_start_end_timestamp() {
#[test]
fn before_queue_qid() {
let output = Command::new("./target/debug/pmg-log-tracker")
let output = Command::new(utils::log_tracker_path())
.arg("-vv")
.arg("-s")
.arg("1608300000")
@ -70,7 +70,7 @@ fn before_queue_qid() {
#[test]
fn before_queue_host() {
let output = Command::new("./target/debug/pmg-log-tracker")
let output = Command::new(utils::log_tracker_path())
.arg("-vv")
.arg("-s")
.arg("1608300000")
@ -93,7 +93,7 @@ fn before_queue_host() {
#[test]
fn before_queue_search_string() {
let output = Command::new("./target/debug/pmg-log-tracker")
let output = Command::new(utils::log_tracker_path())
.arg("-vv")
.arg("-s")
.arg("1608300000")

View File

@ -1,5 +1,22 @@
use std::io::BufRead;
use std::env;
use std::path::PathBuf;
fn get_target_dir() -> PathBuf {
let bin = env::current_exe().expect("exe path");
let mut target_dir = PathBuf::from(bin.parent().expect("bin parent"));
target_dir.pop();
target_dir
}
pub fn log_tracker_path() -> String {
let mut target_dir = get_target_dir();
target_dir.push("pmg-log-tracker");
target_dir.to_str().unwrap().to_string()
}
pub fn compare_output<R: BufRead, R2: BufRead>(command: R, expected: R2) {
let expected_lines: Vec<String> = expected.lines().map(|l| l.unwrap()).collect();
let command_lines: Vec<String> = command.lines().map(|l| l.unwrap()).collect();