View | Details | Raw Unified | Return to bug 336124
Collapse All | Expand All

(-)ChangeLog (+6 lines)
Lines 1-3 Link Here
1
2007-10-23  JP Rosevear  <jpr@novell.com>
2
3
	* src/YGPackageSelector.cc (class YGPatchSelector): Use the more
4
	sophisticated logic taken from YQPkgPatchList::fillList to
5
	determine what patches are available (#336124)
6
1
2007-10-22  Boyd Timothy  <btimothy@novell.com>
7
2007-10-22  Boyd Timothy  <btimothy@novell.com>
2
8
3
	* src/YGPackageSelector.cc: Removed the space before the question mark
9
	* src/YGPackageSelector.cc: Removed the space before the question mark
(-)src/YGPackageSelector.cc (-3 / +54 lines)
Lines 904-915 Link Here
904
		     it != zyppPool().byKindEnd <zypp::Patch>(); it++) {
904
		     it != zyppPool().byKindEnd <zypp::Patch>(); it++) {
905
			ZyppSelectable selectable = *it;
905
			ZyppSelectable selectable = *it;
906
			ZyppPatch patch = tryCastToZyppPatch (selectable->theObj());
906
			ZyppPatch patch = tryCastToZyppPatch (selectable->theObj());
907
			bool displayPatch = false;
907
908
908
			if (patch && !selectable->hasInstalledObj() &&
909
			if (!patch)
909
			    selectable->hasCandidateObj() /*don't show installed ones*/) {
910
				continue;
911
912
			// These rules are taken from YQPkgPatchList::fillList() in the RelevantPatches case
913
			if (selectable->hasInstalledObj()) { // installed?
914
				if (selectable->installedPoolItem().status().isIncomplete()) { // patch broken?
915
					// The patch is broken: It had been installed, but the user somehow
916
					// downgraded individual packages belonging to the patch to older versions.
917
					displayPatch = true;
918
919
					y2warning( "Installed patch is broken: %s - %s",
920
						   patch->name().c_str(),
921
						   patch->summary().c_str() );
922
				}
923
			} else { // not installed
924
				if (selectable->hasCandidateObj() && selectable->candidatePoolItem().status().isSatisfied()) {
925
					// This is a pretty exotic case, but still it might happen:
926
					//
927
					// The patch itelf is not installed, but it is satisfied because the
928
					// user updated all the packages belonging to the patch to the versions
929
					// the patch requires. All that is missing now is to get the patch meta
930
					// data onto the system. So let's display the patch to give the user
931
					// a chance to install it (if he so chooses).
932
933
					displayPatch = true;
934
					
935
					y2milestone( "Patch satisfied, but not installed yet: %s - %s",
936
						     patch->name().c_str(),
937
						     patch->summary().c_str() );
938
				}
939
			}
940
941
			if (selectable->hasCandidateObj()) {	// candidate available?
942
				// The most common case: There is a candidate patch, i.e. one that could be
943
				// installed, but either no version of that patch is installed or there is a
944
				// newer one to which the patch could be updated.
945
				
946
				if (selectable->candidatePoolItem().status().isNeeded()) { // patch really needed?
947
					// Patches are needed if any of the packages that belong to the patch
948
					// are installed on the system.
949
					
950
					displayPatch = true;
951
				} else {
952
					// None of the packages that belong to the patch is installed on the system.
953
					
954
					y2debug( "Patch not needed: %s - %s",
955
						 patch->name().c_str(),
956
						 patch->summary().c_str() );
957
				}
958
			}
959
960
			if (displayPatch) {
910
				// select them all
961
				// select them all
911
				selectable->set_status (zypp::ui::S_Install);
962
				selectable->set_status (zypp::ui::S_Install);
912
963
				
913
				GtkTreeIter iter;
964
				GtkTreeIter iter;
914
				GtkListStore *store = GTK_LIST_STORE (m_patches_model);
965
				GtkListStore *store = GTK_LIST_STORE (m_patches_model);
915
				gtk_list_store_append (store, &iter);
966
				gtk_list_store_append (store, &iter);

Return to bug 336124