Open palica opened 5 years ago
Still needs:
Add fail safe in case the user launches with -b option from the terminal. It should know it wasn't launched by an emerge hook here.
Remove backtics for retrieving build.log, this can be done more safely with pure perl.
bug_report function is sending a hard coded 0 to send report.. there should be logic to determine if the -d flag was actually active or not... or should there be?
I would probably add (hardcoded or configurable through variable in config) -v to the -b so the user can link this directly in bugs.funtoo.org
going to open individual issues for the features needed
so indiv. issues opened. going to move this to review column and ask @ShadowM00n to review the code. We can expand on more functionality in opening new issues and working them out.
Thanks @haxmeister for the hackatlon!
EGIT_OVERRIDE_BRANCH_HAXMEISTER_FUNTOO_REPORTER=feature/bugreports emerge -v1 Funtoo-Report
with this ebuild:
# Distributed under the terms of the GNU General Public License v2
EAPI=6
inherit perl-module bash-completion-r1
DESCRIPTION="Anonymous reporting tool for Funtoo Linux"
HOMEPAGE="https://github.com/haxmeister/funtoo-reporter"
if [[ ${PV} == 9999* ]]; then
inherit git-r3
EGIT_REPO_URI="https://github.com/haxmeister/funtoo-reporter.git"
EGIT_BRANCH="develop"
SRC_URI=""
KEYWORDS=""
IUSE="test"
else
SRC_URI="https://github.com/haxmeister/funtoo-reporter/archive/v${PV}.tar.gz -> ${P}.tar.gz"
KEYWORDS="*"
S="${WORKDIR}/funtoo-reporter-${PV}"
fi
LICENSE="MIT"
SLOT="0"
IUSE="${IUSE} bash-completion zsh-completion"
RDEPEND="
dev-perl/JSON
sys-apps/pciutils
"
DIST_TEST="do parallel"
src_compile() {
pod2man funtoo-report > funtoo-report.1 || die "pod2man failed"
pod2man lib/Funtoo/Report.pm > funtoo-report.3 || die "pod2man failed"
if [[ ${PV} == 9999* ]]; then
./bump_version.sh describe # change the version to show latest commit hash
fi
}
src_install() {
insinto /etc
doins "${FILESDIR}/funtoo-report.conf"
insinto /etc/portage
newins "${FILESDIR}/portage-bashrc" bashrc
dodoc README.md
doman funtoo-report.1
doman funtoo-report.3
# Install bash completion files
if use bash-completion; then
newbashcomp share/bash-completion/funtoo-report.bash funtoo-report
fi
# Install zsh completion files
if use zsh-completion; then
insinto /usr/share/zsh/site-functions
doins share/zsh-completion/_funtoo-report
fi
perl-module_src_install
}
pkg_postinst() {
if [[ ${PV} == 9999* ]]; then
elog Funtoo Reporter - Development release
elog ====================================================================
elog WARNING: You are using a version that is tracking the $EGIT_BRANCH
elog Things can be broken. If you want a stable release use version <9999
elog ====================================================================
else
elog Funtoo Reporter - Stable release
fi
elog "The Funtoo Reporter comes with a default config file that can be found in /etc/funtoo-report.conf"
elog "You can review what information gets submitted and generate/update your config file"
elog "using the tool directly by issuing:"
echo
elog "funtoo-report -u"
echo
elog "It is recommended to run --update-config|-u after any major release."
elog "You can setup a cron job to submit your information on regular basis."
elog "The data collected are submitted with a timestamp, so changes can be followed in time (like kits used, profile usage ...)."
elog "Here is a sample cron job definition to put into your crontab:"
echo
elog "0 * * * * /usr/bin/funtoo-report -s"
echo
elog "This would send data every hour to the database."
echo
}
and adding this into files directory under dev-perl/Funtoo-Report/files:
# define a failure function for bug reporting
function failure ()
{
echo "Something didn't work as expected, submitting a bug report:"
funtoo-report -b -v
}
# register_die_hook calling failure() function
# this gets called by any type of failure including interrupt (CTRL + c)
register_die_hook failure
this is a new proposed feature to be able to automatically submit build.log and other information after a failed build of a program on Funtoo Linux.