Subversion Repositories DevTools

Rev

Rev 1374 | Rev 2546 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 1374 Rev 2362
Line 1... Line 1...
1
--------------------------------------------------------
1
--------------------------------------------------------
2
--  File created - Thursday-September-06-2012   
2
--  File created - Monday-October-29-2012   
3
--------------------------------------------------------
3
--------------------------------------------------------
4
 
4
 
5
--------------------------------------------------------
5
--------------------------------------------------------
6
--  DDL for Function ORA_SYSDATE
6
--  DDL for Function ORA_SYSDATE
7
--------------------------------------------------------
7
--------------------------------------------------------
Line 791... Line 791...
791
 
791
 
792
   FUNCTION return_vcs_tag(pvid IN NUMBER) RETURN VARCHAR2;
792
   FUNCTION return_vcs_tag(pvid IN NUMBER) RETURN VARCHAR2;
793
 
793
 
794
   PROCEDURE update_vcs_details(ipv_id IN NUMBER, vcstag IN VARCHAR2, user_id IN NUMBER);
794
   PROCEDURE update_vcs_details(ipv_id IN NUMBER, vcstag IN VARCHAR2, user_id IN NUMBER);
795
   
795
   
-
 
796
   FUNCTION isSVN( pkgid IN NUMBER ) RETURN NUMBER;
-
 
797
   
-
 
798
   FUNCTION isSVNbyName( pkgname IN VARCHAR2 ) RETURN NUMBER;
-
 
799
 
796
END pk_rmapi;
800
END pk_rmapi;
797
/
801
/
798
--------------------------------------------------------
802
--------------------------------------------------------
799
--  DDL for Package PK_BUILDAPI
803
--  DDL for Package PK_BUILDAPI
800
--------------------------------------------------------
804
--------------------------------------------------------
Line 1907... Line 1911...
1907
                -- NOTE: if reg-expr parsing/replacement fails, the x_... variable may receive the entire input string (vcstag), so
1911
                -- NOTE: if reg-expr parsing/replacement fails, the x_... variable may receive the entire input string (vcstag), so
1908
                -- check for that error as well as the obvious zero-length string conditions.
1912
                -- check for that error as well as the obvious zero-length string conditions.
1909
                IF LENGTH(x_srcpath) = 0 OR LENGTH(x_label) = 0 OR x_srcpath = vcstag OR x_label = vcstag THEN
1913
                IF LENGTH(x_srcpath) = 0 OR LENGTH(x_label) = 0 OR x_srcpath = vcstag OR x_label = vcstag THEN
1910
                   raise_application_error (-20000, 'VCS Tag contains insufficient or malformed data!');
1914
                   raise_application_error (-20000, 'VCS Tag contains insufficient or malformed data!');
1911
                END IF;
1915
                END IF;
-
 
1916
                
-
 
1917
                IF isSVNbyName(pkgname) > 0 THEN
-
 
1918
                    raise_application_error (-20000, 'Package has been migrated to SVN. Cannot release versions from ClearCase');
-
 
1919
                END IF;
1912
 
1920
 
1913
             WHEN 'SVN' THEN
1921
             WHEN 'SVN' THEN
1914
                -- extract the 2nd token, that being the subversion tag
1922
                -- extract the 2nd token, that being the subversion tag
1915
                x_srcpath := REGEXP_REPLACE(vcstag, BOL || Token || Seperator || Token || Seperator || Anything, ReplaceToken2);
1923
                x_srcpath := REGEXP_REPLACE(vcstag, BOL || Token || Seperator || Token || Seperator || Anything, ReplaceToken2);
1916
                x_label   := REGEXP_REPLACE(vcstag, BOL || Token || Seperator || Token || Seperator || Token, ReplaceToken3);
1924
                x_label   := REGEXP_REPLACE(vcstag, BOL || Token || Seperator || Token || Seperator || Token, ReplaceToken3);
Line 2947... Line 2955...
2947
       SELECT vc.vcs_type_id INTO ivcs_type_id FROM vcs_type vc WHERE UPPER(svcs_type) = UPPER(vc.tag);
2955
       SELECT vc.vcs_type_id INTO ivcs_type_id FROM vcs_type vc WHERE UPPER(svcs_type) = UPPER(vc.tag);
2948
     EXCEPTION
2956
     EXCEPTION
2949
       WHEN NO_DATA_FOUND THEN
2957
       WHEN NO_DATA_FOUND THEN
2950
         raise_application_error (-20000, 'Invalid vcs type: ' || '"' || svcs_type || '"' || ' for package version: ' || ipv_id || ', vcstag: ' || '"' || vcstag || '"');
2958
         raise_application_error (-20000, 'Invalid vcs type: ' || '"' || svcs_type || '"' || ' for package version: ' || ipv_id || ', vcstag: ' || '"' || vcstag || '"');
2951
       --RAISE;
2959
       --RAISE;
2952
     END;      
2960
     END;
2953
 
2961
 
2954
     -- If Clearcase           
2962
     -- If Clearcase
2955
     IF (ivcs_type_id = 2) THEN
2963
     IF (ivcs_type_id = 2) THEN
2956
       -- Validate source path
2964
       -- Validate source path
2957
       IF NOT REGEXP_LIKE(ssrc_path,'^(\\|\/)[a-z]+[0-9a-z_\.\-\\\/ -]*$','i') THEN
2965
       IF NOT REGEXP_LIKE(ssrc_path,'^(\\|\/)[a-z]+[0-9a-z_\.\-\\\/ -]*$','i') THEN
2958
         raise_application_error (-20000, 'Invalid CC src path: ' || '"' || ssrc_path || '"' || ' for package version: ' || ipv_id || ', vcstag: ' || '"' || vcstag || '"');
2966
         raise_application_error (-20000, 'Invalid CC src path: ' || '"' || ssrc_path || '"' || ' for package version: ' || ipv_id || ', vcstag: ' || '"' || vcstag || '"');
2959
       END IF;
2967
       END IF;
2960
     
2968
 
2961
       -- Validate label
2969
       -- Validate label
2962
       -- For clearcase the label must be specified. For subversion it is not required.
2970
       -- For clearcase the label must be specified. For subversion it is not required.
2963
       IF NOT REGEXP_LIKE(spkg_label,'^[0-9a-z_\.\-]+$','i') THEN
2971
       IF NOT REGEXP_LIKE(spkg_label,'^[0-9a-z_\.\-]+$','i') THEN
2964
         raise_application_error (-20000, 'Invalid CC label:' || '"' || spkg_label || '"' || ' for package version:' || ipv_id || ', vcstag:' || '"' || vcstag || '"');
2972
         raise_application_error (-20000, 'Invalid CC label:' || '"' || spkg_label || '"' || ' for package version:' || ipv_id || ', vcstag:' || '"' || vcstag || '"');
2965
       END IF;
2973
       END IF;
Line 3003... Line 3011...
3003
       END IF;
3011
       END IF;
3004
 
3012
 
3005
       IF vcount > 1  THEN
3013
       IF vcount > 1  THEN
3006
         raise_application_error (-20000, 'Combined use of /trunk, /tags, or /branches/. Invalid SVN src path: ' || '"' || ssrc_path || '"' || ' for package version: ' || ipv_id || ', vcstag: ' || '"' || vcstag || '"');
3014
         raise_application_error (-20000, 'Combined use of /trunk, /tags, or /branches/. Invalid SVN src path: ' || '"' || ssrc_path || '"' || ' for package version: ' || ipv_id || ', vcstag: ' || '"' || vcstag || '"');
3007
       END IF;
3015
       END IF;
3008
       
3016
 
3009
       
3017
 
3010
     END IF;
3018
     END IF;
3011
 
3019
 
3012
     BEGIN
3020
     BEGIN
3013
       -- Get current vcs tag for specified package version
3021
       -- Get current vcs tag for specified package version
3014
       SELECT pv.src_path, pv.pkg_label, vc.tag as vcs_type
3022
       SELECT pv.src_path, pv.pkg_label, vc.tag as vcs_type
Line 3018... Line 3026...
3018
       AND pv.vcs_type_id = vc.vcs_type_id (+);
3026
       AND pv.vcs_type_id = vc.vcs_type_id (+);
3019
 
3027
 
3020
     EXCEPTION
3028
     EXCEPTION
3021
       WHEN NO_DATA_FOUND THEN
3029
       WHEN NO_DATA_FOUND THEN
3022
         raise_application_error (-20000, 'Package version not found: ' || ipv_id);
3030
         raise_application_error (-20000, 'Package version not found: ' || ipv_id);
3023
     END;      
3031
     END;
3024
 
3032
 
3025
     old_pkg_vcstag:= old_vcs_type || '::' || old_src_path;
3033
     old_pkg_vcstag:= old_vcs_type || '::' || old_src_path;
3026
     IF (old_pkg_label IS NOT NULL) THEN
3034
     IF (old_pkg_label IS NOT NULL) THEN
3027
       old_pkg_vcstag:=old_pkg_vcstag || '::' || old_pkg_label;
3035
       old_pkg_vcstag:=old_pkg_vcstag || '::' || old_pkg_label;
3028
     END IF;
3036
     END IF;
Line 3045... Line 3053...
3045
     -- Store action in action log so that we can back track and also restore vcs settings if required.
3053
     -- Store action in action log so that we can back track and also restore vcs settings if required.
3046
     log_action (ipv_id,'VcsConversion',user_id,saction_desc);
3054
     log_action (ipv_id,'VcsConversion',user_id,saction_desc);
3047
 
3055
 
3048
   END update_vcs_details;
3056
   END update_vcs_details;
3049
 
3057
 
-
 
3058
/*-------------------------------------------------------------------------------------------------------
3050
END pk_rmapi;
3059
Name:        isSVN
-
 
3060
Description: Determine if any of the packages versions are controlled under SVN
-
 
3061
			 Intended to be used to prevent users from releasing a package
-
 
3062
			 that has been migrated to SVN
-
 
3063
 
-
 
3064
Paramters:	pkgid:     Package ID
-
 
3065
 
-
 
3066
Returns:	Number of versions under SVN version control
-
 
3067
*/
-
 
3068
   
-
 
3069
FUNCTION isSVN( pkgid IN NUMBER )
-
 
3070
    RETURN NUMBER
-
 
3071
    IS
-
 
3072
    svncount   NUMBER  := 0;
-
 
3073
   BEGIN
-
 
3074
        SELECT COUNT(*) INTO svncount FROM PACKAGE_VERSIONS pv WHERE pv.PKG_ID = pkgid AND pv.VCS_TYPE_ID = 23;
-
 
3075
        RETURN (svncount);
-
 
3076
   END;
-
 
3077
 
-
 
3078
/*-------------------------------------------------------------------------------------------------------
-
 
3079
Name:        isSVNbyName
-
 
3080
Description: Determine if any of the packages versions are controlled under SVN
-
 
3081
			 Intended to be used to prevent users from releasing a package
-
 
3082
			 that has been migrated to SVN
-
 
3083
 
-
 
3084
Paramters:	pkgname:	Package Name
-
 
3085
 
-
 
3086
Returns:	Number of versions under SVN version control
-
 
3087
*/
-
 
3088
 
-
 
3089
FUNCTION isSVNbyName( pkgname IN VARCHAR2 )
-
 
3090
    RETURN NUMBER
-
 
3091
IS
-
 
3092
   svncount   NUMBER  := 0;
-
 
3093
   BEGIN
-
 
3094
        SELECT COUNT(*) INTO svncount FROM PACKAGE_VERSIONS pv, PACKAGES pkg WHERE pkg.pkg_name = pkgname AND pv.PKG_ID = pkg.pkg_id AND pv.VCS_TYPE_ID = 23;
-
 
3095
        RETURN (svncount);
-
 
3096
   END;
-
 
3097
   
-
 
3098
   END;
3051
/
3099
/
3052
--------------------------------------------------------
3100
--------------------------------------------------------
3053
--  DDL for Package Body PK_BUILDAPI
3101
--  DDL for Package Body PK_BUILDAPI
3054
--------------------------------------------------------
3102
--------------------------------------------------------
3055
 
3103