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-02-19 16:51:17 +02:00
parent 9483359887
commit e5e1bdca53
3 changed files with 17 additions and 39 deletions
@@ -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"
''