gscan2pdf (good app.) and how to install using local overlay

Anything that pertains to Portage

Moderator: Moderators

User avatar
Fitzcarraldo
Sagely Hen
Posts: 8096
Joined: Sat Mar 10, 2007 5:40
Location: United Kingdom
Contact:

gscan2pdf (good app.) and how to install using local overlay

Post by Fitzcarraldo » Fri Dec 14, 2007 19:32

This is a dual-purpose post. Firstly I want to tell you about a good application that I recently came across. Secondly, as it is not in the Portage repositories yet, this is a good opportunity to tell newcomers to SL how to install it the proper way by using a local overlay and local ebuild.

I regularly need to scan multipage documents using my flat-bed scanner, and create a single PDF file containing all the pages. Until recently I have been using XSane to do this, but there is no pause feature so I have to scramble to change pages while the scanner's lamp is returning to its home position. Also, although XSane is a good application, the user interface for simple tasks such as this is less user-friendly than, say, OmniPage Pro under Windows. Kooka's UI is more user-friendly than XSane's, but Kooka does not create multipage PDFs.

Anyway, I came across an article in the December issue (Issue 85) of Linux Magazine about an application called gscan2pdf which appeared to be just what I was looking for. The application works well and is easy to use. You can read more about it on the gscan2pdf Home Page:

http://gscan2pdf.sourceforge.net/

For me it's perfect for my needs:

- Shows thumbnails of each page in a column on the left hand side of the window.
- The page order can be changed by dragging and dropping thumbnails.
- Individual pages can be deleted by clicking on the thumbnail and pressing Delete.
- It is possible to pause between scanning each page if using a flat-bed scanner.
- It is possible to scan several pages automatically if using a scanner with sheet feeder.
- It quickly saves all the pages to a single PDF document.
- Colour, greyscale and lineart scanning is selectable.

Other features, which I have not tried yet, include:
- Scans can be cleaned up using the (external) unpaper utility.
- It performs OCR (using external utilities).

Users of the excellent OmniPage Pro in Windows will, I think, feel right at home using gscan2pdf rather than XSane or Kooka.

The author, Jeffrey Ratcliffe, is actively developing gscan2pdf and contributes to a thread about it over on the Ubuntu Forums:

http://ubuntuforums.org/showthread.php? ... =gscan2pdf

Anyway, as soon as I read about gscan2pdf, I wanted to try it under SL, but unfortunately it is not yet in the Portage repositories.

However, ebuilds for a lot of packages that are not yet in the Portage repositories can be found in the Gentoo Bugzilla, so I surfed over there and, sure enough, found an ebuild for version 0.9.16:

http://bugs.gentoo.org/show_bug.cgi?id=157887

So, if you want to a) install a very useful application for scanning one or more pages and creating PDFs, and/or b) learn how to install an application that is not in Portage by creating a local overlay, here's how to do it (all as root, in a Terminal window):

1. If it does not already exist, create the directory /usr/local/portage/

2. Create the directory /usr/local/portage/media-gfx/ (media-graphics is an appropriate package category for us to put the ebuild for gscan2pdf).

3. Create the directory /usr/local/portage/media-gfx/gscan2pdf/

4. Now surf over to the Gentoo Bugzilla (see URL above) and save the contents of the link gscan2pdf-0.9.16.ebuild (it's in the Filename column) in a text file called, you guessed it, gscan2pdf-0.9.16.ebuild in the directory you just created.

5. Using your favourite text editor, open /etc/make.conf and add the following three lines to the end of the file (right after the line "source /usr/portage/local/layman/make.conf"):

Code: Select all

# Following line added by <your name> in order to install local ebuilds:
PORTDIR_OVERLAY=/usr/local/portage
# Comment the above line out when not emerging local ebuilds, as it interferes with emerging packages from Portage.
(Hopefully the third line above is self-explanatory!)

6. If you're not already in it, cd into /usr/local/portage/media-gfx/gscan2pdf/ and type the following command:

Code: Select all

ebuild /usr/local/portage/media-gfx/gscan2pdf/gscan2pdf-0.9.16.ebuild manifest
This should create the directory /usr/local/portage/media-gfx/gscan2pdf/files/ and the file /usr/local/portage/media-gfx/gscan2pdf/Manifest

7. Now you can go ahead and emerge the package:

Code: Select all

emerge -1v gscan2pdf
(That's a one, short for "oneshot", not a lowercase L, so as to stop the package being listed in your world file.)

8. Now if you click on K Menu > Applications > Graphics you should find gscan2pdf listed. If you wish you can instead launch it from the command line by typing gscan2pdf<Enter>.

9. You can ignore the little window titled "warning: missing packages" that pops up saying "The scanadf frontend is not available. unpaper missing." and just click on OK.

10. The UI is intuitive and you should be able to pick it up easily, but if you need help see the first two URLs I have given above. Oh, and if you select Lineart mode (i.e. binary mode, a.k.a. B&W mode) then be sure to enter a non-zero Threshold or you scans will all show up as empty white pages. I suggest trying a Threshold value of 50.

11. Finally, don't forget to comment out the PORTDIR_OVERLAY=/usr/local/portage line in /etc/make.conf (by adding a "#" symbol to the beginning of the line) until you need to build another package using your local overlay. Once you realise that the Gentoo Bugzilla is full of ebuilds, the world's your oyster! :-)

User avatar
Fitzcarraldo
Sagely Hen
Posts: 8096
Joined: Sat Mar 10, 2007 5:40
Location: United Kingdom
Contact:

Re: gscan2pdf (good app.) and how to install using local overlay

Post by Fitzcarraldo » Sat Feb 07, 2009 3:34

Just to update this thread for the latest version of gscan2pdf...

You need to download the ebuilds for dev-perl/Sane-0.02 (see Gentoo Bugzilla Bug No. 254716), dev-perl/gtk2-imageview-0.04, media-gfx/gtkimageview-1.6.3 and media-gfx/gscan2pdf-0.9.27 (see Gentoo Bugzilla Bug No. 254704 for the last three ebuilds). Create directories for each package in a similar fashion to what I did in my earlier post, and then create manifests for each of them, again in a similar fashion to what I did in my earlier post. Then merge gtk+-2.14.7-r1. Then merge gtkimageview, gtk2-imageview and Sane. Finally merge gscan2pdf.

xipi
Young Hen
Posts: 23
Joined: Sun Feb 15, 2009 13:34

Re: gscan2pdf (good app.) and how to install using local overlay

Post by xipi » Sun Feb 15, 2009 14:31

What exactly will it happen if, instead of doing this, I simply do it with

./configure && make && make install ??

Is there any way in which the application will get removed when doing any maintenance? (as for instance emerge world)

User avatar
Fitzcarraldo
Sagely Hen
Posts: 8096
Joined: Sat Mar 10, 2007 5:40
Location: United Kingdom
Contact:

Re: gscan2pdf (good app.) and how to install using local overlay

Post by Fitzcarraldo » Sun Feb 15, 2009 15:36

You should use the distro's package manager (in this case Portage) to install/remove packages. It will take care of checking dependencies, compilation options etc., and you will see the package when you use the distro's tools for checking what is installed, the version installed etc. I don't know about this particular package, but if you do install outside the package manager you also run the risk of overwriting something used by another package without being warned about it and without having the possibility of being protected against it. Anyway, using local ebuilds is not difficult once you get the hang of it. In fact, in many cases, it's dead easy.

xipi
Young Hen
Posts: 23
Joined: Sun Feb 15, 2009 13:34

Re: gscan2pdf (good app.) and how to install using local overlay

Post by xipi » Sun Feb 15, 2009 15:49

Yes, easy, though it does not work in my system (http://forum.sabayonlinux.org/viewtopic ... 54&t=16132)

On the other hand, what if the ebuild you're looking for simply does not exist?

User avatar
Fitzcarraldo
Sagely Hen
Posts: 8096
Joined: Sat Mar 10, 2007 5:40
Location: United Kingdom
Contact:

Re: gscan2pdf (good app.) and how to install using local overlay

Post by Fitzcarraldo » Mon Feb 16, 2009 8:53

If you want to discuss the general issue of ebuilds and the package manager, then please create a new thread.

Furthermore, I notice that, in your latest post in the Gentoo Forums, you wrote that the local ebuild to which you referred does now build.

Anyway, coming back to the topic of this thread on gscan2pdf, the ebuilds to install gscan2pdf work fine.

User avatar
Fitzcarraldo
Sagely Hen
Posts: 8096
Joined: Sat Mar 10, 2007 5:40
Location: United Kingdom
Contact:

Re: gscan2pdf (good app.) and how to install using local overlay

Post by Fitzcarraldo » Sat Feb 21, 2009 15:33

From the thread http://forum.sabayonlinux.org/viewtopic ... 54&t=16150:
exsencon wrote:Thanks for your explanations.
i tried to install gscan2pdf but it does not work; downloaded the files(latest version) and made the manifests OK so far.
tried to merge gtkimageview(the first one to merge,I believe) but it failed.
Creating Manifest for /usr/local/portage/media-gfx/gtkimageview
localhost gtkimageview # emerge -1v gtkimageview
gzip: stdin: not in gzip format
tar: Child returned status 1
tar: Error exit delayed from previous errors
*
* ERROR: media-gfx/gtkimageview-1.6.3 failed.
* Call stack:
* ebuild.sh, line 49: Called src_unpack
* environment, line 2598: Called unpack '../temp/gtkimageview-1.6.3.tar.gz'
* ebuild.sh, line 372: Called die
* The specific snippet of code:
* tar zoxf "${srcdir}${x}" ${tar_opts} || die "$myfail"
* The die message:
* failure unpacking ../temp/gtkimageview-1.6.3.tar.gz
FYI I have the Sn 4.0 x84 edition.
Installed the sane-pixma ebuild as you know and Thunderbird(no problems there) that's all.
I did a revdep-rebuild --pretend and got 3 broken packages,I don't know if it is relevant for my problem
[ 34% ] * broken /usr/kde/3.5/lib/kde3/libaudiocd_encoder_lame.so (requires libkio.so.5)
[ 45% ] * broken /usr/lib/gcc/i686-pc-linux-gnu/4.3.2/libgij.la (requires /usr/lib/libgcj.la)
* broken /usr/lib/gcj-4.3.2-9/libjvm.la (requires /usr/lib/libgcj.la)
[ 100% ]
* Generated new 3_broken.rr
At the end it says:
[blocks b ] <app-admin/gamin-0.1.10 ("<app-admin/gamin-0.1.10" is blocking app-admin/gam-server-0.1.10)
[blocks b ] <app-admin/gamin-0.1.10 ("<app-admin/gamin-0.1.10" is blocking dev-libs/libgamin-0.1.10-r2)

!!! Multiple package instances within a single package slot have been pulled
!!! into the dependency graph, resulting in a slot conflict:

sys-libs/e2fsprogs-libs:0

('ebuild', '/', 'sys-libs/e2fsprogs-libs-1.41.3-r1', 'merge') pulled in by
~sys-libs/e2fsprogs-libs-1.41.3 required by ('installed', '/', 'sys-fs/e2fsprogs-1.41.3-r1', 'nomerge')
(and 3 more)

('ebuild', '/', 'sys-libs/e2fsprogs-libs-1.41.4', 'merge') pulled in by
>=sys-libs/e2fsprogs-libs-1.41.0 required by ('installed', '/', 'app-crypt/mit-krb5-1.6.3-r4', 'nomerge')
>=sys-libs/e2fsprogs-libs-1.41 required by ('ebuild', '/', 'sys-apps/util-linux-2.14.2', 'merge')
sys-libs/e2fsprogs-libs required by ('installed', '/', 'x11-libs/libSM-1.1.0', 'nomerge')



!!! The following installed packages are masked:
- sys-fs/e2fsprogs-1.41.3-r1 (masked by: package.mask)
For more information, see the MASKED PACKAGES section in the emerge
man page or refer to the Gentoo Handbook.

* Warning: Failed to resolve package order.
* Will merge in arbitrary order
Possible reasons:
- An ebuild is no longer in the portage tree.
- An ebuild is masked, use /etc/portage/packages.keyword
and/or /etc/portage/package.unmask to unmask it
.....
* All prepared. Starting rebuild
emerge --oneshot --pretend kde-base/kdemultimedia-kioslaves:3.5
sys-devel/gcc:4.3

These are the packages that would be merged, in order:

Calculating dependencies... done!
[ebuild R ] kde-base/kdemultimedia-kioslaves-3.5.10
[ebuild U ] sys-devel/gcc-4.3.3 [4.3.2] USE="-nopie%"
* Now you can remove -p (or --pretend) from arguments and re-run revdep-rebuil
I don't know what to think of this. Maybe I should go ahead and revdep-rebuild? On the other hand everything seems to be working OK now as far as I can tell!
Try googling "gtkimageview-1.6.3.tar.gz", download it via your browser to e.g. your Desktop, copy/move it from there to the /usr/portage/distfiles/ directory, rerun the "ebuild gtkimageview-1.6.3.ebuild manifest" command and then try merging gtkimageview again. If that still gives you grief, then try merging gtk+-2.14.7-r1 and then repeat the above.

exsencon
Young Hen
Posts: 30
Joined: Mon Feb 02, 2009 19:26
Location: Belgium

Re: gscan2pdf (good app.) and how to install using local overlay

Post by exsencon » Sat Feb 21, 2009 20:24

Well I think I tried everything,but no luck.
BTW I did a revdep-rebuild several times and ended up with no broken packages.
Now for gscan2pdf I downloaded another file gtkimageview-1.6.3 installed it in distfiles,remanifested,remerged-same error.
Emerged gtk+-2.14.7-r1 (went OK) and redid the whole thing-same error:
gzip: stdin: not in gzip format
tar: Child returned status 1
tar: Error exit delayed from previous errors
*
* ERROR: media-gfx/gtkimageview-1.6.3 failed.
* Call stack:
* ebuild.sh, line 49: Called src_unpack
* environment, line 2597: Called unpack '../temp/gtkimageview-1.6.3.tar.gz'
* ebuild.sh, line 372: Called die
* The specific snippet of code:
* tar zoxf "${srcdir}${x}" ${tar_opts} || die "$myfail"
* The die message:
* failure unpacking ../temp/gtkimageview-1.6.3.tar.gz
Any thoughts?
Note that while trying to emerge the other packages I get exactly the same error.
Last edited by exsencon on Sat Feb 21, 2009 20:42, edited 1 time in total.

User avatar
Fitzcarraldo
Sagely Hen
Posts: 8096
Joined: Sat Mar 10, 2007 5:40
Location: United Kingdom
Contact:

Re: gscan2pdf (good app.) and how to install using local overlay

Post by Fitzcarraldo » Sat Feb 21, 2009 20:40

Strange. I've just had a look to see what the ebuild command downloaded in my case, and it was:

Code: Select all

[email protected] ~ $ cd /usr/portage/distfiles/
[email protected] /usr/portage/distfiles $ ls -la gtkimageview*
-rw-rw-r-- 1 portage portage 1087939 2008-11-20 20:43 gtkimageview-1.6.3.tar.gz?format=raw
[email protected] /usr/portage/distfiles $
Is the file you downloaded the same size as the one that was downloaded in my case? If yes, try adding "?format=raw" to the file name. Don't ask me why this didn't happen in your case, 'cause I don't know. Anyway, let's give it a shot.

exsencon
Young Hen
Posts: 30
Joined: Mon Feb 02, 2009 19:26
Location: Belgium

Re: gscan2pdf (good app.) and how to install using local overlay

Post by exsencon » Sat Feb 21, 2009 20:50

This is what I get:
[email protected] ~ $ cd /usr/portage/distfiles
[email protected] /usr/portage/distfiles $ ls -la gtkimageview*
-rw-r--r-- 1 root portage 1087939 2009-02-21 19:30 gtkimageview-1.6.3.tar.gz
-rw-rw-r-- 1 portage portage 9965 2009-02-21 19:42 gtkimageview-1.6.3.tar.gz?format=raw
[email protected] /usr/portage/distfiles $
I have 2 files there,I could delete the upper one and redo a manifest and a merge.

Post Reply