enable_dirs_in_pkg
authorDebian Octave Group <pkg-octave-devel@lists.alioth.debian.org>
Mon, 1 Dec 2014 20:25:52 +0000 (20:25 +0000)
committerSébastien Villemot <sebastien@debian.org>
Mon, 1 Dec 2014 20:25:52 +0000 (20:25 +0000)
Gbp-Pq: Name enable_dirs_in_pkg

scripts/pkg/private/install.m

index 71fa3321083bad82bbf59c34cbbf6d6212bd0a09..8ea96190498c13f9e9d729580d22cda1e29a333a 100644 (file)
@@ -75,25 +75,32 @@ function install (files, handle_deps, autoload, prefix, archprefix, verbose,
         endif
 
         ## Uncompress the package.
-        if (verbose)
-          printf ("untar (%s, %s)\n", tgz, tmpdir);
-        endif
-        untar (tgz, tmpdir);
-
-        ## Get the name of the directories produced by tar.
-        [dirlist, err, msg] = readdir (tmpdir);
-        if (err)
-          error ("couldn't read directory produced by tar: %s", msg);
-        endif
+       if (!exist(tgz, "dir"))
+          if (verbose)
+            printf ("untar (%s, %s)\n", tgz, tmpdir);
+          endif
+          untar (tgz, tmpdir);
 
-        if (length (dirlist) > 3)
-          error ("bundles of packages are not allowed");
-        endif
-      endif
+         ## Get the name of the directories produced by tar.
+          [dirlist, err, msg] = readdir (tmpdir);
+          if (err)
+            error ("couldn't read directory produced by tar: %s", msg);
+          endif
 
-      ## The filename pointed to an uncompressed package to begin with.
-      if (exist (tgz, "dir"))
-        dirlist = {".", "..", tgz};
+          if (length (dirlist) > 3)
+            error ("bundles of packages are not allowed");
+          endif
+       else
+         ## we are dealing with a directory, so just copy the files
+         if (verbose)
+           printf ("Copying directory (%s, %s)\n", tgz, tmpdir);
+         endif
+         [status, msg, msgid] = copyfile (tgz, tmpdir);
+         if (!status)
+           disp(msg);
+         endif
+         dirlist = {".", "..", tgz};
+       endif
       endif
 
       if (exist (tgz, "file") || exist (tgz, "dir"))