deepin: add setup hook with helper functions
This commit is contained in:
parent
9bf7a735f8
commit
0a971b5a04
|
@ -2,6 +2,8 @@
|
||||||
|
|
||||||
let
|
let
|
||||||
packages = self: with self; {
|
packages = self: with self; {
|
||||||
|
setupHook = ./setup-hook.sh;
|
||||||
|
|
||||||
updateScript = callPackage ./update.nix { };
|
updateScript = callPackage ./update.nix { };
|
||||||
|
|
||||||
dbus-factory = callPackage ./dbus-factory { };
|
dbus-factory = callPackage ./dbus-factory { };
|
||||||
|
|
|
@ -0,0 +1,53 @@
|
||||||
|
# Helper functions for deepin packaging
|
||||||
|
|
||||||
|
searchHardCodedPaths() {
|
||||||
|
# looks for ocurrences of hard coded paths in given (current)
|
||||||
|
# directory and command invocations for the purpose of debugging a
|
||||||
|
# derivation
|
||||||
|
|
||||||
|
local dir=$1
|
||||||
|
|
||||||
|
echo ----------- looking for command invocations
|
||||||
|
grep --color=always -r -E '\<(ExecStart|Exec|startDetached|execute|exec\.(Command|LookPath))\>' $dir || true
|
||||||
|
|
||||||
|
echo ----------- looking for hard coded paths
|
||||||
|
grep --color=always -r -E '/(usr|bin|sbin|etc|var|opt)\>' $dir || true
|
||||||
|
|
||||||
|
echo ----------- done
|
||||||
|
}
|
||||||
|
|
||||||
|
fixPath() {
|
||||||
|
# Usage:
|
||||||
|
#
|
||||||
|
# fixPath <parent dir> <path> <files>
|
||||||
|
#
|
||||||
|
# replaces occurences of <path> by <parent_dir><path> in <files>
|
||||||
|
# removing /usr from the start of <path> if present
|
||||||
|
|
||||||
|
local parentdir=$1
|
||||||
|
local path=$2
|
||||||
|
local newpath=$parentdir$(echo $path | sed "s,^/usr,,")
|
||||||
|
local files=("${@:3}")
|
||||||
|
echo ======= grep --color=always "${path}" "${files[@]}"
|
||||||
|
grep --color=always "${path}" "${files[@]}"
|
||||||
|
echo +++++++ sed -i -e "s,$path,$newpath,g" "${files[@]}"
|
||||||
|
sed -i -e "s,$path,$newpath,g" "${files[@]}"
|
||||||
|
}
|
||||||
|
|
||||||
|
searchForUnresolvedDLL() {
|
||||||
|
# Usage:
|
||||||
|
#
|
||||||
|
# searchForUnresolvedDLL <dir>
|
||||||
|
#
|
||||||
|
# looks in <dir> for executables with unresolved dynamic library paths
|
||||||
|
|
||||||
|
local dir="$1"
|
||||||
|
echo ======= Looking for executables with unresolved dynamic library dependencies
|
||||||
|
echo $dir
|
||||||
|
for f in $(find -L "$dir" -type f -executable); do
|
||||||
|
if (ldd $f | grep -q "not found"); then
|
||||||
|
echo $f
|
||||||
|
ldd $f | grep --color=always "not found"
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
}
|
Loading…
Reference in New Issue