catalog.py revision 302
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
#
# CDDL HEADER START
#
# The contents of this file are subject to the terms of the
# Common Development and Distribution License (the "License").
# You may not use this file except in compliance with the License.
#
# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
# See the License for the specific language governing permissions
# and limitations under the License.
#
# When distributing Covered Code, include this CDDL HEADER in each
# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
# If applicable, add the following below this CDDL HEADER, with the
# fields enclosed by brackets "[]" replaced with your own identifying
# information: Portions Copyright [yyyy] [name of copyright owner]
#
# CDDL HEADER END
#
# Copyright 2008 Sun Microsystems, Inc. All rights reserved.
# Use is subject to license terms.
"""Interfaces and implementation for the Catalog object, as well as functions
that operate on lists of package FMRIs."""
import os
import re
import urllib
import errno
import signal
import threading
import datetime
import sys
import cPickle
class CatalogException(Exception):
class RenameException(Exception):
"""A Catalog is the representation of the package FMRIs available to
this client or repository. Both purposes utilize the same storage
format.
The serialized structure of the repository is an unordered list of
available package versions, followed by an unordered list of
incorporation relationships between packages. This latter section
allows the graph to be topologically sorted by the client.
S Last-Modified: [timespec]
XXX A authority mirror-uri ...
XXX ...
V fmri
V fmri
...
C fmri
C fmri
...
I fmri fmri
I fmri fmri
...
In order to improve the time to search the catalog, a cached list
of package names is kept in the catalog instance. In an effort
to prevent the catalog from having to generate this list every time
it is constructed, the array that contains the names is pickled and
saved and pkg_names.pkl.
"""
# XXX Mirroring records also need to be allowed from client
# configuration, and not just catalogs.
#
# XXX It would be nice to include available tags and package sizes,
# although this could also be calculated from the set of manifests.
#
# XXX Current code is O(N_packages) O(M_versions), should be
# O(1) O(M_versions), and possibly O(1) O(1).
#
# XXX Initial estimates suggest that the Catalog could be composed of
# 1e5 - 1e7 lines. Catalogs across these magnitudes will need to be
# spread out into chunks, and may require a delta-oriented update
# interface.
"""Create a catalog. If the path supplied does not exist,
this will create the required directory structure.
Otherwise, if the directories are already in place, the
existing catalog is opened. If pkg_root is specified
and no catalog is found at cat_root, the catalog will be
rebuilt. authority names the authority that
is represented by this catalog."""
self.searchdb_update_handle = None
# We need to lock the search database against multiple
# simultaneous updates from separate threads closing
# publication transactions.
"/search"
# Rebuild catalog, if we're the depot and it's necessary
if pkg_root is not None:
return
# Load the list of pkg names. If it doesn't exist, build a list
# of pkg names. If the catalog gets rebuilt in build_catalog,
# add_fmri() will generate the list of package names instead.
try:
except IOError, e:
else:
raise
"""Add a package, named by the fmri, to the catalog.
Throws an exception if an identical package is already
present. Throws an exception if package has no version."""
raise CatalogException, \
"Unversioned FMRI not supported: %s" % fmri
# Callers should verify that the FMRI they're going to add is
# valid; however, this check is here in case they're
# lackadaisical
raise CatalogException, \
"Existing renames make adding FMRI %s invalid." \
% fmri
if critical:
else:
"catalog"))
raise CatalogException, \
"Package %s is already in the catalog" % \
# Add this pkg name to the list of package names
return ts
def added_prefix(self, p):
"""Perform any catalog transformations necessary if
prefix p is found in the catalog. Previously, we didn't
know how to handle this prefix and now we do. If we
need to transform the entry from server to client form,
make sure that happens here."""
# Nothing to do now.
pass
def attrs_as_lines(self):
"""Takes the list of in-memory attributes and returns
a list of strings, each string naming an attribute."""
ret = []
s = "S %s: %s\n" % (k, v)
return ret
"""Helper method that takes the full path to the package
directory and the name of the manifest file, and returns an FMRI
constructed from the information in those components."""
f.version = v
return f
def check_prefix(self):
"""If this version of the catalog knows about new prefixes,
check the on disk catalog to see if we can perform any
transformations based upon previously unknown catalog formats.
This routine will add a catalog attribute if it doesn't exist,
otherwise it checks this attribute against a hard-coded
version-specific tuple to see if new methods were added.
If new methods were added, it will call an additional routine
that updates the on-disk catalog, if necessary."""
# If a prefixes attribute doesn't exist, write one and get on
# with it.
return
# Prefixes attribute does exist. Check if it has changed.
# Nothing to do if prefixes haven't changed
if pfx_set == known_prefixes:
return
# If known_prefixes contains a prefix not in pfx_set,
# add the prefix and perform a catalog transform.
if new:
for p in new:
self.added_prefix(p)
# Write out updated prefixes list
def build_catalog(self):
"""Walk the on-disk package data and build (or rebuild) the
package catalog and search database."""
try:
idx_mtime = \
except OSError, e:
raise
idx_mtime = 0
try:
except OSError, e:
raise
cat_mtime = 0
fmri_list = []
# XXX eschew os.walk in favor of another os.listdir here?
continue
# XXX force a rebuild despite mtimes?
# XXX queue this and fork later?
print f
# XXX force a rebuild despite mtimes?
# If the database doesn't exist, don't bother
# building the list; we'll just build it all.
# If we have no updates to make to the search database but it
# already exists, just make it available. If we do have updates
# to make (including possibly building it from scratch), fork it
# off into another process; when that's done, we'll mark it
# available.
try:
"Failed to open search database", \
"for writing: %s (errno=%s)" % \
try:
"Failed to open search " + \
"database: %s (errno=%s)" % \
else:
try:
except ValueError:
# if we are in a subthread already, the signal method
# will not work
else:
# on non-unix, where there is no convenient
# way to fork subprocesses, just update the
# searchdb inline.
"""Handler method for the SIGCLD signal. Checks to see if the
search database update child has finished, and enables searching
if it finished successfully, or logs an error if it didn't."""
if not self.searchdb_update_handle:
return
if rc == 0:
try:
self.searchdb_update_handle = None
"Failed to open search database", \
"for writing: %s (errno=%s)" % \
try:
self.searchdb_update_handle = None
return
"Failed to open search " + \
"database: %s (errno=%s)" % \
return
elif rc > 0:
# XXX This should be logged instead
print "ERROR building search database:"
if fmri_list:
try:
# Since we're here explicitly to update
# the database, if we fail, there's
# nothing more to do.
"Failed to open search database", \
"for writing: %s (errno=%s)" % \
return 1
else:
# new = True
try:
"Failed to open search database", \
"for writing: %s (errno=%s)" % \
return 1
# XXX We should probably iterate over the catalog, for
# cases where manifests have stuck around, but have been
# moved to historical and removed from the catalog.
fmri_list = (
)
"""Update the search database with the FMRIs passed in via
'fmri_list'. If 'fmri_list' is empty or None, then rebuild the
database from scratch. 'fmri_list' should be a list of tuples
where the first element is the full path to the package name in
pkg_root and the second element is the version string."""
# If we're in the process of updating the database in our
# separate process, and this particular update until that's
# done.
return
try:
finally:
# If we rebuilt the database from scratch ... XXX why would we
# want to do this?
# if new:
# self.searchdb.close()
# self.searchdb = None
# Five digits of a base-62 number represents a little over 900 million.
# Assuming 1 million tokens used in a WOS build (current imports use
# just short of 500k, but we don't have all the l10n packages, and may
# not have all the search tokens we want) and keeping every nightly
# build gives us 2.5 years before we run out of token space. We're
# likely to garbage collect manifests and rebuild the db before then.
#
# XXX We're eventually going to run into conflicts with real tokens
# here. This is unlikely until we hit, say "alias", which is a ways
# off, but we should still look at solving this.
idx_tok_len = 5
def next_token(self):
alphabet = "abcdefghijklmnopqrstuvwxyz"
s = ""
s = k[idx] + s
# XXX Do we want to log warnings as we approach index capacity?
return s
"""Update the search database with the data from the manifest
for 'fmri', which has been collected into 'search_dict'"""
# self.searchdb: token -> (type, fmri, action name, key value)
# Don't update the database if it already has this FMRI's
# indices.
return
# XXX The database files are so damned huge (if
# holey) because we have zillions of copies of
# the full fmri strings. We might want to
# indirect these as well.
s = "%s %s %s %s" % \
try:
except:
"'%s' (s_ptr = %s) to search " \
"database" % (s, s_ptr)
continue
"""Because of the size limitations of the underlying database
records, not only do we have to store pointers to the actual
search data, but once the pointer records fill up, we have to
chain those records up to spillover records. This method adds
the pointer to the data to the end of the last link in the
chain, overflowing as necessary. The search token is passed in
as 'token', and the pointer to the actual data which should be
returned is passed in as 'data_token'."""
while True:
try:
except KeyError:
cur = ""
# According to the ndbm man page, the total length of
# key and value must be less than 1024. Seems like the
# actual value is 1018, probably due to some padding or
# accounting bytes or something. The 2 is for the space
# separator and the plus-sign for the extension token.
# XXX The comparison should be against 1017, but that
# crahes in the if clause below trying to append the
# extension token. Dunno why.
# If we're adding the first element in the next
# link of the chain, add the extension token to
# the end of this link, and put the token
# pointing to the data at the beginning of the
# next link.
break # from while True; we're done
# If we find an extension token, start looking
# at the next chain link.
else:
continue
# If we get here, it's safe to append the data token to
# the current link, and get out.
if cur:
else:
break
"""Search through the search database for 'token'. Return a
list of token type / fmri pairs."""
ret = []
while True:
# For each indirect token in the search token's value,
# add its value to the return list. If we see a chain
# token, switch to its value and continue. If we fall
# out of the loop without seeing a chain token, we can
# return.
break
else:
else:
return ret
constraint = None, counthash = None):
"""Iterate through the catalog, looking for packages matching
'pattern', based on the function in 'matcher' and the versioning
constraint described by 'constraint'. If 'matcher' is None,
uses fmri subset matching as the default. Returns a sorted list
of PkgFmri objects, newest versions first. If 'counthash' is a
dictionary, instead store the number of matched fmris for each
package name which was matched."""
tuples = {}
names_matched = set()
return []
if matcher is None:
# 'patterns' may be partially or fully decorated fmris; we want
# to extract their names and versions to match separately
# against the catalog.
#
# XXX "5.11" here needs to be saner
else:
# Walk list of pkg names and patterns. See if any of the
# patterns match known package names
if matcher(p, t[1]):
names_matched.add(p)
"""A generator function that produces FMRIs as it
iterates over the contents of the catalog."""
try:
except IOError, e:
return
else:
raise
continue
try:
continue
if pkg == "pkg":
(cat_name, cat_version),
except ValueError:
# Handle old two-column catalog file, mostly in
# use on server.
"""Returns a list of RenameRecords where fmri is listed as the
destination package."""
# Don't bother doing this if no FMRI is present
if not fmri:
return
# Load renamed packages, if needed
yield rr
"""Returns a list of RenameRecords where fmri is listed as
the source package."""
# Don't bother doing this if no FMRI is present
if not fmri:
return
# Load renamed packages, if needed
yield rr
"""Given a list of pkg_names, return all of the FMRIs
that contain an pkg_name entry as a substring."""
fmris = []
try:
except IOError, e:
return fmris
else:
raise
continue
try:
continue
if pkg != "pkg":
continue
continue
except ValueError:
# Handle old two-column catalog file, mostly in
# use on server.
continue
continue
return fmris
def last_modified(self):
"""Return the time at which the catalog was last modified."""
"""Load attributes from the catalog file into the in-memory
attributes dictionary"""
return
if m != None:
# convert npkgs to integer value
def build_pkg_names(cat_root):
"""Read the catalog and build the array of fmri pkg names
that is contained within the catalog. Returns a list
of strings of package names."""
"catalog"))
try:
except IOError, e:
return pkg_names
else:
raise
try:
continue
if pkg != "pkg":
continue
except ValueError:
# Handle old two-column catalog file, mostly in
# use on server.
return pkg_names
"""Pickle the list of package names in the catalog for faster
re-loading."""
if not pkg_names:
return
"pkg_names.pkl"))
try:
except IOError, e:
# Don't bother saving, if we don't have
# permission.
return
else:
raise
def load_pkg_names(cat_root):
"""Load pickled list of package names. This function
may raise an IOError if the file doesn't exist. Callers
should be sure to catch this exception and rebuild
the package names, if required."""
"pkg_names.pkl"))
return pkg_names
def _load_renamed(self):
"""Load the catalog's rename records into self.renamed"""
try:
except IOError, e:
return
else:
raise
]
"""Returns the number of packages in the catalog."""
"""A static method that takes a file-like object and
a path. This is the other half of catalog.send(). It
reads a stream as an incoming catalog and lays it down
on disk."""
for s in filep:
if not s[1].isspace():
continue
elif not s[0] in known_prefixes:
elif s.startswith("S "):
elif s.startswith("R "):
else:
# XXX Need to be able to handle old and new
# format catalogs.
# Save a list of package names for easier searching
"""Record that the name of package oldname has been changed
to newname as of version vers. Returns a timestamp
of when the catalog was modified and a RenamedPackage
object that describes the rename."""
# Check that the destination (new) package is already in the
# catalog. Also check that the old package does not exist at
# the version that is being renamed.
raise CatalogException, \
"Destination FMRI %s must be in catalog" % \
raise CatalogException, \
"Src FMRI %s must not be in catalog" % \
# Load renamed packages, if needed
# Check that rename record isn't already in catalog
raise CatalogException, \
"Rename %s is already in the catalog" % rr
# Keep renames acyclic. Check that the destination of this
# rename isn't the source of another rename.
raise RenameException, \
"Can't rename %s. Causes cycle in rename graph." \
"catalog"))
"""Returns true if fmri and pfmri are the same package because
of a rename operation."""
return True
elif s.new_fmri() and \
return True
return True
return True
return False
"""Returns true if fmri is a successor to pfmri by way
of a rename operation."""
return True
else:
return False
"""Returns true if fmri is a predecessor to pfmri by
a rename operation."""
return True
elif s.new_fmri():
return False
"""Returns a list of packages that are newer than fmri."""
pkgs = []
if s.new_fmri():
return pkgs
"""Returns a list of packages that are older than fmri."""
pkgs = []
return pkgs
"""Save attributes from the in-memory catalog to a file
specified by filenm."""
try:
except IOError, e:
# This may get called in a situation where
# the user does not have write access to the attrs
# file.
return
else:
raise
"""Send the contents of this catalog out to the filep
specified as an argument."""
# Send attributes first.
try:
except IOError, e:
# Missing catalog is fine; other errors need to be
# reported.
return
else:
raise
for e in cfile:
"""Set time to timestamp if supplied by caller. Otherwise
use the system time."""
else:
def search_available(self):
return self._search_available
"""Check that the fmri supplied as an argument would be
valid to add to the catalog. This checks to make sure that
from adding this FMRI."""
return False
return True
# In order to avoid a fine from the Department of Redundancy Department,
# allow these methods to be invoked without explictly naming the Catalog class.
# Prefixes that this catalog knows how to handle
# Method used by Catalog and UpdateLog. Since UpdateLog needs to know
# about Catalog, keep it in Catalog to avoid circular dependency problems.
def timestamp():
"""Return an integer timestamp that can be used for comparisons."""
return tstr
def ts_to_datetime(ts):
"""Take timestamp ts in string isoformat, and convert it to a datetime
object."""
# usec is not in the string if 0
try:
except ValueError:
usec = 0
return dt
constraint = None, counthash = None):
"""Iterate through the given list of PkgFmri objects,
looking for packages matching 'pattern', based on the function
in 'matcher' and the versioning constraint described by
'constraint'. If 'matcher' is None, uses fmri subset matching
as the default. Returns a sorted list of PkgFmri objects,
newest versions first. If 'counthash' is a dictionary, instead
store the number of matched fmris for each package name which
was matched."""
if not matcher:
# 'pattern' may be a partially or fully decorated fmri; we want
# to extract its name and version to match separately against
# the catalog.
# XXX "5.11" here needs to be saner
tuples = {}
else:
assert pattern != None
ret = []
for p in pkgs:
if not pat_version or \
pat_version, constraint) or \
p.version == pat_version:
if counthash is not None:
else:
if pat_auth:
class RenamedPackage(object):
"""An in-memory representation of a rename object. This object records
information about a package that has had its name changed.
Renaming a package presents a number of challenges. The packaging
system must still be able to recognize and decode dependencies on
packages with the old name. In order for this to work correctly, the
rename record must contain both the old and new name of the package. It
is also undesireable to have a renamed package receive subsequent
versions. However, it still should be possible to publish bugfixes to
the old package lineage. This means that we must also record
versioning information at the time a package is renamed.
This versioning information allows us to determine which portions
of the version and namespace are allowed to add new versions.
If a package is re-named to the NULL package at a specific version,
this is equivalent to freezing the package. No further updates to
the version history may be made under that name. (NULL is never open)
The rename catalog format is as follows:
R <srcname> <srcversion> <destname> <destversion>
"""
"""Create a RenamedPackage object. Srcname is the original
name of the package, destname is the name this package
will take after the operation is successful.
Versionstr is the version at which this change takes place. No
versions >= version of srcname will be permitted."""
if destname == "NULL":
destversion = None
else:
if not srcversion and not destversion:
raise RenameException, \
"Must supply a source or destination version"
elif not srcversion:
elif not destversion:
else:
"""Implementing our own == function allows us to properly
check whether a rename object is in a list of renamed
objects."""
return False
return False
return False
return False
return False
return True
"""Return a FMRI that represents the destination name and
version of the renamed package."""
return None
return fm
"""Return a FMRI that represents the most recent version
of the package had it not been renamed."""
return fm