sheepy

build system (sheepy) and package manager (spm) for C
git clone https://spartatek.se/git/sheepy.git
Log | Files | Refs | README | LICENSE

commit eb0f08cdd46f41d6806be59ea6b0f9cc0952818f
parent 8e084b577ff0735a82c44606151da53ac116f49f
Author: Remy Noulin <loader2x@gmail.com>
Date:   Sat,  7 Aug 2021 19:06:44 +0000

fix error for system(char*) calls and OR command results

instead of adding them in sheepy

src/sheepy.c | 22 +++++++++++-----------
src/spm.c    | 17 +++++++++--------
2 files changed, 20 insertions(+), 19 deletions(-)

Diffstat:
Msrc/sheepy.c | 22+++++++++++-----------
Msrc/spm.c | 17+++++++++--------
2 files changed, 20 insertions(+), 19 deletions(-)

diff --git a/src/sheepy.c b/src/sheepy.c @@ -738,7 +738,7 @@ int MAIN(int ARGC, char** ARGV) { if (getG(cfgD, rtBool, "print_compile_commands")) { printf("%s\n", c); } - programResult += commandNFree(c);; + programResult |= commandNFree(c);; } finishG(pkgDeps); } @@ -835,7 +835,7 @@ int MAIN(int ARGC, char** ARGV) { } char *debugCommand = formatS("%s %s %s", debuggerCmd, buildExePath, params);; - system(debugCommand); + pErrorNot0(system(debugCommand)); if (getG(cfgD, rtBool, "print_compile_commands")) { printf("%s\n", debugCommand); } @@ -1723,7 +1723,7 @@ int MAIN(int ARGC, char** ARGV) { dum = malloc(strlen(buildExePath) + strlen(params) + 1 + 1); sprintf(dum, "%s %s", buildExePath, params); setMaxLogLevel(LOG_DISABLE); - programResult += commandNFree(dum); + programResult |= commandNFree(dum); setMaxLogLevel(LOG_INFO); } } @@ -1807,7 +1807,7 @@ int MAIN(int ARGC, char** ARGV) { if (getG(cfgD, rtBool, "print_compile_commands")) { printf("%s\n", cc); } - programResult += command(cc); + programResult |= command(cc); // compile includes } @@ -1855,7 +1855,7 @@ int MAIN(int ARGC, char** ARGV) { char *D = shDirname(oPath); pError0(mkdirParents(D)); free(D); - programResult += commandNFree(buildMirrorD); + programResult |= commandNFree(buildMirrorD); buildMirrorD = shDirname(oPath); if (!fileExists(buildMirrorD)) { // create c file dir in homedir/build @@ -1882,7 +1882,7 @@ int MAIN(int ARGC, char** ARGV) { listFreeS(jobArgs); } else { - programResult += command(ccmd); + programResult |= command(ccmd); } free(ccmd); } @@ -2200,7 +2200,7 @@ int MAIN(int ARGC, char** ARGV) { // hide eventual error from the compiled program setMaxLogLevel(LOG_DISABLE); - programResult += commandNFree(ld); + programResult |= commandNFree(ld); setMaxLogLevel(LOG_INFO); // build static lib @@ -2212,7 +2212,7 @@ int MAIN(int ARGC, char** ARGV) { if (getG(cfgD, rtBool, "print_compile_commands")) { printf("%s\n", ld); } - programResult += commandNFree(ld); + programResult |= commandNFree(ld); } // mainOPath is not used after link step @@ -2362,7 +2362,7 @@ void copyHeaderToBuildPath(char *bPath, struct stat hst) { char *D = shDirname(bPath); pError0(mkdirParents(D)); free(D); - programResult += commandNFree(tmp); + programResult |= commandNFree(tmp); // copy modification time char *b = catS(bPath, ".dep"); @@ -2393,7 +2393,7 @@ void copyHeaderDates(char *actualDir, smallArrayt *hDeps, char *buildPath) { char *D = shDirname(bPath); pError0(mkdirParents(D)); free(D); - programResult += commandNFree(tmp); + programResult |= commandNFree(tmp); // copy modification time pError0(setModificationTime(bPath, hst.st_mtime)) { @@ -2413,7 +2413,7 @@ bool symlinkFile(char *path, char *buildPath) { pError0(mkdirParents(D)); free(D); char *cmd = catS("ln -s ", path, " ", buildPath); - programResult += commandNFree(cmd); + programResult |= commandNFree(cmd); } r = true; } diff --git a/src/spm.c b/src/spm.c @@ -186,7 +186,8 @@ int MAIN(int ARGC, char** ARGV) { putsG(BLD CYN" memcheck"RST" - compile memcheckBin and run with the memcheck command"); putsG(BLD CYN" showmc"RST" - show the memcheck command, either in " HOME_DIR CONFIG_NAME " or in package.yml"); putsG(BLD CYN" doc"RST" - generate the documentation by running the documentation command from package.yml"); - putsG(BLD CYN" show (PKG1 PKG2)"RST" - show package information in the system"); + putsG(BLD CYN" show (PKG1 PKG2)"RST" - show list of package information in the system"); + putsG(BLD CYN" -g show (PKG1 PKG2)"RST" - show list of package information installed globally in the system"); putsG(BLD CYN" update|upgrade (PKG1 PKG2)"RST" - update package"); putsG(BLD CYN" -g update|upgrade (PKG1 PKG2)"RST" - update packages globally"); putsG(BLD CYN" find PKG1 (PKG2)"RST" - find package in the registry"); @@ -893,7 +894,7 @@ int MAIN(int ARGC, char** ARGV) { if (getG(cfgD, bum, "print_compile_commands")) { printf("%s\n", getG(d, rtChar, "documentationCmd")); } - system(getG(d, rtChar, "documentationCmd")); + pErrorNot0(system(getG(d, rtChar, "documentationCmd"))); } else { puts(BLD RED "No documentation command (documentationCmd) found in package.yml" RST); @@ -961,7 +962,7 @@ void publish(smallDictt *cfgD, bool pigz) { if (getG(cfgD, bum, "print_compile_commands")) { printf("%s\n", cmd); } - pError0(systemNFreeG(cmd)); + pErrorNot0(systemNFreeG(cmd)); terminateG(d); } @@ -1082,7 +1083,7 @@ void installAPackage(bool isGlobal, smallDictt *cfgD, smallStringt *o, bool pigz if (getG(cfgD, rtBool, "print_compile_commands")) { printf("%s\n", cmd); } - pError0(systemNFree(cmd)); + pErrorNot0(systemNFree(cmd)); // detect download errors char *s = catS(name, ".tar.gz");; @@ -1110,7 +1111,7 @@ void installAPackage(bool isGlobal, smallDictt *cfgD, smallStringt *o, bool pigz if (getG(cfgD, rtBool, "print_compile_commands")) { printf("%s\n", cmd); } - pError0(systemNFreeG(cmd)); + pErrorNot0(systemNFreeG(cmd)); // compile package compilePackage(name, isGlobal, cfgD, currentVersion); @@ -1262,7 +1263,7 @@ void compilePackage(char *name, bool isGlobal, smallDictt *cfgD, char *currentVe if (getG(cfgD, rtBool, "print_compile_commands")) { printf("%s\n", cmd); } - pError0(systemNFreeG(cmd)); + pErrorNot0(systemNFreeG(cmd)); skipLink: free(bin); } @@ -1316,7 +1317,7 @@ bool installDependencies(bool isGlobal, smallDictt *cfgD, smallDictt *d, const c // parallel has to be defined and 0 to disable parallel spm if (hasG(cfgD, "parallelSpm") && !getG(cfgD, rtI32, "parallelSpm")) { - pError0(systemNFreeG(join(cmd, " "))); + pErrorNot0(systemNFreeG(join(cmd, " "))); } else { spawnProcDeps(childProc, cmd); @@ -1672,7 +1673,7 @@ void uninstallPackages(bool isGlobal, smallDictt *cfgD, smallArrayt *options) { putsG(cmd); } pError0(chDir(name)); - pError0(systemNFreeG(cmd)); + pErrorNot0(systemNFreeG(cmd)); pError0(chDir("..")); // uninstall dependencies