firefox, thunderbird: Use common-updater/update-source-version script

Replace the custom patching code with the common script.

Also use callPackage and makeBinPath

+17 -39
+6 -6
pkgs/applications/networking/browsers/firefox/default.nix
··· 5 5 , hunspell, libevent, libstartup_notification, libvpx 6 6 , cairo, gstreamer, gst_plugins_base, icu, libpng, jemalloc, libpulseaudio 7 7 , autoconf213, which 8 - , writeScript, xidel, coreutils, gnused, gnugrep, curl, ed 8 + , writeScript, xidel, common-updater-scripts, coreutils, gnused, gnugrep, curl 9 9 , enableGTK3 ? false 10 10 , debugBuild ? false 11 11 , # If you want the resulting program to call itself "Firefox" instead ··· 151 151 version = "51.0.1"; 152 152 sha512 = "556e31b717c0640ef5e181e00b9d2a6ea0ace7c16ae04333d0f2e9e120d0ab9efe82a4ca314ef43594c080523edf37953e65dbf694c7428be0a024f3719d8312"; 153 153 updateScript = import ./update.nix { 154 - name = "firefox"; 155 - inherit writeScript xidel coreutils gnused gnugrep curl ed; 154 + attrPath = "firefox-unwrapped"; 155 + inherit writeScript lib common-updater-scripts xidel coreutils gnused gnugrep curl; 156 156 }; 157 157 }; 158 158 ··· 161 161 version = "45.7.0esr"; 162 162 sha512 = "6424101b6958191ce654d0619950dfbf98d4aa6bdd979306a2df8d6d30d3fecf1ab44638061a2b4fb1af85fe972f5ff49400e8eeda30cdcb9087c4b110b97a7d"; 163 163 updateScript = import ./update.nix { 164 - name = "firefox-esr"; 165 - versionSuffix = "esr"; 166 - inherit writeScript xidel coreutils gnused gnugrep curl ed; 164 + attrPath = "firefox-esr-unwrapped"; 165 + versionSuffix = "esr"; 166 + inherit writeScript lib common-updater-scripts xidel coreutils gnused gnugrep curl; 167 167 }; 168 168 }; 169 169
+7 -27
pkgs/applications/networking/browsers/firefox/update.nix
··· 1 - { name 2 - , writeScript 1 + { writeScript 2 + , lib 3 3 , xidel 4 + , common-updater-scripts 4 5 , coreutils 5 6 , gnused 6 7 , gnugrep 7 8 , curl 8 - , ed 9 - , sourceSectionRegex ? "${name}-unwrapped = common" 10 - , basePath ? "pkgs/applications/networking/browsers/firefox" 9 + , attrPath 11 10 , baseUrl ? "http://archive.mozilla.org/pub/firefox/releases/" 12 11 , versionSuffix ? "" 13 12 }: 14 13 15 - let 16 - version = (builtins.parseDrvName name).version; 17 - in writeScript "update-${name}" '' 18 - PATH=${coreutils}/bin:${gnused}/bin:${gnugrep}/bin:${xidel}/bin:${curl}/bin:${ed}/bin 19 - 20 - pushd ${basePath} 14 + writeScript "update-${attrPath}" '' 15 + PATH=${lib.makeBinPath [ common-updater-scripts coreutils curl gnugrep gnused xidel ]} 21 16 22 17 url=${baseUrl} 23 18 ··· 35 30 36 31 shasum=`curl --silent $url$version/SHA512SUMS | grep 'source\.tar\.xz' | cut -d ' ' -f 1` 37 32 38 - ed default.nix <<COMMANDS 39 - # search line 40 - /${sourceSectionRegex}/ 41 - # search version number line 42 - /version/ 43 - # update the version 44 - s/".*"/"$version"/ 45 - # search hash line 46 - /sha512/ 47 - # update the hash 48 - s/".*"/"$shasum"/ 49 - # write then quit 50 - wq 51 - COMMANDS 52 - 53 - popd 33 + update-source-version ${attrPath} "$version" "$shasum" 54 34 ''
+4 -6
pkgs/applications/networking/mailreaders/thunderbird/default.nix
··· 1 - { stdenv, fetchurl, pkgconfig, which, m4, gtk2, pango, perl, python2, zip, libIDL 1 + { stdenv, lib, fetchurl, pkgconfig, which, m4, gtk2, pango, perl, python2, zip, libIDL 2 2 , libjpeg, libpng, zlib, dbus, dbus_glib, bzip2, xorg 3 3 , freetype, fontconfig, file, alsaLib, nspr, nss, libnotify 4 4 , yasm, mesa, sqlite, unzip, makeWrapper 5 5 , hunspell, libevent, libstartup_notification, libvpx 6 6 , cairo, gstreamer, gst_plugins_base, icu 7 - , writeScript, xidel, coreutils, gnused, gnugrep, curl, ed 7 + , writeScript, xidel, common-updater-scripts, coreutils, gnused, gnugrep, curl 8 8 , debugBuild ? false 9 9 , # If you want the resulting program to call itself "Thunderbird" 10 10 # instead of "Earlybird", enable this option. However, those ··· 140 140 }; 141 141 142 142 passthru.updateScript = import ./../../browsers/firefox/update.nix { 143 - name = "thunderbird"; 144 - sourceSectionRegex = "."; 145 - basePath = "pkgs/applications/networking/mailreaders/thunderbird"; 143 + attrPath = "thunderbird"; 146 144 baseUrl = "http://archive.mozilla.org/pub/thunderbird/releases/"; 147 - inherit writeScript xidel coreutils gnused gnugrep curl ed; 145 + inherit writeScript lib common-updater-scripts xidel coreutils gnused gnugrep curl; 148 146 }; 149 147 }