mirror of
https://github.com/NixOS/nixpkgs.git
synced 2026-07-06 17:13:24 -05:00
lensfun: update lens database (#523491)
This commit is contained in:
commit
2fcba1bf8b
1 changed files with 47 additions and 17 deletions
|
|
@ -1,6 +1,7 @@
|
|||
{
|
||||
lib,
|
||||
stdenv,
|
||||
stdenvNoCC,
|
||||
fetchFromGitHub,
|
||||
pkg-config,
|
||||
glib,
|
||||
|
|
@ -9,20 +10,54 @@
|
|||
cmake,
|
||||
python3,
|
||||
python3Packages,
|
||||
|
||||
# optionally specify a derivation containing the lens data as generated from the `generate_db.py` script
|
||||
lensfunDatabases ? null,
|
||||
}:
|
||||
|
||||
let
|
||||
version = "0.3.4";
|
||||
pname = "lensfun";
|
||||
|
||||
# Fetch a more recent version of the repo containing a more recent lens
|
||||
# database
|
||||
lensfunDatabase = fetchFromGitHub {
|
||||
owner = "lensfun";
|
||||
repo = "lensfun";
|
||||
rev = "a1510e6f33ce9bc8b5056a823c6d5bc6b8cba033";
|
||||
sha256 = "sha256-qdONyKk873Tq11M33JmznhJMAGd4dqp5KdXdVhfy/Ak=";
|
||||
};
|
||||
lensData =
|
||||
if lensfunDatabases != null then
|
||||
lensfunDatabases
|
||||
else
|
||||
# fetch a more recent version of the lens database
|
||||
stdenvNoCC.mkDerivation {
|
||||
name = "lensfun-databases";
|
||||
|
||||
src = fetchFromGitHub {
|
||||
owner = "lensfun";
|
||||
repo = "lensfun";
|
||||
rev = "201da1a7433626a2a1ecd67e1f21a42fb17aa4a5";
|
||||
sha256 = "sha256-64ZcupHA4oClPRCnG8KofGC46M/mZFermugzQ15B6k4=";
|
||||
|
||||
leaveDotGit = true;
|
||||
# generate timestamp based on the most recent commit
|
||||
postFetch = ''
|
||||
cd $out
|
||||
git log -1 --format=%at > $out/timestamp.txt
|
||||
rm -R .git
|
||||
'';
|
||||
};
|
||||
|
||||
nativeBuildInputs = [
|
||||
python3
|
||||
python3Packages.setuptools
|
||||
python3Packages.lxml
|
||||
];
|
||||
|
||||
# generates versioned tarballs of lens data
|
||||
# patch applied so that we read the previously generated `timestamp.txt` instead
|
||||
# of trying to read from `.git` (which is deleted during `postFetch`)
|
||||
buildPhase = ''
|
||||
substituteInPlace tools/update_database/generate_db.py \
|
||||
--replace-fail '"git", "log", "-1", "--format=%ad", "--date=raw", "--", "*.xml"' '"cat", "timestamp.txt"'
|
||||
python3 tools/update_database/generate_db.py --input data/db --output $out
|
||||
cp timestamp.txt $out/timestamp.txt
|
||||
'';
|
||||
};
|
||||
|
||||
in
|
||||
stdenv.mkDerivation {
|
||||
|
|
@ -36,15 +71,13 @@ stdenv.mkDerivation {
|
|||
};
|
||||
|
||||
# replace database with a more recent snapshot
|
||||
# the master branch uses version 2 profiles, while 0.3.3 requires version 1 profiles,
|
||||
# so we run the conversion tool the project provides,
|
||||
# then untar the version 1 profiles into the source dir before we build
|
||||
# the master branch uses version 2 profiles, while this version requires version 1 profiles
|
||||
# also copies in the required `timestamp.txt` file
|
||||
prePatch = ''
|
||||
rm -R data/db
|
||||
python3 ${lensfunDatabase}/tools/lensfun_convert_db_v2_to_v1.py $TMPDIR ${lensfunDatabase}/data/db
|
||||
mkdir -p data/db
|
||||
tar xvf $TMPDIR/db/version_1.tar -C data/db
|
||||
date +%s > data/db/timestamp.txt
|
||||
tar xvfj ${lensData}/version_1.tar.bz2 -C data/db
|
||||
cp ${lensData}/timestamp.txt data/db/timestamp.txt
|
||||
''
|
||||
# Backport CMake 4 support
|
||||
# This is already on master, but not yet in a stable release:
|
||||
|
|
@ -60,9 +93,6 @@ stdenv.mkDerivation {
|
|||
nativeBuildInputs = [
|
||||
cmake
|
||||
pkg-config
|
||||
python3
|
||||
python3Packages.setuptools
|
||||
python3Packages.lxml # For the db converison
|
||||
];
|
||||
|
||||
buildInputs = [
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue