diff -Nru rust-filetime-0.2.8/Cargo.toml rust-filetime-0.2.9/Cargo.toml --- rust-filetime-0.2.8/Cargo.toml 1970-01-01 00:00:00.000000000 +0000 +++ rust-filetime-0.2.9/Cargo.toml 2020-04-01 13:53:52.000000000 +0000 @@ -13,7 +13,7 @@ [package] edition = "2018" name = "filetime" -version = "0.2.8" +version = "0.2.9" authors = ["Alex Crichton "] description = "Platform-agnostic accessors of timestamps in File metadata\n" homepage = "https://github.com/alexcrichton/filetime" diff -Nru rust-filetime-0.2.8/Cargo.toml.orig rust-filetime-0.2.9/Cargo.toml.orig --- rust-filetime-0.2.8/Cargo.toml.orig 2019-11-11 14:43:11.000000000 +0000 +++ rust-filetime-0.2.9/Cargo.toml.orig 2020-04-01 13:53:37.000000000 +0000 @@ -1,7 +1,7 @@ [package] name = "filetime" authors = ["Alex Crichton "] -version = "0.2.8" +version = "0.2.9" license = "MIT/Apache-2.0" readme = "README.md" keywords = ["timestamp", "mtime"] diff -Nru rust-filetime-0.2.8/.cargo_vcs_info.json rust-filetime-0.2.9/.cargo_vcs_info.json --- rust-filetime-0.2.8/.cargo_vcs_info.json 1970-01-01 00:00:00.000000000 +0000 +++ rust-filetime-0.2.9/.cargo_vcs_info.json 2020-04-01 13:53:52.000000000 +0000 @@ -1,5 +1,5 @@ { "git": { - "sha1": "0951c8664edce7435a6ec91724b627fd8946948c" + "sha1": "0aa333346862949332ef5200ece85d6325170080" } } diff -Nru rust-filetime-0.2.8/debian/cargo-checksum.json rust-filetime-0.2.9/debian/cargo-checksum.json --- rust-filetime-0.2.8/debian/cargo-checksum.json 2019-11-16 09:53:16.000000000 +0000 +++ rust-filetime-0.2.9/debian/cargo-checksum.json 2020-05-04 08:39:24.000000000 +0000 @@ -1 +1 @@ -{"package":"1ff6d4dab0aa0c8e6346d46052e93b13a16cf847b54ed357087c35011048cc7d","files":{}} +{"package":"f59efc38004c988e4201d11d263b8171f49a2e7ec0bdbb71773433f271504a5e","files":{}} diff -Nru rust-filetime-0.2.8/debian/changelog rust-filetime-0.2.9/debian/changelog --- rust-filetime-0.2.8/debian/changelog 2019-11-16 09:53:16.000000000 +0000 +++ rust-filetime-0.2.9/debian/changelog 2020-05-04 08:39:24.000000000 +0000 @@ -1,3 +1,9 @@ +rust-filetime (0.2.9-1) unstable; urgency=medium + + * Package filetime 0.2.9 from crates.io using debcargo 2.4.3 + + -- Wolfgang Silbermayr Mon, 04 May 2020 10:39:24 +0200 + rust-filetime (0.2.8-1) unstable; urgency=medium * Package filetime 0.2.8 from crates.io using debcargo 2.4.0 diff -Nru rust-filetime-0.2.8/debian/control rust-filetime-0.2.9/debian/control --- rust-filetime-0.2.8/debian/control 2019-11-16 09:53:16.000000000 +0000 +++ rust-filetime-0.2.9/debian/control 2020-05-04 08:39:24.000000000 +0000 @@ -17,7 +17,7 @@ Uploaders: Ximin Luo , Wolfgang Silbermayr -Standards-Version: 4.2.0 +Standards-Version: 4.4.1 Vcs-Git: https://salsa.debian.org/rust-team/debcargo-conf.git [src/filetime] Vcs-Browser: https://salsa.debian.org/rust-team/debcargo-conf/tree/master/src/filetime Homepage: https://github.com/alexcrichton/filetime @@ -40,8 +40,8 @@ librust-filetime-0+default-dev (= ${binary:Version}), librust-filetime-0.2-dev (= ${binary:Version}), librust-filetime-0.2+default-dev (= ${binary:Version}), - librust-filetime-0.2.8-dev (= ${binary:Version}), - librust-filetime-0.2.8+default-dev (= ${binary:Version}) + librust-filetime-0.2.9-dev (= ${binary:Version}), + librust-filetime-0.2.9+default-dev (= ${binary:Version}) Description: Platform-agnostic accessors of timestamps in File metadata - Rust source code This package contains the source for the Rust filetime crate, packaged by debcargo for use with cargo and dh-cargo. diff -Nru rust-filetime-0.2.8/debian/copyright rust-filetime-0.2.9/debian/copyright --- rust-filetime-0.2.8/debian/copyright 2019-11-16 09:53:16.000000000 +0000 +++ rust-filetime-0.2.9/debian/copyright 2020-05-04 08:39:24.000000000 +0000 @@ -4,14 +4,14 @@ Source: https://github.com/alexcrichton/filetime Files: * -Copyright: 2014-2019 Alex Crichton +Copyright: 2014-2020 Alex Crichton License: MIT or Apache-2.0 Files: debian/* Copyright: - 2018-2019 Debian Rust Maintainers + 2018-2020 Debian Rust Maintainers 2018-2019 Ximin Luo - 2018-2019 Wolfgang Silbermayr + 2018-2020 Wolfgang Silbermayr License: MIT or Apache-2.0 License: Apache-2.0 diff -Nru rust-filetime-0.2.8/debian/copyright.debcargo.hint rust-filetime-0.2.9/debian/copyright.debcargo.hint --- rust-filetime-0.2.8/debian/copyright.debcargo.hint 2019-11-16 09:53:16.000000000 +0000 +++ rust-filetime-0.2.9/debian/copyright.debcargo.hint 2020-05-04 08:39:24.000000000 +0000 @@ -21,9 +21,9 @@ Files: debian/* Copyright: - 2018-2019 Debian Rust Maintainers - 2018-2019 Ximin Luo - 2018-2019 Wolfgang Silbermayr + 2018-2020 Debian Rust Maintainers + 2018-2020 Ximin Luo + 2018-2020 Wolfgang Silbermayr License: MIT or Apache-2.0 License: Apache-2.0 diff -Nru rust-filetime-0.2.8/debian/tests/control rust-filetime-0.2.9/debian/tests/control --- rust-filetime-0.2.8/debian/tests/control 2019-11-16 09:53:16.000000000 +0000 +++ rust-filetime-0.2.9/debian/tests/control 2020-05-04 08:39:24.000000000 +0000 @@ -1,7 +1,9 @@ -Test-Command: /usr/share/cargo/bin/cargo-auto-test filetime 0.2.8 --all-targets --all-features +Test-Command: /usr/share/cargo/bin/cargo-auto-test filetime 0.2.9 --all-targets --all-features +Features: test-name=@ Depends: dh-cargo (>= 18), librust-tempfile-3+default-dev, @ Restrictions: allow-stderr, skip-not-installable -Test-Command: /usr/share/cargo/bin/cargo-auto-test filetime 0.2.8 --all-targets --no-default-features -Depends: dh-cargo (>= 18), librust-tempfile-3+default-dev, librust-filetime-dev +Test-Command: /usr/share/cargo/bin/cargo-auto-test filetime 0.2.9 --all-targets --no-default-features +Features: test-name=librust-filetime-dev +Depends: dh-cargo (>= 18), librust-tempfile-3+default-dev, @ Restrictions: allow-stderr, skip-not-installable diff -Nru rust-filetime-0.2.8/debian/watch rust-filetime-0.2.9/debian/watch --- rust-filetime-0.2.8/debian/watch 2019-11-16 09:53:16.000000000 +0000 +++ rust-filetime-0.2.9/debian/watch 2020-05-04 08:39:24.000000000 +0000 @@ -2,4 +2,3 @@ opts=filenamemangle=s/.*\/(.*)\/download/filetime-$1\.tar\.gz/g,\ uversionmangle=s/(\d)[_\.\-\+]?((RC|rc|pre|dev|beta|alpha)\d*)$/$1~$2/ \ https://qa.debian.org/cgi-bin/fakeupstream.cgi?upstream=crates.io/filetime .*/crates/filetime/@ANY_VERSION@/download - diff -Nru rust-filetime-0.2.8/.github/workflows/main.yml rust-filetime-0.2.9/.github/workflows/main.yml --- rust-filetime-0.2.8/.github/workflows/main.yml 2019-10-28 14:58:33.000000000 +0000 +++ rust-filetime-0.2.9/.github/workflows/main.yml 2020-01-28 08:38:23.000000000 +0000 @@ -34,13 +34,7 @@ - uses: actions/checkout@master - name: Install Rust (rustup) run: rustup update ${{ matrix.rust }} --no-self-update && rustup default ${{ matrix.rust }} - if: matrix.os != 'macos-latest' shell: bash - - name: Install Rust (macos) - run: | - curl https://sh.rustup.rs | sh -s -- -y - echo "##[add-path]$HOME/.cargo/bin" - if: matrix.os == 'macos-latest' - run: cargo test rustfmt: diff -Nru rust-filetime-0.2.8/src/lib.rs rust-filetime-0.2.9/src/lib.rs --- rust-filetime-0.2.8/src/lib.rs 2019-09-06 20:14:32.000000000 +0000 +++ rust-filetime-0.2.9/src/lib.rs 2020-03-11 20:45:26.000000000 +0000 @@ -89,6 +89,25 @@ } } + /// Creates a new timestamp representing the current system time. + /// + /// ``` + /// # use filetime::FileTime; + /// # + /// # fn example() -> std::io::Result<()> { + /// # let path = ""; + /// # + /// filetime::set_file_mtime(path, FileTime::now())?; + /// # + /// # Ok(()) + /// # } + /// ``` + /// + /// Equivalent to `FileTime::from_system_time(SystemTime::now())`. + pub fn now() -> FileTime { + FileTime::from_system_time(SystemTime::now()) + } + /// Creates a new instance of `FileTime` with a number of seconds and /// nanoseconds relative to the Unix epoch, 1970-01-01T00:00:00Z. /// diff -Nru rust-filetime-0.2.8/src/redox.rs rust-filetime-0.2.9/src/redox.rs --- rust-filetime-0.2.8/src/redox.rs 2019-05-15 17:10:01.000000000 +0000 +++ rust-filetime-0.2.9/src/redox.rs 2019-11-11 14:57:03.000000000 +0000 @@ -1,8 +1,8 @@ +use crate::FileTime; use std::fs::{self, File}; use std::io; use std::os::unix::prelude::*; use std::path::Path; -use crate::FileTime; pub fn set_file_times(p: &Path, atime: FileTime, mtime: FileTime) -> io::Result<()> { let fd = syscall::open(p.as_os_str().as_bytes(), 0) @@ -38,7 +38,7 @@ fn to_timespec(ft: &FileTime) -> TimeSpec { TimeSpec { tv_sec: ft.seconds(), - tv_nsec: ft.nanoseconds() as i32 + tv_nsec: ft.nanoseconds() as i32, } } @@ -47,7 +47,7 @@ let _ = syscall::close(fd); match res { Ok(_) => Ok(()), - Err(err) => Err(io::Error::from_raw_os_error(err.errno)) + Err(err) => Err(io::Error::from_raw_os_error(err.errno)), } } diff -Nru rust-filetime-0.2.8/src/unix/macos.rs rust-filetime-0.2.9/src/unix/macos.rs --- rust-filetime-0.2.8/src/unix/macos.rs 2019-08-13 15:41:52.000000000 +0000 +++ rust-filetime-0.2.9/src/unix/macos.rs 2019-11-11 14:57:03.000000000 +0000 @@ -2,12 +2,12 @@ //! and if not, we fallabck to `utimes`. use crate::FileTime; use libc::{c_char, c_int, timespec}; -use std::ffi::{CString, CStr}; +use std::ffi::{CStr, CString}; use std::fs::File; use std::os::unix::prelude::*; use std::path::Path; -use std::sync::atomic::Ordering::SeqCst; use std::sync::atomic::AtomicUsize; +use std::sync::atomic::Ordering::SeqCst; use std::{io, mem}; pub fn set_file_times(p: &Path, atime: FileTime, mtime: FileTime) -> io::Result<()> { @@ -97,9 +97,7 @@ 1 => return None, n => return Some(n), } - let sym = unsafe { - libc::dlsym(libc::RTLD_DEFAULT, name.as_ptr() as *const _) - }; + let sym = unsafe { libc::dlsym(libc::RTLD_DEFAULT, name.as_ptr() as *const _) }; let (val, ret) = if sym.is_null() { (1, None) } else { diff -Nru rust-filetime-0.2.8/src/unix/mod.rs rust-filetime-0.2.9/src/unix/mod.rs --- rust-filetime-0.2.8/src/unix/mod.rs 2019-08-13 15:41:52.000000000 +0000 +++ rust-filetime-0.2.9/src/unix/mod.rs 2020-04-01 13:53:27.000000000 +0000 @@ -14,10 +14,12 @@ pub use self::macos::*; } else if #[cfg(any(target_os = "android", target_os = "solaris", + target_os = "illumos", target_os = "emscripten", target_os = "freebsd", target_os = "netbsd", - target_os = "openbsd"))] { + target_os = "openbsd", + target_os = "haiku"))] { mod utimensat; pub use self::utimensat::*; } else { diff -Nru rust-filetime-0.2.8/src/unix/utimes.rs rust-filetime-0.2.9/src/unix/utimes.rs --- rust-filetime-0.2.8/src/unix/utimes.rs 2019-05-15 17:08:49.000000000 +0000 +++ rust-filetime-0.2.9/src/unix/utimes.rs 2020-03-11 20:45:26.000000000 +0000 @@ -20,6 +20,7 @@ set_times(p, Some(atime), None, false) } +#[cfg(not(target_env = "uclibc"))] #[allow(dead_code)] pub fn set_file_handle_times( f: &fs::File, @@ -39,6 +40,26 @@ }; } +#[cfg(target_env = "uclibc")] +#[allow(dead_code)] +pub fn set_file_handle_times( + f: &fs::File, + atime: Option, + mtime: Option, +) -> io::Result<()> { + let (atime, mtime) = match get_times(atime, mtime, || f.metadata())? { + Some(pair) => pair, + None => return Ok(()), + }; + let times = [to_timespec(&atime), to_timespec(&mtime)]; + let rc = unsafe { libc::futimens(f.as_raw_fd(), times.as_ptr()) }; + return if rc == 0 { + Ok(()) + } else { + Err(io::Error::last_os_error()) + }; +} + fn get_times( atime: Option, mtime: Option, @@ -96,3 +117,13 @@ tv_usec: (ft.nanoseconds() / 1000) as libc::suseconds_t, } } + +fn to_timespec(ft: &FileTime) -> libc::timespec { + libc::timespec { + tv_sec: ft.seconds() as libc::time_t, + #[cfg(all(target_arch = "x86_64", target_pointer_width = "32"))] + tv_nsec: (ft.nanoseconds()) as i64, + #[cfg(not(all(target_arch = "x86_64", target_pointer_width = "32")))] + tv_nsec: (ft.nanoseconds()) as libc::c_long, + } +}