#!/bin/bash - set -o nounset # Treat unset variables as an error mngt_dir() { local dirname=$1 rm -rf ${dirname}.bk if [ -e $dirname ]; then mv $dirname ${dirname}.bk fi mkdir ${dirname} } DEPENDENCIES_DIR="packages-dependencies" KO_OUT_LOG_DIR="ko-out-log-dir" OUT_FILE_NAME_BASE="packages-status" OUT_FILE_NAME_EXT="wiki" OUT_FILE_NAME=${OUT_FILE_NAME_BASE}.${OUT_FILE_NAME_EXT} rm -f ${OUT_FILE_NAME}.bk if [ -e $OUT_FILE_NAME ]; then mv $OUT_FILE_NAME ${OUT_FILE_NAME}.bk fi mngt_dir ${DEPENDENCIES_DIR} mngt_dir ${KO_OUT_LOG_DIR} NB_OK=0 NB_KO=0 NB_UNKNOWN=0 file_header() { local title="Packages status" echo "" echo "start file $OUT_FILE_NAME" echo "" echo "" >> $OUT_FILE_NAME echo "= $title =" >> $OUT_FILE_NAME echo "" >> $OUT_FILE_NAME } section_header() { local title=$1 echo "" echo "" echo "start section \"$title\"" echo "" >> $OUT_FILE_NAME echo "== $title ==" >> $OUT_FILE_NAME echo "" >> $OUT_FILE_NAME echo "| package | status | nb dependencies |" >> $OUT_FILE_NAME NB_OK=0 NB_KO=0 NB_UNKNOWN=0 } section_footer() { echo "" >> $OUT_FILE_NAME echo "nb packages OK in section: $NB_OK" >> $OUT_FILE_NAME echo "" >> $OUT_FILE_NAME echo "nb packages *KO* in section: $NB_KO" >> $OUT_FILE_NAME echo "" >> $OUT_FILE_NAME echo "nb packages UNKNOWN in section: $NB_UNKNOWN" >> $OUT_FILE_NAME echo "" >> $OUT_FILE_NAME echo "" >> $OUT_FILE_NAME } add_package_status() { local package=$1 local status=$2 local nb_deps=$3 if [ "$status" = "OK" ]; then NB_OK=$(($NB_OK+1)) elif [ "$status" = "KO" ]; then status="*KO*" NB_KO=$(($NB_KO+1)) else NB_UNKNOWN=$(($NB_UNKNOWN+1)) fi echo "| $package | $status | $nb_deps |" >> $OUT_FILE_NAME } LIST_PACK_SUPPOSED_OK="" LIST_PACK_SUPPOSED_OK+=" xz" LIST_PACK_SUPPOSED_OK+=" tk" LIST_PACK_SUPPOSED_OK+=" m4" LIST_PACK_SUPPOSED_OK+=" ed" LIST_PACK_SUPPOSED_OK+=" bc" LIST_PACK_SUPPOSED_OK+=" tcl" LIST_PACK_SUPPOSED_OK+=" sed" LIST_PACK_SUPPOSED_OK+=" mpc" LIST_PACK_SUPPOSED_OK+=" lzo" LIST_PACK_SUPPOSED_OK+=" isl" LIST_PACK_SUPPOSED_OK+=" gss" LIST_PACK_SUPPOSED_OK+=" gmp" LIST_PACK_SUPPOSED_OK+=" bdb" LIST_PACK_SUPPOSED_OK+=" acl" LIST_PACK_SUPPOSED_OK+=" zlib" LIST_PACK_SUPPOSED_OK+=" sudo" LIST_PACK_SUPPOSED_OK+=" perl" LIST_PACK_SUPPOSED_OK+=" pcre" LIST_PACK_SUPPOSED_OK+=" mpfr" LIST_PACK_SUPPOSED_OK+=" make" LIST_PACK_SUPPOSED_OK+=" lzip" LIST_PACK_SUPPOSED_OK+=" gzip" LIST_PACK_SUPPOSED_OK+=" grep" LIST_PACK_SUPPOSED_OK+=" gdbm" LIST_PACK_SUPPOSED_OK+=" gawk" LIST_PACK_SUPPOSED_OK+=" fuse" LIST_PACK_SUPPOSED_OK+=" flex" LIST_PACK_SUPPOSED_OK+=" flac" LIST_PACK_SUPPOSED_OK+=" file" LIST_PACK_SUPPOSED_OK+=" fftw" LIST_PACK_SUPPOSED_OK+=" bash" LIST_PACK_SUPPOSED_OK+=" attr" LIST_PACK_SUPPOSED_OK+=" which" LIST_PACK_SUPPOSED_OK+=" unzip" LIST_PACK_SUPPOSED_OK+=" rhash" LIST_PACK_SUPPOSED_OK+=" libuv" LIST_PACK_SUPPOSED_OK+=" libgc" LIST_PACK_SUPPOSED_OK+=" libev" LIST_PACK_SUPPOSED_OK+=" guile" LIST_PACK_SUPPOSED_OK+=" groff" LIST_PACK_SUPPOSED_OK+=" gperf" LIST_PACK_SUPPOSED_OK+=" glibc" LIST_PACK_SUPPOSED_OK+=" expat" LIST_PACK_SUPPOSED_OK+=" bzip2" LIST_PACK_SUPPOSED_OK+=" bison" LIST_PACK_SUPPOSED_OK+=" xtrans" LIST_PACK_SUPPOSED_OK+=" tzdata" LIST_PACK_SUPPOSED_OK+=" sqlite" LIST_PACK_SUPPOSED_OK+=" shishi" LIST_PACK_SUPPOSED_OK+=" shadow" LIST_PACK_SUPPOSED_OK+=" python" LIST_PACK_SUPPOSED_OK+=" nettle" LIST_PACK_SUPPOSED_OK+=" libxft" LIST_PACK_SUPPOSED_OK+=" libxcb" LIST_PACK_SUPPOSED_OK+=" libxau" LIST_PACK_SUPPOSED_OK+=" libx11" LIST_PACK_SUPPOSED_OK+=" libpng" LIST_PACK_SUPPOSED_OK+=" libogg" LIST_PACK_SUPPOSED_OK+=" libidn" LIST_PACK_SUPPOSED_OK+=" libffi" LIST_PACK_SUPPOSED_OK+=" libelf" LIST_PACK_SUPPOSED_OK+=" libcap" LIST_PACK_SUPPOSED_OK+=" libbsd" LIST_PACK_SUPPOSED_OK+=" indent" LIST_PACK_SUPPOSED_OK+=" gnutls" LIST_PACK_SUPPOSED_OK+=" c-ares" LIST_PACK_SUPPOSED_OK+=" texinfo" LIST_PACK_SUPPOSED_OK+=" python2" LIST_PACK_SUPPOSED_OK+=" psutils" LIST_PACK_SUPPOSED_OK+=" ncurses" LIST_PACK_SUPPOSED_OK+=" libxslt" LIST_PACK_SUPPOSED_OK+=" libxml2" LIST_PACK_SUPPOSED_OK+=" libxext" LIST_PACK_SUPPOSED_OK+=" libtool" LIST_PACK_SUPPOSED_OK+=" libtiff" LIST_PACK_SUPPOSED_OK+=" libssh2" LIST_PACK_SUPPOSED_OK+=" libltdl" LIST_PACK_SUPPOSED_OK+=" libjpeg" LIST_PACK_SUPPOSED_OK+=" libidn2" LIST_PACK_SUPPOSED_OK+=" jansson" LIST_PACK_SUPPOSED_OK+=" shepherd" LIST_PACK_SUPPOSED_OK+=" net-base" LIST_PACK_SUPPOSED_OK+=" libxdmcp" LIST_PACK_SUPPOSED_OK+=" libtasn1" LIST_PACK_SUPPOSED_OK+=" libpaper" LIST_PACK_SUPPOSED_OK+=" jemalloc" LIST_PACK_SUPPOSED_OK+=" jbig2dec" LIST_PACK_SUPPOSED_OK+=" gs-fonts" LIST_PACK_SUPPOSED_OK+=" freetype" LIST_PACK_SUPPOSED_OK+=" elfutils" LIST_PACK_SUPPOSED_OK+=" binutils" LIST_PACK_SUPPOSED_OK+=" automake" LIST_PACK_SUPPOSED_OK+=" autoconf" LIST_PACK_SUPPOSED_OK+=" alsa-lib" LIST_PACK_SUPPOSED_OK+=" xorgproto" LIST_PACK_SUPPOSED_OK+=" xcb-proto" LIST_PACK_SUPPOSED_OK+=" linux-pam" LIST_PACK_SUPPOSED_OK+=" libvorbis" LIST_PACK_SUPPOSED_OK+=" libgcrypt" LIST_PACK_SUPPOSED_OK+=" inetutils" LIST_PACK_SUPPOSED_OK+=" findutils" LIST_PACK_SUPPOSED_OK+=" e2fsprogs" LIST_PACK_SUPPOSED_OK+=" diffutils" LIST_PACK_SUPPOSED_OK+=" coreutils" LIST_PACK_SUPPOSED_OK+=" util-linux" LIST_PACK_SUPPOSED_OK+=" libxrender" LIST_PACK_SUPPOSED_OK+=" libsndfile" LIST_PACK_SUPPOSED_OK+=" libsigsegv" LIST_PACK_SUPPOSED_OK+=" libfontenc" LIST_PACK_SUPPOSED_OK+=" guile-json" LIST_PACK_SUPPOSED_OK+=" fontconfig" LIST_PACK_SUPPOSED_OK+=" util-macros" LIST_PACK_SUPPOSED_OK+=" mkfontscale" LIST_PACK_SUPPOSED_OK+=" linux-libre" LIST_PACK_SUPPOSED_OK+=" ghostscript" LIST_PACK_SUPPOSED_OK+=" docbook-xsl" LIST_PACK_SUPPOSED_OK+=" docbook-xml" LIST_PACK_SUPPOSED_OK+=" bash-static" LIST_PACK_SUPPOSED_OK+=" libunistring" LIST_PACK_SUPPOSED_OK+=" libgpg-error" LIST_PACK_SUPPOSED_OK+=" bash-minimal" LIST_PACK_SUPPOSED_OK+=" libsamplerate" LIST_PACK_SUPPOSED_OK+=" libatomic-ops" LIST_PACK_SUPPOSED_OK+=" e2fsck-static" LIST_PACK_SUPPOSED_OK+=" wireless-regdb" LIST_PACK_SUPPOSED_OK+=" python-wrapper" LIST_PACK_SUPPOSED_OK+=" python-minimal" LIST_PACK_SUPPOSED_OK+=" guile-readline" LIST_PACK_SUPPOSED_OK+=" guile-gdbm-ffi" LIST_PACK_SUPPOSED_OK+=" gettext-minimal" LIST_PACK_SUPPOSED_OK+=" libpthread-stubs" LIST_PACK_SUPPOSED_OK+=" openfwwf-firmware" LIST_PACK_SUPPOSED_OK+=" glibc-utf8-locales" LIST_PACK_SUPPOSED_OK+=" ath9k-htc-firmware" LIST_PACK_SUPPOSED_OK+=" linux-libre-headers" LIST_PACK_SUPPOSED_OK+=" guile-static-stripped" LIST_PACK_SUPPOSED_OK+=" python-minimal-wrapper" LIST_PACK_SUPPOSED_OK+=" pkg-config" LIST_PACK_SUPPOSED_OK+=" libarchive" LIST_PACK_SUPPOSED_OK+=" cyrus-sasl" LIST_PACK_SUPPOSED_OK+=" tcsh" LIST_PACK_SUPPOSED_OK+=" xmlto" LIST_PACK_SUPPOSED_OK+=" icu4c" # ? LIST_PACK_SUPPOSED_OK+=" mit-krb5" # ok ? LIST_PACK_SUPPOSED_OK+=" help2man" LIST_PACK_SUPPOSED_OK+=" mkfontdir" LIST_PACK_SUPPOSED_OK+=" lvm2" LIST_PACK_SUPPOSED_OK+=" eudev" LIST_PACK_SUPPOSED_OK+=" procps" LIST_PACK_SUPPOSED_OK+=" alsa-utils" LIST_PACK_SUPPOSED_OK+=" boost" LIST_PACK_SUPPOSED_OK+=" swig" LIST_PACK_SUPPOSED_OK+=" doxygen" LIST_PACK_SUPPOSED_OK+=" curl" LIST_PACK_SUPPOSED_OK+=" nghttp2" LIST_PACK_SUPPOSED_OK+=" openldap" LIST_PACK_SUPPOSED_OK+=" git-minimal" LIST_PACK_SUPPOSED_KO="" LIST_PACK_SUPPOSED_KO+=" libnl" LIST_PACK_SUPPOSED_KO+=" crda" # depends on libnl LIST_PACK_SUPPOSED_KO+=" cmake" LIST_PACK_SUPPOSED_KO+=" guile-wm" LIST_PACK_SUPPOSED_KO+=" guile-xcb" count_dependencies() { local pack="$1" local depsfile="$DEPENDENCIES_DIR/${pack}.dot" guix graph -t bag-emerged $pack > $depsfile count=$(cat $depsfile | grep "\->" | wc -l) echo $count } build_pack() { local pack="$1" local out_file=$(mktemp /tmp/test-guix.XXXXX) local result=0 ./pre-inst-env guix build --target=aarch64-linux-gnu $pack > $out_file 2>&1 result=$? if [ $result -eq 0 ]; then rm -f $out_file else mv $out_file ${KO_OUT_LOG_DIR}/${pack}.log fi return $result } build_all_in_list() { local list_pack="$@" local status=unknown for pack in $list_pack; do echo "" echo "" echo "--------------- package $pack ---------------" echo "" build_pack $pack if [ $? -eq 0 ]; then status="OK" else status="KO" fi nb_deps="$(count_dependencies $pack)" echo " package $pack is $status (and has $nb_deps dependencies)" echo "" echo "" add_package_status $pack $status $nb_deps done } if [ $# -ge 1 ]; then EXEC_SUPPOSED_OK=0 EXEC_SUPPOSED_KO=0 while [ $# -ge 1 ]; do case "$1" in "--ok") EXEC_SUPPOSED_OK=1 ;; "--ko") EXEC_SUPPOSED_KO=1 ;; *) echo "Unknown argument $1" exit 1 ;; esac shift done else EXEC_SUPPOSED_OK=1 EXEC_SUPPOSED_KO=1 fi file_header if [ $EXEC_SUPPOSED_OK -eq 1 ]; then section_header "Supposed OK Packages" build_all_in_list $LIST_PACK_SUPPOSED_OK section_footer fi if [ $EXEC_SUPPOSED_KO -eq 1 ]; then section_header "Supposed KO Packages" build_all_in_list $LIST_PACK_SUPPOSED_KO section_footer fi