mirror of
https://github.com/ilyakooo0/nixpkgs.git
synced 2024-12-26 21:33:03 +03:00
kde: Some tweaks to kde-manifest.sh
- Allow packages with different versions than $release (kde-workspace) - Extra checks
This commit is contained in:
parent
8fe3bd5aa4
commit
8dcf70f918
@ -10,9 +10,9 @@ rec {
|
||||
manifest = import (./. + "/${release}.nix");
|
||||
|
||||
# src attribute for $name tarball
|
||||
kdesrc = name: fetchurl {
|
||||
kdesrc = name: version: fetchurl {
|
||||
url = "mirror://kde/" + (if manifest.stable then "" else "un")
|
||||
+ "stable/${release}/src/${name}-${release}.tar.xz";
|
||||
+ "stable/${release}/src/${name}-${version}.tar.xz";
|
||||
sha256 = getAttr name manifest.hashes;
|
||||
};
|
||||
|
||||
@ -27,10 +27,12 @@ rec {
|
||||
# KDE package built from the whole tarball
|
||||
# This function is used both for monolithic modules and modules which are
|
||||
# released as individual tarballs
|
||||
kdeMonoPkg = name: let n_ = name; in a@{meta, name ? n_, version ? release, ...}:
|
||||
kdeMonoPkg = name:
|
||||
let n_ = name; v_ = getAttr name manifest.versions; in
|
||||
a@{meta, name ? n_, version ? v_, ...}:
|
||||
stdenv.mkDerivation ({
|
||||
name = "${name}-${version}";
|
||||
src = kdesrc name;
|
||||
src = kdesrc name version;
|
||||
meta = defMeta // meta;
|
||||
enableParallelBuilding = true;
|
||||
} // (removeAttrs a [ "meta" "name" ]));
|
||||
@ -42,11 +44,11 @@ rec {
|
||||
# Build subdirectory ${subdir} of tarball ${module}-${release}.tar.xz
|
||||
kdeSubdirPkg = module:
|
||||
{name, subdir ? name, sane ? name}:
|
||||
let name_ = name; in
|
||||
a@{cmakeFlags ? [], name ? name_, meta ? {}, ...}:
|
||||
let name_ = name; version_ = getAttr name manifest.versions; in
|
||||
a@{cmakeFlags ? [], name ? name_, version ? version_, meta ? {}, ...}:
|
||||
stdenv.mkDerivation ({
|
||||
name = "${name}-${release}";
|
||||
src = kdesrc module;
|
||||
src = kdesrc module version;
|
||||
cmakeFlags =
|
||||
[ "-DDISABLE_ALL_OPTIONAL_SUBDIRECTORIES=TRUE"
|
||||
"-DBUILD_doc=TRUE"
|
||||
|
@ -5,15 +5,21 @@
|
||||
|
||||
dir="$1"
|
||||
|
||||
# Detect release number & whether it is a stable release
|
||||
if [[ ! -d "${dir}" ]]; then
|
||||
echo "${dir} is not a directory (or doesn't exist)!" >&2
|
||||
|
||||
if [[ -z $(type -p xsltproc) ]]; then
|
||||
echo "Please provide libxslt" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
release=$(ls "${dir}"/kdelibs-*.tar.xz | \
|
||||
sed -e 's/.*kdelibs-//' -e 's/\.tar\.xz//')
|
||||
|
||||
# Detect release number & whether it is a stable release
|
||||
if [[ $? -ne 0 || -z $release ]]; then
|
||||
echo "'${dir}' is not a directory (or kdelibs...tar.xz doesn't exist)!" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [[ ${release##*.} -gt 50 ]]; then
|
||||
stable="false"
|
||||
else
|
||||
@ -23,15 +29,19 @@ fi
|
||||
echo "Detected release ${release}" >&2
|
||||
|
||||
declare -A hash
|
||||
declare -A version
|
||||
declare -A modules
|
||||
declare -a packages
|
||||
declare -a top_level
|
||||
|
||||
# xsltproc output declares -A module
|
||||
if [[ ! -f kde_projects.xml ]]; then
|
||||
curl -O -J http://projects.kde.org/kde_projects.xml
|
||||
if [[ ! -f ${dir}/kde_projects.xml ]]; then
|
||||
if ! curl -o "${dir}/kde_projects.xml" -J http://projects.kde.org/kde_projects.xml; then
|
||||
echo "Could not download http://projects.kde.org/kde_projects.xml to ${dir}/kde_projects.xml" >&2
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
eval `xsltproc kde-submodules.xslt kde_projects.xml`
|
||||
# xsltproc output declares -A module
|
||||
eval `xsltproc kde-submodules.xslt ${dir}/kde_projects.xml`
|
||||
|
||||
module[kde-baseapps]=kde-baseapps
|
||||
unset module[kactivities]
|
||||
@ -45,13 +55,17 @@ print_sane() {
|
||||
fi
|
||||
}
|
||||
|
||||
for i in `cd "${dir}"; ls *-${release}.tar.xz`; do
|
||||
package=${i%-${release}.tar.xz}
|
||||
for i in `cd "${dir}"; ls *.tar.xz`; do
|
||||
package=${i%.tar.xz}
|
||||
v=${package##*-}
|
||||
package=${i%-*}
|
||||
packages+=( "$package" )
|
||||
echo -n "${package}.. " >&2
|
||||
hash[$package]=$(nix-hash --type sha256 --flat --base32 "${dir}/${i}")
|
||||
echo -n ${hash[$package]} >&2
|
||||
|
||||
version[$package]=$v
|
||||
|
||||
if [ -n "${module[$package]}" ]; then
|
||||
m="${module[$package]}"
|
||||
echo " (${m})" >&2
|
||||
@ -60,7 +74,7 @@ for i in `cd "${dir}"; ls *-${release}.tar.xz`; do
|
||||
top_level+=( "$package" )
|
||||
echo " (top-level)" >&2
|
||||
fi
|
||||
#nix-store --add-fixed sha256 "${dir}/${i}" >&2
|
||||
nix-store --add-fixed sha256 "${dir}/${i}" >&2
|
||||
done
|
||||
|
||||
|
||||
@ -68,12 +82,22 @@ print_pkg_hash() {
|
||||
echo " {name=\"${1}\";value=\"${hash[$1]}\";}"
|
||||
}
|
||||
|
||||
print_pkg_version() {
|
||||
echo " {name=\"${1}\";value=\"${version[$1]}\";}"
|
||||
}
|
||||
|
||||
print_hashes(){
|
||||
echo "hashes=builtins.listToAttrs["
|
||||
for p in "${packages[@]}"; do print_pkg_hash "$p"; done
|
||||
echo "];"
|
||||
}
|
||||
|
||||
print_versions(){
|
||||
echo "versions=builtins.listToAttrs["
|
||||
for p in "${packages[@]}"; do print_pkg_version "$p"; done
|
||||
echo "];"
|
||||
}
|
||||
|
||||
print_split_module(){
|
||||
echo -n "$1:" >&2
|
||||
echo -e "{\n module=\"$1\";"
|
||||
@ -97,9 +121,11 @@ print_mono_module(){
|
||||
echo -en "{ module=\"$1\"; "
|
||||
print_sane "$1"
|
||||
echo -n "$1 ... " >&2
|
||||
pkg=$(cd "$dir"; echo "$1"-*.tar.xz)
|
||||
pkg="${pkg%.tar.xz}"
|
||||
echo -n " split=false;"
|
||||
cml="$1-$release/CMakeLists.txt"
|
||||
tar -xf "${dir}/$1-${release}.tar.xz" "$cml"
|
||||
cml="$pkg/CMakeLists.txt"
|
||||
tar -xf "${dir}/$pkg.tar.xz" "$cml"
|
||||
if grep '^[^#]*add_subdirectory' $cml >/dev/null; then
|
||||
if grep '^[^#]*add_subdirectory' $cml | grep -v macro_optional_add_subdirectory >/dev/null; then
|
||||
echo " is monolithic (has unconditionally added subdirs)" >&2
|
||||
@ -124,7 +150,7 @@ print_mono_module(){
|
||||
echo " is monolithic (has no subdirs)" >&2
|
||||
fi
|
||||
rm $cml
|
||||
rmdir $1-$release
|
||||
rmdir "$pkg"
|
||||
echo "}"
|
||||
}
|
||||
|
||||
@ -142,5 +168,6 @@ echo "Writing ${release}.nix" >&2
|
||||
exec > "${release}.nix"
|
||||
echo "{stable=${stable};"
|
||||
print_hashes
|
||||
print_versions
|
||||
print_modules
|
||||
echo "}"
|
||||
|
Loading…
Reference in New Issue
Block a user