This error was reported in the app server project at http://drupal.org/node/1551768 but I think it more applies to the app module. The problem has to do with how app.installer.inc handles the download url in github. Basically using a github url as a downloadable in the app manifest. The apps module (update manager) expects that the url contains the last value to be filename.tar.gz instead of /tarball/master.

For instance the full filename.tar.gz works because the following variables are set correctly:

url: "http://ftp.drupal.org/files/projects/views_slideshow-7.x-3.0.tar.gz"
extract_directory: "temporary://update-extraction-3c17bb3b/app"
locale_cache: "temporary://update-cache-3c17bb3b/views_slideshow-7.x-3.0.tar.gz"
type: app

However these are the variables when dealing with github without a full filename instead /tarball/master

url: "https://github.com/projectname/tarball/master"
extract_directory: "temporary://update-extraction-3c17bb3b/app"
locale_cache: "temporary://update-cache-3c17bb3b/master"
type: app

The error itself has been traced to: archiver_get_archiver in update_manager_archive_extract as it expects to have an extension of (zip, tar, tar.gz, etc)

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

sylus’s picture

Issue summary: View changes

Mod

sylus’s picture

Issue summary: View changes

Mod

sylus’s picture

Issue summary: View changes

Mod

nedjo’s picture

Component: Code » Documentation
Category: bug » task

Thanks for posting this issue. I ran into this problem with several Github hosted libraries.

This is probably a documentation issue: need to document that URLs for archived downloadables must end in a file name including extension.

A hack with github may be to append /filename.ext to the download URL.

nedjo’s picture

http://githubredir.debian.net is another option. It will provide direct download links.

febbraro’s picture

Status: Active » Fixed

Added the docs for this in the README FAQ

http://drupalcode.org/project/apps.git/commit/6140d79

nedjo’s picture

Status: Fixed » Active

IIRC I tried both the hacks I suggested in #2 and #3 and couldn't get either of them to work. Apologies for not coming back to update this issue.

One problem, if I'm recalling correctly, is that the library archive must contain a directory named for the library. (This is because, with Drupal core, each archive contains a directory named for the project.) So even if you have an archive with an extension, it won't install if e.g. it contains a single file.

(A probably unrelated but tangentially similar issue I've hit: #1459618: Incorrect permissions for single file download with make.)

The messy workaround I've used is to create a custom archive of the library containing a correctly-named folder and use that in the manifest.

gusaus’s picture

Has there been any progress or new suggested workarounds for this issue?

gusaus’s picture

Issue summary: View changes

Mod

B-Prod’s picture

Issue summary: View changes

It seems this issue is asleep...

But as Nedjo said, there is another issue with Github (and probably many others).

The library installation fails when the root folder provided in the archive do not have exactly the same name than the library. This is a serious issue which disallows to use any Github library.

Here is a concrete example, with Flexslider.

Extract of the manifest (there is only the library related part):

"libraries": {
  "flexslider": "flexslider 2.2.2"
},
"downloadables": {
  "flexslider 2.2.2": "https://github.com/woothemes/FlexSlider/archive/version/2.2.2.tar.gz"
}

The updater extracts correctly the archive, since there is the tar.gz extension. But the root folder in the archive is FlexSlider-version-2.2.2, not simply flexslider as expected by the updater. So the apps installation fails with the following exception:

UpdaterException : Unable to determine the type of the source directory. in Updater::factory() (line 99 in includes/updater.inc).

hefox’s picture

I added some code to semi handle this situation, but would work with flexslider-vdsfsadf but not FlexSlider-adffdsf

  // Update might not have been extracted to directory named after project.
  // Github for example extracts to [project name]-[release version].
  if (!is_dir("$extract_directory/$project")) {
     foreach (scandir("$extract_directory") as $file) {
      // Hopefully this is the directory, so move it to project directory for
      // update module.
      if ($file != '.' && $file != '..' && is_dir("$extract_directory/$file") && strpos($file, $project) === 0) {
        rename("$extract_directory/$file", "$extract_directory/$project");
      }
    }

Sounds for your case, being able to specificy the directory that the download will appear in would work -- patches welcome.

hefox’s picture

Title: Cannot extract zip or tar.gz files » Cannot use archives that do not extract to folder named after downloadable

  • febbraro committed 6140d79 on 7.x-1.x-1411912
    Issue #1571428 by nedjo: Cannot extract zip or tar.gz files
    
andyrigby’s picture

Hi,

Re: #7, I was having problems with installing apps from tarballs from bitbucket which extract as the form [username]-[project name]-[commit hash] so I added a patch to check the contents of the dir for the project_name.info file. If this exists then in renames the dir for update module to find.

andyrigby’s picture

Patch #10 did not consider libraries, this includes that too.