BUG#: 6996
authoryi.zhou <yi.zhou>
Fri, 5 Oct 2007 18:46:43 +0000 (18:46 +0000)
committeryi.zhou <yi.zhou>
Fri, 5 Oct 2007 18:46:43 +0000 (18:46 +0000)
TITLE: SDK Sample providers do not get deregistered when SDK rpm is removed

DESCRIPTION: If SDK Sample providers were registered, they were deregistered when SDK rpm was uninstalled.

mak/SDKMakefile
rpm/RPMMakefile
rpm/tog-pegasus.spec
src/SDK/samples/Makefile

index a2b14366a7406ef5fcdce2e27084a8de60ca9e96..5113e863fdafeaeb1f0c9ac7428a33623efff24e 100644 (file)
@@ -412,6 +412,31 @@ stageHTML:
 
 _append_preunSectionToSpecFile:
        @$(ECHO-E) "%preun devel" >> $(PEGASUS_RPM_SPEC_FILE_PATH)
+       @$(ECHO-E) "# Check if the SDK has been setup" \
+            >> $(PEGASUS_RPM_SPEC_FILE_PATH)
+       @$(ECHO-E) "if [ -f $(PEGASUS_SAMPLES_DIR)/SDKIsSetup ]; then" \
+            >> $(PEGASUS_RPM_SPEC_FILE_PATH)
+       @$(ECHO-E) "   make --directory $(PEGASUS_SAMPLES_DIR) -s unsetupSDK" \
+            >> $(PEGASUS_RPM_SPEC_FILE_PATH)
+       @$(ECHO-E) "   if [ \044? != 0 ]; then" \
+            >> $(PEGASUS_RPM_SPEC_FILE_PATH)
+       @$(ECHO-E) "      echo \"++++++++++++++++++++++++++++++++++++++++++++++\" >&2" \
+            >> $(PEGASUS_RPM_SPEC_FILE_PATH)
+       @$(ECHO-E) "      echo \"ERROR: Failed to deregister sample providers.\" >&2" \
+            >> $(PEGASUS_RPM_SPEC_FILE_PATH)
+       @$(ECHO-E) "      echo \"To remove the SDK rpm without deregistering\" >&2" \
+            >> $(PEGASUS_RPM_SPEC_FILE_PATH)
+       @$(ECHO-E) "      echo \"the sample providers, first remove file\" >&2" \
+            >> $(PEGASUS_RPM_SPEC_FILE_PATH)
+       @$(ECHO-E) "      echo \"$(PEGASUS_SAMPLES_DIR)/SDKIsSetup,\" >&2" \
+            >> $(PEGASUS_RPM_SPEC_FILE_PATH)
+       @$(ECHO-E) "      echo \"then remove SDK rpm.\" >&2" \
+            >> $(PEGASUS_RPM_SPEC_FILE_PATH)
+       @$(ECHO-E) "      echo \"++++++++++++++++++++++++++++++++++++++++++++++\" >&2" \
+            >> $(PEGASUS_RPM_SPEC_FILE_PATH)
+       @$(ECHO-E) "      exit 1" >> $(PEGASUS_RPM_SPEC_FILE_PATH)
+       @$(ECHO-E) "   fi" >> $(PEGASUS_RPM_SPEC_FILE_PATH)
+       @$(ECHO-E) "fi" >> $(PEGASUS_RPM_SPEC_FILE_PATH)
        @$(ECHO-E) "make --directory $(PEGASUS_SAMPLES_DIR) -s clean" \
             >> $(PEGASUS_RPM_SPEC_FILE_PATH)
        @$(ECHO-E) ""  >> $(PEGASUS_RPM_SPEC_FILE_PATH)
index 43bdb0136cc409bd5ffcd2f928013a15479171c1..190b269fff1018b240d01243b798ba414b0c763f 100644 (file)
@@ -211,6 +211,7 @@ tests:
        $(MAKE) --directory=$(PEGASUS_SAMPLES_DIR) -f Makefile
        $(MAKE) --directory=$(PEGASUS_SAMPLES_DIR) -f Makefile setupSDK
        $(MAKE) --directory=$(PEGASUS_SAMPLES_DIR) -f Makefile testSDK
+       $(MAKE) --directory=$(PEGASUS_SAMPLES_DIR) -f Makefile unsetupSDK
        @check_for_core
 
        # Install the test RPM after running SDK tests. This is because
index 13ed95a13dc47acf3da2b15ce7cecea0da137fae..6296c7d131dfc55864657fe6d17a9ecc573d01e3 100644 (file)
@@ -397,6 +397,20 @@ fi
 # End of section pegasus/rpm/tog-specfiles/tog-pegasus-preun.spec
 
 %preun devel
+# Check if the SDK has been setup
+if [ -f /usr/share/Pegasus/samples/SDKIsSetup ]; then
+   make --directory /usr/share/Pegasus/samples -s unsetupSDK
+   if [ $? != 0 ]; then
+      echo "++++++++++++++++++++++++++++++++++++++++++++++" >&2
+      echo "ERROR: Failed to deregister sample providers." >&2
+      echo "To remove the SDK rpm without deregistering" >&2
+      echo "the sample providers, first remove file" >&2
+      echo "/usr/share/Pegasus/samples/SDKIsSetup," >&2
+      echo "then remove SDK rpm." >&2
+      echo "++++++++++++++++++++++++++++++++++++++++++++++" >&2
+      exit 1
+   fi
+fi
 make --directory /usr/share/Pegasus/samples -s clean
 
 %if %{PEGASUS_BUILD_TEST_RPM}
index fde313a0b91d4fe3f564638fe9382afe86d3a754..9d04df2e7eafc430dc7ee573734c7c1b3909d3f9 100644 (file)
@@ -41,3 +41,8 @@ include $(ROOT)/mak/recurse.mak
 setupSDK:
        @$(MAKE) --directory $(ROOT)/Providers/Load createrepository
        @$(MAKE) --directory $(ROOT)/Providers/Load registerproviders
+       @$(TOUCH) $(ROOT)/SDKIsSetup
+
+unsetupSDK:
+       @$(MAKE) --directory $(ROOT)/Providers/Load deregisterproviders
+       @$(RM) $(ROOT)/SDKIsSetup