aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--meta-cgl-common/classes/cgl-calc.bbclass21
-rw-r--r--meta-cgl-common/recipes-cgl/corosync/corosync_1.4.7.bb7
-rwxr-xr-xmeta-cgl-common/recipes-cgl/pacemaker/pacemaker_1.1.13.bb7
-rwxr-xr-xscripts/script.py117
4 files changed, 150 insertions, 2 deletions
diff --git a/meta-cgl-common/classes/cgl-calc.bbclass b/meta-cgl-common/classes/cgl-calc.bbclass
new file mode 100644
index 0000000..81660d6
--- /dev/null
+++ b/meta-cgl-common/classes/cgl-calc.bbclass
@@ -0,0 +1,21 @@
+
+do_cgl_calc() {
+ NO_COMPLY="NO"
+ if [ -z "${CGL_ID}" ]; then
+ echo "${NO_COMPLY}" > calculator.txt
+ else
+ echo "${CGL_ID}" > calculator.txt
+ fi
+ if [ -z "${PRIORITY}" ]; then
+ echo "${NO_COMPLY}" >> calculator.txt
+ else
+ echo "${PRIORITY}" >> calculator.txt
+ fi
+ if [ -z "${DISCLOSURE}" ]; then
+ echo "${NO_COMPLY}" >> calculator.txt
+ else
+ echo "${DISCLOSURE}" >> calculator.txt
+ fi
+}
+
+addtask cgl_calc after do_fetch before do_build
diff --git a/meta-cgl-common/recipes-cgl/corosync/corosync_1.4.7.bb b/meta-cgl-common/recipes-cgl/corosync/corosync_1.4.7.bb
index 019a2f4..98b75e6 100644
--- a/meta-cgl-common/recipes-cgl/corosync/corosync_1.4.7.bb
+++ b/meta-cgl-common/recipes-cgl/corosync/corosync_1.4.7.bb
@@ -4,7 +4,7 @@ several default APIs and libraries, default configuration files, and an init \
script."
HOMEPAGE = "http://corosync.github.io/corosync/"
-inherit autotools pkgconfig update-rc.d useradd
+inherit autotools pkgconfig update-rc.d useradd cgl-calc
SRC_URI = "http://build.clusterlabs.org/corosync/releases/${BPN}-${PV}.tar.gz \
file://groff-desc-path.patch \
@@ -58,3 +58,8 @@ USERADD_PACKAGES = "${PN}"
GROUPADD_PARAM_${PN} = "haclient"
USERADD_PARAM_${PN} = "-M --home ${localstatedir}/lib/heartbeat -g haclient hacluster"
+CGL_ID="CFH.2.0,CCM.2.2"
+PRIORITY="P1,P1"
+DISCLOSURE="${PN},${PN}"
+
+
diff --git a/meta-cgl-common/recipes-cgl/pacemaker/pacemaker_1.1.13.bb b/meta-cgl-common/recipes-cgl/pacemaker/pacemaker_1.1.13.bb
index d2e2395..84c8c84 100755
--- a/meta-cgl-common/recipes-cgl/pacemaker/pacemaker_1.1.13.bb
+++ b/meta-cgl-common/recipes-cgl/pacemaker/pacemaker_1.1.13.bb
@@ -26,7 +26,7 @@ SRC_URI = "https://github.com/ClusterLabs/${PN}/archive/Pacemaker-${PV}.zip \
SRC_URI[md5sum] = "d84a5173306727a981a4f87e36007595"
SRC_URI[sha256sum] = "e963bc59a5d98a3e3441ea5cccb42aa67f9d7934b80c8818e19ae91c5da48331"
-inherit autotools-brokensep pkgconfig systemd python-dir useradd
+inherit autotools-brokensep pkgconfig systemd python-dir useradd cgl-calc
S="${WORKDIR}/pacemaker-Pacemaker-${PV}"
@@ -90,3 +90,8 @@ SYSTEMD_SERVICE_${PN}-remote += "pacemaker_remote.service"
USERADD_PACKAGES = "${PN}"
USERADD_PARAM_${PN} = "-r -g haclient -s ${base_sbindir}/nologin hacluster"
GROUPADD_PARAM_${PN} = "-r haclient"
+
+CGL_ID="AVL.25.0,CAF.2.1,CAF.2.2"
+PRIORITY="P1,P1,P1"
+DISCLOSURE="${PN},${PN},${PN}"
+
diff --git a/scripts/script.py b/scripts/script.py
new file mode 100755
index 0000000..e033fa4
--- /dev/null
+++ b/scripts/script.py
@@ -0,0 +1,117 @@
+#!/usr/bin/python
+
+import os, sys
+
+# The value represents the total number of P! requirements available
+# inside the CGL 5.0 template
+p1_reqs = 113
+files_no = 0
+cnt = 0
+nr = 0
+
+def compliance_calc(reqs_len):
+ number_p1=0;
+ for i in range(0,reqs_len):
+ number_p1=number_p1+1
+ procent=float(number_p1)/p1_reqs*100.
+ print "CGL compliance: %.2f%%" % procent
+
+build_dir = os.environ.get('BUILDDIR')
+if not build_dir:
+ print "Source the build environment before executing this script!"
+ sys.exit(1)
+director = build_dir + "/tmp/work"
+
+def populate_compl(content, files):
+ temp = content.split('\n')
+ global cnt
+
+ for j in range(0, len(temp[0].split(",")) ):
+ ID[cnt] = temp[0].split(",")[j]
+ P[cnt] = temp[1].split(",")[j]
+ D[cnt] = temp[2].split(",")[j]
+
+ if ID[cnt].split('.')[0] == "AVL":
+ shadow[cnt]=1
+ if ID[cnt].split('.')[0] == "CFH":
+ shadow[cnt]=2
+ if ID[cnt].split('.')[0] == "CSM":
+ shadow[cnt]=3
+ if ID[cnt].split('.')[0] == "CCM":
+ shadow[cnt]=4
+ if ID[cnt].split('.')[0] == "CAF":
+ shadow[cnt]=5
+ if ID[cnt].split('.')[0] == "CDIAG":
+ shadow[cnt]=6
+ if ID[cnt].split('.')[0] == "SMM":
+ shadow[cnt]=7
+ if ID[cnt].split('.')[0] == "SPM":
+ shadow[cnt]=8
+ if ID[cnt].split('.')[0] == "SFA":
+ shadow[cnt]=9
+ if ID[cnt].split('.')[0] == "PRF":
+ shadow[cnt]=10
+ if ID[cnt].split('.')[0] == "STD":
+ shadow[cnt]=12
+ if ID[cnt].split('.')[0] == "SEC":
+ shadow[cnt]=13
+ if ID[cnt].split('.')[0] == "PMS":
+ shadow[cnt]=14
+ cnt=cnt+1
+
+def sort_reqs():
+ for i in range(0, nr-1):
+ for j in range(i+1, nr):
+ if shadow[i] > shadow[j]:
+ aux=shadow[i]
+ shadow[i]=shadow[j]
+ shadow[j]=aux
+ aux=ID[i]
+ ID[i]=ID[j]
+ ID[j]=aux
+ aux=P[i]
+ P[i]=P[j]
+ P[j]=aux
+ aux=D[i]
+ D[i]=D[j]
+ D[j]=aux;
+ else:
+ if shadow[i]==shadow[j]:
+ if ID[i]>ID[j]:
+ aux=shadow[i]
+ shadow[i]=shadow[j]
+ shadow[j]=aux
+ aux=ID[i]
+ ID[i]=ID[j]
+ ID[j]=aux
+ aux=P[i]
+ P[i]=P[j]
+ P[j]=aux
+ aux=D[i]
+ D[i]=D[j]
+ D[j]=aux
+
+for root, dirs, files in os.walk(director):
+ for file in files:
+ if file == "calculator.txt" :
+ files_no = files_no + 1
+
+ f = open(os.path.join(root, file))
+ temp = f.read().split('\n')
+ nr=nr+len(temp[1].split(","))
+
+ID = [None] * nr
+P = [None] * nr
+D = [None] * nr
+shadow = [0] * nr
+
+for root, dirs, files in os.walk(director):
+ for file in files:
+ if file == "calculator.txt" :
+ f = open(os.path.join(root, file))
+ content=f.read()
+ populate_compl(content, files_no)
+ f.close()
+
+sort_reqs()
+compliance_calc(nr)