-
-
Notifications
You must be signed in to change notification settings - Fork 14k
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
teams-for-linux: 1.0.53 → 1.0.59, add updateScript #222440
Merged
SuperSandro2000
merged 2 commits into
NixOS:master
from
lilyinstarlight:upd/teams-for-linux-1.0.54
Apr 12, 2023
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
50 changes: 50 additions & 0 deletions
50
pkgs/applications/networking/instant-messengers/teams-for-linux/update.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
#!/usr/bin/env nix-shell | ||
#!nix-shell -i bash -p nix jq common-updater-scripts | ||
|
||
set -euo pipefail | ||
|
||
nixpkgs="$(git rev-parse --show-toplevel || (printf 'Could not find root of nixpkgs repo\nAre we running from within the nixpkgs git repo?\n' >&2; exit 1))" | ||
|
||
stripwhitespace() { | ||
sed -e 's/^[[:space:]]*//' -e 's/[[:space:]]*$//' | ||
} | ||
|
||
nixeval() { | ||
nix --extra-experimental-features nix-command eval --json --impure -f "$nixpkgs" "$1" | jq -r . | ||
} | ||
|
||
vendorhash() { | ||
(nix --extra-experimental-features nix-command build --impure --argstr nixpkgs "$nixpkgs" --argstr attr "$1" --expr '{ nixpkgs, attr }: let pkgs = import nixpkgs {}; in with pkgs.lib; (getAttrFromPath (splitString "." attr) pkgs).overrideAttrs (attrs: { outputHash = fakeHash; })' --no-link 2>&1 >/dev/null | tail -n3 | grep -F got: | cut -d: -f2- | stripwhitespace) 2>/dev/null || true | ||
} | ||
|
||
findpath() { | ||
path="$(nix --extra-experimental-features nix-command eval --json --impure -f "$nixpkgs" "$1.meta.position" | jq -r . | cut -d: -f1)" | ||
outpath="$(nix --extra-experimental-features nix-command eval --json --impure --expr "builtins.fetchGit \"$nixpkgs\"")" | ||
|
||
if [ -n "$outpath" ]; then | ||
path="${path/$(echo "$outpath" | jq -r .)/$nixpkgs}" | ||
fi | ||
|
||
echo "$path" | ||
} | ||
Comment on lines
+20
to
+29
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. tbh this can just be hardcoded |
||
|
||
attr="${UPDATE_NIX_ATTR_PATH:-teams-for-linux}" | ||
version="$(cd "$nixpkgs" && list-git-tags --pname="$(nixeval "$attr".pname)" --attr-path="$attr" | grep '^v' | sed -e 's|^v||' | sort -V | tail -n1)" | ||
|
||
pkgpath="$(findpath "$attr")" | ||
|
||
updated="$(cd "$nixpkgs" && update-source-version "$attr" "$version" --file="$pkgpath" --print-changes | jq -r length)" | ||
|
||
if [ "$updated" -eq 0 ]; then | ||
echo 'update.sh: Package version not updated, nothing to do.' | ||
exit 0 | ||
fi | ||
|
||
curhash="$(nixeval "$attr.offlineCache.outputHash")" | ||
newhash="$(vendorhash "$attr.offlineCache")" | ||
|
||
if [ -n "$newhash" ] && [ "$curhash" != "$newhash" ]; then | ||
sed -i -e "s|\"$curhash\"|\"$newhash\"|" "$pkgpath" | ||
else | ||
echo 'update.sh: New vendorHash same as old vendorHash, nothing to do.' | ||
fi |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should get this into nix-update if not already done
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah this one's a bit of a special one since it's not using any standard Yarn builder atm and we would have to just tell it that a package having
.offlineCache
means Yarn (which is a reasonably strong convention but isn't 100% consistent for packages like this since it's not a standard builder)Once we have
buildYarnPackage
though (#210814) we'll add support for it andyarnDeps
innix-update