Skip to content

Commit

Permalink
ISLANDORA-2053: Update travis.yml to force PHP 5.3.3 to run under Ubu…
Browse files Browse the repository at this point in the history
…ntu Precise (#137)

* force PHP 5.3.3 to run under Ubuntu Precise

* Testing regression to the original Trusty 9.10 

9.10~dfsg-0ubuntu10 is the original (2014)
=9.10~dfsg-0ubuntu10.10 is the security patch (aug 2017)
Maybe there is an issue there. Let's see!

* Well, dependencies

If not done this way you get
he following packages have unmet dependencies:
 ghostscript : Depends: libgs9 (= 9.10~dfsg-0ubuntu10) but 9.10~dfsg-0ubuntu10.10 is to be installed

* Roll back, fix at code level

Again, just a test. Seems like the issue is with a “,” really and
previous versions where less concerned about argument validity

* Big fix'a

Happens that we need to read the documentation actually.
Old versions of gs where ignoring some bad parameters (like passing
compression to tiff64etc devices). But new ones are actually correct.
To make the case i added a new device and lets see if this works!

* Getting around gs bugs and weirdness

Rollback and
http://git.ghostscript.com/?p=ghostpdl.git;a=commitdiff;h=f8e77523

* dcs

* Updated failure note for GS v<9.19

* Proper note
  • Loading branch information
DiegoPino authored and whikloj committed Sep 15, 2017
1 parent 2ea3b0f commit 723004b
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 7 deletions.
25 changes: 21 additions & 4 deletions .travis.yml
@@ -1,20 +1,37 @@
sudo: required
dist: trusty
language: php

matrix:
include:
#5.3.3 Ubuntu Precise exceptions
- php: 5.3.3
dist: precise
env: FEDORA_VERSION="3.5"
- php: 5.3.3
dist: precise
env: FEDORA_VERSION="3.6.2"
- php: 5.3.3
dist: precise
env: FEDORA_VERSION="3.7.0"
- php: 5.3.3
dist: precise
env: FEDORA_VERSION="3.8.1"
php:
- 5.3.3
- 5.4
- 5.5
- 5.6
- 7.0
- 7.1
branches:
only:
- /^7.x/
env:
- FEDORA_VERSION="3.5"
- FEDORA_VERSION="3.6.2"
- FEDORA_VERSION="3.7.0"
- FEDORA_VERSION="3.8.1"

branches:
only:
- /^7.x/
before_install:
- cd $HOME
- git clone -b 7.x git://github.com/Islandora/islandora.git
Expand Down
14 changes: 12 additions & 2 deletions includes/utilities.inc
Expand Up @@ -1178,13 +1178,23 @@ function islandora_paged_content_extract_tiff_from_pdf($uri, $offset, $device, $
$output_file = drupal_tempnam('temporary://', "page{$offset}.tif");
// Need to link the file because of UTF-8 encoding.
$copy = islandora_paged_content_create_clean_link($uri, 'pdfforgs');
$base_command = '!gs_path -q -dNOPAUSE -dBATCH -sDEVICE=!device -sCompression=lzw -sOutputFile=!output_file -r!resolution, -dFirstPage=!offset -dLastPage=!offset !pdf_uri';
// For all arguments see https://ghostscript.com/doc/current/Devices.htm#TIFF.
if ($device == 'tiff64nc' || $device == 'tiff48nc') {
// Both are 16bits per channel. No compression possible.
// GhostScript versions 9.10 through 9.18 seem affected by a Bug
// making this devices fail always.
// @see http://git.ghostscript.com/?p=ghostpdl.git;a=commitdiff;h=f8e77523.
$base_command = '!gs_path -q -dNOPAUSE -dBATCH -sDEVICE=!device -sCompression=none -sOutputFile=!output_file -r!resolution -dFirstPage=!offset -dLastPage=!offset !pdf_uri';
}
else {
$base_command = '!gs_path -q -dNOPAUSE -dBATCH -sDEVICE=!device -sCompression=lzw -sOutputFile=!output_file -r!resolution -dFirstPage=!offset -dLastPage=!offset !pdf_uri';
}
$command = format_string($base_command, array(
'!gs_path' => escapeshellarg($gs),
'!device' => $device,
'!offset' => $offset,
'!output_file' => drupal_realpath($output_file),
'!resolution' => $resolution,
'!resolution' => (int) $resolution,
'!pdf_uri' => escapeshellarg(drupal_realpath($copy)),
));
$output = array();
Expand Down
2 changes: 1 addition & 1 deletion tests/ghostscript.test
Expand Up @@ -48,7 +48,7 @@ class GhostscriptTestCase extends DrupalWebTestCase {
*/
public function testGhostscriptOutputValidity() {
$mcgill_pdf = drupal_get_path('module', 'islandora_paged_content') . '/tests/fixtures/2010.08.25_McGill_Librarians.pdf';
$output = islandora_paged_content_extract_tiff_from_pdf($mcgill_pdf, 1, 'tiff64nc', '300', 'Ghostscript ran successfully.');
$output = islandora_paged_content_extract_tiff_from_pdf($mcgill_pdf, 1, 'tiff32nc', '300', 'Ghostscript ran successfully.');
if ($output) {
if (filesize($output)) {
$this->pass('Ghostscript returned valid output for TIF extraction.');
Expand Down
Empty file modified tests/scripts/ghostscript-install.sh 100644 → 100755
Empty file.

0 comments on commit 723004b

Please sign in to comment.