Compare commits

..

1 Commits

Author SHA1 Message Date
Thomas Schönauer
9e694d8e13 Added last version note (#75) 2022-10-26 11:33:43 +00:00
30 changed files with 261 additions and 529 deletions

24
.github/workflows/build-and-test.yml vendored Normal file
View File

@@ -0,0 +1,24 @@
name: Cargo Build & Test
on:
push:
pull_request:
env:
CARGO_TERM_COLOR: always
jobs:
build_and_test:
name: Rust project - latest
runs-on: ubuntu-latest
strategy:
matrix:
toolchain:
- stable
- beta
- nightly
steps:
- uses: actions/checkout@v3
- run: rustup update ${{ matrix.toolchain }} && rustup default ${{ matrix.toolchain }}
- run: cargo build --verbose
- run: cargo test --verbose

View File

@@ -1,27 +0,0 @@
on:
release:
types: [published, edited]
name: Check SemVer compliance
jobs:
prepare:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
with:
toolchain: nightly-2022-08-03
override: true
components: rustfmt, clippy
semver:
runs-on: ubuntu-latest
steps:
- uses: actions-rs/cargo@v1
with:
command: install
args: --git https://github.com/rust-lang/rust-semverver
- run: eval "current_version=$(grep -e '^version = .*$' Cargo.toml | cut -d ' ' -f 3)"
- run: cargo semver | tee semver_out
- run: (head -n 1 semver_out | grep "\-> $current_version") || (echo "versioning mismatch" && return 1)

View File

@@ -1,16 +1,11 @@
on: on:
# workflow_run:
# workflows: ["Check SemVer compliance"]
# types:
# - completed
release: release:
types: [published, edited] types: [published, edited]
name: Publish to crates.io on release name: Check SemVer compliance and publish on release
jobs: jobs:
prepare: prepare:
runs-on: ubuntu-latest
steps: steps:
- uses: actions/checkout@v2 - uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1 - uses: actions-rs/toolchain@v1
@@ -18,8 +13,18 @@ jobs:
toolchain: nightly-2022-08-03 toolchain: nightly-2022-08-03
override: true override: true
publish: semver:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps:
- uses: actions-rs/cargo@v1
with:
command: install
args: --git https://github.com/rust-lang/rust-semverver
- run: eval "current_version=$(grep -e '^version = .*$' Cargo.toml | cut -d ' ' -f 3)"
- run: cargo semver | tee semver_out
- run: (head -n 1 semver_out | grep "\-> $current_version") || (echo "versioning mismatch" && return 1)
publish:
steps: steps:
- uses: katyo/publish-crates@v1 - uses: katyo/publish-crates@v1
with: with:

View File

@@ -1,70 +0,0 @@
name: Publish release files for non-cd-native environments
on:
# workflow_run:
# workflows: ["Check SemVer compliance"]
# types:
# - completed
release:
types: [ created ]
jobs:
build:
strategy:
fail-fast: false
matrix:
target: [ "aarch64-unknown-linux-gnu", "armv7-unknown-linux-gnueabihf", "x86_64-unknown-linux-musl", "aarch64-unknown-linux-musl", "x86_64-unknown-freebsd", ]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
with:
toolchain: 1.57.0
profile: minimal
default: true
override: true
target: ${{ matrix.target }}
components: rustfmt, clippy
- uses: actions-rs/cargo@v1.0.1
name: Check format
with:
use-cross: true
command: fmt
args: --all -- --check
- uses: actions-rs/cargo@v1.0.1
name: Run clippy
with:
command: clippy
use-cross: true
args: --all-targets --locked --target ${{matrix.target}} -- -D warnings
- uses: actions-rs/cargo@v1.0.1
name: Run clippy (All features)
with:
command: clippy
use-cross: true
args: --locked --all-features --target ${{matrix.target}} -- -D warnings
- uses: actions-rs/cargo@v1.0.1
name: Run tests
with:
command: test
use-cross: true
args: --target ${{matrix.target}}
- uses: actions-rs/cargo@v1.0.1
name: Build
with:
command: build
use-cross: true
args: --release --all-features --target ${{matrix.target}}
- name: Rename Release
run: |
mkdir assets
FILENAME=topgrade-${{github.event.release.tag_name}}-${{matrix.target}}
mv target/${{matrix.target}}/release/topgrade assets
cd assets
tar --format=ustar -czf $FILENAME.tar.gz topgrade
rm topgrade
ls .
- name: Release
uses: softprops/action-gh-release@v1
with:
files: assets/*

View File

@@ -0,0 +1,28 @@
on:
workflow_dispatch:
push:
branches:
- main
name: Release Packaging
jobs:
release:
name: Release Packaging
env:
PROJECT_NAME_UNDERSCORE: topgrade-rs
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
override: true
- name: Release Build
run: cargo build --release
- name: 'Upload Artifact'
uses: actions/upload-artifact@v2
with:
name: ${{ env.PROJECT_NAME_UNDERSCORE }}
path: target/release/${{ env.PROJECT_NAME_UNDERSCORE }}

View File

@@ -1,10 +1,7 @@
name: Publish release files for CD native environments name: CD Win/MacOS Native
on: on:
# workflow_run: workflow_dispatch:
# workflows: ["Check SemVer compliance"]
# types:
# - completed
release: release:
types: [ created ] types: [ created ]
@@ -13,31 +10,16 @@ jobs:
strategy: strategy:
fail-fast: false fail-fast: false
matrix: matrix:
platform: [ ubuntu-latest, macos-latest, windows-latest ] platform: [ macos-latest, windows-latest ]
runs-on: ${{ matrix.platform }} runs-on: ${{ matrix.platform }}
steps: steps:
- uses: actions/checkout@v2 - uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1 - uses: actions-rs/toolchain@v1
with: with:
toolchain: 1.57.0 toolchain: stable
profile: minimal profile: minimal
override: true override: true
components: rustfmt, clippy components: rustfmt, clippy
- uses: actions-rs/cargo@v1.0.1
name: Check format
with:
command: fmt
args: --all -- --check
- uses: actions-rs/cargo@v1.0.1
name: Run clippy
with:
command: clippy
args: --all-targets --locked -- -D warnings
- uses: actions-rs/cargo@v1.0.1
name: Run clippy (All features)
with:
command: clippy
args: --all-targets --locked --all-features -- -D warnings
- uses: actions-rs/cargo@v1.0.1 - uses: actions-rs/cargo@v1.0.1
name: Run tests name: Run tests
with: with:

24
.github/workflows/rust-ubuntu.yml vendored Normal file
View File

@@ -0,0 +1,24 @@
name: Rust
on:
push:
branches: [ "master", "dev" ]
pull_request:
branches: [ "master", "dev" ]
env:
CARGO_TERM_COLOR: always
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Build
run: cargo build --verbose
- name: Fmt
run: cargo fmt --check --all
- name: Run tests
run: cargo test --verbose

View File

@@ -1,12 +1,10 @@
on: on:
pull_request: pull_request:
push: push:
branches: branches:
- main - main
env:
CARGO_TERM_COLOR: always
name: Test with Code Coverage name: Test with Code Coverage
jobs: jobs:

View File

@@ -1,22 +0,0 @@
name: Publish to AUR
on:
# workflow_run:
# workflows: ["Check SemVer compliance"]
# types:
# - completed
push:
tags:
- "v*"
jobs:
aur-publish:
runs-on: ubuntu-latest
steps:
- name: Publish AUR package
uses: ATiltedTree/create-aur-release@v1
with:
package_name: topgrade
commit_username: "Thomas Schönauer"
commit_email: t.schoenauer@hgs-wt.at
ssh_private_key: ${{ secrets.AUR_SSH_PRIVATE_KEY }}

6
.vscode/launch.json vendored
View File

@@ -12,11 +12,11 @@
"cargo": { "cargo": {
"args": [ "args": [
"build", "build",
"--bin=topgrade-rs", "--bin=topgrade",
"--package=topgrade-rs" "--package=topgrade"
], ],
"filter": { "filter": {
"name": "topgrade-rs", "name": "topgrade",
"kind": "bin" "kind": "bin"
} }
}, },

232
Cargo.lock generated
View File

@@ -39,9 +39,9 @@ dependencies = [
[[package]] [[package]]
name = "anyhow" name = "anyhow"
version = "1.0.66" version = "1.0.65"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "216261ddc8289130e551ddcd5ce8a064710c0d064a4d2895c67151c92b5443f6" checksum = "98161a4e3e2184da77bb14f02184cdd111e83bbbcc9979dfee3c44b9a85f5602"
[[package]] [[package]]
name = "async-broadcast" name = "async-broadcast"
@@ -81,16 +81,16 @@ dependencies = [
[[package]] [[package]]
name = "async-io" name = "async-io"
version = "1.10.0" version = "1.9.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e8121296a9f05be7f34aa4196b1747243b3b62e048bb7906f644f3fbfc490cf7" checksum = "83e21f3a490c72b3b0cf44962180e60045de2925d8dff97918f7ee43c8f637c7"
dependencies = [ dependencies = [
"async-lock",
"autocfg", "autocfg",
"concurrent-queue", "concurrent-queue",
"futures-lite", "futures-lite",
"libc", "libc",
"log", "log",
"once_cell",
"parking", "parking",
"polling", "polling",
"slab", "slab",
@@ -101,12 +101,11 @@ dependencies = [
[[package]] [[package]]
name = "async-lock" name = "async-lock"
version = "2.6.0" version = "2.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c8101efe8695a6c17e02911402145357e718ac92d3ff88ae8419e84b1707b685" checksum = "e97a171d191782fba31bb902b14ad94e24a68145032b7eedf871ab0bc0d077b6"
dependencies = [ dependencies = [
"event-listener", "event-listener",
"futures-lite",
] ]
[[package]] [[package]]
@@ -128,9 +127,9 @@ checksum = "7a40729d2133846d9ed0ea60a8b9541bccddab49cd30f0715a1da672fe9a2524"
[[package]] [[package]]
name = "async-trait" name = "async-trait"
version = "0.1.58" version = "0.1.57"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1e805d94e6b5001b651426cf4cd446b1ab5f319d27bab5c644f61de0a804360c" checksum = "76464446b8bc32758d7e88ee1a804d9914cd9b1cb264c029899680b0be29826f"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
@@ -156,9 +155,9 @@ checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa"
[[package]] [[package]]
name = "base64" name = "base64"
version = "0.13.1" version = "0.13.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9e1b586273c5702936fe7b7d6896644d8be71e6314cfe09d3167c95f712589e8" checksum = "904dfeac50f3cdaba28fc6f57fdcddb75f49ed61346676a78c4ffe55877802fd"
[[package]] [[package]]
name = "bitflags" name = "bitflags"
@@ -174,9 +173,9 @@ checksum = "0d8c1fef690941d3e7788d328517591fecc684c084084702d6ff1641e993699a"
[[package]] [[package]]
name = "bumpalo" name = "bumpalo"
version = "3.11.1" version = "3.11.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "572f695136211188308f16ad2ca5c851a712c464060ae6974944458eb83880ba" checksum = "c1ad822118d20d2c234f427000d5acc36eabe1e29a348c89b63dd60b13f28e5d"
[[package]] [[package]]
name = "byteorder" name = "byteorder"
@@ -198,9 +197,9 @@ checksum = "c1db59621ec70f09c5e9b597b220c7a2b43611f4710dc03ceb8748637775692c"
[[package]] [[package]]
name = "cc" name = "cc"
version = "1.0.74" version = "1.0.73"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "581f5dba903aac52ea3feb5ec4810848460ee833876f1f9b0fdeab1f19091574" checksum = "2fff2a6927b3bb87f9595d67196a70493f627687a71d87a0d692242c33f58c11"
[[package]] [[package]]
name = "cfg-if" name = "cfg-if"
@@ -321,9 +320,9 @@ dependencies = [
[[package]] [[package]]
name = "cxx" name = "cxx"
version = "1.0.80" version = "1.0.79"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6b7d4e43b25d3c994662706a1d4fcfc32aaa6afd287502c111b237093bb23f3a" checksum = "3f83d0ebf42c6eafb8d7c52f7e5f2d3003b89c7aa4fd2b79229209459a849af8"
dependencies = [ dependencies = [
"cc", "cc",
"cxxbridge-flags", "cxxbridge-flags",
@@ -333,9 +332,9 @@ dependencies = [
[[package]] [[package]]
name = "cxx-build" name = "cxx-build"
version = "1.0.80" version = "1.0.79"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "84f8829ddc213e2c1368e51a2564c552b65a8cb6a28f31e576270ac81d5e5827" checksum = "07d050484b55975889284352b0ffc2ecbda25c0c55978017c132b29ba0818a86"
dependencies = [ dependencies = [
"cc", "cc",
"codespan-reporting", "codespan-reporting",
@@ -348,15 +347,15 @@ dependencies = [
[[package]] [[package]]
name = "cxxbridge-flags" name = "cxxbridge-flags"
version = "1.0.80" version = "1.0.79"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e72537424b474af1460806647c41d4b6d35d09ef7fe031c5c2fa5766047cc56a" checksum = "99d2199b00553eda8012dfec8d3b1c75fce747cf27c169a270b3b99e3448ab78"
[[package]] [[package]]
name = "cxxbridge-macro" name = "cxxbridge-macro"
version = "1.0.80" version = "1.0.79"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "309e4fb93eed90e1e14bea0da16b209f81813ba9fc7830c20ed151dd7bc0a4d7" checksum = "dcb67a6de1f602736dd7eaead0080cf3435df806c61b24b13328db128c58868f"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
@@ -502,9 +501,9 @@ dependencies = [
[[package]] [[package]]
name = "filetime" name = "filetime"
version = "0.2.18" version = "0.2.17"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4b9663d381d07ae25dc88dbdf27df458faa83a9b25336bcac83d5e452b5fc9d3" checksum = "e94a7bbaa59354bc20dd75b67f23e2797b4490e9d6928203fb105c79e448c86c"
dependencies = [ dependencies = [
"cfg-if", "cfg-if",
"libc", "libc",
@@ -539,9 +538,9 @@ dependencies = [
[[package]] [[package]]
name = "futures" name = "futures"
version = "0.3.25" version = "0.3.24"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "38390104763dc37a5145a53c29c63c1290b5d316d6086ec32c293f6736051bb0" checksum = "7f21eda599937fba36daeb58a22e8f5cee2d14c4a17b5b7739c7c8e5e3b8230c"
dependencies = [ dependencies = [
"futures-channel", "futures-channel",
"futures-core", "futures-core",
@@ -554,9 +553,9 @@ dependencies = [
[[package]] [[package]]
name = "futures-channel" name = "futures-channel"
version = "0.3.25" version = "0.3.24"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "52ba265a92256105f45b719605a571ffe2d1f0fea3807304b522c1d778f79eed" checksum = "30bdd20c28fadd505d0fd6712cdfcb0d4b5648baf45faef7f852afb2399bb050"
dependencies = [ dependencies = [
"futures-core", "futures-core",
"futures-sink", "futures-sink",
@@ -564,15 +563,15 @@ dependencies = [
[[package]] [[package]]
name = "futures-core" name = "futures-core"
version = "0.3.25" version = "0.3.24"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "04909a7a7e4633ae6c4a9ab280aeb86da1236243a77b694a49eacd659a4bd3ac" checksum = "4e5aa3de05362c3fb88de6531e6296e85cde7739cccad4b9dfeeb7f6ebce56bf"
[[package]] [[package]]
name = "futures-executor" name = "futures-executor"
version = "0.3.25" version = "0.3.24"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7acc85df6714c176ab5edf386123fafe217be88c0840ec11f199441134a074e2" checksum = "9ff63c23854bee61b6e9cd331d523909f238fc7636290b96826e9cfa5faa00ab"
dependencies = [ dependencies = [
"futures-core", "futures-core",
"futures-task", "futures-task",
@@ -581,9 +580,9 @@ dependencies = [
[[package]] [[package]]
name = "futures-io" name = "futures-io"
version = "0.3.25" version = "0.3.24"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "00f5fb52a06bdcadeb54e8d3671f8888a39697dcb0b81b23b55174030427f4eb" checksum = "bbf4d2a7a308fd4578637c0b17c7e1c7ba127b8f6ba00b29f717e9655d85eb68"
[[package]] [[package]]
name = "futures-lite" name = "futures-lite"
@@ -602,9 +601,9 @@ dependencies = [
[[package]] [[package]]
name = "futures-macro" name = "futures-macro"
version = "0.3.25" version = "0.3.24"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bdfb8ce053d86b91919aad980c220b1fb8401a9394410e1c289ed7e66b61835d" checksum = "42cd15d1c7456c04dbdf7e88bcd69760d74f3a798d6444e16974b505b0e62f17"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
@@ -613,21 +612,21 @@ dependencies = [
[[package]] [[package]]
name = "futures-sink" name = "futures-sink"
version = "0.3.25" version = "0.3.24"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "39c15cf1a4aa79df40f1bb462fb39676d0ad9e366c2a33b590d7c66f4f81fcf9" checksum = "21b20ba5a92e727ba30e72834706623d94ac93a725410b6a6b6fbc1b07f7ba56"
[[package]] [[package]]
name = "futures-task" name = "futures-task"
version = "0.3.25" version = "0.3.24"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2ffb393ac5d9a6eaa9d3fdf37ae2776656b706e200c8e16b1bdb227f5198e6ea" checksum = "a6508c467c73851293f390476d4491cf4d227dbabcd4170f3bb6044959b294f1"
[[package]] [[package]]
name = "futures-util" name = "futures-util"
version = "0.3.25" version = "0.3.24"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "197676987abd2f9cadff84926f410af1c183608d36641465df73ae8211dc65d6" checksum = "44fb6cb1be61cc1d2e43b262516aafcf63b241cffdb1d3fa115f91d9c7b09c90"
dependencies = [ dependencies = [
"futures-channel", "futures-channel",
"futures-core", "futures-core",
@@ -643,9 +642,9 @@ dependencies = [
[[package]] [[package]]
name = "getrandom" name = "getrandom"
version = "0.2.8" version = "0.2.7"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c05aeb6a22b8f62540c194aac980f2115af067bfe15a0734d7277a768d396b31" checksum = "4eb1a864a501629691edf6c15a593b7a51eebaa1e8468e9ddc623de7c9b58ec6"
dependencies = [ dependencies = [
"cfg-if", "cfg-if",
"libc", "libc",
@@ -660,9 +659,9 @@ checksum = "9b919933a397b79c37e33b77bb2aa3dc8eb6e165ad809e58ff75bc7db2e34574"
[[package]] [[package]]
name = "h2" name = "h2"
version = "0.3.15" version = "0.3.14"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5f9f29bc9dda355256b2916cf526ab02ce0aeaaaf2bad60d65ef3f12f11dd0f4" checksum = "5ca32592cf21ac7ccab1825cd87f6c9b3d9022c44d086172ed0966bec8af30be"
dependencies = [ dependencies = [
"bytes", "bytes",
"fnv", "fnv",
@@ -770,9 +769,9 @@ dependencies = [
[[package]] [[package]]
name = "hyper" name = "hyper"
version = "0.14.22" version = "0.14.20"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "abfba89e19b959ca163c7752ba59d737c1ceea53a5d31a149c805446fc958064" checksum = "02c929dc5c39e335a03c405292728118860721b10190d98c2a0f0efd5baafbac"
dependencies = [ dependencies = [
"bytes", "bytes",
"futures-channel", "futures-channel",
@@ -807,9 +806,9 @@ dependencies = [
[[package]] [[package]]
name = "iana-time-zone" name = "iana-time-zone"
version = "0.1.53" version = "0.1.51"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "64c122667b287044802d6ce17ee2ddf13207ed924c712de9a66a5814d5b64765" checksum = "f5a6ef98976b22b3b7f2f3a806f858cb862044cfa66805aa3ad84cb3d3b785ed"
dependencies = [ dependencies = [
"android_system_properties", "android_system_properties",
"core-foundation-sys", "core-foundation-sys",
@@ -899,9 +898,9 @@ checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646"
[[package]] [[package]]
name = "libc" name = "libc"
version = "0.2.137" version = "0.2.135"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fc7fcc620a3bff7cdd7a365be3376c97191aeaccc2a603e600951e452615bf89" checksum = "68783febc7782c6c5cb401fbda4de5a9898be1762314da0bb2c10ced61f18b0c"
[[package]] [[package]]
name = "link-cplusplus" name = "link-cplusplus"
@@ -941,7 +940,7 @@ dependencies = [
"dirs-next", "dirs-next",
"objc-foundation", "objc-foundation",
"objc_id", "objc_id",
"time 0.3.16", "time 0.3.15",
] ]
[[package]] [[package]]
@@ -985,9 +984,9 @@ dependencies = [
[[package]] [[package]]
name = "mio" name = "mio"
version = "0.8.5" version = "0.8.4"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e5d732bc30207a6423068df043e3d02e0735b155ad7ce1a6f76fe2baa5b158de" checksum = "57ee1c23c7c63b0c9250c339ffdc69255f110b298b901b9f6c82547b7b87caaf"
dependencies = [ dependencies = [
"libc", "libc",
"log", "log",
@@ -1109,9 +1108,9 @@ dependencies = [
[[package]] [[package]]
name = "once_cell" name = "once_cell"
version = "1.16.0" version = "1.15.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "86f0b0d4bf799edbc74508c1e8bf170ff5f41238e5f8225603ca7caaae2b7860" checksum = "e82dad04139b71a90c080c8463fe0dc7902db5192d939bd0950f074d014339e1"
[[package]] [[package]]
name = "ordered-multimap" name = "ordered-multimap"
@@ -1135,9 +1134,9 @@ dependencies = [
[[package]] [[package]]
name = "os_str_bytes" name = "os_str_bytes"
version = "6.3.1" version = "6.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3baf96e39c5359d2eb0dd6ccb42c62b91d9678aa68160d261b9e0ccbf9e9dea9" checksum = "9ff7415e9ae3fff1225851df9e0d9e4e5479f947619774677a63572e55e80eff"
[[package]] [[package]]
name = "parking" name = "parking"
@@ -1157,9 +1156,9 @@ dependencies = [
[[package]] [[package]]
name = "parking_lot_core" name = "parking_lot_core"
version = "0.9.4" version = "0.9.3"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4dc9e0dc2adc1c69d09143aff38d3d30c5c3f0df0dad82e6d25547af174ebec0" checksum = "09a279cbf25cb0757810394fbc1e359949b59e348145c643a939a525692e6929"
dependencies = [ dependencies = [
"cfg-if", "cfg-if",
"libc", "libc",
@@ -1201,9 +1200,9 @@ checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184"
[[package]] [[package]]
name = "polling" name = "polling"
version = "2.4.0" version = "2.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ab4609a838d88b73d8238967b60dd115cc08d38e2bbaf51ee1e4b695f89122e2" checksum = "899b00b9c8ab553c743b3e11e87c5c7d423b2a2de229ba95b24a756344748011"
dependencies = [ dependencies = [
"autocfg", "autocfg",
"cfg-if", "cfg-if",
@@ -1448,9 +1447,9 @@ dependencies = [
[[package]] [[package]]
name = "rustls" name = "rustls"
version = "0.20.7" version = "0.20.6"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "539a2bfe908f471bfa933876bd1eb6a19cf2176d375f82ef7f99530a40e48c2c" checksum = "5aab8ee6c7097ed6057f43c187a62418d0c05a4bd5f18b3571db50ee0f9ce033"
dependencies = [ dependencies = [
"log", "log",
"ring", "ring",
@@ -1539,18 +1538,18 @@ checksum = "e25dfac463d778e353db5be2449d1cce89bd6fd23c9f1ea21310ce6e5a1b29c4"
[[package]] [[package]]
name = "serde" name = "serde"
version = "1.0.147" version = "1.0.145"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d193d69bae983fc11a79df82342761dfbf28a99fc8d203dca4c3c1b590948965" checksum = "728eb6351430bccb993660dfffc5a72f91ccc1295abaa8ce19b27ebe4f75568b"
dependencies = [ dependencies = [
"serde_derive", "serde_derive",
] ]
[[package]] [[package]]
name = "serde_derive" name = "serde_derive"
version = "1.0.147" version = "1.0.145"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4f1d362ca8fc9c3e3a7484440752472d68a6caa98f1ab81d99b5dfe517cec852" checksum = "81fa1584d3d1bcacd84c277a0dfe21f5b0f6accf4a23d04d4c6d61f1af522b4c"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
@@ -1559,9 +1558,9 @@ dependencies = [
[[package]] [[package]]
name = "serde_json" name = "serde_json"
version = "1.0.87" version = "1.0.86"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6ce777b7b150d76b9cf60d28b55f5847135a003f7d7350c6be7a773508ce7d45" checksum = "41feea4228a6f1cd09ec7a3593a682276702cd67b5273544757dae23c096f074"
dependencies = [ dependencies = [
"itoa", "itoa",
"ryu", "ryu",
@@ -1712,9 +1711,9 @@ dependencies = [
[[package]] [[package]]
name = "syn" name = "syn"
version = "1.0.103" version = "1.0.102"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a864042229133ada95abf3b54fdc62ef5ccabe9515b64717bcb9a1919e59445d" checksum = "3fcd952facd492f9be3ef0d0b7032a6e442ee9b361d4acc2b1d0c4aaa5f613a1"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
@@ -1825,32 +1824,21 @@ dependencies = [
[[package]] [[package]]
name = "time" name = "time"
version = "0.3.16" version = "0.3.15"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0fab5c8b9980850e06d92ddbe3ab839c062c801f3927c0fb8abd6fc8e918fbca" checksum = "d634a985c4d4238ec39cacaed2e7ae552fbd3c476b552c1deac3021b7d7eaf0c"
dependencies = [ dependencies = [
"itoa", "itoa",
"libc", "libc",
"num_threads", "num_threads",
"serde",
"time-core",
"time-macros", "time-macros",
] ]
[[package]]
name = "time-core"
version = "0.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2e153e1f1acaef8acc537e68b44906d2db6436e2b35ac2c6b42640fff91f00fd"
[[package]] [[package]]
name = "time-macros" name = "time-macros"
version = "0.2.5" version = "0.2.4"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "65bb801831d812c562ae7d2bfb531f26e66e4e1f6b17307ba4149c5064710e5b" checksum = "42657b1a6f4d817cda8e7a0ace261fe0cc946cf3a80314390b22cc61ae080792"
dependencies = [
"time-core",
]
[[package]] [[package]]
name = "tinyvec" name = "tinyvec"
@@ -1920,8 +1908,8 @@ dependencies = [
] ]
[[package]] [[package]]
name = "topgrade" name = "topgrade-rs"
version = "10.1.0" version = "10.0.1"
dependencies = [ dependencies = [
"anyhow", "anyhow",
"cfg-if", "cfg-if",
@@ -2271,24 +2259,22 @@ dependencies = [
[[package]] [[package]]
name = "windows-sys" name = "windows-sys"
version = "0.42.0" version = "0.36.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5a3e1820f08b8513f676f7ab6c1f99ff312fb97b553d30ff4dd86f9f15728aa7" checksum = "ea04155a16a59f9eab786fe12a4a450e75cdb175f9e0d80da1e17db09f55b8d2"
dependencies = [ dependencies = [
"windows_aarch64_gnullvm", "windows_aarch64_msvc 0.36.1",
"windows_aarch64_msvc 0.42.0", "windows_i686_gnu 0.36.1",
"windows_i686_gnu 0.42.0", "windows_i686_msvc 0.36.1",
"windows_i686_msvc 0.42.0", "windows_x86_64_gnu 0.36.1",
"windows_x86_64_gnu 0.42.0", "windows_x86_64_msvc 0.36.1",
"windows_x86_64_gnullvm",
"windows_x86_64_msvc 0.42.0",
] ]
[[package]] [[package]]
name = "windows_aarch64_gnullvm" name = "windows_aarch64_msvc"
version = "0.42.0" version = "0.36.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "41d2aa71f6f0cbe00ae5167d90ef3cfe66527d6f613ca78ac8024c3ccab9a19e" checksum = "9bb8c3fd39ade2d67e9874ac4f3db21f0d710bee00fe7cab16949ec184eeaa47"
[[package]] [[package]]
name = "windows_aarch64_msvc" name = "windows_aarch64_msvc"
@@ -2297,10 +2283,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ec7711666096bd4096ffa835238905bb33fb87267910e154b18b44eaabb340f2" checksum = "ec7711666096bd4096ffa835238905bb33fb87267910e154b18b44eaabb340f2"
[[package]] [[package]]
name = "windows_aarch64_msvc" name = "windows_i686_gnu"
version = "0.42.0" version = "0.36.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "dd0f252f5a35cac83d6311b2e795981f5ee6e67eb1f9a7f64eb4500fbc4dcdb4" checksum = "180e6ccf01daf4c426b846dfc66db1fc518f074baa793aa7d9b9aaeffad6a3b6"
[[package]] [[package]]
name = "windows_i686_gnu" name = "windows_i686_gnu"
@@ -2309,10 +2295,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "763fc57100a5f7042e3057e7e8d9bdd7860d330070251a73d003563a3bb49e1b" checksum = "763fc57100a5f7042e3057e7e8d9bdd7860d330070251a73d003563a3bb49e1b"
[[package]] [[package]]
name = "windows_i686_gnu" name = "windows_i686_msvc"
version = "0.42.0" version = "0.36.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fbeae19f6716841636c28d695375df17562ca208b2b7d0dc47635a50ae6c5de7" checksum = "e2e7917148b2812d1eeafaeb22a97e4813dfa60a3f8f78ebe204bcc88f12f024"
[[package]] [[package]]
name = "windows_i686_msvc" name = "windows_i686_msvc"
@@ -2321,10 +2307,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7bc7cbfe58828921e10a9f446fcaaf649204dcfe6c1ddd712c5eebae6bda1106" checksum = "7bc7cbfe58828921e10a9f446fcaaf649204dcfe6c1ddd712c5eebae6bda1106"
[[package]] [[package]]
name = "windows_i686_msvc" name = "windows_x86_64_gnu"
version = "0.42.0" version = "0.36.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "84c12f65daa39dd2babe6e442988fc329d6243fdce47d7d2d155b8d874862246" checksum = "4dcd171b8776c41b97521e5da127a2d86ad280114807d0b2ab1e462bc764d9e1"
[[package]] [[package]]
name = "windows_x86_64_gnu" name = "windows_x86_64_gnu"
@@ -2333,16 +2319,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6868c165637d653ae1e8dc4d82c25d4f97dd6605eaa8d784b5c6e0ab2a252b65" checksum = "6868c165637d653ae1e8dc4d82c25d4f97dd6605eaa8d784b5c6e0ab2a252b65"
[[package]] [[package]]
name = "windows_x86_64_gnu" name = "windows_x86_64_msvc"
version = "0.42.0" version = "0.36.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bf7b1b21b5362cbc318f686150e5bcea75ecedc74dd157d874d754a2ca44b0ed" checksum = "c811ca4a8c853ef420abd8592ba53ddbbac90410fab6903b3e79972a631f7680"
[[package]]
name = "windows_x86_64_gnullvm"
version = "0.42.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "09d525d2ba30eeb3297665bd434a54297e4170c7f1a44cad4ef58095b4cd2028"
[[package]] [[package]]
name = "windows_x86_64_msvc" name = "windows_x86_64_msvc"
@@ -2350,12 +2330,6 @@ version = "0.39.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5e4d40883ae9cae962787ca76ba76390ffa29214667a111db9e0a1ad8377e809" checksum = "5e4d40883ae9cae962787ca76ba76390ffa29214667a111db9e0a1ad8377e809"
[[package]]
name = "windows_x86_64_msvc"
version = "0.42.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f40009d85759725a34da6d89a94e63d7bdc50a862acf0dbc7c8e488f1edcb6f5"
[[package]] [[package]]
name = "winreg" name = "winreg"
version = "0.10.1" version = "0.10.1"
@@ -2448,7 +2422,7 @@ dependencies = [
"crc32fast", "crc32fast",
"crossbeam-utils", "crossbeam-utils",
"flate2", "flate2",
"time 0.3.16", "time 0.3.15",
] ]
[[package]] [[package]]

View File

@@ -1,11 +1,11 @@
[package] [package]
name = "topgrade" name = "topgrade-rs"
description = "Upgrade all the things" description = "Upgrade all the things, successor of topgrade"
categories = ["os"] categories = ["os"]
keywords = ["upgrade", "update"] keywords = ["upgrade", "update"]
license-file = "LICENSE" license-file = "LICENSE"
repository = "https://github.com/topgrade-rs/topgrade" repository = "https://github.com/topgrade-rs/topgrade"
version = "10.1.0" version = "10.0.1"
authors = ["Roey Darwish Dror <roey.ghost@gmail.com>", "Thomas Schönauer <t.schoenauer@hgs-wt.at>"] authors = ["Roey Darwish Dror <roey.ghost@gmail.com>", "Thomas Schönauer <t.schoenauer@hgs-wt.at>"]
exclude = ["doc/screenshot.gif"] exclude = ["doc/screenshot.gif"]
edition = "2021" edition = "2021"
@@ -16,9 +16,6 @@ readme = "README.md"
name = "topgrade" name = "topgrade"
path = "src/main.rs" path = "src/main.rs"
##[lib]
##name = "topgrade_lib"
[dependencies] [dependencies]
home = "0.5" home = "0.5"
directories = "4.0" directories = "4.0"

View File

@@ -1,89 +1,59 @@
<div align="center"> ![Topgrade](doc/topgrade.png)
<img alt="Topgrade" src="doc/topgrade.png" width="850px"> <!---
![GitHub release](https://img.shields.io/github/release/r-darwish/topgrade.svg)
<!-- [![Crates.io](https://img.shields.io/crates/v/topgrade.svg)](https://crates.io/crates/topgrade)
<a href="https://github.com/topgrade-rs/topgrade/releases"><img alt="GitHub Release" src="https://img.shields.io/github/release/r-darwish/topgrade.svg"></a> [![AUR](https://img.shields.io/aur/version/topgrade.svg)](https://aur.archlinux.org/packages/topgrade/)
<a href="https://crates.io/crates/topgrade"><img alt="crates.io" src="https://img.shields.io/crates/v/topgrade.svg"></a> ![homebrew](https://img.shields.io/homebrew/v/topgrade.svg) -->
<a href="https://aur.archlinux.org/packages/topgrade"><img alt="AUR" src="https://img.shields.io/aur/version/topgrade.svg"></a> --->
<a href="https://formulae.brew.sh/formula/topgrade"><img alt="Homebrew" src="https://img.shields.io/homebrew/v/topgrade.svg"></a>
-->
<img alt="Demo" src="doc/screenshot.gif" width="550px"> ![Demo](doc/screenshot.gif)
</div>
## Fork
## Introduction This is a fork of [topgrade by r-darwish](https://github.com/r-darwish/topgrade) to keep it maintained.
> **Note**
> This is a fork of [topgrade by r-darwish](https://github.com/r-darwish/topgrade) to keep it maintained.
Keeping your system up to date usually involves invoking multiple package managers. Keeping your system up to date usually involves invoking multiple package managers.
This results in big, non-portable shell one-liners saved in your shell. This results in big, non-portable shell one-liners saved in your shell.
To remedy this, **Topgrade** detects which tools you use and runs the appropriate commands to update them. To remedy this, _topgrade_ detects which tools you use and runs the appropriate commands to update them.
## Installation ## Installation
- Arch Linux: [AUR](https://aur.archlinux.org/packages/topgrade/) package.
- Arch Linux: [AUR](https://aur.archlinux.org/packages/topgrade) package.
- NixOS: _topgrade_ package in `nixpkgs`. - NixOS: _topgrade_ package in `nixpkgs`.
- macOS: [Homebrew](https://formulae.brew.sh/formula/topgrade) or [MacPorts](https://ports.macports.org/port/topgrade/). - macOS: [Homebrew](https://brew.sh/) or [MacPorts](https://www.macports.org/install.php).
Other systems users can either use `cargo install` or use the compiled binaries from the release page. Other systems users can either use `cargo install` or use the compiled binaries from the release page.
The compiled binaries contain a self-upgrading feature. The compiled binaries contain a self-upgrading feature.
Topgrade requires Rust 1.51 or above. Topgrade requires Rust 1.51 or above.
## Documentation ## Documentation[WIP]
> **Warning**
> Work in Progress
You can visit the documentation at [topgrade-rs.github.io](https://topgrade-rs.github.io/) . You can visit the documentation at [topgrade-rs.github.io](https://topgrade-rs.github.io/) .
## Usage ## Usage
Just run `topgrade`. Just run `topgrade`.
See [the wiki](https://github.com/r-darwish/topgrade/wiki/Step-list) for the list of things Topgrade supports. See [the wiki](https://github.com/r-darwish/topgrade/wiki/Step-list) for the list of things Topgrade supports.
## Customization ## Customization
See `config.example.toml` for an example configuration file. See `config.example.toml` for an example configuration file.
### Configuration path ### Configuration path
The configuration should be placed in the following paths depending by the operating system: The configuration should be placed in the following paths depending by the operating system:
- **Windows** - `%APPDATA%/topgrade.toml` * **Windows** - `%APPDATA%/topgrade.toml`
- **macOS** and **other Unix systems** - `${XDG_CONFIG_HOME:-~/.config}/topgrade.toml` * **macOS** and **other Unix systems** - `${XDG_CONFIG_HOME:-~/.config}/topgrade.toml`
## Contribution ## Contribution
### Problems or missing features? ### Problems or missing features?
Open a new Issue describing your problem and if possible with a possible solution. Open a new Issue describing your problem and if possible with a possible solution.
### Missing a feature or found an unsupported tool/distro? ### Missing a feature or found an unsupported tool/distro?
Just let us now what you are missing by opening an issue. Just let us now what you are missing by opening an issue.
For tools please open an Issue describing the tool, which platforms it supports and if possible, give us an example of its usage. For tools please open an Issue describing the tool, which platforms it supports and if possible, give us an example of its usage.
### Want to contribute to the code? ### Want to contribute to the code?
Just fork the repository and start coding. Just fork the repository and start coding.
### Contribution Guidelines
- Check if your code passes `cargo fmt` and `cargo clippy`.
- Check if your code is self explanatory, if not it should be documented by comments.
- Make a Pull Request to the dev branch for new features or to the bug-fixes branch for bug fixes.
## Remote execution ## Remote execution
You can specify a key called `remote_topgrades` in the configuration file. You can specify a key called `remote_topgrades` in the configuration file.
This key should contain a list of hostnames that have Topgrade installed on them. This key should contain a list of hostnames that have topgrade installed on them.
Topgrade will use `ssh` to run `topgrade` on remote hosts before acting locally. Topgrade will use `ssh` to run `topgrade` on remote hosts before acting locally.
To limit the execution only to specific hosts use the `--remote-host-limit` parameter. To limit the execution only to specific hosts use the `--remote-host-limit` parameter.
## ToDo
- Add a proper testing framework to the code base.
- Add unit tests for package managers.
- Split up code into more maintainable parts, eg. putting every linux package manager in a own submodule of linux.rs.

View File

@@ -107,7 +107,3 @@
[flatpak] [flatpak]
# Use sudo for updating the system-wide installation # Use sudo for updating the system-wide installation
#use_sudo = true #use_sudo = true
[distrobox]
#use_root = false
#containers = ["archlinux-latest"]

View File

@@ -83,7 +83,6 @@ pub enum Step {
Containers, Containers,
CustomCommands, CustomCommands,
DebGet, DebGet,
Distrobox,
Deno, Deno,
Dotnet, Dotnet,
Emacs, Emacs,
@@ -93,7 +92,6 @@ pub enum Step {
Fossil, Fossil,
Gcloud, Gcloud,
Gem, Gem,
Ghcup,
GithubCliExtensions, GithubCliExtensions,
GitRepos, GitRepos,
Go, Go,
@@ -122,7 +120,6 @@ pub enum Step {
Powershell, Powershell,
Protonup, Protonup,
Raco, Raco,
Rcm,
Remotes, Remotes,
Restarts, Restarts,
Rtcl, Rtcl,
@@ -174,14 +171,6 @@ pub struct Windows {
enable_winget: Option<bool>, enable_winget: Option<bool>,
} }
#[derive(Deserialize, Default, Debug)]
#[serde(deny_unknown_fields)]
#[allow(clippy::upper_case_acronyms)]
pub struct Distrobox {
use_root: Option<bool>,
containers: Option<Vec<String>>,
}
#[derive(Deserialize, Default, Debug)] #[derive(Deserialize, Default, Debug)]
#[serde(deny_unknown_fields)] #[serde(deny_unknown_fields)]
#[allow(clippy::upper_case_acronyms)] #[allow(clippy::upper_case_acronyms)]
@@ -303,7 +292,6 @@ pub struct ConfigFile {
firmware: Option<Firmware>, firmware: Option<Firmware>,
vagrant: Option<Vagrant>, vagrant: Option<Vagrant>,
flatpak: Option<Flatpak>, flatpak: Option<Flatpak>,
distrobox: Option<Distrobox>,
} }
fn config_directory(base_dirs: &BaseDirs) -> PathBuf { fn config_directory(base_dirs: &BaseDirs) -> PathBuf {
@@ -626,6 +614,7 @@ impl Config {
} }
/// Extra Tmux arguments /// Extra Tmux arguments
pub fn tmux_arguments(&self) -> &Option<String> { pub fn tmux_arguments(&self) -> &Option<String> {
&self.config_file.tmux_arguments &self.config_file.tmux_arguments
} }
@@ -819,20 +808,6 @@ impl Config {
.and_then(|linux| linux.dnf_arguments.as_deref()) .and_then(|linux| linux.dnf_arguments.as_deref())
} }
/// Distrobox use root
pub fn distrobox_root(&self) -> bool {
self.config_file
.distrobox
.as_ref()
.and_then(|r| r.use_root)
.unwrap_or(false)
}
/// Distrobox containers
pub fn distrobox_containers(&self) -> Option<&Vec<String>> {
self.config_file.distrobox.as_ref().and_then(|r| r.containers.as_ref())
}
/// Concurrency limit for git /// Concurrency limit for git
pub fn git_concurrency_limit(&self) -> Option<usize> { pub fn git_concurrency_limit(&self) -> Option<usize> {
self.config_file.git.as_ref().and_then(|git| git.max_concurrency) self.config_file.git.as_ref().and_then(|git| git.max_concurrency)

View File

@@ -1,2 +0,0 @@
//pub mod steps;
//pub mod utils;

View File

@@ -209,11 +209,6 @@ fn run() -> Result<()> {
freebsd::upgrade_packages(sudo.as_ref(), run_type) freebsd::upgrade_packages(sudo.as_ref(), run_type)
})?; })?;
#[cfg(target_os = "openbsd")]
runner.execute(Step::Pkg, "OpenBSD Packages", || {
openbsd::upgrade_packages(sudo.as_ref(), run_type)
})?;
#[cfg(target_os = "android")] #[cfg(target_os = "android")]
runner.execute(Step::Pkg, "Termux Packages", || android::upgrade_packages(&ctx))?; runner.execute(Step::Pkg, "Termux Packages", || android::upgrade_packages(&ctx))?;
@@ -236,10 +231,6 @@ fn run() -> Result<()> {
git_repos.insert_if_repo(base_dirs.home_dir().join(".ideavimrc")); git_repos.insert_if_repo(base_dirs.home_dir().join(".ideavimrc"));
git_repos.insert_if_repo(base_dirs.home_dir().join(".intellimacs")); git_repos.insert_if_repo(base_dirs.home_dir().join(".intellimacs"));
if config.should_run(Step::Rcm) {
git_repos.insert_if_repo(base_dirs.home_dir().join(".dotfiles"));
}
#[cfg(unix)] #[cfg(unix)]
{ {
git_repos.insert_if_repo(zsh::zshrc(&base_dirs)); git_repos.insert_if_repo(zsh::zshrc(&base_dirs));
@@ -300,7 +291,6 @@ fn run() -> Result<()> {
runner.execute(Step::Shell, "bash-it", || unix::run_bashit(&ctx))?; runner.execute(Step::Shell, "bash-it", || unix::run_bashit(&ctx))?;
runner.execute(Step::Shell, "oh-my-fish", || unix::run_oh_my_fish(&ctx))?; runner.execute(Step::Shell, "oh-my-fish", || unix::run_oh_my_fish(&ctx))?;
runner.execute(Step::Shell, "fish-plug", || unix::run_fish_plug(&ctx))?; runner.execute(Step::Shell, "fish-plug", || unix::run_fish_plug(&ctx))?;
runner.execute(Step::Shell, "fundle", || unix::run_fundle(&ctx))?;
runner.execute(Step::Tmux, "tmux", || tmux::run_tpm(&base_dirs, run_type))?; runner.execute(Step::Tmux, "tmux", || tmux::run_tpm(&base_dirs, run_type))?;
runner.execute(Step::Tldr, "TLDR", || unix::run_tldr(run_type))?; runner.execute(Step::Tldr, "TLDR", || unix::run_tldr(run_type))?;
runner.execute(Step::Pearl, "pearl", || unix::run_pearl(run_type))?; runner.execute(Step::Pearl, "pearl", || unix::run_pearl(run_type))?;
@@ -311,7 +301,6 @@ fn run() -> Result<()> {
runner.execute(Step::Sdkman, "SDKMAN!", || { runner.execute(Step::Sdkman, "SDKMAN!", || {
unix::run_sdkman(&base_dirs, config.cleanup(), run_type) unix::run_sdkman(&base_dirs, config.cleanup(), run_type)
})?; })?;
runner.execute(Step::Rcm, "rcm", || unix::run_rcm(&ctx))?;
} }
#[cfg(not(any( #[cfg(not(any(
@@ -334,7 +323,6 @@ fn run() -> Result<()> {
runner.execute(Step::Pipx, "pipx", || generic::run_pipx_update(run_type))?; runner.execute(Step::Pipx, "pipx", || generic::run_pipx_update(run_type))?;
runner.execute(Step::Conda, "conda", || generic::run_conda_update(&ctx))?; runner.execute(Step::Conda, "conda", || generic::run_conda_update(&ctx))?;
runner.execute(Step::Pip3, "pip3", || generic::run_pip3_update(run_type))?; runner.execute(Step::Pip3, "pip3", || generic::run_pip3_update(run_type))?;
runner.execute(Step::Ghcup, "ghcup", || generic::run_ghcup_update(run_type))?;
runner.execute(Step::Stack, "stack", || generic::run_stack_update(run_type))?; runner.execute(Step::Stack, "stack", || generic::run_stack_update(run_type))?;
runner.execute(Step::Tlmgr, "tlmgr", || generic::run_tlmgr_update(&ctx))?; runner.execute(Step::Tlmgr, "tlmgr", || generic::run_tlmgr_update(&ctx))?;
runner.execute(Step::Myrepos, "myrepos", || { runner.execute(Step::Myrepos, "myrepos", || {
@@ -380,7 +368,6 @@ fn run() -> Result<()> {
runner.execute(Step::Pacstall, "pacstall", || linux::run_pacstall(&ctx))?; runner.execute(Step::Pacstall, "pacstall", || linux::run_pacstall(&ctx))?;
runner.execute(Step::Pacdef, "pacdef", || linux::run_pacdef(&ctx))?; runner.execute(Step::Pacdef, "pacdef", || linux::run_pacdef(&ctx))?;
runner.execute(Step::Protonup, "protonup", || linux::run_protonup_update(&ctx))?; runner.execute(Step::Protonup, "protonup", || linux::run_protonup_update(&ctx))?;
runner.execute(Step::Distrobox, "distrobox", || linux::run_distrobox_update(&ctx))?;
} }
if let Some(commands) = config.commands() { if let Some(commands) = config.commands() {
@@ -416,11 +403,6 @@ fn run() -> Result<()> {
freebsd::upgrade_freebsd(sudo.as_ref(), run_type) freebsd::upgrade_freebsd(sudo.as_ref(), run_type)
})?; })?;
#[cfg(target_os = "openbsd")]
runner.execute(Step::System, "OpenBSD Upgrade", || {
openbsd::upgrade_openbsd(sudo.as_ref(), run_type)
})?;
#[cfg(windows)] #[cfg(windows)]
runner.execute(Step::System, "Windows update", || windows::windows_update(&ctx))?; runner.execute(Step::System, "Windows update", || windows::windows_update(&ctx))?;
@@ -504,6 +486,9 @@ fn run() -> Result<()> {
} }
fn main() { fn main() {
print_info("Due to r-darwish giving this project access to the original topgrade crate, this crate will no longer receive any updates beyond the 10.0.1 update. To install the supported version, please run the following command: \n");
println!("cargo uninstall topgrade-rs");
println!("cargo install topgrade");
match run() { match run() {
Ok(()) => { Ok(()) => {
exit(0); exit(0);

View File

@@ -31,7 +31,7 @@ impl Drop for SelfRenamer {
} }
match fs::rename(&self.temp_path, &self.exe_path) { match fs::rename(&self.temp_path, &self.exe_path) {
Ok(_) => debug!("Moved Topgrade back from {:?} to {:?}", self.temp_path, self.exe_path), Ok(_) => debug!("Moved topgrade back from {:?} to {:?}", self.temp_path, self.exe_path),
Err(e) => error!( Err(e) => error!(
"Could not move Topgrade from {} back to {}: {}", "Could not move Topgrade from {} back to {}: {}",
self.temp_path.display(), self.temp_path.display(),

View File

@@ -15,14 +15,10 @@ pub fn self_update() -> Result<()> {
let target = self_update_crate::get_target(); let target = self_update_crate::get_target();
let result = Update::configure() let result = Update::configure()
.repo_owner("topgrade-rs") .repo_owner("r-darwish")
.repo_name("topgrade") .repo_name("topgrade")
.target(target) .target(target)
.bin_name(if cfg!(windows) { .bin_name(if cfg!(windows) { "topgrade.exe" } else { "topgrade" })
"topgrade-rs.exe"
} else {
"topgrade-rs"
})
.show_output(false) .show_output(false)
.show_download_progress(true) .show_download_progress(true)
.current_version(self_update_crate::cargo_crate_version!()) .current_version(self_update_crate::cargo_crate_version!())

View File

@@ -289,26 +289,12 @@ pub fn run_pip3_update(run_type: RunType) -> Result<()> {
} }
pub fn run_stack_update(run_type: RunType) -> Result<()> { pub fn run_stack_update(run_type: RunType) -> Result<()> {
if let Ok(_) = utils::require("ghcup") {
// `ghcup` is present and probably(?) being used to install `stack`.
// Don't upgrade `stack`, let `ghcup` handle it. Per `ghcup install stack`:
// !!! Additionally, you should upgrade stack only through ghcup and not use 'stack upgrade' !!!
return Ok(());
}
let stack = utils::require("stack")?; let stack = utils::require("stack")?;
print_separator("stack"); print_separator("stack");
run_type.execute(&stack).arg("upgrade").check_run() run_type.execute(&stack).arg("upgrade").check_run()
} }
pub fn run_ghcup_update(run_type: RunType) -> Result<()> {
let ghcup = utils::require("ghcup")?;
print_separator("ghcup");
run_type.execute(&ghcup).arg("upgrade").check_run()
}
pub fn run_tlmgr_update(ctx: &ExecutionContext) -> Result<()> { pub fn run_tlmgr_update(ctx: &ExecutionContext) -> Result<()> {
cfg_if::cfg_if! { cfg_if::cfg_if! {
if #[cfg(any(target_os = "linux", target_os = "android"))] { if #[cfg(any(target_os = "linux", target_os = "android"))] {

View File

@@ -5,33 +5,27 @@ use crate::Step;
use anyhow::Result; use anyhow::Result;
pub fn upgrade_packages(ctx: &ExecutionContext) -> Result<()> { pub fn upgrade_packages(ctx: &ExecutionContext) -> Result<()> {
//let pkg = require("pkg")?; let pkg = require("pkg")?;
let pkg = which("nala").or_else(|| which("pkg")).unwrap();
print_separator("Termux Packages"); print_separator("Termux Packages");
let is_nala = pkg.end_with("nala");
let mut command = ctx.run_type().execute(&pkg); let mut command = ctx.run_type().execute(&pkg);
command.arg("upgrade"); command.arg("upgrade");
if ctx.config().yes(Step::System) { if ctx.config().yes(Step::System) {
command.arg("-y"); command.arg("-y");
} }
command.check_run()?; command.check_run()?;
if !is_nala { if ctx.config().cleanup() {
if ctx.config().cleanup() { ctx.run_type().execute(&pkg).arg("clean").check_run()?;
ctx.run_type().execute(&pkg).arg("clean").check_run()?;
let apt = require("apt")?; let apt = require("apt")?;
let mut command = ctx.run_type().execute(&apt); let mut command = ctx.run_type().execute(&apt);
command.arg("autoremove"); command.arg("autoremove");
if ctx.config().yes(Step::System) { if ctx.config().yes(Step::System) {
command.arg("-y"); command.arg("-y");
}
command.check_run()?;
} }
command.check_run()?;
} }
Ok(()) Ok(())

View File

@@ -606,29 +606,6 @@ pub fn run_protonup_update(ctx: &ExecutionContext) -> Result<()> {
Ok(()) Ok(())
} }
pub fn run_distrobox_update(ctx: &ExecutionContext) -> Result<()> {
print_separator("Distrobox");
match (
match (
ctx.run_type().execute("distrobox").arg("upgrade"),
ctx.config().distrobox_containers(),
) {
(r, Some(c)) => {
if c.is_empty() {
return Err(SkipStep("You need to specify at least one container".to_string()).into());
}
r.args(c)
}
(r, None) => r.arg("--all"),
},
ctx.config().distrobox_root(),
) {
(r, true) => r.arg("--root"),
(r, false) => r,
}
.check_run()
}
pub fn run_config_update(ctx: &ExecutionContext) -> Result<()> { pub fn run_config_update(ctx: &ExecutionContext) -> Result<()> {
let sudo = require_option(ctx.sudo().as_ref(), String::from("sudo is not installed"))?; let sudo = require_option(ctx.sudo().as_ref(), String::from("sudo is not installed"))?;
if ctx.config().yes(Step::ConfigUpdate) { if ctx.config().yes(Step::ConfigUpdate) {

View File

@@ -10,8 +10,6 @@ pub mod freebsd;
pub mod linux; pub mod linux;
#[cfg(target_os = "macos")] #[cfg(target_os = "macos")]
pub mod macos; pub mod macos;
#[cfg(target_os = "openbsd")]
pub mod openbsd;
#[cfg(unix)] #[cfg(unix)]
pub mod unix; pub mod unix;
#[cfg(target_os = "windows")] #[cfg(target_os = "windows")]

View File

@@ -1,17 +0,0 @@
use crate::executor::RunType;
use crate::terminal::print_separator;
use crate::utils::require_option;
use anyhow::Result;
use std::path::PathBuf;
pub fn upgrade_openbsd(sudo: Option<&PathBuf>, run_type: RunType) -> Result<()> {
let sudo = require_option(sudo, String::from("No sudo detected"))?;
print_separator("OpenBSD Update");
run_type.execute(sudo).args(&["/usr/sbin/sysupgrade", "-n"]).check_run()
}
pub fn upgrade_packages(sudo: Option<&PathBuf>, run_type: RunType) -> Result<()> {
let sudo = require_option(sudo, String::from("No sudo detected"))?;
print_separator("OpenBSD Packages");
run_type.execute(sudo).args(&["/usr/sbin/pkg_add", "-u"]).check_run()
}

View File

@@ -157,23 +157,6 @@ pub fn run_fish_plug(ctx: &ExecutionContext) -> Result<()> {
ctx.run_type().execute(&fish).args(["-c", "plug update"]).check_run() ctx.run_type().execute(&fish).args(["-c", "plug update"]).check_run()
} }
/// Upgrades `fundle` and `fundle` plugins.
///
/// `fundle` is a package manager for the Fish shell.
///
/// See: <https://github.com/danhper/fundle>
pub fn run_fundle(ctx: &ExecutionContext) -> Result<()> {
let fish = require("fish")?;
ctx.base_dirs().home_dir().join(".config/fish/fundle").require()?;
print_separator("fundle");
ctx.run_type()
.execute(fish)
.args(["-c", "fundle self-update && fundle update"])
.check_run()
}
#[cfg(not(any(target_os = "android", target_os = "macos")))] #[cfg(not(any(target_os = "android", target_os = "macos")))]
pub fn upgrade_gnome_extensions(ctx: &ExecutionContext) -> Result<()> { pub fn upgrade_gnome_extensions(ctx: &ExecutionContext) -> Result<()> {
let gdbus = require("gdbus")?; let gdbus = require("gdbus")?;
@@ -474,16 +457,6 @@ pub fn run_bun(ctx: &ExecutionContext) -> Result<()> {
ctx.run_type().execute(&bun).arg("upgrade").check_run() ctx.run_type().execute(&bun).arg("upgrade").check_run()
} }
/// Update dotfiles with `rcm(7)`.
///
/// See: <https://github.com/thoughtbot/rcm>
pub fn run_rcm(ctx: &ExecutionContext) -> Result<()> {
let rcup = require("rcup")?;
print_separator("rcm");
ctx.run_type().execute(rcup).arg("-v").check_run()
}
pub fn reboot() { pub fn reboot() {
print!("Rebooting..."); print!("Rebooting...");
Command::new("sudo").arg("reboot").spawn().unwrap().wait().unwrap(); Command::new("sudo").arg("reboot").spawn().unwrap().wait().unwrap();

View File

@@ -92,7 +92,7 @@ pub fn run_in_tmux(args: &Option<String>) -> ! {
tmux.new_session("topgrade").expect("Error creating a tmux session"); tmux.new_session("topgrade").expect("Error creating a tmux session");
} }
tmux.run_in_session(&command).expect("Error running Topgrade in tmux"); tmux.run_in_session(&command).expect("Error running topgrade in tmux");
tmux.build() tmux.build()
.args(["kill-window", "-t", "topgrade:dummy"]) .args(["kill-window", "-t", "topgrade:dummy"])
.output() .output()

View File

@@ -33,7 +33,7 @@ pub fn run_toolbx(ctx: &ExecutionContext) -> Result<()> {
debug!("Toolboxes to inspect: {:?}", toolboxes); debug!("Toolboxes to inspect: {:?}", toolboxes);
let mut topgrade_path = PathBuf::from("/run/host"); let mut topgrade_path = PathBuf::from("/run/host");
// Path of the running Topgrade executable // Path of the running topgrade executable
// Skip 1 to eliminate the path root, otherwise push overwrites the path // Skip 1 to eliminate the path root, otherwise push overwrites the path
topgrade_path.push(std::env::current_exe()?.components().skip(1).collect::<PathBuf>()); topgrade_path.push(std::env::current_exe()?.components().skip(1).collect::<PathBuf>());
let topgrade_path = topgrade_path.to_str().unwrap(); let topgrade_path = topgrade_path.to_str().unwrap();

View File

@@ -18,6 +18,11 @@ if exists(":PlugUpgrade")
endif endif
endif endif
if exists(":PackerUpdate")
echo "Packer"
PackerSync
endif
if exists("*dein#update()") if exists("*dein#update()")
echo "dein#update()" echo "dein#update()"
call dein#update() call dein#update()
@@ -38,10 +43,4 @@ if exists(":CocUpdateSync")
CocUpdateSync CocUpdateSync
endif endif
if exists(':PackerSync') quitall
echo "Packer"
autocmd User PackerComplete quitall
PackerSync
else
quitall
endif

View File

@@ -1,7 +1,7 @@
use crate::error::{SkipStep, TopgradeError}; use crate::error::{SkipStep, TopgradeError};
use anyhow::Result; use anyhow::Result;
use crate::executor::{CommandExt, Executor, ExecutorOutput, RunType}; use crate::executor::{CommandExt, ExecutorOutput, RunType};
use crate::terminal::print_separator; use crate::terminal::print_separator;
use crate::{ use crate::{
execution_context::ExecutionContext, execution_context::ExecutionContext,
@@ -9,7 +9,7 @@ use crate::{
}; };
use directories::BaseDirs; use directories::BaseDirs;
use log::debug; use log::debug;
use std::path::PathBuf; use std::path::{Path, PathBuf};
use std::{ use std::{
io::{self, Write}, io::{self, Write},
process::Command, process::Command,
@@ -40,14 +40,19 @@ fn nvimrc(base_dirs: &BaseDirs) -> Result<PathBuf> {
.or_else(|_| base_dir.join("nvim/init.lua").require()) .or_else(|_| base_dir.join("nvim/init.lua").require())
} }
fn upgrade_script() -> Result<tempfile::NamedTempFile> { fn upgrade(vim: &Path, vimrc: &Path, ctx: &ExecutionContext) -> Result<()> {
let mut tempfile = tempfile::NamedTempFile::new()?; let mut tempfile = tempfile::NamedTempFile::new()?;
tempfile.write_all(UPGRADE_VIM.replace('\r', "").as_bytes())?; tempfile.write_all(UPGRADE_VIM.replace('\r', "").as_bytes())?;
debug!("Wrote vim script to {:?}", tempfile.path()); debug!("Wrote vim script to {:?}", tempfile.path());
Ok(tempfile)
}
fn upgrade(command: &mut Executor, ctx: &ExecutionContext) -> Result<()> { let mut command = ctx.run_type().execute(vim);
command
.args(["-u"])
.arg(vimrc)
.args(["-U", "NONE", "-V1", "-nNesS"])
.arg(tempfile.path());
if ctx.config().force_vim_plug_update() { if ctx.config().force_vim_plug_update() {
command.env("TOPGRADE_FORCE_PLUGUPDATE", "true"); command.env("TOPGRADE_FORCE_PLUGUPDATE", "true");
} }
@@ -109,21 +114,13 @@ pub fn upgrade_vim(base_dirs: &BaseDirs, ctx: &ExecutionContext) -> Result<()> {
let output = Command::new(&vim).arg("--version").check_output()?; let output = Command::new(&vim).arg("--version").check_output()?;
if !output.starts_with("VIM") { if !output.starts_with("VIM") {
return Err(SkipStep(String::from("vim binary might be actually nvim")).into()); return Err(SkipStep(String::from("vim binary might by actually nvim")).into());
} }
let vimrc = vimrc(base_dirs)?; let vimrc = vimrc(base_dirs)?;
print_separator("Vim"); print_separator("Vim");
upgrade( upgrade(&vim, &vimrc, ctx)
ctx.run_type()
.execute(&vim)
.args(&["-u"])
.arg(vimrc)
.args(&["-U", "NONE", "-V1", "-nNesS"])
.arg(upgrade_script()?.path()),
ctx,
)
} }
pub fn upgrade_neovim(base_dirs: &BaseDirs, ctx: &ExecutionContext) -> Result<()> { pub fn upgrade_neovim(base_dirs: &BaseDirs, ctx: &ExecutionContext) -> Result<()> {
@@ -131,15 +128,7 @@ pub fn upgrade_neovim(base_dirs: &BaseDirs, ctx: &ExecutionContext) -> Result<()
let nvimrc = nvimrc(base_dirs)?; let nvimrc = nvimrc(base_dirs)?;
print_separator("Neovim"); print_separator("Neovim");
upgrade( upgrade(&nvim, &nvimrc, ctx)
ctx.run_type()
.execute(&nvim)
.args(&["-u"])
.arg(nvimrc)
.args(&["--headless", "-V1", "-nS"])
.arg(upgrade_script()?.path()),
ctx,
)
} }
pub fn run_voom(_base_dirs: &BaseDirs, run_type: RunType) -> Result<()> { pub fn run_voom(_base_dirs: &BaseDirs, run_type: RunType) -> Result<()> {

View File

@@ -2,7 +2,7 @@
.TH "topgrade" "8" .TH "topgrade" "8"
.SH NAME .SH NAME
.PP .PP
Topgrade \- Upgrade everything topgrade \- upgrade everything
.SH SYNOPSIS .SH SYNOPSIS
.PP .PP
topgrade [\fIoptions\f[]] topgrade [\fIoptions\f[]]
@@ -10,7 +10,7 @@ topgrade [\fIoptions\f[]]
.PP .PP
Keeping your system up to date usually involves invoking multiple package managers. Keeping your system up to date usually involves invoking multiple package managers.
This results in big, non-portable shell one-liners saved in your shell. This results in big, non-portable shell one-liners saved in your shell.
To remedy this, \fBTopgrade\fR detects which tools you use and runs the appropriate commands to update them. To remedy this, \fBtopgrade\fR detects which tools you use and runs the appropriate commands to update them.
.SH OPTIONS .SH OPTIONS
.TP .TP
.B \-\-only <only> .B \-\-only <only>
@@ -75,6 +75,6 @@ A list of steps must be provided as a list of separate arguments, i.e. 'topgrade
.SH BUGS .SH BUGS
For a list of bugs see <\fIhttps://github.com/r-darwish/topgrade/issues\fR>. For a list of bugs see <\fIhttps://github.com/r-darwish/topgrade/issues\fR>.
.SH AUTHOR .SH AUTHOR
\fBTopgrade\fR is maintained by Roey Dror (\[aq]r\-darwish\[aq]) and many other contributors. \fBtopgrade\fR is maintained by Roey Dror (\[aq]r\-darwish\[aq]) and many other contributors.
You can view the full list at You can view the full list at
<\fIhttps://github.com/r-darwish/topgrade/graphs/contributors\fR> <\fIhttps://github.com/r-darwish/topgrade/graphs/contributors\fR>