From 5a3799dc47a3990d90c5657a9c11998a1c77ed28 Mon Sep 17 00:00:00 2001 From: Jon Turney Date: Wed, 14 Dec 2016 00:00:02 +0000 Subject: [PATCH] Make package size and checksum mandatory in setup.ini The setup.ini grammar is written such that size and checksum are optional in install: lines, and checksum is optional in source: lines. Presumably this had some historical use. Change to make package size and checksum mandatory. Future work: We keep the asymmetry between install: and source: where buildPackageSource() sets both pathname and size, but buildPackageInstall() only sets pathname, relying on a separate buildInstallSize() to set the size later for the moment, as fixing that ripples through to other place. --- iniparse.yy | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/iniparse.yy b/iniparse.yy index 8ae1e2d7..7a0b5226 100644 --- a/iniparse.yy +++ b/iniparse.yy @@ -112,7 +112,7 @@ singleitem /* non-empty */ | SHA512LINE SHA512 NL { iniBuilder->buildInstallSHA512 ((unsigned char *)$2); } | SOURCEPACKAGE source NL | CATEGORY categories NL - | INSTALL STRING { iniBuilder->buildPackageInstall ($2); } installmeta NL + | INSTALL STRING STRING { iniBuilder->buildPackageInstall ($2); iniBuilder->buildInstallSize($3);} installchksum NL | SOURCE STRING STRING sourcechksum NL {iniBuilder->buildPackageSource ($2, $3);} | PROVIDES { iniBuilder->buildBeginProvides(); } packagelist NL | BINARYPACKAGE { iniBuilder->buildBeginBinary (); } packagelist NL @@ -141,17 +141,13 @@ categories: /* empty */ | categories STRING { iniBuilder->buildPackageCategory ($2); } ; -installmeta: /* empty */ - | STRING installchksum { iniBuilder->buildInstallSize($1); } - ; - -installchksum: /* empty */ - | MD5 { iniBuilder->buildInstallMD5 ((unsigned char *)$1);} +installchksum /* non-empty */ + : MD5 { iniBuilder->buildInstallMD5 ((unsigned char *)$1);} | SHA512 { iniBuilder->buildInstallSHA512 ((unsigned char *)$1);} ; -sourcechksum: /* empty */ - | MD5 { iniBuilder->buildSourceMD5 ((unsigned char *)$1); } +sourcechksum /* non-empty */ + : MD5 { iniBuilder->buildSourceMD5 ((unsigned char *)$1); } | SHA512 { iniBuilder->buildSourceSHA512 ((unsigned char *)$1); } ; -- 2.43.5