11
11
from rest_framework .views import APIView
12
12
from rest_framework .response import Response
13
13
from django .http import Http404
14
+ from datetime import datetime
14
15
15
16
from .serializers import BuildHistSerializer
16
17
from .models import BuildHist
@@ -26,34 +27,47 @@ def check_model(request) :
26
27
content = jsonObject .get ('content' )
27
28
scontent = sorted (set (content .split ()))
28
29
29
- command = os .environ .get ("SVN_ADDRESS" ) + content + '\" '
30
- print (command )
31
- output = subprocess .check_output (command , shell = True , text = True )
32
-
33
- # 결과 파싱하여 계정, 날짜, 커밋로그 저장
34
- commits = []
35
- lines = output .split ('------------------------------------------------------------------------' )
36
-
37
- accounts = []
38
- dates = []
39
- commit_logs = []
40
-
41
- for i in range (1 , len (lines )- 1 ):
42
- line = lines [i ].split (" | " )
43
- account = line [1 ].strip ()
44
- date = line [2 ].strip ()
45
- commit_log = line [- 1 ].strip ()
46
- accounts .append (account )
47
- dates .append (date )
48
- commit_logs .append (commit_log )
49
-
50
- print ("Accounts:" , accounts )
51
- print ("Dates:" , dates )
52
- print ("Commit Logs:" , commit_logs )
53
-
54
- context = {'account' : accounts , 'dates' : dates , 'commitLogs' : commit_logs }
30
+ all_contexts = []
31
+
32
+ for i in range (0 ,len (scontent )):
33
+ app = scontent [i ][- 2 :]
34
+ comp = scontent [i ].split ("_" )[0 ]
35
+ package = scontent [i ].split ("_" )[1 ]
36
+ contentUrl = ''
37
+ if app == "xp" :
38
+ contentUrl = f'xpapps/{ comp } /{ package } '
39
+ else :
40
+ contentUrl = f'components/{ comp } /{ package } '
41
+
42
+ command = os .environ .get ("SVN_ADDRESS" ) + contentUrl + '\" '
43
+ print (command )
44
+ output = subprocess .check_output (command , shell = True , text = True )
45
+
46
+ # 결과 파싱하여 계정, 날짜, 커밋로그 저장
47
+ commits = []
48
+ lines = output .split ('------------------------------------------------------------------------' )
49
+
50
+ accounts = []
51
+ dates = []
52
+ commit_logs = []
53
+
54
+ for j in range (1 , len (lines )- 1 ):
55
+ line = lines [j ].split (" | " )
56
+ account = line [1 ].strip ()
57
+ date = line [2 ].strip ()
58
+ commit_log = line [- 1 ].strip ()
59
+ accounts .append (account )
60
+ dates .append (date )
61
+ commit_logs .append (commit_log )
62
+
63
+ print ("Accounts:" , accounts )
64
+ print ("Dates:" , dates )
65
+ print ("Commit Logs:" , commit_logs )
66
+
67
+ context = {'account' : accounts , 'dates' : dates , 'commitLogs' : commit_logs }
68
+ all_contexts .append ({'context' : context , 'package' : package })
55
69
56
- return JsonResponse (context )
70
+ return JsonResponse (all_contexts , safe = False )
57
71
58
72
def request_build (request ):
59
73
jsonObject = json .loads (request .body )
0 commit comments