8 package_dir
= 'packages'
9 for pkgdir_name
in sorted(os
.listdir(package_dir
)):
10 dir_path
= package_dir
+ '/' + pkgdir_name
11 build_sh_path
= dir_path
+ '/build.sh'
12 if not os
.path
.isfile(build_sh_path
):
13 sys
.exit('No build.sh file in: ' + pkgdir_name
)
14 with
open(build_sh_path
) as build_sh
:
15 lines
= build_sh
.readlines()
16 validate_package(pkgdir_name
, lines
)
18 def validate_package(package_name
, lines
):
20 print('Too few lines in package: ' + package_name
)
22 if not lines
[0].startswith('TERMUX_PKG_HOMEPAGE='):
23 print('The first line is not TERMUX_PKG_HOMEPAGE: ' + package_name
)
24 if not lines
[1].startswith('TERMUX_PKG_DESCRIPTION='):
25 print('The second line is not TERMUX_PKG_DESCRIPTION: ' + package_name
)
29 if line
.endswith(' \n'):
30 print(package_name
+ ': Line ' + str(line_number
) + ' has trailing whitespace')
31 if line
.startswith('TERMUX_PKG_REVISION='):
32 value
= line
[len('TERMUX_PKG_REVISION='):].strip()
33 if not re
.match('[0-9]+', value
):
34 print(package_name
+ ': strange TERMUX_PKG_REVISION value "' + value
+ '"')
38 if __name__
== '__main__':