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

Replace the custom patching code with the common script.

Also use callPackage and makeBinPath
This commit is contained in:
Tuomas Tynkkynen 2017-01-05 00:38:55 +02:00
parent 9483359887
commit e5e1bdca53
3 changed files with 17 additions and 39 deletions

@ -5,7 +5,7 @@
, hunspell, libevent, libstartup_notification, libvpx
, cairo, gstreamer, gst_plugins_base, icu, libpng, jemalloc, libpulseaudio
, autoconf213, which
, writeScript, xidel, coreutils, gnused, gnugrep, curl, ed
, writeScript, xidel, common-updater-scripts, coreutils, gnused, gnugrep, curl
, enableGTK3 ? false
, debugBuild ? false
, # If you want the resulting program to call itself "Firefox" instead
@ -151,8 +151,8 @@ in {
version = "51.0.1";
sha512 = "556e31b717c0640ef5e181e00b9d2a6ea0ace7c16ae04333d0f2e9e120d0ab9efe82a4ca314ef43594c080523edf37953e65dbf694c7428be0a024f3719d8312";
updateScript = import ./update.nix {
name = "firefox";
inherit writeScript xidel coreutils gnused gnugrep curl ed;
attrPath = "firefox-unwrapped";
inherit writeScript lib common-updater-scripts xidel coreutils gnused gnugrep curl;
};
};
@ -161,9 +161,9 @@ in {
version = "45.7.0esr";
sha512 = "6424101b6958191ce654d0619950dfbf98d4aa6bdd979306a2df8d6d30d3fecf1ab44638061a2b4fb1af85fe972f5ff49400e8eeda30cdcb9087c4b110b97a7d";
updateScript = import ./update.nix {
name = "firefox-esr";
versionSuffix = "esr";
inherit writeScript xidel coreutils gnused gnugrep curl ed;
attrPath = "firefox-esr-unwrapped";
versionSuffix = "esr";
inherit writeScript lib common-updater-scripts xidel coreutils gnused gnugrep curl;
};
};

@ -1,23 +1,18 @@
{ name
, writeScript
{ writeScript
, lib
, xidel
, common-updater-scripts
, coreutils
, gnused
, gnugrep
, curl
, ed
, sourceSectionRegex ? "${name}-unwrapped = common"
, basePath ? "pkgs/applications/networking/browsers/firefox"
, attrPath
, baseUrl ? "http://archive.mozilla.org/pub/firefox/releases/"
, versionSuffix ? ""
}:
let
version = (builtins.parseDrvName name).version;
in writeScript "update-${name}" ''
PATH=${coreutils}/bin:${gnused}/bin:${gnugrep}/bin:${xidel}/bin:${curl}/bin:${ed}/bin
pushd ${basePath}
writeScript "update-${attrPath}" ''
PATH=${lib.makeBinPath [ common-updater-scripts coreutils curl gnugrep gnused xidel ]}
url=${baseUrl}
@ -35,20 +30,5 @@ in writeScript "update-${name}" ''
shasum=`curl --silent $url$version/SHA512SUMS | grep 'source\.tar\.xz' | cut -d ' ' -f 1`
ed default.nix <<COMMANDS
# search line
/${sourceSectionRegex}/
# search version number line
/version/
# update the version
s/".*"/"$version"/
# search hash line
/sha512/
# update the hash
s/".*"/"$shasum"/
# write then quit
wq
COMMANDS
popd
update-source-version ${attrPath} "$version" "$shasum"
''

@ -1,10 +1,10 @@
{ stdenv, fetchurl, pkgconfig, which, m4, gtk2, pango, perl, python2, zip, libIDL
{ stdenv, lib, fetchurl, pkgconfig, which, m4, gtk2, pango, perl, python2, zip, libIDL
, libjpeg, libpng, zlib, dbus, dbus_glib, bzip2, xorg
, freetype, fontconfig, file, alsaLib, nspr, nss, libnotify
, yasm, mesa, sqlite, unzip, makeWrapper
, hunspell, libevent, libstartup_notification, libvpx
, cairo, gstreamer, gst_plugins_base, icu
, writeScript, xidel, coreutils, gnused, gnugrep, curl, ed
, writeScript, xidel, common-updater-scripts, coreutils, gnused, gnugrep, curl
, debugBuild ? false
, # If you want the resulting program to call itself "Thunderbird"
# instead of "Earlybird", enable this option. However, those
@ -140,10 +140,8 @@ stdenv.mkDerivation rec {
};
passthru.updateScript = import ./../../browsers/firefox/update.nix {
name = "thunderbird";
sourceSectionRegex = ".";
basePath = "pkgs/applications/networking/mailreaders/thunderbird";
attrPath = "thunderbird";
baseUrl = "http://archive.mozilla.org/pub/thunderbird/releases/";
inherit writeScript xidel coreutils gnused gnugrep curl ed;
inherit writeScript lib common-updater-scripts xidel coreutils gnused gnugrep curl;
};
}