mirror of
https://github.com/NixOS/nixpkgs.git
synced 2025-02-20 02:55:39 +00:00
xidel: 0.9.6 -> 0.9.8, refactor
This commit is contained in:
parent
8b31fa0567
commit
d14ea1499b
@ -1,48 +1,92 @@
|
||||
{ lib, stdenv, fetchurl, dpkg }:
|
||||
{ lib, stdenv, fetchsvn, fetchFromGitHub, fpc }:
|
||||
|
||||
stdenv.mkDerivation rec {
|
||||
let
|
||||
flreSrc = fetchFromGitHub {
|
||||
owner = "benibela";
|
||||
repo = "flre";
|
||||
rev = "5aa8a9e032feff7a5790104f2d53fa74c70bb1d9"; # latest as of 0.9.8 release date
|
||||
sha256 = "1zny494jm92fjgfirzwmxff988j4yygblaxmaclkkmcvzkjrzs05";
|
||||
};
|
||||
synapseSrc = fetchsvn {
|
||||
url = "http://svn.code.sf.net/p/synalist/code/synapse/40/";
|
||||
rev = 237;
|
||||
sha256 = "0ciqd2xgpinwrk42cpyinh9gz2i5s5rlww4mdlsca1h6saivji96";
|
||||
};
|
||||
rcmdlineSrc = fetchFromGitHub {
|
||||
owner = "benibela";
|
||||
repo = "rcmdline";
|
||||
rev = "96859e574e82d76eae49d5552a8c5aa7574a5987"; # latest as of 0.9.8 release date
|
||||
sha256 = "0vwvpwrxsy9axicbck143yfxxrdifc026pv9c2lzqxzskf9fd78b";
|
||||
};
|
||||
internettoolsSrc = fetchFromGitHub {
|
||||
owner = "benibela";
|
||||
repo = "internettools";
|
||||
rev = "c9c5cc3a87271180d4fb5bb0b17040763d2cfe06"; # latest as of 0.9.8 release date
|
||||
sha256 = "057hn7cb1vy827gvim3b6vwgfdh2ckjy8h9yj1ry7lv6hw8ynx6n";
|
||||
};
|
||||
in stdenv.mkDerivation rec {
|
||||
pname = "xidel";
|
||||
version = "0.9.6";
|
||||
version = "0.9.8";
|
||||
|
||||
## Source archive lacks file (manageUtils.sh), using pre-built package for now.
|
||||
#src = fetchurl {
|
||||
# url = "mirror://sourceforge/videlibri/Xidel/Xidel%20${version}/${name}.src.tar.gz";
|
||||
# sha256 = "1h5xn16lgzx0s94iyhxa50lk05yf0af44nzm5w5k57615nd82kz2";
|
||||
#};
|
||||
src = fetchFromGitHub {
|
||||
owner = "benibela";
|
||||
repo = pname;
|
||||
rev = "Xidel_${version}";
|
||||
sha256 = "0q75jjyciybvj6y17s2283zis9fcw8w5pfsq8bn7diinnbjnzgl6";
|
||||
};
|
||||
|
||||
src =
|
||||
if stdenv.hostPlatform.system == "x86_64-linux" then
|
||||
fetchurl {
|
||||
url = "mirror://sourceforge/videlibri/Xidel/Xidel%20${version}/xidel_${version}-1_amd64.deb";
|
||||
sha256 = "0hskc74y7p4j1x33yx0w4fvr610p2yimas8pxhr6bs7mb9b300h7";
|
||||
}
|
||||
else if stdenv.hostPlatform.system == "i686-linux" then
|
||||
fetchurl {
|
||||
url = "mirror://sourceforge/videlibri/Xidel/Xidel%20${version}/xidel_${version}-1_i386.deb";
|
||||
sha256 = "07yk5sk1p4jm0jmgjwdm2wq8d2wybi1wkn1qq5j5y03z1pdc3fi6";
|
||||
}
|
||||
else throw "xidel is not supported on ${stdenv.hostPlatform.system}";
|
||||
nativeBuildInputs = [ fpc ];
|
||||
|
||||
buildInputs = [ dpkg ];
|
||||
|
||||
unpackPhase = ''
|
||||
dpkg-deb -x ${src} ./
|
||||
patchPhase = ''
|
||||
patchShebangs \
|
||||
build.sh \
|
||||
tests/test.sh \
|
||||
tests/tests-file-module.sh \
|
||||
tests/tests.sh \
|
||||
tests/downloadTest.sh \
|
||||
tests/downloadTests.sh \
|
||||
tests/zorbajsoniq.sh \
|
||||
tests/zorbajsoniq/download.sh
|
||||
'';
|
||||
|
||||
dontBuild = true;
|
||||
preBuildPhase = ''
|
||||
mkdir -p import/{flre,synapse} rcmdline internettools
|
||||
cp -R ${flreSrc}/. import/flre
|
||||
cp -R ${synapseSrc}/. import/synapse
|
||||
cp -R ${rcmdlineSrc}/. rcmdline
|
||||
cp -R ${internettoolsSrc}/. internettools
|
||||
'';
|
||||
|
||||
buildPhase = ''
|
||||
runHook preBuildPhase
|
||||
./build.sh
|
||||
runHook postBuildPhase
|
||||
'';
|
||||
|
||||
installPhase = ''
|
||||
mkdir -p "$out/bin"
|
||||
cp -a usr/* "$out/"
|
||||
patchelf --set-interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" "$out/bin/xidel"
|
||||
mkdir -p "$out/bin" "$out/share/man/man1"
|
||||
cp meta/xidel.1 "$out/share/man/man1/"
|
||||
cp xidel "$out/bin/"
|
||||
'';
|
||||
|
||||
doCheck = true;
|
||||
|
||||
checkPhase = ''
|
||||
# Not all, if any, of these tests are blockers. Failing or not this phase will pass.
|
||||
# As of 2021-08-15, all of 37 failed tests are linked with the lack of network access.
|
||||
./tests/tests.sh
|
||||
'';
|
||||
|
||||
doInstallCheck = true;
|
||||
|
||||
installCheckPhase = ''
|
||||
$out/bin/xidel --version | grep "${version}"
|
||||
'';
|
||||
|
||||
meta = with lib; {
|
||||
description = "Command line tool to download and extract data from html/xml pages";
|
||||
homepage = "http://videlibri.sourceforge.net/xidel.html";
|
||||
# source contains no license info (AFAICS), but sourceforge says GPLv2
|
||||
license = licenses.gpl2;
|
||||
# more platforms will be supported when we switch to source build
|
||||
description = "Command line tool to download and extract data from HTML/XML pages as well as JSON APIs";
|
||||
homepage = "https://www.videlibri.de/xidel.html";
|
||||
license = licenses.gpl3Plus;
|
||||
platforms = platforms.linux;
|
||||
maintainers = [ maintainers.bjornfor ];
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user