Skip to content

Commit 9cbe395

Browse files
authored
Merge pull request #75 from TomasTomecek/git-0.20
Update git2 to 0.20 and update RPM packaging
2 parents 6b1509a + a994f77 commit 9cbe395

6 files changed

Lines changed: 27 additions & 39 deletions

File tree

.packit.yaml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,11 @@
22
downstream_package_name: rust-pretty-git-prompt
33
srpm_build_deps:
44
- cargo
5-
- rust
5+
- cargo-rpm-macros
66
actions:
77
create-archive:
8-
- cargo publish --dry-run --allow-dirty
8+
# didn't manage to make it work with --offline, cargo cannot find the packages/crates locally
9+
- cargo package --allow-dirty
910
- bash -c "ls -1 target/package/*.crate"
1011
jobs:
1112
- job: copr_build

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,6 @@ default-features = false
2222
features = ["std", "cargo"]
2323

2424
[dependencies.git2]
25-
version = "0.18"
25+
version = "0.20"
2626
default-features = false
2727
features = []

rust-pretty-git-prompt.spec

Lines changed: 21 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,64 +1,63 @@
1-
# Generated by rust2rpm
2-
%bcond_without check
1+
# Generated by rust2rpm 28
2+
# * tests can only be run inside the upstream git repository:
3+
# https://github.com/tomastomecek/pretty-git-prompt/issues/35
4+
%bcond check 0
35

46
%global crate pretty-git-prompt
57

6-
Name: rust-%{crate}
8+
Name: rust-pretty-git-prompt
79
Version: 0.2.2
810
Release: %autorelease
911
Summary: Your current git repository information inside a beautiful shell prompt
1012

1113
License: MIT
1214
URL: https://crates.io/crates/pretty-git-prompt
13-
Source0: %{crates_source}
15+
Source: %{crates_source}
1416

15-
ExclusiveArch: %{rust_arches}
17+
BuildRequires: cargo-rpm-macros >= 24
1618

17-
BuildRequires: rust-packaging >= 23
19+
%global _description %{expand:
20+
Your current git repository information inside a beautiful shell prompt.}
1821

19-
%description
20-
%{summary}.
22+
%description %{_description}
2123

2224
%package -n %{crate}
2325
Summary: %{summary}
26+
# (MIT OR Apache-2.0) AND BSD-3-Clause AND GPL-2.0-only WITH GCC-exception-2.0 AND MIT
2427
# MIT
25-
# MIT AND GPL-2.0-only WITH GCC-exception-2.0 AND BSD-3-Clause
2628
# MIT OR Apache-2.0
2729
# MIT OR Apache-2.0 OR Zlib
2830
# Zlib OR Apache-2.0 OR MIT
2931
License: MIT AND BSD-3-Clause AND GPL-2.0-only WITH GCC-exception-2.0 AND (MIT OR Apache-2.0) AND (MIT OR Apache-2.0 OR Zlib)
3032
# LICENSE.dependencies contains a full license breakdown
3133

32-
%description -n %{crate}
33-
%{summary}.
34+
%description -n %{crate} %{_description}
35+
36+
%files -n %{crate}
37+
%license LICENSE
38+
%license LICENSE.dependencies
39+
%doc README.md
40+
%{_bindir}/pretty-git-prompt
3441

3542
%prep
36-
%autosetup -n %{crate}-%{version_no_tilde} -p1
43+
%autosetup -n %{crate}-%{version} -p1
3744
%cargo_prep
3845

3946
%generate_buildrequires
4047
%cargo_generate_buildrequires
4148

4249
%build
4350
%cargo_build
44-
%cargo_license_summary
51+
%{cargo_license_summary}
4552
%{cargo_license} > LICENSE.dependencies
4653

4754
%install
4855
%cargo_install
4956

5057
%if %{with check}
5158
%check
52-
# https://github.com/tomastomecek/pretty-git-prompt/issues/35
53-
%cargo_test || :
59+
%cargo_test
5460
%endif
5561

56-
%files -n %{crate}
57-
%license LICENSE
58-
%license LICENSE.dependencies
59-
%doc README.md
60-
%doc files
61-
%{_bindir}/pretty-git-prompt
62-
6362
%changelog
6463
%autochangelog

src/backend.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ impl Backend {
106106
Backend{ repo: repo, debug: debug, cache: Cache::new() }
107107
}
108108

109-
fn get_head(&self) -> Option<Reference> {
109+
fn get_head(&self) -> Option<Reference<'_>> {
110110
match self.repo.head() {
111111
Ok(head) => Some(head),
112112
Err(e2) => {
@@ -317,7 +317,7 @@ impl Backend {
317317
}
318318
}
319319

320-
pub fn get_status(&self) -> Option<Statuses> {
320+
pub fn get_status(&self) -> Option<Statuses<'_>> {
321321
let mut so = StatusOptions::new();
322322
let mut opts = so.show(StatusShow::IndexAndWorkdir);
323323
opts.include_untracked(true);

src/conf.rs

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -297,15 +297,6 @@ pub fn create_default_config(path: &PathBuf) -> Result<String, io::Error> {
297297

298298
mod tests {
299299
// We'll use this git repo for testing
300-
use std::fs::{File,OpenOptions,remove_file};
301-
use std::io::{Write,Read};
302-
use std::path::{Path,PathBuf};
303-
use conf::{get_configuration,create_default_config,DEFAULT_CONF,Conf};
304-
use yaml_rust::{YamlLoader};
305-
use backend::Backend;
306-
use models::DisplayMaster;
307-
use git2::Repository;
308-
309300
#[test]
310301
#[should_panic(expected = "'version' is missing in config file.")]
311302
fn test_empty_config() {

src/constants.rs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,6 @@ pub fn get_default_config_path() -> PathBuf {
3838
}
3939

4040
mod tests {
41-
use std::ffi::OsStr;
42-
use constants::{get_default_config_path,DEFAULT_CONFIG_NAME};
43-
4441
#[test]
4542
fn test_default_config_path() {
4643
// FIXME: create test dir and remove it aftet testing

0 commit comments

Comments
 (0)