Mailinglist Archive: opensuse-buildservice (348 mails)

< Previous Next >
[opensuse-buildservice] [patch] Make sure hermes get the right data for requests
  • From: Vincent Untz <vuntz@xxxxxxxxxxxx>
  • Date: Thu, 8 Apr 2010 12:00:06 +0200
  • Message-id: <20100408100006.GO19886@xxxxxxxxx>
Hi,

Here are two patches to make sure hermes gets the right data for
requests.

The first patch handles change_devel requests, and the second patch
makes the unused paramaters undefined so that they don't get accidently
used in the hermes templates later on (this can at least happen if there
are multiple actions in one request -- we'd get a weird mix there).

Cheers,

Vincent

--
Les gens heureux ne sont pas pressés.
From b93ed22b56eb0277d519976f7028ed9552b6ff93 Mon Sep 17 00:00:00 2001
From: Vincent Untz <vuntz@xxxxxxxxxxxx>
Date: Thu, 8 Apr 2010 11:40:45 +0200
Subject: [PATCH 1/2] [backend] Get the right data for Hermes for change_devel
requests

---
src/backend/BSHermes.pm | 6 ++++++
1 files changed, 6 insertions(+), 0 deletions(-)

diff --git a/src/backend/BSHermes.pm b/src/backend/BSHermes.pm
index 89ff0d1..113dfe6 100644
--- a/src/backend/BSHermes.pm
+++ b/src/backend/BSHermes.pm
@@ -101,6 +101,12 @@ sub requestParams( $$ )
$reqinfo{'sourcerevision'} = $a->{'source'}->{'rev'};
$reqinfo{'targetproject'} = $a->{'target'}->{'project'};
$reqinfo{'targetpackage'} = $a->{'target'}->{'package'};
+ }elsif( $a->{'type'} eq 'change_devel' && $a->{'source'} &&
+ $a->{'target'}) {
+ $reqinfo{'sourceproject'} = $a->{'source'}->{'project'};
+ $reqinfo{'sourcepackage'} = $a->{'source'}->{'package'};
+ $reqinfo{'targetproject'} = $a->{'target'}->{'project'};
+ $reqinfo{'targetpackage'} = ($a->{'target'}->{'package'} ||
$a->{'source'}->{'package'});
}elsif( $a->{'type'} eq 'delete' && $a->{'target'}->{'project'} ) {
$reqinfo{'deleteproject'} = $a->{'target'}->{'project'};
$reqinfo{'deletepackage'} = $a->{'target'}->{'package'};
--
1.7.0.2

From dd53fb22d8af66e82e724d41c05f807152b3fddd Mon Sep 17 00:00:00 2001
From: Vincent Untz <vuntz@xxxxxxxxxxxx>
Date: Thu, 8 Apr 2010 11:42:17 +0200
Subject: [PATCH 2/2] [backend] Make sure Hermes won't get defined parameters
that shouldn't

Since the templates in Hermes look if a parameter is defined, we need to
make sure a parameter is not defined so that the template won't output
random data.
---
src/backend/BSHermes.pm | 10 ++++++++++
1 files changed, 10 insertions(+), 0 deletions(-)

diff --git a/src/backend/BSHermes.pm b/src/backend/BSHermes.pm
index 113dfe6..a2ac786 100644
--- a/src/backend/BSHermes.pm
+++ b/src/backend/BSHermes.pm
@@ -101,15 +101,25 @@ sub requestParams( $$ )
$reqinfo{'sourcerevision'} = $a->{'source'}->{'rev'};
$reqinfo{'targetproject'} = $a->{'target'}->{'project'};
$reqinfo{'targetpackage'} = $a->{'target'}->{'package'};
+ $reqinfo{'deleteproject'} = undef;
+ $reqinfo{'deletepackage'} = undef;
}elsif( $a->{'type'} eq 'change_devel' && $a->{'source'} &&
$a->{'target'}) {
$reqinfo{'sourceproject'} = $a->{'source'}->{'project'};
$reqinfo{'sourcepackage'} = $a->{'source'}->{'package'};
$reqinfo{'targetproject'} = $a->{'target'}->{'project'};
$reqinfo{'targetpackage'} = ($a->{'target'}->{'package'} ||
$a->{'source'}->{'package'});
+ $reqinfo{'deleteproject'} = undef;
+ $reqinfo{'deletepackage'} = undef;
+ $reqinfo{'sourcerevision'} = undef;
}elsif( $a->{'type'} eq 'delete' && $a->{'target'}->{'project'} ) {
$reqinfo{'deleteproject'} = $a->{'target'}->{'project'};
$reqinfo{'deletepackage'} = $a->{'target'}->{'package'};
+ $reqinfo{'sourceproject'} = undef;
+ $reqinfo{'sourcepackage'} = undef;
+ $reqinfo{'targetproject'} = undef;
+ $reqinfo{'targetpackage'} = undef;
+ $reqinfo{'sourcerevision'} = undef;
}
}
if( $req->{'oldstate'} ) {
--
1.7.0.2

< Previous Next >
Follow Ups