Homebrew / legacy-homebrew

💀 The former home of Homebrew/homebrew (deprecated)
https://brew.sh
26.99k stars 11.36k forks source link

directory for lock file should be created for sane-backends #4605

Closed stepheneb closed 13 years ago

stepheneb commented 13 years ago

I was getting an error using the plustek sane backend because it expected the following directory to exist for a lock file when accessing my scanner.

<prefix>/var/lock/sane

After I created I also the following directory and set the permissions the lock file error stopped.

mkdir -p /usr/local/Cellar/sane-backends/1.0.22/var/lock/sane
chmod a+w /usr/local/Cellar/sane-backends/1.0.22/var/lock/sane

I wasn't sure of the best way to add this to the brew.

adamv commented 13 years ago

Off the top of my head something like:

def lock_folder
    return var+"lock/sane"
end

And then add a "skip_clean lock_folder" to prevent the empty dir from being removed and a "lock_folder.mkpath" in the def install. I could whip up a patch, but only have a CanoScan scanner (and bought VueScan when I bought a house and needed to scan a bunch of stuff.)

stepheneb commented 13 years ago

I just have a CanoScan LiDE 30.

Here's a diff that works:

diff --git a/Library/Formula/sane-backends.rb b/Library/Formula/sane-backends.rb
index 4d85d32..d38eb13 100644
--- a/Library/Formula/sane-backends.rb
+++ b/Library/Formula/sane-backends.rb
@@ -9,9 +9,12 @@ class SaneBackends <Formula
   depends_on 'libtiff'
   depends_on 'libusb-compat'

+  skip_clean "var/lock/sane"
+
   def install
+    ENV.j1 # Needed for Mac Pro compilation
     system "./configure", "--disable-dependency-tracking",
-                          "--disable-debug",
+                          # "--disable-debug",
                           "--prefix=#{prefix}",
                           "--without-gphoto2",
                           "--enable-local-backends",
@@ -19,5 +22,11 @@ class SaneBackends <Formula
                           "--disable-latex"
     system "make"
     system "make install"
+    lock_folder.mkpath
+  end
+  
+  def lock_folder
+      return var+"lock/sane"
   end
+  
 end

After installing with this brew I could run this successfully:

scanimage --format tiff > test.tiff

What is strange however is that installing the TWAIN-SANE interface by downloading and running the package from this page: http://www.ellert.se/twain-sane/

... doesn't end up working. The TWAIN-SANE package is nice because it lets apps like Graphic Converter and Image Capture work with the scanner.

If I use brew and uninstall sane-backends, libusb-compat, and libusb

and then install these packages manually from http://www.ellert.se/twain-sane

Then I can use the scanner with Graphic Convertor.

I'm not sure why TWAIN-SANE doesn't work with sane-backends installed by homebrew.

The version of sane-backends installed by homebrew is a bit newer.

There are two incompatible versions of libusb:

brew installs 1.0.8

the TWAIN-SANE page installs 0.1.13 beta 2009-09-10

???

adamv commented 13 years ago

Add a lockfile to sane-backends.

Some back-ends require this folder to operate. Closed by e7db80ae1c9a6465e02107cd514e6e8b46f72ab3