Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Arch Linux 打包问题 #1

Open
taotieren opened this issue Jan 11, 2022 · 1 comment
Open

Arch Linux 打包问题 #1

taotieren opened this issue Jan 11, 2022 · 1 comment

Comments

@taotieren
Copy link

taotieren commented Jan 11, 2022

准备将 ssh-rs 打包到 AUR 仓库
编写了 PKGBUILD 如下

# Maintainer: taotieren <admin@taotieren.com>

pkgname=ssh-rs
pkgver=0.1.2
pkgrel=1
pkgdesc="In addition to encryption library, pure RUST implementation of SSH-2.0 client protocol"
arch=('any')
url="https://github.com/1148118271/ssh-rs"
license=('Apache-2.0')
provides=(${pkgname})
conflicts=(${pkgname} ${pkgname}-git)
#replaces=(${pkgname})
depends=('cargo')
makedepends=('make' 'git' 'cmake' 'gcc' 'rust')
backup=()
options=('!strip')
#install=${pkgname}.install
source=("${pkgname}-${pkgver}.tar.gz::https://ghproxy.com/${url}/archive/refs/tags/v${pkgver}.tar.gz")
sha256sums=('8559f1a5dab8c0a2740da562feec85f967fbb39aa2797e3c0590213b898e64e3')
build() {
# build crm
    cd "${srcdir}/${pkgname}-${pkgver}/"
    cargo build --frozen --release --all-features
}

check() {
    cd "${srcdir}/${pkgname}-${pkgver}/"
    cargo test  --frozen --release --all-features
}

package() {
    cd "${srcdir}/${pkgname}-${pkgver}/"
    export RUSTUP_TOOLCHAIN=stable
    cargo install --no-track --frozen --all-features --root "$pkgdir/usr/" --path .
}

本地编译日志如下:

➜  ssh-rs git:(master) makepkg -sf                                    
==> 正在创建软件包:ssh-rs 0.1.2-1 (Tue 11 Jan 2022 06:22:49 PM CST)
==> 正在检查运行时依赖关系...
==> 正在检查编译时依赖关系
==> 获取源代码...
  -> 找到 ssh-rs-0.1.2.tar.gz
==> 正在验证 source 文件,使用sha256sums...
    ssh-rs-0.1.2.tar.gz ... 通过
==> 正在释放源码...
  -> 正在解压缩 ssh-rs-0.1.2.tar.gz,使用 bsdtar
==> 正在删除现存的 $pkgdir/ 目录...
==> 正在开始 build()...
   Compiling cc v1.0.72
   Compiling libc v0.2.112
   Compiling getrandom v0.1.16
   Compiling pkg-config v0.3.24
   Compiling cfg-if v1.0.0
   Compiling autocfg v1.0.1
   Compiling ppv-lite86 v0.2.15
   Compiling once_cell v1.8.0
   Compiling foreign-types-shared v0.1.1
   Compiling openssl v0.10.38
   Compiling spin v0.5.2
   Compiling bitflags v1.3.2
   Compiling untrusted v0.7.1
   Compiling foreign-types v0.3.2
   Compiling openssl-src v111.17.0+1.1.1m
   Compiling openssl-sys v0.9.72
   Compiling ring v0.16.20
   Compiling rand_core v0.5.1
   Compiling rand_chacha v0.2.2
   Compiling rand v0.7.3
   Compiling ssh-rs v0.1.2 (/home/taotieren/git_clone/aur/ssh-rs/src/ssh-rs-0.1.2)
warning: use of deprecated associated function `std::error::Error::description`: use the Display impl or to_string()
   --> src/error.rs:110:45
    |
110 |             SshErrorKind::IoError(io) => io.description(),
    |                                             ^^^^^^^^^^^
    |
    = note: `#[warn(deprecated)]` on by default

warning: variable `crypt` is assigned to, but never used
  --> src/key_agreement.rs:25:17
   |
25 |         let mut crypt: String = String::new();
   |                 ^^^^^
   |
   = note: `#[warn(unused_variables)]` on by default
   = note: consider using `_crypt` instead

warning: value assigned to `crypt` is never read
  --> src/key_agreement.rs:49:29
   |
49 | ...                   crypt = String::from(a);
   |                       ^^^^^
   |
   = note: `#[warn(unused_assignments)]` on by default
   = help: maybe it is overwritten before being read?

warning: associated function is never used: `new`
  --> src/packet.rs:21:19
   |
21 |     pub(crate) fn new() -> Packet {
   |                   ^^^
   |
   = note: `#[warn(dead_code)]` on by default

warning: associated function is never used: `put_data`
  --> src/packet.rs:25:19
   |
25 |     pub(crate) fn put_data(&mut self, d: Data) {
   |                   ^^^^^^^^

warning: function is never used: `get_error`
   --> src/error.rs:143:4
    |
143 | fn get_error() -> Result<(), SshError> {
    |    ^^^^^^^^^

warning: `ssh-rs` (lib) generated 6 warnings
    Finished release [optimized] target(s) in 30.71s
==> 正在开始 check()...
warning: use of deprecated associated function `std::error::Error::description`: use the Display impl or to_string()
   --> src/error.rs:110:45
    |
110 |             SshErrorKind::IoError(io) => io.description(),
    |                                             ^^^^^^^^^^^
    |
    = note: `#[warn(deprecated)]` on by default

warning: variable `crypt` is assigned to, but never used
  --> src/key_agreement.rs:25:17
   |
25 |         let mut crypt: String = String::new();
   |                 ^^^^^
   |
   = note: `#[warn(unused_variables)]` on by default
   = note: consider using `_crypt` instead

warning: value assigned to `crypt` is never read
  --> src/key_agreement.rs:49:29
   |
49 | ...                   crypt = String::from(a);
   |                       ^^^^^
   |
   = note: `#[warn(unused_assignments)]` on by default
   = help: maybe it is overwritten before being read?

warning: associated function is never used: `new`
  --> src/packet.rs:21:19
   |
21 |     pub(crate) fn new() -> Packet {
   |                   ^^^
   |
   = note: `#[warn(dead_code)]` on by default

warning: associated function is never used: `put_data`
  --> src/packet.rs:25:19
   |
25 |     pub(crate) fn put_data(&mut self, d: Data) {
   |                   ^^^^^^^^

warning: function is never used: `get_error`
   --> src/error.rs:143:4
    |
143 | fn get_error() -> Result<(), SshError> {
    |    ^^^^^^^^^

   Compiling ssh-rs v0.1.2 (/home/taotieren/git_clone/aur/ssh-rs/src/ssh-rs-0.1.2)
warning: `ssh-rs` (lib) generated 6 warnings
warning: unused import: `std::sync::atomic::Ordering::Relaxed`
 --> src/tests.rs:7:9
  |
7 |     use std::sync::atomic::Ordering::Relaxed;
  |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  |
  = note: `#[warn(unused_imports)]` on by default

warning: unused import: `global_variable`
 --> src/tests.rs:9:17
  |
9 |     use crate::{global_variable, message, SSH, strings};
  |                 ^^^^^^^^^^^^^^^

error[E0599]: no method named `write` found for struct `Arc<Mutex<Client>>` in the current scope
  --> src/tests.rs:40:24
   |
40 |         channel.stream.write(packet.as_slice()).unwrap();
   |                        ^^^^^ method not found in `Arc<Mutex<Client>>`

error[E0599]: no method named `read` found for struct `Arc<Mutex<Client>>` in the current scope
  --> src/tests.rs:43:46
   |
43 |                 let results = channel.stream.read().unwrap();
   |                                              ^^^^ method not found in `Arc<Mutex<Client>>`

error[E0599]: no method named `write` found for struct `Arc<Mutex<Client>>` in the current scope
  --> src/tests.rs:73:24
   |
73 |         channel.stream.write(packet.as_slice()).unwrap();
   |                        ^^^^^ method not found in `Arc<Mutex<Client>>`

error[E0599]: no method named `read` found for struct `Arc<Mutex<Client>>` in the current scope
  --> src/tests.rs:76:46
   |
76 |                 let results = channel.stream.read().unwrap();
   |                                              ^^^^ method not found in `Arc<Mutex<Client>>`

error[E0599]: no method named `write` found for struct `Arc<Mutex<Client>>` in the current scope
   --> src/tests.rs:110:28
    |
110 |             channel.stream.write(packet.as_slice()).unwrap();
    |                            ^^^^^ method not found in `Arc<Mutex<Client>>`

error[E0599]: no method named `write` found for struct `Arc<Mutex<Client>>` in the current scope
   --> src/tests.rs:118:24
    |
118 |         channel.stream.write(packet.as_slice()).unwrap();
    |                        ^^^^^ method not found in `Arc<Mutex<Client>>`

warning: unused import: `Write`
 --> src/tests.rs:4:25
  |
4 |     use std::io::{Read, Write};
  |                         ^^^^^

For more information about this error, try `rustc --explain E0599`.
warning: `ssh-rs` (lib test) generated 4 warnings (1 duplicate)
error: could not compile `ssh-rs` due to 6 previous errors; 4 warnings emitted
==> 错误: 在 check() 中发生一个错误。
    正在放弃...
➜  ssh-rs git:(master)
@taotieren taotieren changed the title Arch Linux Arch Linux 打包问题 Jan 11, 2022
@1148118271
Copy link
Owner

您好, 这个问题是因为项目里面有个 src/tests.rs 的文件, 这个文件是我做scp测试用的,当时打包版本之前在本地测试的时候没发现有有影响,就没把这个文件删除,也没引入到 lib.rs 里面,如果您那边着急使用的话就先把下载到本地的项目里面的 tests.rs 文件删除一下, 我会在下次打包版本的时候把这个文件去掉,对您造成不便感觉十分抱歉,如果有其他问题,可以继续给我反馈一下。

1148118271 pushed a commit that referenced this issue Nov 15, 2022
HsuJv added a commit that referenced this issue Sep 11, 2023
* fix workflows

* bump aes to 0.8, fix workflows
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants