From 9d75d1cef2327cdf02c26d1264cf15f9947749a9 Mon Sep 17 00:00:00 2001 From: Vehbi Sinan Tunalioglu Date: Mon, 18 Apr 2022 23:24:45 +0800 Subject: [PATCH 1/8] chore: bump development version to 0.0.3 --- Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Cargo.toml b/Cargo.toml index 1a3cd30..7c258a3 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "rrclone" -version = "0.0.2" +version = "0.0.3" authors = ["Vehbi Sinan Tunalioglu "] edition = "2018" From 18613b17ed5cb27ff50f26f47f7dc1e6ba3a55f5 Mon Sep 17 00:00:00 2001 From: Vehbi Sinan Tunalioglu Date: Mon, 18 Apr 2022 23:33:41 +0800 Subject: [PATCH 2/8] chore(docs): document release process --- README.md | 78 ++++++++++++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 75 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 9d03985..b7e047d 100644 --- a/README.md +++ b/README.md @@ -6,7 +6,7 @@ `rrclone` is an Rclone wrapper to use YAML/JSON configuration for backup tasks. > **TODO:** Provide full README. - +> > **NOTE:** This is a work-in-progress application with a very limited > functionality. Expect breaking changes and improved functionality as we move > on. @@ -32,7 +32,7 @@ rrclone ./config.yaml ``` -## Cross Compilation +## Releasing Install [cross](https://github.com/cross-rs/cross): @@ -40,10 +40,82 @@ Install [cross](https://github.com/cross-rs/cross): cargo install -f cross ``` -Cross compile, for example for Linux on aarch64: +First, merge `develop` to `main`: + +```sh +git checkout main +git merge --no-ff develop +``` + +Update the version information in `Cargo.toml` if required. Update the +`CHANGELOG.md` as well (currently using `standard-version`). + +Set the release tag (example is `0.0.2`): + +```sh +export RELTAG="0.0.2" +``` + +Commit changes: + +```sh +git commit -am "chore(release): ${RELTAG}" +``` + +Tag: + +```sh +git tag -a -m "Release ${RELTAG}" "${RELTAG}" +``` + +Push everything: + +```sh +git push --follow-tags origin main +``` + +Create a new GitHub release: + +```sh +gh release create "${RELTAG}" --generate-notes --title "v${RELTAG}" --draft +``` + +Build on your own architecture and upload to the release(hoping that it is Linux +x86_64, otherwise must add this to cross build instructions, too): + +```sh +cargo build --release +mv target/release/rrclone "target/release/rrclone-$(uname -s)-$(uname -m)" +gh release upload "${RELTAG}" --clobber "target/release/rrclone-$(uname -s)-$(uname -m)" +``` + +Build and upload other architectures: ```sh cross build --target aarch64-unknown-linux-gnu --release +mv target/aarch64-unknown-linux-gnu/release/rrclone "target/aarch64-unknown-linux-gnu/release/rrclone-Linux-aarch64" +gh release upload "${RELTAG}" --clobber "target/aarch64-unknown-linux-gnu/release/rrclone-Linux-aarch64" + +cross build --target arm-unknown-linux-gnueabihf --release +mv target/arm-unknown-linux-gnueabihf/release/rrclone "target/arm-unknown-linux-gnueabihf/release/rrclone-Linux-arm" +gh release upload "${RELTAG}" --clobber "target/arm-unknown-linux-gnueabihf/release/rrclone-Linux-arm" + +cross build --target armv7-unknown-linux-gnueabihf --release +mv target/armv7-unknown-linux-gnueabihf/release/rrclone "target/armv7-unknown-linux-gnueabihf/release/rrclone-Linux-armv7" +gh release upload "${RELTAG}" --clobber "target/armv7-unknown-linux-gnueabihf/release/rrclone-Linux-armv7" +``` + +Switch to develop and rebase: + +```sh +git checkout develop +git rebase main +``` + +Bump development version, commit and push: + +```sh +git push ``` ## License From 5b06f868f6623862a37340a46af203db7f9a8eea Mon Sep 17 00:00:00 2001 From: Vehbi Sinan Tunalioglu Date: Mon, 18 Apr 2022 23:42:07 +0800 Subject: [PATCH 3/8] chore(docs): add installation instructions and commands --- README.md | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index b7e047d..c082e5c 100644 --- a/README.md +++ b/README.md @@ -13,8 +13,16 @@ ## Installation -1. Install [rclone](https://rclone.org/install/) -1. Put `rrclone` onto `$PATH` +First, make sure that [rclone](https://rclone.org/install/) is +installed. + +Then, download the latest version from releases for your architecture +and put it in your path: + +```sh +curl -sLo /tmp/rrclone "https://github.com/telostat/rrclone/releases/latest/download/rrclone-$(uname -s)-$(uname -m)" +sudo install /tmp/rrclone /usr/local/bin +``` ## Usage From e423df7aa77089c2f1e2677dff5f4c8ad61b6e2a Mon Sep 17 00:00:00 2001 From: Vehbi Sinan Tunalioglu Date: Mon, 18 Apr 2022 23:43:05 +0800 Subject: [PATCH 4/8] chore(docs): add release badge --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index c082e5c..0d86ad8 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,6 @@ # rrclone +![GitHub release (latest by date)](https://img.shields.io/github/v/release/telostat/rrclone) ![GitHub contributors](https://img.shields.io/github/contributors/telostat/rrclone) ![GitHub](https://img.shields.io/github/license/telostat/rrclone) From 4bba7314a007c5b5fbdfba9dece862b21b8fe2b5 Mon Sep 17 00:00:00 2001 From: Vehbi Sinan Tunalioglu Date: Mon, 23 May 2022 13:58:11 +0800 Subject: [PATCH 5/8] chore(build): commit Cargo.lock --- .gitignore | 4 -- Cargo.lock | 183 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 183 insertions(+), 4 deletions(-) create mode 100644 Cargo.lock diff --git a/.gitignore b/.gitignore index 29eead4..0a5a7a3 100644 --- a/.gitignore +++ b/.gitignore @@ -2,10 +2,6 @@ # will have compiled files and executables /target/ -# Remove Cargo.lock from gitignore if creating an executable, leave it for libraries -# More information here https://doc.rust-lang.org/cargo/guide/cargo-toml-vs-cargo-lock.html -Cargo.lock - # These are backup files generated by rustfmt **/*.rs.bk diff --git a/Cargo.lock b/Cargo.lock new file mode 100644 index 0000000..fa9fd1e --- /dev/null +++ b/Cargo.lock @@ -0,0 +1,183 @@ +# This file is automatically @generated by Cargo. +# It is not intended for manual editing. +version = 3 + +[[package]] +name = "autocfg" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cdb031dd78e28731d87d56cc8ffef4a8f36ca26c38fe2de700543e627f8a464a" + +[[package]] +name = "chrono" +version = "0.4.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "670ad68c9088c2a963aaa298cb369688cf3f9465ce5e2d4ca10e6e0098a1ce73" +dependencies = [ + "libc", + "num-integer", + "num-traits", + "time", + "winapi", +] + +[[package]] +name = "dtoa" +version = "0.4.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "88d7ed2934d741c6b37e33e3832298e8850b53fd2d2bea03873375596c7cea4e" + +[[package]] +name = "libc" +version = "0.2.81" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1482821306169ec4d07f6aca392a4681f66c75c9918aa49641a2595db64053cb" + +[[package]] +name = "linked-hash-map" +version = "0.5.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8dd5a6d5999d9907cda8ed67bbd137d3af8085216c2ac62de5be860bd41f304a" + +[[package]] +name = "num-integer" +version = "0.1.44" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d2cc698a63b549a70bc047073d2949cce27cd1c7b0a4a862d08a8031bc2801db" +dependencies = [ + "autocfg", + "num-traits", +] + +[[package]] +name = "num-traits" +version = "0.2.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9a64b1ec5cda2586e284722486d802acf1f7dbdc623e2bfc57e65ca1cd099290" +dependencies = [ + "autocfg", +] + +[[package]] +name = "proc-macro2" +version = "1.0.24" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e0704ee1a7e00d7bb417d0770ea303c1bccbabf0ef1667dae92b5967f5f8a71" +dependencies = [ + "unicode-xid", +] + +[[package]] +name = "quote" +version = "1.0.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "991431c3519a3f36861882da93630ce66b52918dcf1b8e2fd66b397fc96f28df" +dependencies = [ + "proc-macro2", +] + +[[package]] +name = "rrclone" +version = "0.0.3" +dependencies = [ + "chrono", + "serde", + "serde_yaml", +] + +[[package]] +name = "serde" +version = "1.0.118" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "06c64263859d87aa2eb554587e2d23183398d617427327cf2b3d0ed8c69e4800" +dependencies = [ + "serde_derive", +] + +[[package]] +name = "serde_derive" +version = "1.0.118" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c84d3526699cd55261af4b941e4e725444df67aa4f9e6a3564f18030d12672df" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "serde_yaml" +version = "0.8.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f7baae0a99f1a324984bcdc5f0718384c1f69775f1c7eec8b859b71b443e3fd7" +dependencies = [ + "dtoa", + "linked-hash-map", + "serde", + "yaml-rust", +] + +[[package]] +name = "syn" +version = "1.0.57" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4211ce9909eb971f111059df92c45640aad50a619cf55cd76476be803c4c68e6" +dependencies = [ + "proc-macro2", + "quote", + "unicode-xid", +] + +[[package]] +name = "time" +version = "0.1.44" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6db9e6914ab8b1ae1c260a4ae7a49b6c5611b40328a735b21862567685e73255" +dependencies = [ + "libc", + "wasi", + "winapi", +] + +[[package]] +name = "unicode-xid" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f7fe0bb3479651439c9112f72b6c505038574c9fbb575ed1bf3b797fa39dd564" + +[[package]] +name = "wasi" +version = "0.10.0+wasi-snapshot-preview1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1a143597ca7c7793eff794def352d41792a93c481eb1042423ff7ff72ba2c31f" + +[[package]] +name = "winapi" +version = "0.3.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419" +dependencies = [ + "winapi-i686-pc-windows-gnu", + "winapi-x86_64-pc-windows-gnu", +] + +[[package]] +name = "winapi-i686-pc-windows-gnu" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" + +[[package]] +name = "winapi-x86_64-pc-windows-gnu" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" + +[[package]] +name = "yaml-rust" +version = "0.4.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "56c1936c4cc7a1c9ab21a1ebb602eb942ba868cbd44a99cb7cdc5892335e1c85" +dependencies = [ + "linked-hash-map", +] From ac855173972129690581cdf3efb49ee8966870b1 Mon Sep 17 00:00:00 2001 From: Vehbi Sinan Tunalioglu Date: Mon, 23 May 2022 14:16:51 +0800 Subject: [PATCH 6/8] feat(build): add build artifact for Nix --- default.nix | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 default.nix diff --git a/default.nix b/default.nix new file mode 100644 index 0000000..3150b5f --- /dev/null +++ b/default.nix @@ -0,0 +1,20 @@ +let + pkgs = import (fetchTarball "https://github.com/nixos/nixpkgs/archive/21.11.tar.gz") { }; + package = (pkgs.lib.modules.importTOML ./Cargo.toml).config.package; +in +pkgs.rustPlatform.buildRustPackage rec { + pname = package.name; + version = package.version; + + src = ./.; + + cargoLock = { + lockFile = ./Cargo.lock; + }; + + meta = with pkgs.lib; { + description = "Rclone wrapper to use YAML/JSON configuration for backup tasks"; + homepage = "https://github.com/telostat/rrclone"; + license = licenses.bsd3; + }; +} From 4ac77a2a16efaebdd36518c99c9d2cc14ba334d5 Mon Sep 17 00:00:00 2001 From: Vehbi Sinan Tunalioglu Date: Tue, 24 May 2022 09:15:27 +0800 Subject: [PATCH 7/8] feat: delete excluded files from destination --- src/rclone.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/src/rclone.rs b/src/rclone.rs index 0eab89e..8aebe57 100644 --- a/src/rclone.rs +++ b/src/rclone.rs @@ -51,6 +51,7 @@ pub fn task_to_args(task: &config::Task) -> Vec { "--stats".to_string(), "10000m".to_string(), "sync".to_string(), + "--delete-excluded".to_string(), format!( "{}{}", backend_to_args(&task.source.backend), From 835a9ac60af032d7f142f16760c9d32c4f711e82 Mon Sep 17 00:00:00 2001 From: Vehbi Sinan Tunalioglu Date: Tue, 24 May 2022 09:46:41 +0800 Subject: [PATCH 8/8] chore(dev): add Nix shell for local compilation --- shell.nix | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 shell.nix diff --git a/shell.nix b/shell.nix new file mode 100644 index 0000000..7c2463b --- /dev/null +++ b/shell.nix @@ -0,0 +1,11 @@ +{ ... }: + +let + pkgs = import (fetchTarball "https://github.com/nixos/nixpkgs/archive/21.11.tar.gz") { }; +in +pkgs.mkShell { + buildInputs = [ + pkgs.cargo + pkgs.rustc + ]; +}