summaryrefslogtreecommitdiff
path: root/maintainer
diff options
context:
space:
mode:
authorAlexey Neyman <stilor@att.net>2017-08-23 23:05:40 (GMT)
committerAlexey Neyman <stilor@att.net>2017-08-23 23:05:40 (GMT)
commitf8d4ce3d0e9b384a66286901f6680c835af76284 (patch)
tree0efbee3a3f267c83211c65c066b5829dc8b92741 /maintainer
parent8e8417226d5cdd90896df2c585ad03a995e5e9a1 (diff)
Implement a script for checking packages
Then use this script to check that all packages can be extracted and patched. Signed-off-by: Alexey Neyman <stilor@att.net>
Diffstat (limited to 'maintainer')
-rw-r--r--maintainer/kconfig-versions.template6
-rw-r--r--maintainer/package-versions.template13
-rwxr-xr-xmaintainer/test-packages.sh190
3 files changed, 209 insertions, 0 deletions
diff --git a/maintainer/kconfig-versions.template b/maintainer/kconfig-versions.template
index 4692a25..c16bb77 100644
--- a/maintainer/kconfig-versions.template
+++ b/maintainer/kconfig-versions.template
@@ -252,10 +252,16 @@ config @@pfx@@_MIRRORS
config @@pfx@@_ARCHIVE_FILENAME
string
+#!foreach version
+ default "@@archive_filename@@" if @@pfx@@_V_@@kcfg@@
+#!end-foreach
default "@@archive_filename@@"
config @@pfx@@_ARCHIVE_DIRNAME
string
+#!foreach version
+ default "@@archive_dirname@@" if @@pfx@@_V_@@kcfg@@
+#!end-foreach
default "@@archive_dirname@@"
config @@pfx@@_ARCHIVE_FORMATS
diff --git a/maintainer/package-versions.template b/maintainer/package-versions.template
new file mode 100644
index 0000000..3645162
--- /dev/null
+++ b/maintainer/package-versions.template
@@ -0,0 +1,13 @@
+#!foreach fork
+#!foreach version
+run_pkgversion \
+ master=@@master@@ \
+ masterpfx=@@masterpfx@@ \
+ originpfx=@@originpfx@@ \
+ pkg_name=@@pkg_name@@ \
+ pfx=@@pfx@@ \
+ versionlocked=@@versionlocked@@ \
+ ver=@@ver@@ \
+ kcfg=@@kcfg@@
+#!end-foreach
+#!end-foreach
diff --git a/maintainer/test-packages.sh b/maintainer/test-packages.sh
new file mode 100755
index 0000000..7a19651
--- /dev/null
+++ b/maintainer/test-packages.sh
@@ -0,0 +1,190 @@
+#!/bin/bash
+
+selected=
+
+usage()
+{
+ cat <<EOF
+$0 -- Test packages in crosstool-NG
+
+Verifies that the release tarballs can be downloaded for the packages
+available in crosstoo-NG and check that the patches apply cleanly.
+Requires crosstool-NG to be configured and built prior to running.
+
+Options:
+ --help, -?
+ Display this help message.
+
+ --download, -d
+ Download all packages to the default directory (\$HOME/src).
+
+ --apply-patches, -a
+ Implies -d. Unpack and apply the bundled patches.
+
+ --verify-urls, -u
+ Check *all* the download URLs for accessibility, without
+ actually downloading anything.
+
+ --select MASK, -s MASK
+ Specify the package to operate upon. MASK can be either package
+ name ("-s foo"), or package name + version ("-s foo-1.1").
+
+EOF
+}
+
+while [ -n "${1}" ]; do
+ case "${1}" in
+ --download|-d)
+ download_pkgs=y
+ ;;
+ --verify-urls|-u)
+ verify_urls=y
+ ;;
+ --apply-patches|-a)
+ apply_patches=y
+ download_pkgs=y
+ ;;
+ --select|-s)
+ shift
+ [ -n "${1}" ] || { echo "argument required for --select" >&2; exit 1; }
+ selected="${1}"
+ ;;
+ --help|-?)
+ usage
+ exit 0
+ ;;
+ *)
+ echo "Unknown option ${1}" >&2
+ exit 1
+ ;;
+ esac
+ shift
+done
+
+CT_LIB_DIR=`pwd`
+CT_TOP_DIR=`pwd`
+CT_TARBALLS_DIR=`pwd`/temp.tarballs
+CT_COMMON_SRC_DIR=`pwd`/temp.src
+CT_SRC_DIR=`pwd`/temp.src
+CT_LOG_LEVEL_MAX=EXTRA
+mkdir -p ${CT_TARBALLS_DIR}
+
+# Does not matter, just to make the scripts load
+CT_ARCH=arm
+CT_KERNEL=bare-metal
+CT_BINUTILS=binutils
+CT_LIBC=none
+CT_CC=gcc
+
+. paths.sh
+. scripts/functions
+
+rm -f build.log
+CT_LogEnable
+
+check_pkg_urls()
+{
+ local e m mh url
+
+ for e in ${archive_formats}; do
+ local -A mirror_status=( )
+
+ CT_DoStep EXTRA "Looking for ${archive_filename}${e}"
+ for m in ${mirrors}; do
+ url="${m}/${archive_filename}${e}"
+ mh="${m#*://}"
+ mh="${mh%%[:/]*}"
+ if [ -n "${mirror_status[${mh}]}" ]; then
+ CT_DoLog DEBUG "Skipping '${url}': already found on this host at '${mirror_status[${mh}]}'"
+ continue
+ fi
+ if CT_DoExecLog ALL wget --spider "${url}"; then
+ mirror_status[${mh}]="${url}"
+ else
+ mirror_status[${mh}]=
+ fi
+ done
+ for mh in "${!mirror_status[@]}"; do
+ if [ -n "${mirror_status[${mh}]}" ]; then
+ CT_DoLog EXTRA "OK ${mh} [${archive_filename}${e}]"
+ else
+ CT_DoLog ERROR "FAIL ${mh} [${archive_filename}${e}]"
+ fi
+ done
+ CT_EndStep
+ done
+}
+
+run_pkgversion()
+{
+ while [ -n "${1}" ]; do
+ eval "local ${1}"
+ shift
+ done
+
+ if [ -n "${selected}" ]; then
+ case "${selected}" in
+ ${pkg_name}|${pkg_name}-${ver})
+ ;;
+ *)
+ return
+ ;;
+ esac
+ fi
+
+ CT_DoStep INFO "Handling ${pkg_name}-${ver}"
+
+ # Create a temporary configuration head file
+ cat >temp.in <<EOF
+config OBSOLETE
+ def_bool y
+
+config EXPERIMENTAL
+ def_bool y
+
+config CONFIGURE_has_wget
+ def_bool y
+
+config CONFIGURE_has_curl
+ def_bool y
+
+config ${versionlocked}_V_${kcfg}
+ def_bool y
+
+source "config/global/paths.in"
+source "config/global/download.in"
+source "config/global/extract.in"
+source "config/versions/${master}.in"
+EOF
+
+ cat >temp.defconfig <<EOF
+CT_${masterpfx}_USE_${originpfx}=y
+CT_${pfx}_SRC_RELEASE=y
+CT_${pfx}_V_${kcfg}=y
+CT_SAVE_TARBALLS=y
+EOF
+
+ ./kconfig/conf --defconfig=temp.defconfig temp.in >/dev/null
+
+ CT_LoadConfig
+ rm -f .config .config.old temp.defconfig temp.in
+ if [ -n "${verify_urls}" ]; then
+ CT_DoLog EXTRA "Verifying URLs for ${pkg_name}-${ver}"
+ CT_PackageRun "${masterpfx}" check_pkg_urls
+ fi
+ if [ -n "${download_pkgs}" ]; then
+ CT_DoLog EXTRA "Downloading ${pkg_name}-${ver}"
+ CT_Fetch "${masterpfx}"
+ fi
+ if [ -n "${apply_patches}" ]; then
+ rm -rf ${CT_COMMON_SRC_DIR}
+ mkdir -p ${CT_COMMON_SRC_DIR}
+ CT_ExtractPatch "${masterpfx}"
+ fi
+
+ CT_EndStep
+}
+
+. maintainer/package-versions
+
+rm -rf ${CT_TARBALLS_DIR} ${CT_COMMON_SRC_DIR}