-
Notifications
You must be signed in to change notification settings - Fork 0
/
yum-utils-HEAD.patch
1681 lines (1508 loc) · 62.2 KB
/
yum-utils-HEAD.patch
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
From bc3d026acd1c8f332d024bf9a9918da6451c8c07 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Ville=20Skytt=C3=A4?= <ville.skytta@iki.fi>
Date: Tue, 9 Feb 2010 21:35:15 +0200
Subject: [PATCH 01/24] Make --alldeps the default in repoquery.
--alldeps is what people really almost always want, but fail to
specify for some reason. --exactdeps can be used to get the previous
default of exact matching.
---
docs/repoquery.1 | 10 +++++++---
repoquery.py | 6 ++++--
yum-utils.bash | 2 +-
3 files changed, 12 insertions(+), 6 deletions(-)
diff --git a/docs/repoquery.1 b/docs/repoquery.1
index 1056c80..e5ed8b7 100644
--- a/docs/repoquery.1
+++ b/docs/repoquery.1
@@ -107,8 +107,12 @@ Query all packages that provide CAPABILITY.
.IP "\fB\-\-whatrequires CAPABILITY\fP"
Query all packages that require CAPABILITY.
.IP "\fB\-\-alldeps\fP"
-When used with --whatrequires, use both automatic and manual dependencies
-for the query.
+When used with --whatrequires, look for non-explicit dependencies in
+addition to explicit ones (e.g. files and Provides in addition to
+package names). This is the default.
+.IP "\fB\-\-exactdeps\fP"
+When used with --whatrequires, search for dependencies only exactly as given.
+This is effectively the opposite of --alldeps.
.IP "\fB\-\-recursive\fP"
When used with --whatrequires, query packages recursively.
.IP "\fB\-\-archlist=ARCH1[,ARCH2...]\fP"
@@ -147,7 +151,7 @@ Query groups instead of packages.
.IP "List all packages whose name contains 'perl':"
\fBrepoquery '*perl*'\fP
.IP "List all packages depending on openssl:"
-\fBrepoquery --whatrequires --alldeps openssl\fP
+\fBrepoquery --whatrequires openssl\fP
.IP "List all package names and the repository they come from, nicely formatted:"
\fBrepoquery -a --qf "%-20{repoid} %{name}"\fP
.IP "List name and summary of all available updates (if any), nicely formatted:"
diff --git a/repoquery.py b/repoquery.py
index 2e3004b..3e2c18a 100755
--- a/repoquery.py
+++ b/repoquery.py
@@ -647,8 +647,10 @@ def main(args):
help="operate on corresponding source RPM")
parser.add_option("--resolve", action="store_true",
help="resolve capabilities to originating package(s)")
- parser.add_option("--alldeps", action="store_true",
- help="check non-explicit dependencies (files and Provides:) as well")
+ parser.add_option("--alldeps", action="store_true", default=True,
+ help="check non-explicit dependencies (files and Provides:) as well, defaults to on")
+ parser.add_option("--exactdeps", dest="alldeps", action="store_false",
+ help="check dependencies exactly as given, opposite of --alldeps")
parser.add_option("--recursive", action="store_true",
help="recursively query for packages (for whatrequires)")
parser.add_option("--whatprovides", action="store_true",
diff --git a/yum-utils.bash b/yum-utils.bash
index d8ca1dd..7df1b49 100644
--- a/yum-utils.bash
+++ b/yum-utils.bash
@@ -210,7 +210,7 @@ _yu_repoquery()
COMPREPLY=( $( compgen -W '--version --help --list --info --file
--queryformat --groupmember --all --requires --provides --obsoletes
--conflicts --changelog --location --nevra --envra --nvr --source
- --srpm --resolve --alldeps --recursive --whatprovides --whatrequires
+ --srpm --resolve --exactdeps --recursive --whatprovides --whatrequires
--whatobsoletes --whatconflicts --group --grouppkgs --archlist
--pkgnarrow --show-duplicates --repoid --enablerepo --disablerepo
--repofrompath --plugins --quiet --verbose --cache --tempcache
--
1.6.6.1
From efc35f8de0475db1bfe27eb04a93f571a23ce8b7 Mon Sep 17 00:00:00 2001
From: Seth Vidal <skvidal@fedoraproject.org>
Date: Mon, 15 Feb 2010 22:01:50 -0500
Subject: [PATCH 02/24] make repoquery pass in the whole string not just split for names
---
repoquery.py | 5 +----
1 files changed, 1 insertions(+), 4 deletions(-)
diff --git a/repoquery.py b/repoquery.py
index 2e3004b..c2b8c03 100755
--- a/repoquery.py
+++ b/repoquery.py
@@ -554,10 +554,7 @@ class YumBaseQuery(yum.YumBase):
provs.extend(pkg.files())
for prov in provs:
- # Only look at the providing name, not the whole version. This
- # might occasionally give some false positives but that's
- # better than missing ones which it had previously
- for pkg in self.pkgSack.searchRequires(prov.split()[0]):
+ for pkg in self.pkgSack.searchRequires(prov):
pkgs[pkg.pkgtup] = pkg
if self.options.recursive:
require_recursive(pkg.name)
--
1.6.6.1
From 493450d26d04e3f61470e21f7db717e7d98e3d57 Mon Sep 17 00:00:00 2001
From: Seth Vidal <skvidal@fedoraproject.org>
Date: Thu, 25 Feb 2010 12:58:35 -0500
Subject: [PATCH 03/24] move around where we query for pkgs from sackops/prcos and what happens if no special output format
is specified in repoquery.
makes:
repoquery -qfi /bin/bash output -qi output rather than -q output.
---
repoquery.py | 19 +++++++++++--------
1 files changed, 11 insertions(+), 8 deletions(-)
diff --git a/repoquery.py b/repoquery.py
index 0a56430..225a4cb 100755
--- a/repoquery.py
+++ b/repoquery.py
@@ -504,10 +504,21 @@ class YumBaseQuery(yum.YumBase):
else:
if self.options.srpm:
pkgs = self.matchSrcPkgs(items)
+
else:
pkgs = self.matchPkgs(items)
+ for prco in items:
+ for oper in self.sackops:
+ try:
+ for p in self.doQuery(oper, prco):
+ if p:
+ pkgs.append(p)
+ except queryError, e:
+ self.logger.error( e.msg)
for pkg in pkgs:
+ if not self.pkgops:
+ print to_unicode(pkg)
for oper in self.pkgops:
try:
out = pkg.doQuery(oper)
@@ -515,14 +526,6 @@ class YumBaseQuery(yum.YumBase):
print to_unicode(out)
except queryError, e:
self.logger.error( e.msg)
- for prco in items:
- for oper in self.sackops:
- try:
- for p in self.doQuery(oper, prco):
- if p:
- print p
- except queryError, e:
- self.logger.error( e.msg)
def doQuery(self, method, *args, **kw):
return getattr(self, "fmt_%s" % method)(*args, **kw)
--
1.6.6.1
From f0bee60c3fc81325e547d0f8bf42591368d18ee4 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Ville=20Skytt=C3=A4?= <ville.skytta@iki.fi>
Date: Sat, 27 Feb 2010 14:21:02 +0200
Subject: [PATCH 04/24] Fix --releasever.
---
repoquery.py | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/repoquery.py b/repoquery.py
index 225a4cb..eb524f3 100755
--- a/repoquery.py
+++ b/repoquery.py
@@ -774,7 +774,7 @@ def main(args):
# silence initialisation junk from modules etc unless verbose mode
initnoise = (not opts.quiet) * 2
- repoq.releasever = opts.releasever
+ repoq.preconf.releasever = opts.releasever
if opts.conffile:
repoq.doConfigSetup(fn=opts.conffile, debuglevel=initnoise, init_plugins=opts.plugins)
else:
--
1.6.6.1
From b15cb0760c864cadc5029474d07cc38882ec1815 Mon Sep 17 00:00:00 2001
From: Seth Vidal <skvidal@fedoraproject.org>
Date: Mon, 1 Mar 2010 14:58:27 -0500
Subject: [PATCH 05/24] catch all yum errors and valueError (which is coming from yum.config.py :()
generally this just means we'll get less ABRT errors and more reports from users
(I hope)
---
repoclosure.py | 7 ++++++-
1 files changed, 6 insertions(+), 1 deletions(-)
diff --git a/repoclosure.py b/repoclosure.py
index 5076fe8..8c27cdd 100755
--- a/repoclosure.py
+++ b/repoclosure.py
@@ -273,5 +273,10 @@ def main():
my.logger.info(' %s' % req)
if __name__ == "__main__":
- main()
+ try:
+ main()
+ except (yum.Errors.YumBaseError, ValueError), e:
+ print >> sys.stderr, str(e)
+ sys.exit(1)
+
--
1.6.6.1
From 30e58c85e07abe939ff3c9af017f8355f81a4f32 Mon Sep 17 00:00:00 2001
From: Seth Vidal <skvidal@fedoraproject.org>
Date: Mon, 1 Mar 2010 15:27:57 -0500
Subject: [PATCH 06/24] setup some repo features that make sense for the debug repos to
inherit from the non-debug repos when we add them
---
debuginfo-install.py | 5 +++++
1 files changed, 5 insertions(+), 0 deletions(-)
diff --git a/debuginfo-install.py b/debuginfo-install.py
index 242be65..dc41b5f 100755
--- a/debuginfo-install.py
+++ b/debuginfo-install.py
@@ -90,6 +90,11 @@ class DebugInfoInstall(YumUtilBase):
r.enable()
try:
self.doRepoSetup(thisrepo=r.id)
+ for opt in ['repo_gpgcheck', 'gpgcheck', 'cost',
+ 'skip_if_unavailable']:
+ if hasattr(r, opt):
+ setattr(r, opt, getattr(repo, opt))
+
except yum.Errors.RepoError, e:
self.logger.critical("Could not access repo %s error was: %s" %
(r.id, to_unicode(str(e))))
--
1.6.6.1
From c65516666fdca02f6f1500134d8a6832176320c7 Mon Sep 17 00:00:00 2001
From: James Antill <james@and.org>
Date: Mon, 1 Mar 2010 22:57:07 -0500
Subject: [PATCH 07/24] Add yum-utils to the run_with_packages when running y-c-t
---
yum-complete-transaction.py | 1 +
1 files changed, 1 insertions(+), 0 deletions(-)
diff --git a/yum-complete-transaction.py b/yum-complete-transaction.py
index ba41a51..0a9f5df 100755
--- a/yum-complete-transaction.py
+++ b/yum-complete-transaction.py
@@ -161,6 +161,7 @@ class YumCompleteTransaction(YumUtilBase):
# populate the ts
# run it
+ self.run_with_package_names.add('yum-utils')
times = []
for thistime in find_unfinished_transactions(self.conf.persistdir):
if thistime.endswith('disabled'):
--
1.6.6.1
From 37454f631436624cfeda72496757c6206420cc78 Mon Sep 17 00:00:00 2001
From: James Antill <james@and.org>
Date: Mon, 1 Mar 2010 22:58:53 -0500
Subject: [PATCH 08/24] Add yum-utils to the run_with_packages when running pkg-cleanup
---
package-cleanup.py | 2 ++
1 files changed, 2 insertions(+), 0 deletions(-)
diff --git a/package-cleanup.py b/package-cleanup.py
index 3f5507f..ca4aa9a 100755
--- a/package-cleanup.py
+++ b/package-cleanup.py
@@ -335,6 +335,7 @@ class PackageCleanup(YumUtilBase):
sys.exit(100)
self._remove_old_kernels(opts.kernelcount, opts.keepdevel)
+ self.run_with_package_names.add('yum-utils')
self.buildTransaction()
if len(self.tsInfo) < 1:
print 'No old kernels to remove'
@@ -371,6 +372,7 @@ class PackageCleanup(YumUtilBase):
if opts.noscripts:
self.conf.tsflags.append('noscripts')
self._remove_old_dupes()
+ self.run_with_package_names.add('yum-utils')
self.buildTransaction()
if len(self.tsInfo) < 1:
print 'No duplicates to remove'
--
1.6.6.1
From 94b52cb5499b47cb4e2b64c8a2e4e7863b2e965e Mon Sep 17 00:00:00 2001
From: Tim Lauridsen <timlau@fedoraproject.org>
Date: Tue, 2 Mar 2010 12:18:31 +0100
Subject: [PATCH 09/24] Make repoclosure work with relative paths, like ./myrepo or just .
---
repoclosure.py | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/repoclosure.py b/repoclosure.py
index 8c27cdd..9bfc007 100755
--- a/repoclosure.py
+++ b/repoclosure.py
@@ -60,7 +60,7 @@ def parseArgs():
parser.add_option("-n", "--newest", default=0, action="store_true",
help="check only the newest packages in the repos")
parser.add_option("--repofrompath", action="append",
- help="specify repoid & paths of additional repositories - unique repoid and complete path required, can be specified multiple times. Example. --repofrompath=myrepo,/path/to/repo")
+ help="specify repoid & paths of additional repositories - unique repoid and path required, can be specified multiple times. Example. --repofrompath=myrepo,/path/to/repo")
parser.add_option("-p", "--pkg", action="append",
help="check closure for this package only")
(opts, args) = parser.parse_args()
@@ -195,12 +195,12 @@ def main():
# setup the fake repos
for repo in opts.repofrompath:
repoid,repopath = tuple(repo.split(','))
+ repopath = os.path.abspath(repopath)
if repopath[0] == '/':
baseurl = 'file://' + repopath
else:
baseurl = repopath
- repopath = os.path.normpath(repopath)
newrepo = yum.yumRepo.YumRepository(repoid)
newrepo.name = repopath
newrepo.baseurl = baseurl
--
1.6.6.1
From 7cece362ea4c2f9c6619339775adb5975e022275 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Ville=20Skytt=C3=A4?= <ville.skytta@iki.fi>
Date: Wed, 10 Mar 2010 21:13:00 +0200
Subject: [PATCH 10/24] Add bash completion for yumdb.
---
yum-utils.bash | 27 +++++++++++++++++++++++++++
1 files changed, 27 insertions(+), 0 deletions(-)
diff --git a/yum-utils.bash b/yum-utils.bash
index 7df1b49..1ff3fbd 100644
--- a/yum-utils.bash
+++ b/yum-utils.bash
@@ -218,6 +218,33 @@ _yu_repoquery()
} &&
complete -F _yu_repoquery -o filenames repoquery repoquery.py
+# yumdb
+_yu_yumdb()
+{
+ COMPREPLY=()
+
+ case "$3" in
+ -h|--help|-version)
+ return 0
+ ;;
+ -c|--config)
+ COMPREPLY=( $( compgen -f -o plusdirs -X '!*.conf' -- "$2" ) )
+ return 0
+ ;;
+ shell)
+ COMPREPLY=( $( compgen -f -o plusdirs -- "$2" ) )
+ return 0
+ ;;
+ esac
+
+ if [ $COMP_CWORD -le 1 ] ; then
+ COMPREPLY=( $( compgen -W 'get set del rename rename-force search
+ exist unset info shell --version --help --noplugins --config' \
+ -- "$2" ) )
+ fi
+} &&
+complete -F _yu_yumdb -o filenames yumdb yumdb.py
+
# Local variables:
# mode: shell-script
# sh-basic-offset: 4
--
1.6.6.1
From 421ba27da401618dd10d1a31801df01b89277585 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Ville=20Skytt=C3=A4?= <ville.skytta@iki.fi>
Date: Fri, 26 Mar 2010 22:58:45 +0200
Subject: [PATCH 11/24] Complete on repomanage.py, package-cleanup.py, and verifytree.py.
---
yum-utils.bash | 6 +++---
1 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/yum-utils.bash b/yum-utils.bash
index 1ff3fbd..308d82b 100644
--- a/yum-utils.bash
+++ b/yum-utils.bash
@@ -23,7 +23,7 @@ _yu_repomanage()
COMPREPLY=( $( compgen -d -- "$2" ) )
} &&
-complete -F _yu_repomanage -o filenames repomanage
+complete -F _yu_repomanage -o filenames repomanage repomanage.py
# package-cleanup
_yu_package_cleanup()
@@ -49,7 +49,7 @@ _yu_package_cleanup()
--cleandupes --oldkernels --count --keepdevel -c --queryformat' \
-- "$2" ) )
} &&
-complete -F _yu_package_cleanup -o filenames package-cleanup
+complete -F _yu_package_cleanup -o filenames package-cleanup package-cleanup.py
# verifytree
_yu_verifytree()
@@ -70,7 +70,7 @@ _yu_verifytree()
COMPREPLY=( $( compgen -d -- "$2" ) )
} &&
-complete -F _yu_verifytree -o filenames verifytree
+complete -F _yu_verifytree -o filenames verifytree verifytree.py
# repo-graph
_yu_repo_graph()
--
1.6.6.1
From 25ceb993e0bda203804c3e8241df5d1942eab303 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Ville=20Skytt=C3=A4?= <ville.skytta@iki.fi>
Date: Tue, 30 Mar 2010 23:04:44 +0300
Subject: [PATCH 12/24] Use "in" instead of has_key.
---
package-cleanup.py | 2 +-
plugins/changelog/changelog.py | 4 ++--
.../fastestmirror-asyncore.py | 2 +-
plugins/fedorakmod/fedorakmod.py | 9 +++++----
plugins/fs-snapshot/fs-snapshot.py | 2 +-
.../post-transaction-actions.py | 2 +-
plugins/priorities/priorities.py | 10 +++++-----
plugins/protectbase/protectbase.py | 2 +-
plugins/remove-with-leaves/remove-with-leaves.py | 2 +-
plugins/upgrade-helper/upgrade-helper.py | 8 ++++----
repo-graph.py | 4 ++--
repo-rss.py | 2 +-
repoclosure.py | 6 +++---
repodiff.py | 2 +-
repomanage.py | 4 ++--
repoquery.py | 6 +++---
reposync.py | 2 +-
repotrack.py | 5 ++---
yum-debug-dump.py | 2 +-
19 files changed, 38 insertions(+), 38 deletions(-)
diff --git a/package-cleanup.py b/package-cleanup.py
index ca4aa9a..c796286 100755
--- a/package-cleanup.py
+++ b/package-cleanup.py
@@ -129,7 +129,7 @@ class PackageCleanup(YumUtilBase):
for (req,flags,ver) in po.requires:
if req.startswith('rpmlib'): continue # ignore rpmlib deps
- if not providers.has_key((req,flags,ver)):
+ if (req,flags,ver) not in providers:
resolve_sack = self.rpmdb.whatProvides(req,flags,ver)
else:
resolve_sack = providers[(req,flags,ver)]
diff --git a/plugins/changelog/changelog.py b/plugins/changelog/changelog.py
index 250326f..007ac6d 100644
--- a/plugins/changelog/changelog.py
+++ b/plugins/changelog/changelog.py
@@ -58,7 +58,7 @@ def srpmname(pkg):
def _show_changes_changelog(conduit, srpms):
for name in sorted(srpms.keys()):
rpms = []
- if origpkgs.has_key(name):
+ if name in origpkgs:
for rpm in srpms[name]:
rpms.append("%s" % rpm)
done = False
@@ -85,7 +85,7 @@ def show_changes(conduit, msg):
if not tsmem.updates:
continue
name = srpmname(tsmem.po)
- if srpms.has_key(name):
+ if name in srpms:
srpms[name].append(tsmem.po)
else:
srpms[name] = [tsmem.po]
diff --git a/plugins/fastestmirror/fastestmirror-asyncore/fastestmirror-asyncore.py b/plugins/fastestmirror/fastestmirror-asyncore/fastestmirror-asyncore.py
index 8129e2c..11c394f 100644
--- a/plugins/fastestmirror/fastestmirror-asyncore/fastestmirror-asyncore.py
+++ b/plugins/fastestmirror/fastestmirror-asyncore/fastestmirror-asyncore.py
@@ -135,7 +135,7 @@ def postreposetup_hook(conduit):
repomirrors = {}
repos = conduit.getRepos()
for repo in repos.listEnabled():
- if not repomirrors.has_key(str(repo)):
+ if str(repo) not in repomirrors:
repomirrors[str(repo)] = FastestMirror(repo.urls).get_mirrorlist()
if exclude:
for mirror in repomirrors[str(repo)]:
diff --git a/plugins/fedorakmod/fedorakmod.py b/plugins/fedorakmod/fedorakmod.py
index ab9f673..b3aed61 100644
--- a/plugins/fedorakmod/fedorakmod.py
+++ b/plugins/fedorakmod/fedorakmod.py
@@ -140,7 +140,7 @@ def resolveVersions(packageList):
continue
po.kmodName = name[0]
- if not pdict.has_key(kernel):
+ if kernel not in pdict:
pdict[kernel] = [po]
else:
sameName = None
@@ -208,7 +208,7 @@ def pinKernels(c, newKernels, installedKernels, modules):
str(runningKernel))
table = resolveVersions(modules)
- if not table.has_key(runningKernel):
+ if runningKernel not in table:
c.info(2, "Trying to mimic %s which has no kernel modules installed" \
% str(runningKernel))
return
@@ -217,7 +217,7 @@ def pinKernels(c, newKernels, installedKernels, modules):
c.info(2, "kmods in %s: %s" % (str(runningKernel), str(names)))
for kpo in newKernels:
prov = getKernelProvides(kpo)[0]
- if table.has_key(prov):
+ if prov in table:
kmods = [ po.kmodName for po in table[prov] ]
else:
kmods = []
@@ -255,7 +255,8 @@ def installAllKmods(c, avaModules, modules, kernels):
table = resolveVersions(interesting + modules)
for kernel in [ getKernelProvides(k)[0] for k in kernels ]:
- if not table.has_key(kernel): continue
+ if kernel not in table:
+ continue
for po in table[kernel]:
if po not in modules:
c.getTsInfo().addTrueInstall(po)
diff --git a/plugins/fs-snapshot/fs-snapshot.py b/plugins/fs-snapshot/fs-snapshot.py
index f0ce051..a83156d 100644
--- a/plugins/fs-snapshot/fs-snapshot.py
+++ b/plugins/fs-snapshot/fs-snapshot.py
@@ -178,7 +178,7 @@ def _create_snapshot(conduit, snapshot_tag, volume):
"""
if volume["fstype"] == "btrfs":
return _create_btrfs_snapshot(conduit, snapshot_tag, volume)
- elif volume.has_key(lvm_key):
+ elif lvm_key in volume:
return _create_lvm_snapshot(conduit, snapshot_tag, volume)
return 0
diff --git a/plugins/post-transaction-actions/post-transaction-actions.py b/plugins/post-transaction-actions/post-transaction-actions.py
index 7b94b90..b4da1ce 100644
--- a/plugins/post-transaction-actions/post-transaction-actions.py
+++ b/plugins/post-transaction-actions/post-transaction-actions.py
@@ -62,7 +62,7 @@ def parse_actions(ddir, conduit):
def _get_installed_po(rpmdb, pkgtup):
(n,a,e,v,r) = pkgtup
- if _just_installed.has_key(pkgtup):
+ if pkgtup in _just_installed:
return _just_installed[pkgtup]
return rpmdb.searchNevra(name=n, arch=a, epoch=e, ver=v, rel=r)[0]
diff --git a/plugins/priorities/priorities.py b/plugins/priorities/priorities.py
index 3650736..ddee1cb 100644
--- a/plugins/priorities/priorities.py
+++ b/plugins/priorities/priorities.py
@@ -134,11 +134,11 @@ def exclude_hook(conduit):
if only_samearch:
key = "%s.%s" % (po.name,po.arch)
- if pkg_priorities.has_key(key) and pkg_priorities[key] < repo.priority:
+ if key in pkg_priorities and pkg_priorities[key] < repo.priority:
delPackage = True
else:
key = "%s" % po.name
- if pkg_priorities_archless.has_key(key) and pkg_priorities_archless[key] < repo.priority:
+ if key in pkg_priorities_archless and pkg_priorities_archless[key] < repo.priority:
delPackage = True
if delPackage:
@@ -150,11 +150,11 @@ def exclude_hook(conduit):
# one of the obsoleted packages is not available through
# a repo with a higher priority. If so, remove this package.
if check_obsoletes:
- if obsoletes.has_key(po.pkgtup):
+ if po.pkgtup in obsoletes:
obsolete_pkgs = obsoletes[po.pkgtup]
for obsolete_pkg in obsolete_pkgs:
pkg_name = obsolete_pkg[0]
- if pkg_priorities_archless.has_key(pkg_name) and pkg_priorities_archless[pkg_name] < repo.priority:
+ if pkg_name in pkg_priorities_archless and pkg_priorities_archless[pkg_name] < repo.priority:
conduit.delPackage(po)
cnt += 1
conduit.info(3," --> %s from %s excluded (priority)" % (po,po.repoid))
@@ -173,5 +173,5 @@ def _pkglist_to_dict(pl, priority, addArch = False):
def _mergeprioritydicts(dict1, dict2):
for package in dict2.keys():
- if not dict1.has_key(package) or dict2[package] < dict1[package]:
+ if package not in dict1 or dict2[package] < dict1[package]:
dict1[package] = dict2[package]
diff --git a/plugins/protectbase/protectbase.py b/plugins/protectbase/protectbase.py
index 441cdba..37a39dd 100644
--- a/plugins/protectbase/protectbase.py
+++ b/plugins/protectbase/protectbase.py
@@ -55,7 +55,7 @@ def exclude_hook(conduit):
continue
for po in conduit.getPackages(repo2):
- if repo1pkgs.has_key(po.name):
+ if po.name in repo1pkgs:
conduit.delPackage(po)
cnt += 1
diff --git a/plugins/remove-with-leaves/remove-with-leaves.py b/plugins/remove-with-leaves/remove-with-leaves.py
index 004472f..a808aef 100644
--- a/plugins/remove-with-leaves/remove-with-leaves.py
+++ b/plugins/remove-with-leaves/remove-with-leaves.py
@@ -42,7 +42,7 @@ remove_always = False
def _requires_this_package(rpmdb, pkg):
- if _requires_cache.has_key(pkg):
+ if pkg in _requires_cache:
return _requires_cache[pkg]
requirers = {}
diff --git a/plugins/upgrade-helper/upgrade-helper.py b/plugins/upgrade-helper/upgrade-helper.py
index fd76c4f..9aa05f0 100644
--- a/plugins/upgrade-helper/upgrade-helper.py
+++ b/plugins/upgrade-helper/upgrade-helper.py
@@ -68,11 +68,11 @@ def parse_xml(xmlfile):
child_name = ns_cleanup(child.tag)
thisarch = myarch
if child_name == 'removespec':
- if child.attrib.has_key('on_arch'):
+ if 'on_arch' in child.attrib:
thisarch = child.attrib.get('on_arch')
- if child.attrib.has_key('pkgmatch'):
+ if 'pkgmatch' in child.attrib:
thismatch = child.attrib.get('pkgmatch')
- if results.has_key(thisarch):
+ if thisarch in results:
if thismatch not in results[thisarch]:
results[thisarch].append(thismatch)
else:
@@ -89,7 +89,7 @@ def stuff_to_remove(repos):
# return them as the toremove list
for repo in repos.listEnabled():
- if repo.repoXML.repoData.has_key('cleanup'):
+ if 'cleanup' in repo.repoXML.repoData:
trf = repo.retrieveMD('cleanup')
tr_dict = parse_xml(trf)
# prune out things like *, ?, *.*, *.*.*.*.*
diff --git a/repo-graph.py b/repo-graph.py
index e771874..bb901a8 100755
--- a/repo-graph.py
+++ b/repo-graph.py
@@ -69,7 +69,7 @@ class yumQuiet(yum.YumBase):
for r in pkg.returnPrco('requires'):
reqname = r[0]
if reqname.startswith('rpmlib'): continue
- if prov.has_key(reqname):
+ if reqname in prov:
provider = prov[reqname]
cached += 1
else:
@@ -83,7 +83,7 @@ class yumQuiet(yum.YumBase):
prov[reqname] = provider
if provider == pkg.name:
xx[provider] = None
- if xx.has_key(provider) or provider in skip:
+ if provider in xx or provider in skip:
continue
else:
xx[provider] = None
diff --git a/repo-rss.py b/repo-rss.py
index f395089..845c65e 100755
--- a/repo-rss.py
+++ b/repo-rss.py
@@ -45,7 +45,7 @@ class YumQuiet(yum.YumBase):
for po in avail:
ftime = int(po.returnSimple('filetime'))
if ftime > recentlimit:
- if not ftimehash.has_key(ftime):
+ if ftime not in ftimehash:
ftimehash[ftime] = [po]
else:
ftimehash[ftime].append(po)
diff --git a/repoclosure.py b/repoclosure.py
index 9bfc007..d9a94d7 100755
--- a/repoclosure.py
+++ b/repoclosure.py
@@ -153,7 +153,7 @@ class RepoClosure(yum.YumBase):
if req.startswith('rpmlib'): continue # ignore rpmlib deps
ver = self.evrTupletoVer((reqe, reqv, reqr))
- if resolved.has_key((req,flags,ver)):
+ if (req,flags,ver) in resolved:
continue
try:
resolve_sack = self.whatProvides(req, flags, ver)
@@ -161,7 +161,7 @@ class RepoClosure(yum.YumBase):
pass
if len(resolve_sack) < 1:
- if not unresolved.has_key(pkg):
+ if pkg not in unresolved:
unresolved[pkg] = []
unresolved[pkg].append((req, flags, ver))
continue
@@ -176,7 +176,7 @@ class RepoClosure(yum.YumBase):
if resolved_by_newest:
resolved[(req,flags,ver)] = 1
else:
- if not unresolved.has_key(pkg):
+ if pkg not in unresolved:
unresolved[pkg] = []
unresolved[pkg].append((req, flags, ver))
diff --git a/repodiff.py b/repodiff.py
index 5b547c0..ac1865e 100755
--- a/repodiff.py
+++ b/repodiff.py
@@ -184,7 +184,7 @@ def main(args):
if ygh.remove:
for pkg in sorted(ygh.remove):
print 'Removed package %s' % pkg.name
- if ygh.obsoleted.has_key(pkg):
+ if pkg in ygh.obsoleted:
print 'Obsoleted by %s' % ygh.obsoleted[pkg]
remove_sizechange += (int(pkg.size))
diff --git a/repomanage.py b/repomanage.py
index 759bf30..aeff9e5 100755
--- a/repomanage.py
+++ b/repomanage.py
@@ -158,11 +158,11 @@ def main(args):
(n,a,e,v,r) = pkgtuple
del hdr
- if not pkgdict.has_key((n,a)):
+ if (n,a) not in pkgdict:
pkgdict[(n,a)] = []
pkgdict[(n,a)].append((e,v,r))
- if not verfile.has_key(pkgtuple):
+ if pkgtuple not in verfile:
verfile[pkgtuple] = []
verfile[pkgtuple].append(pkg)
diff --git a/repoquery.py b/repoquery.py
index eb524f3..76b1178 100755
--- a/repoquery.py
+++ b/repoquery.py
@@ -146,7 +146,7 @@ class pkgQuery:
if len(tmp) > 1:
item = tmp[0]
conv = tmp[1]
- if convertmap.has_key(conv):
+ if conv in convertmap:
convert = convertmap[conv]
else:
raise queryError("Invalid conversion: %s" % conv)
@@ -168,7 +168,7 @@ class pkgQuery:
return self.fmt_queryformat()
def doQuery(self, method, *args, **kw):
- if std_qf.has_key(method):
+ if method in std_qf:
self.qf = std_qf[method]
return self.fmt_queryformat()
elif hasattr(self, "fmt_%s" % method):
@@ -295,7 +295,7 @@ class instPkgQuery(pkgQuery):
self.classname = 'installed pkg'
def __getitem__(self, item):
- if self.tagmap.has_key(item):
+ if item in self.tagmap:
return self.pkg.tagByName(self.tagmap[item])
else:
return pkgQuery.__getitem__(self, item)
diff --git a/reposync.py b/reposync.py
index 5c8ee32..b66e927 100755
--- a/reposync.py
+++ b/reposync.py
@@ -222,7 +222,7 @@ def main():
download_set[rpmname] = 1
for pkg in current_pkgs:
- if download_set.has_key(pkg):
+ if pkg in download_set:
continue
if not opts.quiet:
diff --git a/repotrack.py b/repotrack.py
index 35b8375..1c7158a 100755
--- a/repotrack.py
+++ b/repotrack.py
@@ -214,9 +214,8 @@ def main():
del this_sack
for res in pkg_list:
- if res is not None:
- if not unprocessed_pkgs.has_key(res.pkgtup):
- unprocessed_pkgs[res.pkgtup] = res
+ if res is not None and res.pkgtup not in unprocessed_pkgs:
+ unprocessed_pkgs[res.pkgtup] = res
diff --git a/yum-debug-dump.py b/yum-debug-dump.py
index f280d61..0ef90b2 100644
--- a/yum-debug-dump.py
+++ b/yum-debug-dump.py
@@ -128,7 +128,7 @@ class YumDebugDump(yum.YumBase):
if req.startswith('rpmlib'):
continue # ignore rpmlib deps
- if not providers.has_key((req,rflags,ver)):
+ if (req,rflags,ver) not in providers:
resolve_sack = self.rpmdb.whatProvides(req,rflags,ver)
else:
resolve_sack = providers[(req,rflags,ver)]
--
1.6.6.1
From 39e3f286c7bb5d09f1440e2a50dd21d0c1603b49 Mon Sep 17 00:00:00 2001
From: Dennis Gregorovic <dgregor@redhat.com>
Date: Wed, 31 Mar 2010 15:00:54 -0400
Subject: [PATCH 13/24] Include all packages listed in the pkgonly arg
---
repoclosure.py | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/repoclosure.py b/repoclosure.py
index d9a94d7..4c8cfa6 100755
--- a/repoclosure.py
+++ b/repoclosure.py
@@ -146,7 +146,7 @@ class RepoClosure(yum.YumBase):
pkgs = filter(lambda x: x.arch == 'src', pkgs)
if self.pkgonly:
- pkgs = filter(lambda x: x.name == self.pkgonly[0], pkgs)
+ pkgs = filter(lambda x: x.name in self.pkgonly, pkgs)
for pkg in pkgs:
for (req, flags, (reqe, reqv, reqr)) in pkg.returnPrco('requires'):
--
1.6.6.1
From 267c33dd4c50ea9844f3720832c6c65a623d7b4c Mon Sep 17 00:00:00 2001
From: Dennis Gregorovic <dgregor@redhat.com>
Date: Wed, 31 Mar 2010 15:18:35 -0400
Subject: [PATCH 14/24] Add a --group flag to filter packages by comps group
---
repoclosure.py | 20 +++++++++++++++++---
1 files changed, 17 insertions(+), 3 deletions(-)
diff --git a/repoclosure.py b/repoclosure.py
index 4c8cfa6..88a6adb 100755
--- a/repoclosure.py
+++ b/repoclosure.py
@@ -63,6 +63,8 @@ def parseArgs():
help="specify repoid & paths of additional repositories - unique repoid and path required, can be specified multiple times. Example. --repofrompath=myrepo,/path/to/repo")
parser.add_option("-p", "--pkg", action="append",
help="check closure for this package only")
+ parser.add_option("-g", "--group", action="append",
+ help="check closure for packages in this group only")
(opts, args) = parser.parse_args()
return (opts, args)
@@ -70,13 +72,14 @@ def parseArgs():
# so we have to do at least some API guarantee stuff.
class RepoClosure(yum.YumBase):
def __init__(self, arch=[], config="/etc/yum.conf", builddeps=False, pkgonly=None,
- basearch=None):
+ basearch=None, grouponly=None):
yum.YumBase.__init__(self)
if basearch:
self.preconf.arch = basearch
self.logger = logging.getLogger("yum.verbose.repoclosure")
self.builddeps = builddeps
self.pkgonly = pkgonly
+ self.grouponly = grouponly
self.doConfigSetup(fn = config,init_plugins=False)
self._rc_arches = arch
@@ -145,8 +148,18 @@ class RepoClosure(yum.YumBase):
if self.builddeps:
pkgs = filter(lambda x: x.arch == 'src', pkgs)
- if self.pkgonly:
- pkgs = filter(lambda x: x.name in self.pkgonly, pkgs)
+ pkglist = self.pkgonly
+ if self.grouponly:
+ if not pkglist:
+ pkglist = []
+ for group in self.grouponly:
+ groupobj = self.comps.return_group(group)
+ if not groupobj:
+ continue
+ pkglist.extend(groupobj.packages)
+
+ if pkglist:
+ pkgs = filter(lambda x: x.name in pkglist, pkgs)
for pkg in pkgs:
for (req, flags, (reqe, reqv, reqr)) in pkg.returnPrco('requires'):
@@ -189,6 +202,7 @@ def main():
config=opts.config,
builddeps=opts.builddeps,
pkgonly=opts.pkg,
+ grouponly=opts.group,
basearch=opts.basearch)
if opts.repofrompath:
--
1.6.6.1
From 8361ec1ae233a507a05c214fa4966e1f232e7a92 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Ville=20Skytt=C3=A4?= <ville.skytta@iki.fi>
Date: Thu, 1 Apr 2010 21:57:36 +0300
Subject: [PATCH 15/24] Add repoclosure --group completion.
---
yum-utils.bash | 6 +++++-
1 files changed, 5 insertions(+), 1 deletions(-)
diff --git a/yum-utils.bash b/yum-utils.bash
index 308d82b..d1f13c9 100644
--- a/yum-utils.bash
+++ b/yum-utils.bash
@@ -142,10 +142,14 @@ _yu_repoclosure()
type _yum_list &>/dev/null && _yum_list all "$2"
return 0
;;
+ -g|--group)
+ type _yum_grouplist &>/dev/null && _yum_grouplist "" "$2"
+ return 0
+ ;;
esac
COMPREPLY=( $( compgen -W '--help --config --arch --basearch --builddeps
- --repoid --tempcache --quiet --newest --repofrompath --pkg' \
+ --repoid --tempcache --quiet --newest --repofrompath --pkg --group' \
-- "$2" ) )
} &&
complete -F _yu_repoclosure -o filenames repoclosure repoclosure.py
--
1.6.6.1
From 08975b3f4d0f31fe7af7a12443c227bfcbc9f6de Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Ville=20Skytt=C3=A4?= <ville.skytta@iki.fi>
Date: Fri, 2 Apr 2010 11:34:54 +0300
Subject: [PATCH 16/24] Fix always_print_best_host conf setting.
---
plugins/fastestmirror/fastestmirror.py | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/plugins/fastestmirror/fastestmirror.py b/plugins/fastestmirror/fastestmirror.py
index 0701ef7..a8f1ee7 100644
--- a/plugins/fastestmirror/fastestmirror.py
+++ b/plugins/fastestmirror/fastestmirror.py
@@ -90,7 +90,7 @@ def init_hook(conduit):
"""
global verbose, socket_timeout, hostfilepath, maxhostfileage, loadcache
- global maxthreads, exclude, prefer, downgrade_ftp
+ global maxthreads, exclude, prefer, downgrade_ftp, always_print_best_host