Report an error when dpkg-source fails to extract package.
While invoking dpkg-source to extract package, switch from os.system to Popen to get output and exit code.
A fake PluginResult is generated if extract fails.
The importer has been modified to report dpkg-source output if detected.
This has been tested with a faulty package (orig not matching):
15:17:40,070 DEBUG [debexpo.lib.plugins] Running plugins of type: qa
15:17:40,070 DEBUG [debexpo.lib.plugins] Getting plugins with key (repr): 'debexpo.plugins.qa'
15:17:40,070 DEBUG [debexpo.lib.plugins] Using these plugins: lintian native maintaineremail watchfile closedbugs controlfields diffclean buildsystem debianqa distribution
15:17:40,070 DEBUG [debexpo.lib.plugins] Extracting package for plugins
15:17:40,070 DEBUG [debexpo.lib.plugins] Copying files to a temp directory to run dpkg-source -x on the dsc file
15:17:40,073 DEBUG [debexpo.lib.plugins] Temp dir is: /tmp/tmp2vTTZJ
15:17:40,073 DEBUG [debexpo.lib.plugins] Copying: ifmetric_0.3-1.dsc
15:17:40,073 DEBUG [debexpo.lib.plugins] Copying: ifmetric_0.3-1.debian.tar.xz
15:17:40,076 DEBUG [debexpo.lib.plugins] Extracting sources for ifmetric
15:17:40,355 CRITI [debexpo.lib.plugins] Failed to extract sources for ifmetric:
gpgv: Signature made Sat 12 Jan 2019 02:50:24 PM CET
gpgv: using EDDSA key 2DE24895313C5DA7F089E14E17494B10795DD733
gpgv: issuer "lyknode@cilg.org"
gpgv: Can't check signature: No public key
dpkg-source: warning: failed to verify signature on ./ifmetric_0.3-1.dsc
dpkg-source: error: file ./ifmetric_0.3.orig.tar.gz has size 313587 instead of expected 99874
15:17:40,356 ERROR [debexpo.importer.7573] Rejected: QA plugins failed the package
gpgv: Signature made Sat 12 Jan 2019 02:50:24 PM CET
gpgv: using EDDSA key 2DE24895313C5DA7F089E14E17494B10795DD733
gpgv: issuer "lyknode@cilg.org"
gpgv: Can't check signature: No public key
dpkg-source: warning: failed to verify signature on ./ifmetric_0.3-1.dsc
dpkg-source: error: file ./ifmetric_0.3.orig.tar.gz has size 313587 instead of expected 99874
15:17:40,356 DEBUG [debexpo.lib.email] Getting mail template: importer_reject_maintainer
15:17:40,373 DEBUG [debexpo.lib.email] Starting SMTP session to localhost
15:17:40,376 DEBUG [debexpo.lib.email] Sending email to lyknode@cilg.org
15:17:40,391 DEBUG [debexpo.lib.email] Successfully sent
Closes #43 (closed)
Edited by Baptiste Beauplat