Add scripts/lint-packages.py
authorFredrik Fornwall <fredrik@fornwall.net>
Tue, 5 Dec 2017 21:48:12 +0000 (22:48 +0100)
committerFredrik Fornwall <fredrik@fornwall.net>
Tue, 5 Dec 2017 21:48:12 +0000 (22:48 +0100)
Harmonize the layout by having the first two lines of a package
definition always be the homepage and the description.

15 files changed:
packages/aapt/build.sh
packages/alpine/build.sh
packages/apr/build.sh
packages/autoconf/build.sh
packages/ccache/build.sh
packages/dialog/build.sh
packages/gmic/build.sh
packages/ncmpcpp/build.sh
packages/ncurses/build.sh
packages/neofetch/build.sh
packages/unzip/build.sh
packages/valac/build.sh
packages/vim-python/build.sh
packages/vim/build.sh
scripts/lint-packages.py [new file with mode: 0755]

index 9dbe66a..4373c12 100644 (file)
@@ -1,6 +1,3 @@
-# FIXME: We would like to enable checksums when downloading
-# tar files, but they change each time as the tar metadata
-# differs: https://github.com/google/gitiles/issues/84
 TERMUX_PKG_HOMEPAGE=http://elinux.org/Android_aapt
 TERMUX_PKG_DESCRIPTION="Android Asset Packaging Tool"
 _TAG_VERSION=7.1.2
@@ -11,6 +8,10 @@ TERMUX_PKG_BUILD_IN_SRC=yes
 TERMUX_PKG_DEPENDS="libexpat, libpng, libzopfli"
 
 termux_step_make_install () {
+       # FIXME: We would like to enable checksums when downloading
+       # tar files, but they change each time as the tar metadata
+       # differs: https://github.com/google/gitiles/issues/84
+
        local _TAGNAME=${_TAG_VERSION}_r${_TAG_REVISION}
 
        SYSTEM_CORE_INCLUDE_TARFILE=$TERMUX_PKG_CACHEDIR/system_core_include_${_TAGNAME}.tar.gz
index 9a6394b..9e73f2f 100644 (file)
@@ -11,7 +11,7 @@ TERMUX_PKG_EXTRA_CONFIGURE_ARGS="
 --without-pthread
 --without-tcl
 --with-system-pinerc=${TERMUX_PREFIX}/etc/pine.conf
---with-passfile=$TERMUX_ANDROID_HOME/.pine-passfile 
+--with-passfile=$TERMUX_ANDROID_HOME/.pine-passfile
 "
 TERMUX_PKG_BUILD_IN_SRC=yes
 TERMUX_PKG_SHA256=6030b6881b8168546756ab3a5e43628d8d564539b0476578e287775573a77438
index 935bd11..035e4f9 100644 (file)
@@ -1,8 +1,8 @@
 TERMUX_PKG_HOMEPAGE=https://apr.apache.org/
+TERMUX_PKG_DESCRIPTION="Apache Portable Runtime Library"
 TERMUX_PKG_VERSION=1.6.3
 TERMUX_PKG_SHA256=131f06d16d7aabd097fa992a33eec2b6af3962f93e6d570a9bd4d85e95993172
 TERMUX_PKG_SRCURL=http://apache.mirrors.spacedump.net/apr/apr-${TERMUX_PKG_VERSION}.tar.bz2
-TERMUX_PKG_DESCRIPTION="Apache Portable Runtime Library"
 TERMUX_PKG_DEPENDS="libuuid"
 TERMUX_PKG_BUILD_IN_SRC="yes"
 # "ac_cv_search_crypt=" to avoid needlessly linking to libcrypt.
index c968f89..a43a728 100644 (file)
@@ -12,5 +12,5 @@ termux_step_post_extract_package () {
 
 termux_step_post_massage () {
        perl -p -i -e "s|/usr/bin/m4|$TERMUX_PREFIX/bin/m4|" bin/*
-       perl -p -i -e "s|CONFIG_SHELL-/bin/sh|CONFIG_SHELL-$TERMUX_PREFIX/bin/sh|" bin/autoconf 
+       perl -p -i -e "s|CONFIG_SHELL-/bin/sh|CONFIG_SHELL-$TERMUX_PREFIX/bin/sh|" bin/autoconf
 }
index ce0bb7d..639e722 100644 (file)
@@ -1,7 +1,7 @@
 TERMUX_PKG_HOMEPAGE=https://ccache.samba.org
+TERMUX_PKG_DESCRIPTION="Compiler cache for fast recompilation of C/C++ code"
 TERMUX_PKG_VERSION=3.3.4
 TERMUX_PKG_SRCURL=https://www.samba.org/ftp/ccache/ccache-$TERMUX_PKG_VERSION.tar.xz
 TERMUX_PKG_MAINTAINER="Vishal Biswas @vishalbiswas"
-TERMUX_PKG_DESCRIPTION="Compiler cache for fast recompilation of C/C++ code"
 TERMUX_PKG_SHA256=24f15bf389e38c41548c9c259532187774ec0cb9686c3497bbb75504c8dc404f
 
index 326482d..eff3d2e 100755 (executable)
@@ -1,5 +1,5 @@
-TERMUX_PKG_DESCRIPTION="Application used in shell scripts which displays text user interface widgets"
 TERMUX_PKG_HOMEPAGE=http://invisible-island.net/dialog/
+TERMUX_PKG_DESCRIPTION="Application used in shell scripts which displays text user interface widgets"
 TERMUX_PKG_DEPENDS="ncurses"
 TERMUX_PKG_VERSION="1.3-20170509"
 TERMUX_PKG_SHA256=2ff1ba74c632b9d13a0d0d2c942295dd4e8909694eeeded7908a467d0bcd4756
index 93695b8..9cb2122 100644 (file)
@@ -14,7 +14,7 @@ termux_step_configure() {
 
 termux_step_make () {
        cd src/
-       make cli 
+       make cli
 }
 
 termux_step_make_install() {
index a235a7f..2d84445 100644 (file)
@@ -9,7 +9,7 @@ TERMUX_PKG_BUILD_IN_SRC=yes
 TERMUX_PKG_KEEP_SHARE_DOC=yes
 TERMUX_PKG_EXTRA_CONFIGURE_ARGS="--enable-visualizer --enable-outputs --enable-clock"
 
-termux_step_pre_configure() { 
+termux_step_pre_configure() {
        ./autogen.sh
        CXXFLAGS+=" -DNCURSES_WIDECHAR -U_XOPEN_SOURCE"
 }
index 9486f8c..368c1dc 100755 (executable)
@@ -41,7 +41,7 @@ termux_step_pre_configure() {
 termux_step_post_make_install () {
        cd $TERMUX_PREFIX/lib
        for lib in form menu ncurses panel; do
-               for file in lib${lib}w.so*; do 
+               for file in lib${lib}w.so*; do
                        ln -s -f $file `echo $file | sed 's/w//'`
                done
                (cd pkgconfig && ln -s -f ${lib}w.pc `echo $lib | sed 's/w//'`.pc)
index 495641a..ba565d5 100644 (file)
@@ -1,6 +1,6 @@
-TERMUX_PKG_MAINTAINER="Muhammad Herdiansyah @konimex"
 TERMUX_PKG_HOMEPAGE=https://github.com/dylanaraps/neofetch
 TERMUX_PKG_DESCRIPTION="Simple system information script"
+TERMUX_PKG_MAINTAINER="Muhammad Herdiansyah @konimex"
 TERMUX_PKG_DEPENDS="bash"
 TERMUX_PKG_VERSION=3.3.0
 TERMUX_PKG_SRCURL=https://github.com/dylanaraps/neofetch/archive/${TERMUX_PKG_VERSION}/neofetch-${TERMUX_PKG_VERSION}.tar.gz
index 7457c0d..e668acd 100644 (file)
@@ -1,7 +1,7 @@
-TERMUX_PKG_VERSION=6.0
-TERMUX_PKG_REVISION=1
 TERMUX_PKG_HOMEPAGE=http://www.info-zip.org/
 TERMUX_PKG_DESCRIPTION="Tools for working with zip files"
+TERMUX_PKG_VERSION=6.0
+TERMUX_PKG_REVISION=1
 TERMUX_PKG_SRCURL=https://downloads.sourceforge.net/infozip/unzip60.tar.gz
 TERMUX_PKG_SHA256=036d96991646d0449ed0aa952e4fbe21b476ce994abc276e49d30e686708bd37
 TERMUX_PKG_DEPENDS="libandroid-support"
index 135d112..3aa7d07 100644 (file)
@@ -1,10 +1,7 @@
 TERMUX_PKG_HOMEPAGE=https://wiki.gnome.org/Projects/Vala
-_VALA_MAJOR=0
-_VALA_MINOR=36
-_VALA_PATCH=4
-TERMUX_PKG_VERSION=$_VALA_MAJOR.$_VALA_MINOR.$_VALA_PATCH
-TERMUX_PKG_MAINTAINER="Vishal Biswas @vishalbiswas"
-TERMUX_PKG_SRCURL=https://download.gnome.org/sources/vala/$_VALA_MAJOR.$_VALA_MINOR/vala-$TERMUX_PKG_VERSION.tar.xz
 TERMUX_PKG_DESCRIPTION="C# like language for the GObject system"
+TERMUX_PKG_VERSION=0.36.4
+TERMUX_PKG_MAINTAINER="Vishal Biswas @vishalbiswas"
+TERMUX_PKG_SRCURL=https://download.gnome.org/sources/vala/${TERMUX_PKG_VERSION:0:4}/vala-$TERMUX_PKG_VERSION.tar.xz
 TERMUX_PKG_DEPENDS="clang, glib-dev, pkg-config"
 TERMUX_PKG_SHA256=e9f23ce711c1a72ce664d10946fbc5953f01b0b7f2a3562e7a01e362d86de059
index 0d4f58e..3de205e 100755 (executable)
@@ -1,5 +1,5 @@
-TERMUX_PKG_DESCRIPTION="Vi IMproved - enhanced vi editor"
 TERMUX_PKG_HOMEPAGE=http://www.vim.org/
+TERMUX_PKG_DESCRIPTION="Vi IMproved - enhanced vi editor"
 TERMUX_PKG_DEPENDS="ncurses, vim-runtime, python"
 # vim should only be updated every 50 releases on multiples of 50.
 # Update both vim and vim-python to the same version in one PR.
index 1275d71..82db536 100755 (executable)
@@ -1,5 +1,5 @@
-TERMUX_PKG_DESCRIPTION="Vi IMproved - enhanced vi editor"
 TERMUX_PKG_HOMEPAGE=http://www.vim.org/
+TERMUX_PKG_DESCRIPTION="Vi IMproved - enhanced vi editor"
 TERMUX_PKG_DEPENDS="ncurses, vim-runtime"
 # vim should only be updated every 50 releases on multiples of 50.
 # Update both vim and vim-python to the same version in one PR.
diff --git a/scripts/lint-packages.py b/scripts/lint-packages.py
new file mode 100755 (executable)
index 0000000..dc48a3d
--- /dev/null
@@ -0,0 +1,33 @@
+#!/usr/bin/env python3
+
+import os
+import sys
+
+def main():
+    package_dir = 'packages'
+    for pkgdir_name in sorted(os.listdir(package_dir)):
+        dir_path = package_dir + '/' + pkgdir_name
+        build_sh_path = dir_path + '/build.sh'
+        if not os.path.isfile(build_sh_path):
+            sys.exit('No build.sh file in: ' + pkgdir_name)
+        with open(build_sh_path) as build_sh:
+            lines = build_sh.readlines()
+        validate_package(pkgdir_name, lines)
+
+def validate_package(package_name, lines):
+    if len(lines) < 3:
+        print('Too few lines in package: ' + package_name)
+        return
+    if not lines[0].startswith('TERMUX_PKG_HOMEPAGE='):
+        print('The first line is not TERMUX_PKG_HOMEPAGE: ' + package_name)
+    if not lines[1].startswith('TERMUX_PKG_DESCRIPTION='):
+        print('The second line is not TERMUX_PKG_DESCRIPTION: ' + package_name)
+
+    line_number = 1
+    for line in lines:
+        if line.endswith(' \n'):
+            print('Line ' + str(line_number) + ' has trailing whitespace: ' + package_name)
+        line_number += 1
+
+if __name__ == '__main__':
+    main()