#!/bin/bash # $HeadURL$ $LastChangedRevision$ # Modules . $(bs-config bs_share_prefix)/include/bssupport.sh || { echo "${0##*/}: INTERNAL ERROR: failed to load bssupport.sh" >&2; exit 3; } . $(miniade) || { echo "${0##*/}: ERROR: miniade failed (hint: run 'miniade' to see error)" >&2; exit 1; } # Configurable stuff # Other globals main() { local MY_ARGS local PROGRAM VERBOSELEVEL PROGNAME # Defaults for options # Process options miniade_process_options --help-handler=usage MY_ARGS "$@" && set -- "${MY_ARGS[@]}" # Process arguments # Sanity checks and derivations # bs sets PROGRAM, but passes it to us through environment as BS_PROGRAM, copy it back. PROGRAM=$BS_PROGRAM VERBOSELEVEL=$BS_VERBOSELEVEL PKGCTRL_SVNREPO_URL=$BS_PKGCTRL_SVNREPO_URL PKGCTRL_SVNWC_DIR=$BS_PKGCTRL_SVNWC_DIR bssupport_checkset VERBOSELEVEL PROGRAM PKGCTRL_SVNREPO_URL PKGCTRL_SVNWC_DIR miniade_set_verboselevel $VERBOSELEVEL { ! [[ $PROGRAM =~ .*\.debian$ ]]; } || miniade_internal "PROGRAM ends with '.debian'" checkinstalled dh_make # Guts # Check doesn't exist already. SVN_CMDLINE="svn ls $PKGCTRL_SVNREPO_URL 2>&1" miniade_debug 10 "calling [$SVN_CMDLINE] ..." SVN_OUTPUT=$(eval "$SVN_CMDLINE") || true if ! [[ $SVN_OUTPUT =~ W160013 ]]; then miniade_error "$PROGRAM.debian: svn did not report that this module does not exist (hint: output was [$SVN_OUTPUT])" fi # Generate files # We'll set the version to be 0 and then let the package developer # respond to the 'uh ... higher version available' message themselves. VERSION=0 PROGRAM_UC=${PROGRAM^^} # make what dh_make needs to work mkdir $PROGRAM-$VERSION cd $PROGRAM-$VERSION # Stop message 'Currently there is not top level Makefile. This may require additional tuning' from # appearing by creating dummy Makefile.. touch Makefile DHMAKE_CMDLINE="dh_make --indep --createorig --copyright gpl3 --yes" miniade_debug 10 "calling [$DHMAKE_CMDLINE] ..." if ! eval "$DHMAKE_CMDLINE" > /dev/null; then miniade_error "$PROGRAM.debian: dh_make failed (hint: see messages above)" fi rm Makefile cd debian { echo "#!/usr/bin/make -f" echo "# -*- makefile -*-" echo "# \$HeadURL$PKGCTRL_SVNREPO_URL/trunk/rules \$ \$LastChangedRevision: 4884 \$" echo echo "#export DH_VERBOSE=1" echo "PACKAGE=$PROGRAM" echo "SHELL=/bin/bash" echo "#ADETEST_FLAGS=-vk" echo echo "get-orig-source:" echo " uscan --noconf --force-download --rename --repack --download-current-version --destdir=." echo echo "%:" echo " dh \$@" echo echo "override_dh_auto_build:" echo " env -i \$(MAKE) -s" echo echo "override_dh_auto_test:" echo " env -i ADETEST_FLAGS=\$(ADETEST_FLAGS) \$(MAKE) -s tests" echo echo "override_dh_auto_install:" echo " env -i ${PROGRAM_UC}_PREFIX=\$(CURDIR)/debian/\$(PACKAGE)/usr ${PROGRAM_UC}_ETC_PREFIX=\$(CURDIR)/debian/\$(PACKAGE)/etc \$(MAKE) install" echo " rm -f \$(CURDIR)/debian/\$(PACKAGE)/usr/share/doc/$PROGRAM/COPYING" } > rules { echo "# \$HeadURL$PKGCTRL_SVNREPO_URL/trunk/watch \$ \$LastChangedRevision: 4880 \$" echo "version=3" echo "https://repo.pasta.freemyip.com/sources/$PROGRAM-(.*)\.tar\.gz" } > watch # Remove stuff that dh_make created that I don't want. rm *.{ex,EX} README.source README.Debian $PROGRAM-docs.docs cd ../.. rm ${PROGRAM}_$VERSION.orig.tar.xz #tweak miniade_info "$PROGRAM.debian: tweaking directories for initial import ..." mv $PROGRAM-$VERSION/debian trunk rmdir $PROGRAM-$VERSION mkdir tags branches miniade_info "$PROGRAM.debian: importing ..." svn -q import -m " * $PROGRAM.debian: initial version" $PKGCTRL_SVNREPO_URL miniade_info "$PROGRAM.debian: checking out into the usual place ..." svn -q co $PKGCTRL_SVNREPO_URL/trunk $PKGCTRL_SVNWC_DIR } main "$@"