This commit is contained in:
Laurent Destailleur 2026-04-08 19:52:45 +02:00
parent 2ba7c9d910
commit 3a02b7a9b7
2 changed files with 32 additions and 14 deletions

View file

@ -62,24 +62,31 @@ print '***** '.$script_file.' *****'."\n";
if (empty($argv[1])) {
print "Usage: ".$script_file." release=auto[-mybuild]|x.y.z[-mybuild] [includecustom=1] [includeconstant=CC:MY_CONF_NAME:value] [buildzip=1]\n";
print "Usage: ".$script_file." checklock=auto[-mybuild]|x.y.z[-mybuild] unalterable_files\n";
print "Usage: ".$script_file." checklock=auto[-mybuild]|x.y.z[-mybuild] name_of_locked_scope\n";
print "\n";
print "Example: ".$script_file." release=6.0.0 includecustom=1 includeconstant=ES:CONST_XX_IS_ON includeconstant=all:MAILING_NO_USING_PHPMAIL:1\n";
print "Example: ".$script_file." checklock=auto unalterable_files\n";
print "\n";
print "Generate the file filelist-x.y.z[-mybuild].xml with signature of files. ";
print "The file always includes the 3 sections:\n";
print "Generate the XML filelist-x.y.z[-mybuild].xml with the signature of files. ";
print "The XML always includes the 3 sections:\n";
print "- dolibarr_htdocs_dir\n";
print "- dolibarr_scripts_dir\n";
print "- dolibarr_unalterable_files (only files inside the scope of the unalterable module)\n";
print "and if a specific setup/parameter need to be included into the signature for check:\n";
print "and if a specific setup/parameter need to be included into the signature:\n";
print "- dolibarr_constants\n";
print "\n";
print "If used with parameter 'check_unalterable_files', it will validate that the signature generated is the samethan the one found into lockedfiles.txt";
print "If used with the parameter 'checklock' 'unalterable_files', it will validate that the signature generated is the same than the one for scope 'unalterable_files' found into dev/lockedfiles.txt\n";
print "\n";
exit(1);
}
// We can defined here a list of scopes that need a dedicated signature
$arrayoflockedscopes = array(
'unalterable_files' => DOLCERT_VERSION // The scope for the French Loi Finance and certification
);
$i = 0;
$result = array();
while ($i < $argc) {
@ -116,6 +123,7 @@ if (empty($release) && empty($checklock)) {
print "Error: Missing release or checklock parameter\n";
print "Usage: ".$script_file." release=auto[-mybuild]|x.y.z[-mybuild] [includecustom=1] [includeconstant=CC:MY_CONF_NAME:value]\n";
print "Usage: ".$script_file." checklock=auto[-mybuild]|x.y.z[-mybuild] unalterable_files\n";
print "\n";
exit(2);
}
@ -135,10 +143,12 @@ $releaseblockedlog = DOLCERT_VERSION;
// If $checklock is auto, we take current version to read checklock file
$tmpver = explode('-', $checklock, 2);
if ($tmpver[0] == 'auto') {
if ($checksource == 'unalterable_files') {
$checklock = DOLCERT_VERSION;
} else {
$checklock = DOL_VERSION;
$checklock = DOL_VERSION;
foreach ($arrayoflockedscopes as $lockedscope => $versionlocked) {
if ($checksource == $lockedscope) {
$checklock = $versionlocked;
break;
}
}
if (!empty($tmpver[1]) && $tmpver[0] == 'auto') {
$checklock .= '-'.$tmpver[1];
@ -206,7 +216,7 @@ if ($release) {
if ($checklock) {
print "Working on files into : ".DOL_DOCUMENT_ROOT."\n";
print "Version to check in lockedfiles.txt : ".$checklockmajorversion."\n"; // For example 2.0.0
print "Check source : ".$checksource."\n"; // For example unalterable_files
print "Scope name to check : ".$checksource."\n"; // For example unalterable_files
}
if ($release) {
@ -460,7 +470,11 @@ if ($release) {
print "File ".$outputfile." generated.\n";
print "Signature for htdocs files: ".$hashhtdocsdir."\n";
print "Signature for scripts files: ".$hashscriptsdir."\n";
print "Signature for the ".count($checksumconcat)." unalterable files: ".$hashunalterable_files."\n";
// For the scope unalterable_files:
print "Signature for the ".count($checksumconcat)." files in scope unalterable_files ";
print DOLCERT_VERSION;
print ": ".$hashunalterable_files."\n";
} else {
if ($buildzip == '1' || $buildzip == 'zip') {
$result = dol_compress_file($outputfile, $outputfile.'.zip', 'zip');
@ -479,7 +493,7 @@ if ($release) {
}
if ($checklock) {
print "Signature for unalterable files: ".$algo." ".$hashunalterable_files."\n";
print "Signature of locked files for the scope '".$checksource."' : ".$algo." ".$hashunalterable_files."\n";
$lockedfile = DOL_DOCUMENT_ROOT.'/../dev/lockedfiles.txt';
$checksuminlockedfile = '';
@ -498,7 +512,7 @@ if ($checklock) {
if (empty($checksuminlockedfile)) {
print "The major version ".$checklockmajorversion." is not locked on the scope '".$checksource."' (file found but no matching entry found into dev/lockedfiles.txt).\n";
} elseif ($checksuminlockedfile != $hashunalterable_files) {
print "The major version ".$checklockmajorversion." is locked on scope '".$checksource."' to checksum ".$algo." ".$checksuminlockedfile."\n";
print "The major version ".$checklockmajorversion." is locked on scope '".$checksource."' with the checksum : ".$algo." ".$checksuminlockedfile."\n";
if ($checklockmajorversion != $checksource) {
print "The checksum now differs from the locked one, so we return an error.\n";
print "\n";

View file

@ -2,6 +2,10 @@
This file is the list of the signatures of some set of files locked to block a commit if files are tried to be modified for a given version.
It is used by the CI or the script to check and guarantee that no change is done on a given scope of files.
Version Scope name Algo Signature (generated by dev/build/generate_filelist_xml.php) that must remain unchanged for this couple version/scope
To generate the signature of a scope of files, you can use the following command:
dev/build/generate_filelist_xml.php release=auto
Version Scope name Algo Signature that must remain unchanged for this couple version/scope
x.0.0 unalterable_files sha256 123456
2.0.0 unalterable_files sha256 123456