git.iko.soy/typeable/nixpkgs
on master help sign in
Merge pull request #104018 from NeQuissimus/xterm_update

xterm: 353 -> 362, add test, add update script

commit08e6c4d00175aa8f026aea12e03b601787d69658 authorTim Steinbach <NeQuissimus@users.noreply.github.com> dateTue 17 Nov 2020, 12:15 (6 years ago) parent098412561e5626
3 files changed+88−18
nixos/tests/all-tests.nix+1 nixos/tests/xterm.nix+23 pkgs/applications/terminal-emulators/xterm/default.nix+64−18
nixos/tests/all-tests.nix+1
@@ -389,6 +389,7 @@ in
389389 xmonad = handleTest ./xmonad.nix {};
390390 xrdp = handleTest ./xrdp.nix {};
391391 xss-lock = handleTest ./xss-lock.nix {};
392+ xterm = handleTest ./xterm.nix {};
392393 yabar = handleTest ./yabar.nix {};
393394 yggdrasil = handleTest ./yggdrasil.nix {};
394395 zfs = handleTest ./zfs.nix {};
nixos/tests/xterm.nixnew file+23
@@ -0,0 +1,23 @@
1+import ./make-test-python.nix ({ pkgs, ...} : {
2+ name = "xterm";
3+ meta = with pkgs.stdenv.lib.maintainers; {
4+ maintainers = [ nequissimus ];
5+ };
6+
7+ machine = { pkgs, ... }:
8+ {
9+ imports = [ ./common/x11.nix ];
10+ services.xserver.desktopManager.xterm.enable = false;
11+ };
12+
13+ testScript =
14+ ''
15+ machine.wait_for_x()
16+ machine.succeed("DISPLAY=:0 xterm -title testterm -class testterm -fullscreen &")
17+ machine.sleep(2)
18+ machine.send_chars("echo $XTERM_VERSION >> /tmp/xterm_version\n")
19+ machine.wait_for_file("/tmp/xterm_version")
20+ assert "${pkgs.xterm.version}" in machine.succeed("cat /tmp/xterm_version")
21+ machine.screenshot("window")
22+ '';
23+})
pkgs/applications/terminal-emulators/xterm/default.nix+64−18
@@ -1,29 +1,41 @@
1−{ stdenv, fetchurl, fetchpatch, xorg, ncurses, freetype, fontconfig, pkgconfig, makeWrapper
2−, enableDecLocator ? true
3−}:
1+{ stdenv, fetchurl, fetchpatch, xorg, ncurses, freetype, fontconfig, pkgconfig
2+, makeWrapper, nixosTests, writeScript, common-updater-scripts, git, nixfmt, nix
3+, gnused, coreutils, enableDecLocator ? true }:
44
55stdenv.mkDerivation rec {
6− name = "xterm-353";
6+ pname = "xterm";
7+ version = "362";
78
89 src = fetchurl {
910 urls = [
10− "ftp://ftp.invisible-island.net/xterm/${name}.tgz"
11− "https://invisible-mirror.net/archives/xterm/${name}.tgz"
12− ];
13− sha256 = "0s5pkfn4r8iy09s1q1y78zhnr9f3sm6wgbqir7azaqggkppd68g5";
11+ "ftp://ftp.invisible-island.net/xterm/${pname}-${version}.tgz"
12+ "https://invisible-mirror.net/archives/xterm/${pname}-${version}.tgz"
13+ ];
14+ sha256 = "HU/+Im+o8CGFm7wwB3iP9jpGoxJC2b2ae9fr4k6BrKI=";
1415 };
1516
16− buildInputs =
17− [ xorg.libXaw xorg.xorgproto xorg.libXt xorg.libXext xorg.libX11 xorg.libSM xorg.libICE
18− ncurses freetype fontconfig pkgconfig xorg.libXft xorg.luit makeWrapper
19− ];
17+ buildInputs = [
18+ xorg.libXaw
19+ xorg.xorgproto
20+ xorg.libXt
21+ xorg.libXext
22+ xorg.libX11
23+ xorg.libSM
24+ xorg.libICE
25+ ncurses
26+ freetype
27+ fontconfig
28+ pkgconfig
29+ xorg.libXft
30+ xorg.luit
31+ makeWrapper
32+ ];
2033
21− patches = [
22− ./sixel-256.support.patch
23− ] ++ stdenv.lib.optional stdenv.hostPlatform.isMusl
24− (fetchpatch {
34+ patches = [ ./sixel-256.support.patch ]
35+ ++ stdenv.lib.optional stdenv.hostPlatform.isMusl (fetchpatch {
2536 name = "posix-ptys.patch";
26− url = "https://git.alpinelinux.org/aports/plain/community/xterm/posix-ptys.patch?id=3aa532e77875fa1db18c7fcb938b16647031bcc1";
37+ url =
38+ "https://git.alpinelinux.org/aports/plain/community/xterm/posix-ptys.patch?id=3aa532e77875fa1db18c7fcb938b16647031bcc1";
2739 sha256 = "0czgnsxkkmkrk1idw69qxbprh0jb4sw3c24zpnqq2v76jkl7zvlr";
2840 });
2941
@@ -62,10 +74,44 @@ stdenv.mkDerivation rec {
6274 install -D -t $out/share/icons/hicolor/48x48/apps icons/xterm-color_48x48.xpm
6375 '';
6476
77+ passthru = {
78+ updateScript = let
79+ # Tags that end in letters are unstable
80+ suffixes = stdenv.lib.concatStringsSep " "
81+ (map (c: "-c versionsort.suffix='${c}'")
82+ (stdenv.lib.stringToCharacters "abcdefghijklmnopqrstuvwxyz"));
83+ in writeScript "update.sh" ''
84+ #!${stdenv.shell}
85+ set -o errexit
86+ PATH=${
87+ stdenv.lib.makeBinPath [
88+ common-updater-scripts
89+ git
90+ nixfmt
91+ nix
92+ coreutils
93+ gnused
94+ ]
95+ }
96+
97+ oldVersion="$(nix-instantiate --eval -E "with import ./. {}; lib.getVersion ${pname}" | tr -d '"')"
98+ latestTag="$(git ${suffixes} ls-remote --exit-code --refs --sort='version:refname' --tags git@github.com:ThomasDickey/xterm-snapshots.git 'xterm-*' | tail --lines=1 | cut --delimiter='/' --fields=3 | sed 's|^xterm-||g')"
99+
100+ if [ ! "$oldVersion" = "$latestTag" ]; then
101+ update-source-version ${pname} "$latestTag" --version-key=version --print-changes
102+ nixpkgs="$(git rev-parse --show-toplevel)"
103+ default_nix="$nixpkgs/pkgs/applications/terminal-emulators/xterm/default.nix"
104+ nixfmt "$default_nix"
105+ else
106+ echo "${pname} is already up-to-date"
107+ fi
108+ '';
109+ };
110+
65111 meta = {
66112 homepage = "https://invisible-island.net/xterm";
67113 license = with stdenv.lib.licenses; [ mit ];
68− maintainers = with stdenv.lib.maintainers; [vrthra];
114+ maintainers = with stdenv.lib.maintainers; [ nequissimus vrthra ];
69115 platforms = with stdenv.lib.platforms; linux ++ darwin;
70116 };
71117}