]> granicus.if.org Git - fortune-mod/commitdiff
ascertain rinutils presence
authorShlomi Fish <shlomif@shlomifish.org>
Mon, 27 Feb 2023 13:51:30 +0000 (15:51 +0200)
committerShlomi Fish <shlomif@shlomifish.org>
Mon, 27 Feb 2023 13:51:30 +0000 (15:51 +0200)
https://github.com/shlomif/fortune-mod/issues/76

fortune-mod/.tidyallrc
fortune-mod/cmake/rinutils_bootstrap.cmake
fortune-mod/tests/t/check-rinutils.t

index f81db2b3cc7843a3c749f6c7dc0f5559450e4d3b..33d2ec6ab49f818bd700fd8bd776471cd758239c 100644 (file)
@@ -3,7 +3,7 @@ select = **/*.{c,h}
 
 [PerlTidy]
 argv = -ci=4 -bl -cti=0 --character-encoding=none
-ignore = rinutils/run-tests.pl **/t/valgrind*.t
+ignore = rinutils/run-tests.pl rinutils/t/lib/Rinutils/InlineWrap.pm **/t/valgrind*.t
 select = **/*.{pl,pm,t}
 
 [PerlCritic]
index 3879bce8501e8a9a1b70cadeb903fbcc86b2f6e4..6dc92daea7d15bce729f59a87ca789a89e0b34c4 100644 (file)
@@ -5,21 +5,22 @@ MACRO(RINUTILS_SET_UP_FLAGS)
     SET (rinutils_inc_dir "${rinutils_dir_absolute}/rinutils/include")
     SET (rinutils_git_tag "0.6.0")
 
+    IF (NOT EXISTS "${rinutils_inc_dir}")
+        EXECUTE_PROCESS(
+            COMMAND "git" "clone" "-b" "${rinutils_git_tag}" "https://github.com/shlomif/rinutils.git" "${rinutils_dir}"
+            WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}"
+        )
+#       ELSE ()
+#           EXECUTE_PROCESS(
+#               COMMAND "git" "submodule" "update" "--init"
+#               WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}"
+#           )
+    ENDIF ()
+
     find_package(Rinutils QUIET)
     IF ("${Rinutils_FOUND}")
         INCLUDE_DIRECTORIES(AFTER ${RINUTILS_INCLUDE_DIR} ${RINUTILS_INCLUDE_DIRS})
     ELSE ()
-        IF (NOT EXISTS "${rinutils_inc_dir}")
-            EXECUTE_PROCESS(
-                COMMAND "git" "clone" "-b" "${rinutils_git_tag}" "https://github.com/shlomif/rinutils.git" "${rinutils_dir}"
-                WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}"
-            )
-        ELSE ()
-            EXECUTE_PROCESS(
-                COMMAND "git" "submodule" "update" "--init"
-                WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}"
-            )
-        ENDIF ()
         IF (NOT EXISTS "${rinutils_inc_dir}")
             MESSAGE(FATAL_ERROR "Could not find rinutils anywhere - it should have been bundled in the releases' source tarball.\nYou can try installing it from a source release or from its repository: https://github.com/shlomif/rinutils\n\nAlso see: https://github.com/shlomif/fortune-mod/issues/44")
         ENDIF ()
index 0e6c355a294415f994e94c39dfb6082745f1b58b..4aebd28a11794bacb25e7ab18d18dad504d3acde 100644 (file)
@@ -21,17 +21,18 @@ sub check_file
 sub mytest
 {
     my $dir = "$ENV{SRC_DIR}/rinutils";
-    if ( -e $dir )
+    if ( not -e $dir )
     {
-        # body...
-        foreach my $fn ("rinutils/include/rinutils/portable_time.h")
+        fail("-e $dir failed.");
+        return;
+    }
+    foreach my $fn ("rinutils/include/rinutils/portable_time.h")
+    {
+        my $err = check_file("${dir}/${fn}");
+        if ( $err ne '' )
         {
-            my $err = check_file("${dir}/${fn}");
-            if ( $err ne '' )
-            {
-                fail("$fn failed - $err.");
-                return;
-            }
+            fail("$fn failed - $err.");
+            return;
         }
     }
     pass("All are ok.");