[PATCH setup 1/8] Make package size and checksum mandatory in setup.ini

Jon Turney jon.turney@dronecode.org.uk
Sun Jan 22 14:16:00 GMT 2017


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.

Signed-off-by: Jon Turney <jon.turney@dronecode.org.uk>
---
 iniparse.yy | 14 +++++---------
 1 file changed, 5 insertions(+), 9 deletions(-)

diff --git a/iniparse.yy b/iniparse.yy
index 8ae1e2d..7a0b522 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.8.3



More information about the Cygwin-apps mailing list