OpenSCAP/scap-security-guide — pull request #49 by iankko (2014-09-04 14:31:31+00:00)
Title: [bugfix] Start clearing the state of keeping multiple identical copies of the same transform script across the various products in the repository

There are multiple occurrences of keeping the identical / same copy of particular transform script in various products across the repository. This change focuses only on moving the following three of them:

transforms/cpe_generate.py
transforms/idtranslate.py
transforms/relabelids.py

from {RHEL/6, RHEL/7, OpenStack, RHEVM3}/transforms locations to shared/transforms location.

This is safe operation, because all of them are identical:
-----------------------------------------------------------------------
scap-security-guide]$ diff -s RHEL/6/transforms/cpe_generate.py RHEL/7/transforms/cpe_generate.py
Files RHEL/6/transforms/cpe_generate.py and RHEL/7/transforms/cpe_generate.py are identical

scap-security-guide]$ diff -s RHEL/7/transforms/cpe_generate.py OpenStack/transforms/cpe_generate.py
Files RHEL/7/transforms/cpe_generate.py and OpenStack/transforms/cpe_generate.py are identical

scap-security-guide]$ diff -s OpenStack/transforms/cpe_generate.py RHEVM3/transforms/cpe_generate.py
Files OpenStack/transforms/cpe_generate.py and RHEVM3/transforms/cpe_generate.py are identical

scap-security-guide]$ diff -s RHEL/6/transforms/idtranslate.py RHEL/7/transforms/idtranslate.py
Files RHEL/6/transforms/idtranslate.py and RHEL/7/transforms/idtranslate.py are identical

scap-security-guide]$ diff -s RHEL/7/transforms/idtranslate.py OpenStack/transforms/idtranslate.py
Files RHEL/7/transforms/idtranslate.py and OpenStack/transforms/idtranslate.py are identical

scap-security-guide]$ diff -s OpenStack/transforms/idtranslate.py RHEVM3/transforms/idtranslate.py
Files OpenStack/transforms/idtranslate.py and RHEVM3/transforms/idtranslate.py are identical

scap-security-guide]$ diff -s RHEL/6/transforms/relabelids.py RHEL/7/transforms/relabelids.py
Files RHEL/6/transforms/relabelids.py and RHEL/7/transforms/relabelids.py are identical

scap-security-guide]$ diff -s RHEL/7/transforms/relabelids.py OpenStack/transforms/relabelids.py
Files RHEL/7/transforms/relabelids.py and OpenStack/transforms/relabelids.py are identical

scap-security-guide]$ diff -s OpenStack/transforms/relabelids.py RHEVM3/transforms/relabelids.py
Files OpenStack/transforms/relabelids.py and RHEVM3/transforms/relabelids.py are identical

To keep multiple identical file / script copies at various places of the repository is bad practice, since in case of a need for modification of particular file it needs to be modified at multiple places (obviously forgetting to do so somewhere would mean the issue isn't fixed).

Two notes yet:
* This is just start - more similar pull requests (involving different files) might come in the future, but would like to make it gradually (& check everything by each change) not to break something,
* I am aware the idtranslate.py & relabelids.py scripts from Fedora are identical with the shared version too,
but cpe_generate.py slightly differs for now (there's sanity oval_variables check). Since to my knowledge
Fedora content doesn't contain OVAL check definition utilizing some OVAL variable this check is necessary (=> cpe_generate.py can't be unified). The other two scripts can't be unified, because cpe_generate.py depends on idtranslate.py & relabelids.py also uses idtranslate.py (so can't split them for now). Long story short -- will in the soon future submit Fedora OVAL check utilizing OVAL variable, so cpe_generate.py can be merged (and in that moment merge / unify the other two Fedora scripts too).

Testing result - performing the testing as follows:

RHEL/6 $ make / make content / make content-stig
RHEL/7 $ make / make content / make content-stig
RHEVM3 $ make / make content / make content-stig
OpenStack $ make / make content / make content-stig
scap-security-guide $ make / make validate / make rpm / make fedora-rpm

All of the above referenced checks PASSed (there isn't a difference between the actual and proposed / the new behaviour once those three transform scripts moved to shared/ directory).

Please review.