From de35794692ec58d6b19a6e13e62c087b5324c812 Mon Sep 17 00:00:00 2001 From: Fredrik Fornwall Date: Tue, 5 Dec 2017 22:48:12 +0100 Subject: [PATCH] Add scripts/lint-packages.py Harmonize the layout by having the first two lines of a package definition always be the homepage and the description. --- packages/aapt/build.sh | 7 ++++--- packages/alpine/build.sh | 2 +- packages/apr/build.sh | 2 +- packages/autoconf/build.sh | 2 +- packages/ccache/build.sh | 2 +- packages/dialog/build.sh | 2 +- packages/gmic/build.sh | 2 +- packages/ncmpcpp/build.sh | 2 +- packages/ncurses/build.sh | 2 +- packages/neofetch/build.sh | 2 +- packages/unzip/build.sh | 4 ++-- packages/valac/build.sh | 9 +++------ packages/vim-python/build.sh | 2 +- packages/vim/build.sh | 2 +- scripts/lint-packages.py | 33 +++++++++++++++++++++++++++++++++ 15 files changed, 53 insertions(+), 22 deletions(-) create mode 100755 scripts/lint-packages.py diff --git a/packages/aapt/build.sh b/packages/aapt/build.sh index 9dbe66a2..4373c126 100644 --- a/packages/aapt/build.sh +++ b/packages/aapt/build.sh @@ -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 diff --git a/packages/alpine/build.sh b/packages/alpine/build.sh index 9a6394be..9e73f2fa 100644 --- a/packages/alpine/build.sh +++ b/packages/alpine/build.sh @@ -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 diff --git a/packages/apr/build.sh b/packages/apr/build.sh index 935bd117..035e4f90 100644 --- a/packages/apr/build.sh +++ b/packages/apr/build.sh @@ -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. diff --git a/packages/autoconf/build.sh b/packages/autoconf/build.sh index c968f895..a43a7280 100644 --- a/packages/autoconf/build.sh +++ b/packages/autoconf/build.sh @@ -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 } diff --git a/packages/ccache/build.sh b/packages/ccache/build.sh index ce0bb7da..639e7229 100644 --- a/packages/ccache/build.sh +++ b/packages/ccache/build.sh @@ -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 diff --git a/packages/dialog/build.sh b/packages/dialog/build.sh index 326482d3..eff3d2e7 100755 --- a/packages/dialog/build.sh +++ b/packages/dialog/build.sh @@ -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 diff --git a/packages/gmic/build.sh b/packages/gmic/build.sh index 93695b82..9cb21222 100644 --- a/packages/gmic/build.sh +++ b/packages/gmic/build.sh @@ -14,7 +14,7 @@ termux_step_configure() { termux_step_make () { cd src/ - make cli + make cli } termux_step_make_install() { diff --git a/packages/ncmpcpp/build.sh b/packages/ncmpcpp/build.sh index a235a7f0..2d844452 100644 --- a/packages/ncmpcpp/build.sh +++ b/packages/ncmpcpp/build.sh @@ -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" } diff --git a/packages/ncurses/build.sh b/packages/ncurses/build.sh index 9486f8ce..368c1dc5 100755 --- a/packages/ncurses/build.sh +++ b/packages/ncurses/build.sh @@ -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) diff --git a/packages/neofetch/build.sh b/packages/neofetch/build.sh index 495641ad..ba565d5b 100644 --- a/packages/neofetch/build.sh +++ b/packages/neofetch/build.sh @@ -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 diff --git a/packages/unzip/build.sh b/packages/unzip/build.sh index 7457c0de..e668acd4 100644 --- a/packages/unzip/build.sh +++ b/packages/unzip/build.sh @@ -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" diff --git a/packages/valac/build.sh b/packages/valac/build.sh index 135d1127..3aa7d07b 100644 --- a/packages/valac/build.sh +++ b/packages/valac/build.sh @@ -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 diff --git a/packages/vim-python/build.sh b/packages/vim-python/build.sh index 0d4f58e1..3de205e0 100755 --- a/packages/vim-python/build.sh +++ b/packages/vim-python/build.sh @@ -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. diff --git a/packages/vim/build.sh b/packages/vim/build.sh index 1275d710..82db5362 100755 --- a/packages/vim/build.sh +++ b/packages/vim/build.sh @@ -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 index 00000000..dc48a3de --- /dev/null +++ b/scripts/lint-packages.py @@ -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() -- 2.11.0