scripts/feeds: cache feed metadata instead of re-reading it on every get_feed() call
[openwrt.git] / scripts / update-package-md5sum
1 #!/usr/bin/env sh
2 #
3 # update-package-md5sum - Updates md5sum of OpenWrt packages
4 #
5 # update-package-md5sum will update the md5sum for all recusivly found OpenWrt packages
6 # in a given directory.
7 #
8 # Usage: scripts/update-package-md5sum <package directory>
9 #
10 # Example: `scripts/update-package-md5sum feeds/packages/python`
11
12 DL_FOLDER=`grep -Eo '^CONFIG_DOWNLOAD_FOLDER=".*"$' .config | \
13 sed 's,^CONFIG_DOWNLOAD_FOLDER="\(.*\)"$,\1,'`
14 if test -z ${DL_FOLDER}; then
15 DL_FOLDER=./dl
16 fi
17
18 if test -z "$1"; then
19 echo "Usage: $0 <package directory>"
20 exit
21 fi
22
23 for file in `find $1 -name Makefile`; do
24 if grep BuildPackage ${file} > /dev/null; then
25 source=`DUMP=1 TOPDIR=\`pwd\` make -f ${file} | grep -m 1 Source | cut -f 2 -d ' '`
26 if test -n "${source}"; then
27 if test ! -f "${DL_FOLDER}/${source}"; then
28 make package/`basename \`dirname ${file}\``/download
29 fi
30 sum=`md5sum ${DL_FOLDER}/${source} 2> /dev/null` || continue
31 echo Updating ${file}...
32 sum=`echo ${sum} | cut -d ' ' -f 1`
33 sed -i "s,^PKG_MD5SUM:=.*,PKG_MD5SUM:=${sum}," ${file}
34 else
35 echo No source for ${file}
36 fi
37 fi
38 done
This page took 0.047116 seconds and 5 git commands to generate.