stable/sru-workflow-manager: be smarter when checking package builds

This is a huge change reestructuring the way we check for package
builds. Before, the bot was relying on tasks being set to an specific
status ('In Progress'), and only in this case we would check for builds.
Also, depending on the existence of the upload-to-ppa task, we were
using it also to conditionally check for the main package build on the
ckt ppa. Not only that, but in addition we were treating prepare-package-*
tasks as a dependency to the main prepare-package task, because we were
using only the prepare-package status to check if we needed to set the
promotion to proposed tasks forward.

Now, instead of treating all prepare-package tasks separately, before
we process bug tasks and actions we first check for the status of all
package builds, and depending on their status, we set the
prepare-package status right away to the proper state. Also, we look and
set what should be the proper assignee from information gathered from
launchpad, and if the packages were already released, we also go ahead
and set promotion to update/release tasks status and assignments.

Finally, upload-to-ppa task now only servers to indicate that a package
is ready to be uploaded from contents in git, for bugs where maintainer
and stable team split the work. The bot doesn't use it anymore for
anything.

Signed-off-by: Herton Ronaldo Krzesinski <herton.krzesinski@canonical.com>
ktl/workflow.py: disable upload-to-ppa task on armadaxp bugs

Since Ike himself prepares the packages and uploads them, there is no
reason to have an upload-to-ppa task on armadaxp tracking bugs.
upload-to-ppa is only useful to tell us, the stable team, that source
is ready and we can build the source packages and upload, after the
maintainer prepared and provided the source tree somewhere.

Signed-off-by: Herton Ronaldo Krzesinski <herton.krzesinski@canonical.com>
cve-autotriage: add local fix information for CVE-2013-0216

Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
stable/sru-workflow-manager: be careful when changing status from Fix Released

When the copy of packages happen between pockets, we may be in an state
where packages are not available anywhere while the bot is running. This
means that we were misdetecting the package builds as not available.
Refactor the setting of build status to account for this, adding a
bug property that we use to wait before we go wild and reset the
prepare-package tasks if for some reason packages are really gone.

Signed-off-by: Herton Ronaldo Krzesinski <herton.krzesinski@canonical.com>
cve-autotriage: add local fix information for CVE-2013-0217

Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
cve-autotriage: Fixed local- notation

The local- notation has to be unique; fixed that for CVEs
CVE-2013-0216 and CVE-2013-0217.

Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
ktl/tracking_bug.py: set development tasks to invalid

We don't use development tasks, but always add a nomination. Set the
development task to invalid always. While at it, set the importance of
all tasks to Medium.

Signed-off-by: Herton Ronaldo Krzesinski <herton.krzesinski@canonical.com>
stable/sru-workflow-manager: don't set abi tasks to invalid when closing

When packages are published to the release or updates pockets, we can't
reliably detect anymore if an ABI bump was done, as we use the
difference between packages in ckt-ppa/proposed pockets and the ones in
the release/updates pockets (and don't check package publishing history,
which can be complex). Due to this, we can't just rely on this
detection when packages are released, otherwise we will set all
prepare-package tasks which are abi bumps to Invalid, even if they were
really done and released.

If packages are released and really we are unable to detect the abi
change, assume the state of the task is correct and don't change it.

Signed-off-by: Herton Ronaldo Krzesinski <herton.krzesinski@canonical.com>
autotriage: fix up syntax issues in linux-overlay

Signed-off-by: Andy Whitcroft <apw@canonical.com>
linux-overlay: CVE-2013-0231 real sha1 available

Signed-off-by: Andy Whitcroft <apw@canonical.com>
linux-overlay: CVE-2013-0217 real sha1 available

Signed-off-by: Andy Whitcroft <apw@canonical.com>
linux-overlay: CVE-2013-0216 real sha1 available

Signed-off-by: Andy Whitcroft <apw@canonical.com>
stable/sru-report: Fix changelog regexp for LP bugs

The regular expression for bug patterns was returning a false positive
for changelog entries related with drivers/leds/leds-lp5521.c -- this
was resulting in picking LP bug #5521.

This fixes the regexp by assuming that a reference to an LP bug
contains, at least, one of ':', ' ' or '#'.

Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
stable/sru-workflow-manager: make build_status return the published source obj

We may want to check into other attributes of the published source
object returned by Launchpad. So instead of returning only two
properties that we are using, return the entire object, this also makes
the code a bit smaller.

Signed-off-by: Herton Ronaldo Krzesinski <herton.krzesinski@canonical.comm>
stable/sru-workflow-manager: handle upload-to-ppa tasks

This makes sru-workflow-manager to automatically maintain the
upload-to-ppa task in the correct state.

Signed-off-by: Herton Ronaldo Krzesinski <herton.krzesinski@canonical.com>
ktl/tracking_bug.py: fix importance setting for nominations in devel series

Commit "ktl/tracking_bug.py: set development tasks to invalid"
unfortunately uncovered an weird launchpad behaviour when handling
development package tasks: since Ubuntu package tasks which are not a
nomination are considered the task for the development series, when you
nominate the development series in the bug, the status is now tracked
in the nomination ("Status tracked in <series>" as shown when opening
the bug in the browser).

The problem is if you try to set importance or any remaining fields in
the package task, and its status is tracked in a nomination, Launchpad
service will return an "HTTP Error 412: Precondition Failed", probably
because the importance and other fields are not "available" anymore. But
Launchpad API still provides those fields and there is no way to
differentiate when status is tracked in a nomination or not. So this
change tries to avoid the issue, if the series is a development
series we avoid messing with the importance field in the package task.
Also we properly set now the status to Invalid on it if this is an
stable tracking bug.

Signed-off-by: Herton Ronaldo Krzesinski <herton.krzesinski@canonical.com>
stable/sru-workflow-manager: redo again logic for setting status of ABI tasks

Simplify and hopefully now properly set status of prepare-package-* tasks
which depends on ABI bumps in main linux* packages.

Signed-off-by: Herton Ronaldo Krzesinski <herton.krzesinski@canonical.com>
stable/sru-workflow-manager: fix task assignment if its 'Unassigned'

When the task has no assignee, it's of type None, so we must explicitly
check it otherwise we will crash on set_task_assignee

Signed-off-by: Herton Ronaldo Krzesinski <herton.krzesinski@canonical.com>
stable/sru-workflow-manager: don't always set upload-to-ppa back to 'New'

Fix another recently introduced regression, if the person which prepared
the package set the upload-to-ppa task to Confirmed, we shouldn't set it
back to 'New'.

Signed-off-by: Herton Ronaldo Krzesinski <herton.krzesinski@canonical.com>
stable/sru-workflow-manager: don't stop processing if QA is invalid

From the beginning it was assumed that QA/regression-testing should
always be done on stable updates, but in practice we have some rare
cases where we want to skip QA. So allow regression-testing to be
Invalid in a tracking bug, and allow processing move forward.

Signed-off-by: Herton Ronaldo Krzesinski <herton.krzesinski@canonical.com>