Subversion Repositories DevTools

Rev

Rev 129 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 129 Rev 151
Line 506... Line 506...
506
'   NN_pv_id_list   A list of PV_IDs representing pending items to be approved for release or merge.
506
'   NN_pv_id_list   A list of PV_IDs representing pending items to be approved for release or merge.
507
'
507
'
508
Sub PUBLIC_MakeBulkRelease (NNrtag_id, NN_pv_id_list)
508
Sub PUBLIC_MakeBulkRelease (NNrtag_id, NN_pv_id_list)
509
   Dim initialList         ' holds all items
509
   Dim initialList         ' holds all items
510
   Dim remainingList1()    ' To hold additive merge items
510
   Dim remainingList1()    ' To hold additive merge items
-
 
511
   Dim remainingList2()    ' To hold auto/manual build items that need to be validated before processing
511
   Dim remainingList2()    ' To hold auto/manual build items
512
   Dim remainingList3()    ' To hold auto/manual build items that can be processed
-
 
513
   Dim remainingList4()    ' To hold auto/manual build items that cannot be processed due to validation failures
-
 
514
   Dim len_remainingList1
-
 
515
   Dim len_remainingList2
-
 
516
   Dim len_remainingList3
512
   Dim len_remainingList
517
   Dim len_remainingList4
513
   Dim pvId
518
   Dim pvId
514
   Dim retParameters
519
   Dim retParameters
515
   Dim allowedToApproveMerge
520
   Dim allowedToApproveMerge
516
 
521
 
517
   ' determine in advance if user is allowed to approve merges
522
   ' determine in advance if user is allowed to approve merges
518
   allowedToApproveMerge = PRIVATE_Is_Allowed_To_Approve_Merge(NNrtag_id)
523
   allowedToApproveMerge = PRIVATE_Is_Allowed_To_Approve_Merge(NNrtag_id)
519
 
524
 
520
   ' ready the remaining list index to extract additive merges and manual/auto build items
525
   ' ready the remaining list index to extract additive merges and manual/auto build items
521
   len_remainingList = 0
526
   len_remainingList1 = 0
522
 
527
 
523
   AutoBuildPermissionDenied   = FALSE
528
   AutoBuildPermissionDenied   = FALSE
524
   ManualBuildPermissionDenied = FALSE
529
   ManualBuildPermissionDenied = FALSE
525
 
530
 
526
   ' Remove any spaces and split the pv_id list into a string array
531
   ' Remove any spaces and split the pv_id list into a string array
Line 538... Line 543...
538
               AutoBuildPermissionDenied   = TRUE
543
               AutoBuildPermissionDenied   = TRUE
539
               ManualBuildPermissionDenied = TRUE
544
               ManualBuildPermissionDenied = TRUE
540
            End If
545
            End If
541
         Else
546
         Else
542
            ' add item to the remaining list for the next loop to process
547
            ' add item to the remaining list for the next loop to process
543
            len_remainingList = len_remainingList + 1
548
            len_remainingList1 = len_remainingList1 + 1
544
            ReDim Preserve remainingList1(len_remainingList)
549
            ReDim Preserve remainingList1(len_remainingList1)
545
            remainingList1(len_remainingList - 1) = pvId
550
            remainingList1(len_remainingList1 - 1) = pvId
546
         End If
551
         End If
547
      End If
552
      End If
548
   Next
553
   Next
549
 
554
 
550
   ' ready the remaining list index to extract manual/auto build items
555
   ' ready the remaining list index to extract manual/auto build items
551
   len_remainingList = 0
556
   len_remainingList2 = 0
552
 
557
 
553
   ' Now process each additive merge item in the string array
558
   ' Now process each additive merge item in the string array
554
   ' We do these before finally processing any auto/manual build items so that the latter take precedence in their eventual
559
   ' We do these before finally processing any auto/manual build items so that the latter take precedence in their eventual
555
   ' effect upon the release.
560
   ' effect upon the release.
556
   For Each pvId In remainingList1
561
   For Each pvId In remainingList1
Line 562... Line 567...
562
            AutoBuildPermissionDenied   = TRUE
567
            AutoBuildPermissionDenied   = TRUE
563
            ManualBuildPermissionDenied = TRUE
568
            ManualBuildPermissionDenied = TRUE
564
         End If
569
         End If
565
      Else
570
      Else
566
         ' add item to the remaining list for the next loop to process
571
         ' add item to the remaining list for the next loop to process
567
         len_remainingList = len_remainingList + 1
572
         len_remainingList2 = len_remainingList2 + 1
568
         ReDim Preserve remainingList2(len_remainingList)
573
         ReDim Preserve remainingList2(len_remainingList2)
569
         remainingList2(len_remainingList - 1) = pvId
574
         remainingList2(len_remainingList2 - 1) = pvId
570
      End If
575
      End If
571
   Next
576
   Next
572
 
577
 
573
   ' Now process each new Auto/Manaul build item in the string array
578
   ' ready the remaining list index to extract manual/auto build items
574
   RaiseWIPExists = FALSE
579
   len_remainingList3 = 0
-
 
580
   len_remainingList4 = 0
-
 
581
 
-
 
582
   ' We cannot bulk release multiple WIPS of the same pkg_id because the modified_stamp in the package versions
-
 
583
   ' table for each one will become identical upon doing so (since they are simultaneously being bulk released)
-
 
584
   ' and the build daemon will therefore not necessarily build them in the order the user needs them to be built in.
-
 
585
   ' This is especially the case with multiple WIPS for packages that are in fact database patches.
-
 
586
   ' We have to bust out those pv_ids from the ones we can bulk release, and tell the user about them afterwards,
-
 
587
   ' basically forcing the user to approve them one by one.
-
 
588
   ' We use a few dictionaries to bust apart the pv_id's
-
 
589
 
-
 
590
   Dim pkgIdsAndCounts
-
 
591
   Dim pkgIdsAndPvIds
-
 
592
   Dim pkgId
-
 
593
 
-
 
594
   Set pkgIdsAndCounts = Server.CreateObject("Scripting.Dictionary")
-
 
595
   Set pkgIdsAndPvIds = Server.CreateObject("Scripting.Dictionary")
-
 
596
 
-
 
597
   ' Count instances of pkg_id's and for each pkg_id, create a list of pv_id's, using the dictionaries declared earlier
575
   For Each pvId In remainingList2
598
   For Each pvId In remainingList2
-
 
599
      If ( NNrtag_id <> "") AND (pvId <> "") Then
-
 
600
         pkgId = Get_Pkg_Id_For_Pv_Id(pvId)
-
 
601
         If pkgIdsAndCounts.Exists(pkgId) Then
-
 
602
            pkgIdsAndCounts.Item(pkgId) = CStr(CInt(pkgIdsAndCounts.Item(pkgId)) + 1)
-
 
603
            pkgIdsAndPvIds.Item(pkgId) = pkgIdsAndPvIds.Item(pkgId) & "," & pvId
-
 
604
         Else
-
 
605
            pkgIdsAndCounts.Add pkgId, "1"
-
 
606
            pkgIdsAndPvIds.Add pkgId, pvId
-
 
607
         End If
-
 
608
      End If
-
 
609
   Next
-
 
610
 
-
 
611
   ' Now use the pkg_id counts to distinguish between the pv_id's we can proceed with and those we cannot.
-
 
612
   ' The ones we can proceed with are accumulated into remainingList3, and the ones we cannot are
-
 
613
   ' accumulated into remainingList4
-
 
614
   Dim i,a
-
 
615
   a = pkgIdsAndCounts.Keys
-
 
616
   For i=0 to pkgIdsAndCounts.Count-1
-
 
617
      If pkgIdsAndCounts.Item(a(i)) = "1" Then
-
 
618
         len_remainingList3 = len_remainingList3 + 1
-
 
619
         ReDim Preserve remainingList3(len_remainingList3)
-
 
620
         remainingList3(len_remainingList3 - 1) = pkgIdsAndPvIds.Item(a(i))
-
 
621
      Else
-
 
622
         len_remainingList4 = len_remainingList4 + 1
-
 
623
         ReDim Preserve remainingList4(len_remainingList4)
-
 
624
         remainingList4(len_remainingList4 - 1) = pkgIdsAndPvIds.Item(a(i))
-
 
625
      End If
-
 
626
   Next
-
 
627
 
-
 
628
   ' free dictionaries
-
 
629
   Set pkgIdsAndCounts = nothing
-
 
630
   Set pkgIdsAndPvIds = nothing
-
 
631
 
-
 
632
   ' Now process each new and valid Auto/Manaul build item in the string array
-
 
633
   RaiseWIPExists = FALSE
-
 
634
   For Each pvId In remainingList3
576
      Call PUBLIC_ApproveRelease(NNrtag_id, pvId, retParameters, TRUE)
635
      Call PUBLIC_ApproveRelease(NNrtag_id, pvId, retParameters, TRUE)
577
   Next
636
   Next
578
   If ( RaiseWIPExists = TRUE ) Then
637
   If ( RaiseWIPExists = TRUE ) Then
579
     Call RaiseMsg ( enum_MSG_PACKAGE_WIP_EXISTS&"?rtag_id="& NNrtag_id & "&pv_id="& pvId & "", pvId )
638
     Call RaiseMsg ( enum_MSG_PACKAGE_WIP_EXISTS & "?rtag_id="& request("rtag_id") & "&pv_id="& request("pv_id") & "", "" )
580
     ' RaiseMsg redirects loaded web page, so no return
639
     ' RaiseMsg redirects loaded web page, so no return
581
   End If
640
   End If
582
 
641
 
-
 
642
   ' Issue a warning for when some items could not be bulk released due to having the same package ID's
-
 
643
   If len_remainingList4 > 0 Then
-
 
644
      Call RaiseMsg ( enum_MSG_PACKAGE_WIP_EXISTS_BULK_RELEASE & "?rtag_id="& request("rtag_id") & "&pv_id="& request("pv_id") & "", "" )
-
 
645
   End If
583
 
646
 
584
   ' If any items were not approved for release due to permission errors, issue an alert to the user
647
   ' If any items were not approved for release due to permission errors, issue an alert to the user
585
   If AutoBuildPermissionDenied = TRUE OR ManualBuildPermissionDenied = TRUE Then
648
   If AutoBuildPermissionDenied = TRUE OR ManualBuildPermissionDenied = TRUE Then
586
      Call RaiseMsg( enum_MSG_ERROR, "One of more items could not be approved due to missing permissions (either ApproveForAutoBuild or ApproveForManualBuild).<p>"_
649
      Call RaiseMsg( enum_MSG_PERMISSION_PROBLEMS_BULK_RELEASE & "?rtag_id="& request("rtag_id") & "&pv_id="& request("pv_id") & "", "" )
587
                                   & "NOTE : All items that could be approved, have been.</p>" )
-
 
588
   End If
650
   End If
589
 
651
 
590
End Sub
652
End Sub
591
'-----------------------------------------------------------------------------------------------------------------------------
653
'-----------------------------------------------------------------------------------------------------------------------------
592
 
654
 
593
 
655
 
594
 
-
 
595
 
-
 
596
%>
656
%>