Subversion Repositories DevTools

Rev

Rev 6705 | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
119 ghuddy 1
<%@LANGUAGE="VBSCRIPT"%>
2
<%
3
'=====================================================
6176 dpurdie 4
'   _make_rejected.asp
5
'   Reject a package from pending back to a WIP
6
'       Used to Reject a failed build
7
'       Used to Reject before being built    
119 ghuddy 8
'=====================================================
9
%>
10
<%
11
Option explicit
12
' Good idea to set when using redirect
129 ghuddy 13
Response.Expires = 0   ' always load the page, dont store
119 ghuddy 14
%>
15
 
16
<!--#include file="common/conf.asp"-->
17
<!--#include file="common/globals.asp"-->
18
<!--#include file="common/formating.asp"-->
19
<!--#include file="common/qstr.asp"-->
20
<!--#include file="common/common_subs.asp"-->
21
<!--#include file="common/common_dbedit.asp"-->
22
<%
23
'------------ ACCESS CONTROL ------------------
24
%>
25
<!--#include file="_access_control_login.asp"-->
26
<!--#include file="_access_control_general.asp"-->
27
<!--#include file="_access_control_project.asp"-->
28
<%
29
'------------ Variable Definition -------------
143 ghuddy 30
Dim isDLocked
119 ghuddy 31
'------------ Constants Declaration -----------
32
'------------ Variable Init -------------------
33
'----------------------------------------------
34
%>
35
<%
36
Sub MakeReject ()
129 ghuddy 37
 
38
   objEH.TryORA ( OraSession )
39
   On Error Resume Next
40
 
143 ghuddy 41
   OraDatabase.Parameters.Add "PV_ID",   Request("pv_id"),        ORAPARM_INPUT, ORATYPE_NUMBER
42
   OraDatabase.Parameters.Add "RTAG_ID", Request("rtag_id"),      ORAPARM_INPUT, ORATYPE_NUMBER
43
   OraDatabase.Parameters.Add "USER_ID", objAccessControl.UserId, ORAPARM_INPUT, ORATYPE_NUMBER
129 ghuddy 44
 
45
   OraDatabase.ExecuteSQL _
46
   "BEGIN "&_
47
   " PK_ENVIRONMENT.MAKE_REJECT ( :PV_ID, :RTAG_ID, :USER_ID ); "&_
48
   "END; "
49
 
50
   objEH.CatchORA ( OraSession )
51
 
52
   OraDatabase.Parameters.Remove "PV_ID"
53
   OraDatabase.Parameters.Remove "RTAG_ID"
54
   OraDatabase.Parameters.Remove "USER_ID"
55
 
119 ghuddy 56
End Sub
143 ghuddy 57
 
58
Sub RejectAutobuild()
59
 
60
   OraDatabase.Parameters.Add "PV_ID",            Request("pv_id"),        ORAPARM_INPUT, ORATYPE_NUMBER
61
   OraDatabase.Parameters.Add "RTAG_ID",          Request("rtag_id"),      ORAPARM_INPUT, ORATYPE_NUMBER
62
   OraDatabase.Parameters.Add "USER_ID",          objAccessControl.UserId, ORAPARM_INPUT, ORATYPE_NUMBER
63
   OraDatabase.Parameters.Add "ACTION_TYPE_NAME", "reject_package",        ORAPARM_INPUT, ORATYPE_VARCHAR2
64
   OraDatabase.Parameters.Add "DESCRIPTION",      "Rejected manually following autobuild failure", ORAPARM_INPUT, ORATYPE_VARCHAR2
65
 
66
   On Error Resume Next
67
   objEH.TryORA( OraSession )
68
 
69
   ' Move package back to work-in-progress table (changes dlocked to "R" in doing so)
6705 dpurdie 70
   OraDatabase.ExecuteSQL ("BEGIN PK_ENVIRONMENT.MAKE_REJECT ( :PV_ID, :RTAG_ID, :USER_ID ); END; ")
143 ghuddy 71
 
72
   If Err.Number = 0 Then
73
 
74
      ' Remove the entry from the do not ripple table but only if it is a direct exlusion entry caused by some build problem.
75
      ' This way, if user has deliberately excluded the package from the build (root_pv_id is null, root_cause is null
76
      ' and root_file is null) then it will remain exlcuded, as it will if there is some underlying package that has caused
77
      ' the exclusion.
6705 dpurdie 78
      Dim count : count = 0
79
      count = OraDatabase.ExecuteSQL ("DELETE FROM do_not_ripple " &_
80
                                      "WHERE pv_id   = :PV_ID " &_
81
                                      "  AND rtag_id = :RTAG_ID " &_
82
                                      "  AND nvl(root_pv_id,-1) < 0" &_
83
                                      "  AND ((root_cause IS NOT NULL) OR (root_file IS NOT NULL))" )
143 ghuddy 84
 
6705 dpurdie 85
        If Err.Number = 0 Then
86
            OraDatabase.ExecuteSQL ("BEGIN Log_Action ( :PV_ID, :ACTION_TYPE_NAME, :USER_ID, :DESCRIPTION ); END;")
143 ghuddy 87
 
6705 dpurdie 88
            '
89
            ' If we have removed a package from the do_not_ripple list, then we need to increment the release sequence
90
            ' number so that the build system will come and re-plan the build.
91
            '
92
            If count > 0 Then
93
                OraDatabase.ExecuteSQL ("BEGIN PK_RELEASE.SET_RELEASE_MODIFIED(:RTAG_ID); END; ")
94
            End If
95
        End If
143 ghuddy 96
   End If
97
 
98
   objEH.CatchORA( OraSession )
99
 
100
   OraDatabase.Parameters.Remove "PV_ID"
101
   OraDatabase.Parameters.Remove "RTAG_ID"
102
   OraDatabase.Parameters.Remove "USER_ID"
103
   OraDatabase.Parameters.Remove "ACTION_TYPE_NAME"
104
   OraDatabase.Parameters.Remove "DESCRIPTION"
105
 
106
End Sub
107
 
119 ghuddy 108
%>
109
<%
110
'-----------------------  MAIN LINE  ---------------------------
111
 
143 ghuddy 112
'--- Process submit ---
119 ghuddy 113
If (Request("rtag_id") <> "") AND (Request("pv_id") <> "")  Then
129 ghuddy 114
 
115
 
143 ghuddy 116
   Call Get_Pkg_Short_Info( Request("pv_id"), NULL, NULL, NULL, NULL, NULL, isDLocked )
129 ghuddy 117
 
143 ghuddy 118
   If isDLocked = "A" Then
119
      'Do the reject operation - this execution path rejects an Approved package version back to Pending
120
 
121
      'We can only do this operation if the build daemon is not going to be doing anything with the entry in
6176 dpurdie 122
      'the "package versions" table. We can only guarantee this 
123
      '     if the Daemon has failed to build the package version and placed an entry for it in the "do not ripple" table
124
      '     OR the release has no active build daemons
7022 dpurdie 125
      '
126
      ' Note: Must match code in _pkg_action_buttons.asp
127
      '
128
      If activeDaemonCount(parRtag_id) = 0 OR isInDoNotRippleTable( Request("rtag_id"), Request("pv_id") ) = TRUE OR hasFutureBuild( Request("rtag_id"), Request("pv_id")) Then
143 ghuddy 129
         Call RejectAutobuild()
130
      Else
131
         Call RaiseMsg(enum_MSG_ERROR, "Cannot reject unless item is certain not to be examined concurrently by a build daemon during the reject operation. Wait for the build to fail.")
132
      End If
133
   Else
134
      'Do the reject operation - this execution path rejects a Pending package version back to Work In Progress
135
      Call MakeReject()
136
   End If
137
 
5957 dpurdie 138
   Call Destroy_All_Objects
6705 dpurdie 139
   Response.Redirect ( RequestDefault("rfile", "dependencies.asp") &"?pv_id="& Request("pv_id") &"&rtag_id="& Request("rtag_id") )
129 ghuddy 140
 
119 ghuddy 141
Else
1376 dpurdie 142
   Response.write "Some mandatory parameters are missing!" & "<br>" 'TODO
4955 dpurdie 143
   Response.write QSTR_FullQuery
119 ghuddy 144
End If
145
%>
146
<!-- DESTRUCTOR ------->
129 ghuddy 147
<!--#include file="common/destructor.asp"-->