Merge lp:~stevenk/launchpad/denorm-bspph-model into lp:launchpad

Proposed by Steve Kowalik
Status: Merged
Approved by: William Grant
Approved revision: no longer in the source branch.
Merged at revision: 13942
Proposed branch: lp:~stevenk/launchpad/denorm-bspph-model
Merge into: lp:launchpad
Diff against target: 138 lines (+31/-12)
3 files modified
lib/lp/soyuz/interfaces/publishing.py (+16/-11)
lib/lp/soyuz/model/publishing.py (+14/-1)
lib/lp/soyuz/scripts/gina/handlers.py (+1/-0)
To merge this branch: bzr merge lp:~stevenk/launchpad/denorm-bspph-model
Reviewer Review Type Date Requested Status
William Grant code Approve
Review via email: mp+75100@code.launchpad.net

Commit message

[r=wgrant][bug=826516][incr] Add model changes for {B,S}PPH denormalisation, and fix new publications to set their name.

Description of the change

Sprinkle in the model changes for {B,S}PPH denormalisation. This is able to land right away, due to the db patch having landed.

To post a comment you must log in.
Revision history for this message
William Grant (wgrant) wrote :

8 + sourcepackagenameID = Attribute(
9 + "The DB id for the sourcepackagename.")
10 + sourcepackagename = Int(
11 + title=_('The source package name being published'),
12 + required=False, readonly=False,
13 + )

Lies. I think you have those types the wrong way around.

There's also already SPPH.source_package_name, which delegates to SPR.name. Might want to clarify with comments what the difference is.

Same with the binary equivalents for both comments.

review: Needs Fixing
Revision history for this message
William Grant (wgrant) :
review: Approve (code)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'lib/lp/soyuz/interfaces/publishing.py'
2--- lib/lp/soyuz/interfaces/publishing.py 2011-09-11 11:08:30 +0000
3+++ lib/lp/soyuz/interfaces/publishing.py 2011-09-13 08:41:42 +0000
4@@ -326,12 +326,15 @@
5 id = Int(
6 title=_('ID'), required=True, readonly=True,
7 )
8- sourcepackagereleaseID = Attribute(
9- "The DB id for the sourcepackagerelease.")
10- sourcepackagerelease = Int(
11- title=_('The source package release being published'),
12- required=False, readonly=False,
13- )
14+ sourcepackagenameID = Int(
15+ title=_('The DB id for the sourcepackagename.'),
16+ required=False, readonly=False)
17+ sourcepackagename = Attribute('The source package name being published')
18+ sourcepackagereleaseID = Int(
19+ title=_('The DB id for the sourcepackagerelease.'),
20+ required=False, readonly=False)
21+ sourcepackagerelease = Attribute(
22+ 'The source package release being published')
23 status = exported(
24 Choice(
25 title=_('Package Publishing Status'),
26@@ -669,13 +672,15 @@
27
28 class IBinaryPackagePublishingHistoryPublic(IPublishingView):
29 """A binary package publishing record."""
30- id = Int(
31- title=_('ID'), required=True, readonly=True,
32- )
33+
34+ id = Int(title=_('ID'), required=True, readonly=True)
35+ binarypackagenameID = Int(
36+ title=_('The DB id for the binarypackagename.'),
37+ required=False, readonly=False)
38+ binarypackagename = Attribute('The binary package name being published')
39 binarypackagerelease = Int(
40 title=_('The binary package being published'), required=False,
41- readonly=False,
42- )
43+ readonly=False)
44 distroarchseries = exported(
45 Reference(
46 Interface, #Really IDistroArchSeries, circular import fixed below.
47
48=== modified file 'lib/lp/soyuz/model/publishing.py'
49--- lib/lp/soyuz/model/publishing.py 2011-09-11 11:08:30 +0000
50+++ lib/lp/soyuz/model/publishing.py 2011-09-13 08:41:42 +0000
51@@ -421,6 +421,8 @@
52 """A source package release publishing record."""
53 implements(ISourcePackagePublishingHistory)
54
55+ sourcepackagename = ForeignKey(foreignKey='SourcePackageName',
56+ dbName='sourcepackagename')
57 sourcepackagerelease = ForeignKey(foreignKey='SourcePackageRelease',
58 dbName='sourcepackagerelease')
59 distroseries = ForeignKey(foreignKey='DistroSeries',
60@@ -683,6 +685,8 @@
61 return self.distroseries.distribution.getSourcePackageRelease(
62 self.supersededby)
63
64+ # XXX: StevenK 2011-09-13 bug=848563: This can die when
65+ # self.sourcepackagename is populated.
66 @property
67 def source_package_name(self):
68 """See `ISourcePackagePublishingHistory`"""
69@@ -904,6 +908,8 @@
70
71 implements(IBinaryPackagePublishingHistory)
72
73+ binarypackagename = ForeignKey(foreignKey='BinaryPackageName',
74+ dbName='binarypackagename')
75 binarypackagerelease = ForeignKey(foreignKey='BinaryPackageRelease',
76 dbName='binarypackagerelease')
77 distroarchseries = ForeignKey(foreignKey='DistroArchSeries',
78@@ -951,6 +957,8 @@
79 """See `IBinaryPackagePublishingHistory`"""
80 return self.distroarchseries.distroseries
81
82+ # XXX: StevenK 2011-09-13 bug=848563: This can die when
83+ # self.binarypackagename is populated.
84 @property
85 def binary_package_name(self):
86 """See `IBinaryPackagePublishingHistory`"""
87@@ -1198,6 +1206,7 @@
88
89 # Append the modified package publishing entry
90 return BinaryPackagePublishingHistory(
91+ binarypackagename=self.binarypackagerelease.binarypackagename,
92 binarypackagerelease=self.binarypackagerelease,
93 distroarchseries=self.distroarchseries,
94 status=PackagePublishingStatus.PENDING,
95@@ -1429,12 +1438,14 @@
96 insert_head = """
97 INSERT INTO BinaryPackagePublishingHistory
98 (archive, distroarchseries, pocket, binarypackagerelease,
99- component, section, priority, status, datecreated)
100+ binarypackagename, component, section, priority, status,
101+ datecreated)
102 VALUES
103 """
104 insert_pubs = ", ".join(
105 "(%s)" % ", ".join(sqlvalues(
106 get_archive(archive, bpr).id, das.id, pocket, bpr.id,
107+ bpr.binarypackagename,
108 get_component(archive, das.distroseries, component).id,
109 section.id, priority, PackagePublishingStatus.PENDING,
110 UTC_NOW))
111@@ -1463,6 +1474,7 @@
112 "Will not create new publications in a disabled architecture.")
113 return BinaryPackagePublishingHistory(
114 archive=archive,
115+ binarypackagename=binarypackagerelease.binarypackagename,
116 binarypackagerelease=binarypackagerelease,
117 distroarchseries=distroarchseries,
118 component=get_component(
119@@ -1485,6 +1497,7 @@
120 distroseries=distroseries,
121 pocket=pocket,
122 archive=archive,
123+ sourcepackagename=sourcepackagerelease.sourcepackagename,
124 sourcepackagerelease=sourcepackagerelease,
125 component=get_component(archive, distroseries, component),
126 section=section,
127
128=== modified file 'lib/lp/soyuz/scripts/gina/handlers.py'
129--- lib/lp/soyuz/scripts/gina/handlers.py 2011-09-08 09:27:01 +0000
130+++ lib/lp/soyuz/scripts/gina/handlers.py 2011-09-13 08:41:42 +0000
131@@ -976,6 +976,7 @@
132
133 BinaryPackagePublishingHistory(
134 binarypackagerelease=binarypackage.id,
135+ binarypackagename=binarypackage.binarypackagename,
136 component=component.id,
137 section=section.id,
138 priority=priority,