3 # Updates the timestamp and contents in a package's .project
4 # if $1 is null, update pkgusr's pkg
8 if [ -z "${pkg}" ]; then
12 pkgdir=/usr/src/${pkg}
16 for file in $(forall_direntries_from $pkg -type f -executable -readable); do
17 (readelf -d $file ; ldd $file ) |
18 awk '/NEEDED/ { lib=substr($5,2,length($5)-2); LIBS[lib]=$5 } \
19 /.*=>/ {if ( $1 in LIBS ) LIBS[$1]=$3 } END \
20 { for (lib in LIBS) print LIBS[lib] }' |
21 xargs stat --printf "%U:%G\n"
22 done|sort -u|tr -s '\n' ' '
26 sed -i "s/\(Last_Updated: \).*$/\1$(date +%c)/" ${pkgdir}/.project
27 sed -i s/"\(Deps: \).*$"/"\1$(upd_pkg_deps)"/ ${pkgdir}/.project
28 awk '/^CONTENTS:/ { print; exit; } {print}' ${pkgdir}/.project > ${pkgdir}/.projtmp
29 echo "--------" >> ${pkgdir}/.projtmp
30 list_package ${pkg} >> ${pkgdir}/.projtmp
31 mv ${pkgdir}/.projtmp ${pkgdir}/.project
33 # If we're root, chown the .project file
34 [[ $(id -u) -eq 0 ]] && chown -v ${pkg}:${pkg} ${pkgdir}/.project