Commits

Shlomi Fish  committed abd0bc0

Fixed the CPACK ignores for "make package_source" in a freecell-solver-* dir.

It was broken for a long time and was left un-noticed because all
"make package_source" were conducted inside the trunk. It was fixed by
splitting a regex in CPACK_IGNORE_FILES into two.

git-svn-id: file:///home/shlomif/Backup/svn-dumps/google-code/svnsync-repos/fc-solve/trunk@2327 e7e8a897-7ba4-4ee7-b36f-f4c66519b19a

  • Participants
  • Parent commits 16cc28c

Comments (0)

Files changed (4)

File fc-solve/source/CMakeLists.txt

 
 SET(CPACK_SOURCE_PACKAGE_FILE_NAME "${CPACK_PACKAGE_NAME}-${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}.${CPACK_PACKAGE_VERSION_PATCH}")
 
+SET (base_with_ver "freecell-solver-[0-9]+\\\\.[0-9]+\\\\.[0-9]+")
+
 SET(CPACK_SOURCE_IGNORE_FILES
     "/_CPack_Packages/"
     "/CMakeFiles/"
     "/.deps/"
-    "freecell-solver-[0-9]+\\\\.[0-9]+\\\\.[0-9]+(-Source|-Linux|)(/|\\\\.(sh|tar\\\\.(gz|bz2|Z|lzma|xz))$)"
+    "${base_with_ver}(-Source|-Linux)/"
+    "${base_with_ver}.tar\\\\.(gz|bz2|Z|lzma|xz)$"
     "\\\\.o$"
     "~$"
     "/board_gen/(pi-make-microsoft-freecell-board|make-microsoft-freecell-board|make-gnome-freecell-board|make-aisleriot-freecell-board)$"

File fc-solve/source/DONE.txt

 
 * Update the "long solutions" help screen of fc-solve with the new presets.
 
+* Deal with the inability to "make package_source" inside an unpacked
+.../freecell-solver-x.y.z/ directory.
+

File fc-solve/source/TODO.txt

 ** Create an enum for choosing which one.
 ** Create wrapper macros based on the #ifdef.
 
-* Deal with the inability to "make package_source" inside an unpacked
-.../freecell-solver-x.y.z/ directory.
-
 Non-pressing
 ------------
 

File fc-solve/source/t/t/build-process.t

 use String::ShellQuote;
 use File::Spec;
 use List::MoreUtils qw(none);
+use Cwd;
+use File::Path;
 
 if (! $ENV{'FCS_TEST_BUILD'} )
 {
     plan skip_all => "Skipping because FCS_TEST_BUILD is not set";
 }
 
-plan tests => 7;
+plan tests => 15;
 
 # Change directory to the Freecell Solver base distribution directory.
 chdir($ENV{"FCS_PATH"});
     close($ver_fh);
     chomp($version);
 
-    my $tar_arc = "freecell-solver-$version.tar";
+    my $base =  "freecell-solver-$version";
+    my $tar_arc = "$base.tar";
     my $arc_name = "$tar_arc.bz2";
 
-    # We need to delete the tar.gz because rpmbuild -tb may work on the
-    # .bz2 with the .gz still present.
-    unlink("$tar_arc.gz");
+    # The code starting from here makes sure we can run "make package_source"
+    # inside the freecell-solver-$X.$Y.$Z/ directory generated by the unpacked
+    # archive. So we don't have to rename it.
 
     # TEST
-    ok (scalar(-e $arc_name), 
-        "Archive exists."
-    );
+    test_cmd(["tar", "-xvf", $arc_name], "Unpacking the arc name");
+
+    # TEST
+    ok (scalar(-d $base), "The directory was created");
 
-    open my $tar_fh, "-|", "tar", "-tvf", $arc_name
-        or die "Could not open Tar '$arc_name' for opening.";
+    my $orig_cwd = Cwd::getcwd();
 
-    my @tar_lines = (<$tar_fh>);
-    close($tar_fh);
+    chdir($base);
+
+    # TEST
+    test_cmd(["cmake", "."], 
+        "CMaking in the unpacked dir"
+    );
 
-    chomp(@tar_lines);
+    # TEST
+    test_cmd(["make", "package_source"]);
 
     # TEST
-    ok ((none { m{/config\.h\z} } @tar_lines),
-        "Archive does not contain config.h files");
+    test_cmd(["tar", "-xvf", $arc_name],
+        "Unpacking the arc name in the unpacked dir"
+    );
 
     # TEST
-    ok ((none { m{/freecell-solver-range-parallel-solve\z} } @tar_lines),
-        "Archive does not contain the range solver executable");
+    ok (scalar(-d $base), "The directory was created again");
 
     # TEST
-    ok ((none { m{/libfreecell-solver\.a\z} } @tar_lines),
-        "Archive does not contain libfreecell-solver.a");
+    ok (scalar(-f
+            File::Spec->catfile(
+                File::Spec->curdir(), $base, "CMakeLists.txt"
+            )
+        ), "CMakeLists.txt exists",
+    );
 
     # TEST
-    test_cmd ("rpmbuild -tb $arc_name 2>/dev/null", 
-        "rpmbuild -tb is successful."
+    ok (scalar(-f 
+            File::Spec->catfile(
+                File::Spec->curdir(), $base, "HACKING.txt"
+            )
+        ), "CMakeLists.txt exists",
     );
+
+    chdir($orig_cwd);
+
+    # Delete the unpacked directory.
+    rmtree($base);
+
+    # Now test the rpm building.
+    {
+        # We need to delete the tar.gz because rpmbuild -tb may work on the
+        # .bz2 with the .gz still present.
+        unlink("$tar_arc.gz");
+
+        # TEST
+        ok (scalar(-e $arc_name), 
+            "Archive exists."
+        );
+
+        open my $tar_fh, "-|", "tar", "-tvf", $arc_name
+            or die "Could not open Tar '$arc_name' for opening.";
+
+        my @tar_lines = (<$tar_fh>);
+        close($tar_fh);
+
+        chomp(@tar_lines);
+
+        # TEST
+        ok ((none { m{/config\.h\z} } @tar_lines),
+            "Archive does not contain config.h files");
+
+        # TEST
+        ok ((none { m{/freecell-solver-range-parallel-solve\z} } @tar_lines),
+            "Archive does not contain the range solver executable");
+
+        # TEST
+        ok ((none { m{/libfreecell-solver\.a\z} } @tar_lines),
+            "Archive does not contain libfreecell-solver.a");
+
+        # TEST
+        test_cmd ("rpmbuild -tb $arc_name 2>/dev/null", 
+            "rpmbuild -tb is successful."
+        );
+    }
 }
 
 =head1 COPYRIGHT AND LICENSE