/[smeserver]/rpms/smeserver-yum/sme10/smeserver-yum-2.6.0-bz11184-smeserver.py.patch
ViewVC logotype

Annotation of /rpms/smeserver-yum/sme10/smeserver-yum-2.6.0-bz11184-smeserver.py.patch

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph


Revision 1.2 - (hide annotations) (download)
Mon Dec 7 19:12:11 2020 UTC (3 years, 11 months ago) by jpp
Branch: MAIN
Changes since 1.1: +2 -1 lines
* Sun Dec 06 2020 Jean-Philipe Pialasse <tests@pialasse.com> 2.6.0-41.sme
- fix -update events not runt on package upgrade [SME: 11184]

1 jpp 1.1 diff -Nur smeserver-yum-2.6.0.old/root/usr/lib/yum-plugins/smeserver.py smeserver-yum-2.6.0/root/usr/lib/yum-plugins/smeserver.py
2     --- smeserver-yum-2.6.0.old/root/usr/lib/yum-plugins/smeserver.py 2020-12-06 23:11:14.321000000 -0500
3     +++ smeserver-yum-2.6.0/root/usr/lib/yum-plugins/smeserver.py 2020-12-06 23:12:58.737000000 -0500
4     @@ -63,6 +63,11 @@
5     smechange = False
6     ourfile = False
7     erasing = False
8     +DEBUG = False
9     +
10     +def log(s):
11     + if DEBUG:
12     + print s
13    
14     def report_yum_status(status):
15     fileHandle = open(status_file, 'w')
16     @@ -94,7 +99,21 @@
17     report_yum_status('postresolve')
18    
19     def pretrans_hook(conduit):
20     +#transaction set states
21     +#TS_UPDATE = 10
22     +#TS_INSTALL = 20
23     +#TS_TRUEINSTALL = 30
24     +#TS_ERASE = 40
25     +#TS_OBSOLETED = 50
26     +#TS_OBSOLETING = 60
27     +#TS_AVAILABLE = 70
28     +#TS_UPDATED = 90
29     +#TS_FAILED = 100
30     +#TS_INSTALL_STATES = [TS_INSTALL, TS_TRUEINSTALL, TS_UPDATE, TS_OBSOLETING]
31     +#TS_REMOVE_STATES = [TS_ERASE, TS_OBSOLETED, TS_UPDATED]
32     +
33     report_yum_status('pretrans')
34     + log("*******Pretrans********")
35     # Prefetch filelist for packages to be removed,
36     # otherwise for updated packages headers will not be available
37     ts = conduit.getTsInfo()
38     @@ -112,10 +131,10 @@
39     erasing = True
40     (n, a, e, v, r) = tsmem.po.pkgtup
41     #only for debug
42     - #print 'Package: ' + tsmem.name + ' remove'
43     + log('**Package: ' + tsmem.name + ' remove')
44     smeevent = tsmem.name + '-update'
45     #only for debug
46     - #print smeevent
47     + #log(smeevent)
48     if os.path.isdir(events_path + os.sep + smeevent):
49     tmppath = events_path + os.sep + smeevent + os.sep
50     eventlist[tsmem.name] = smeevent
51     @@ -128,22 +147,24 @@
52     if not templateslist.has_key(mytmptemplate):
53     templateslist[mytmptemplate]=mytmptemplate
54     #tmptmplpath = subdir + os.sep + file
55     - #print (file)
56     + log(" template " + file)
57    
58     + # nothing for actions ???
59     +
60     if os.path.isdir(tmppath + "services2adjust" + os.sep):
61     tmppathsrv = tmppath + "services2adjust" + os.sep
62     files = [f for f in os.listdir(tmppathsrv)]
63     for f in files:
64     if os.path.islink(tmppathsrv + f):
65     - #print "link " + f + ": " + (os.readlink(tmppathsrv + f))
66     + log(" service link " + f + ": " + (os.readlink(tmppathsrv + f)))
67     mytmpserv = os.readlink(tmppathsrv + f)
68     if not serviceslist.has_key(f):
69     - serviceslist[f]=mytmpserv
70     + if tsmem.output_state == TS_ERASE:
71     + print('===> removal, we stop the service ' + f)
72     + serviceslist[f]="stop"
73     + else:
74     + serviceslist[f]=mytmpserv
75     else:
76     - #only for debug
77     - #print "old value: " + serviceslist[f]
78     - #print "new value: " + mytmpserv
79     -
80     if mytmpserv == "restart":
81 jpp 1.2 - print "overriding all signals, forcing restart"
82     + log("overriding all signals, forcing restart " + f)
83 jpp 1.1 serviceslist[f]="restart"
84     @@ -153,13 +174,14 @@
85     smechange = True
86    
87     #only for debug
88     - #print 'smechange: '+str(smechange)
89     - #print 'eventlist: '+ str(eventlist)
90     - #print 'templateslist: '+str(templateslist)
91     - #print 'serviceslist: '+str(serviceslist)
92     + log('## smechange: '+str(smechange))
93     + log('## eventlist: '+ str(eventlist.keys()))
94     + log('## templateslist: '+str(templateslist.keys()))
95     + log('## serviceslist: '+str(serviceslist.keys()))
96    
97     def posttrans_hook(conduit):
98     report_yum_status('posttrans')
99     + log("*******Postrans********")
100     ts = conduit.getTsInfo()
101    
102     global smechange
103     @@ -174,13 +196,12 @@
104    
105     for tsmem in ts.getMembers():
106     (n, a, e, v, r) = tsmem.po.pkgtup
107     -
108     #print 'smechange: '+str(smechange)
109    
110     # we're upgrading/installing/removing a rebootpkgs package.. a reboot is required
111     for pkg in rebootpkgs:
112     if n.startswith(pkg):
113     - #print 'Package: ' + tsmem.name + ' triggers reboot'
114     + log('**Package: ' + tsmem.name + ' triggers reboot')
115     #smechange = True
116     # we do some exclusions -devel -doc ...
117     if pkg in rebootpkgsexclude:
118     @@ -216,7 +237,11 @@
119    
120    
121     #if smechange is true we can ignore the following part
122     - if not smechange and not erasing:
123     + # wondering if we reallly do want to ignore that : let's say we want to delay kernel reboot,
124     + # could we at least configure httpd cleanly until next week ?
125     + # also when updating a package the erasing flag was on and prevented to do this ....
126     + # if not smechange and not erasing:
127     + if True:
128    
129     #smeevent = 'yum-reconfigure-' + tsmem.name
130     smeevent = tsmem.name + '-update'
131     @@ -229,17 +254,20 @@
132     if os.path.islink(tmppath + f):
133    
134     mytmpaction = os.path.realpath(os.readlink(tmppath + f).replace("..",events_path))
135     - #print "link " + f + ": " + mytmpaction
136     + #log(" link " + f + ": " + mytmpaction)
137    
138     if f < "S05generic_template_expand":
139     if not actionlistpre.has_key(mytmpaction):
140     actionlistpre[mytmpaction] = mytmpaction
141     + log(" action Pre : " + f + " -> " + mytmpaction)
142     elif f > "S90adjust-services":
143     if not actionlistpost.has_key(mytmpaction):
144     actionlistpost[mytmpaction] = mytmpaction
145     + log(" action Post : " + f + " -> " + mytmpaction)
146     else:
147     if not actionlist.has_key(mytmpaction):
148     actionlist[mytmpaction] = mytmpaction
149     + log(" action : " + f + " -> " + mytmpaction)
150    
151     if os.path.isdir(tmppath + "templates2expand" + os.sep):
152     tmppathtmpl = tmppath + "templates2expand" + os.sep
153     @@ -249,22 +277,18 @@
154     if not templateslist.has_key(mytmptemplate):
155     templateslist[mytmptemplate]=mytmptemplate
156     #tmptmplpath = subdir + os.sep + file
157     - #print (file)
158     + log(" template " + mytmptemplate)
159    
160     if os.path.isdir(tmppath + "services2adjust" + os.sep):
161     tmppathsrv = tmppath + "services2adjust" + os.sep
162     files = [f for f in os.listdir(tmppathsrv)]
163     for f in files:
164     if os.path.islink(tmppathsrv + f):
165     - #print "link " + f + ": " + (os.readlink(tmppathsrv + f))
166     + log(" service link " + f + ": " + (os.readlink(tmppathsrv + f)))
167     mytmpserv = os.readlink(tmppathsrv + f)
168     if not serviceslist.has_key(f):
169     serviceslist[f]=mytmpserv
170     else:
171     - #only for debug
172     - #print "old value: " + serviceslist[f]
173     - #print "new value: " + mytmpserv
174     -
175     if mytmpserv == "restart":
176     #only for debug
177     print "overriding all signals, forcing restart"
178     @@ -276,11 +300,15 @@
179    
180    
181     #only for debug
182     - #print 'smechange: '+str(smechange)
183     + log('## smechange: '+str(smechange))
184     #print 'post-trans'
185     - #print 'eventlist: '+ str(eventlist)
186     - #print 'templateslist: '+str(templateslist)
187     - #print 'serviceslist: '+str(serviceslist)
188     + log('## eventlist: '+ str(eventlist))
189     + log('## actions early: ' + str(actionlistpre.keys()))
190     + log('## templateslist: '+str(templateslist.keys()))
191     + log('## actions: ' + str(actionlist.keys()))
192     + log('## serviceslist: '+str(serviceslist.keys()))
193     + log('## actions late: ' + str(actionlistpost.keys()))
194     +
195    
196     # check if smechange is true or if eventlist has items.. in both cases we must initialize databases
197     if smechange == True or len(eventlist)>0:
198     @@ -293,14 +321,14 @@
199     if len(actionlistpre)>0:
200     print "Executing early actions"
201     for kactions in actionlistpre:
202     - #print kactions
203     + log(" " + kactions)
204     if os.path.isfile(kactions):
205     os.spawnl(os.P_WAIT, kactions, kactions)
206    
207     if len(templateslist)>0:
208     print "Expanding templates"
209     for ktemplates in templateslist:
210     - #print ktemplates
211     + log(" " + ktemplates)
212     mytemplatedir = '/etc/e-smith/templates/' + ktemplates
213     mytemplatemeta = '/etc/e-smith/templates.metadata/' + ktemplates
214     if os.path.exists(mytemplatedir) or os.path.exists(mytemplatemeta):
215     @@ -309,7 +337,7 @@
216     if len(actionlist)>0:
217     print "Executing actions"
218     for kactions in actionlist:
219     - #print kactions
220     + log(" " + kactions)
221     if os.path.isfile(kactions):
222     os.spawnl(os.P_WAIT, kactions, kactions,"post-upgrade")
223    
224     @@ -322,7 +350,7 @@
225     if len(actionlistpost)>0:
226     print "Executing late actions"
227     for kactions in actionlistpost:
228     - #print kactions
229     + log(" " + kactions)
230     if os.path.isfile(kactions):
231     os.spawnl(os.P_WAIT, kactions, kactions)
232    
233     @@ -335,6 +363,7 @@
234     def close_hook(conduit):
235     if ourfile and os.path.isfile('/var/run/yum.status'):
236     os.unlink('/var/run/yum.status')
237     + log("***Close***")
238    
239     if smechange:
240     print "\n=============================================================="

admin@koozali.org
ViewVC Help
Powered by ViewVC 1.2.1 RSS 2.0 feed