LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Slackware (http://www.linuxquestions.org/questions/slackware-14/)
-   -   src2pkg from $HOME (http://www.linuxquestions.org/questions/slackware-14/src2pkg-from-%24home-4175433566/)

lopid 10-22-2012 04:22 PM

src2pkg from $HOME
 
I'm wondering why src2pkg won't work when I run it from $HOME, even though the source tarball and destination package are to be in other directories (PKG_DEST_DIR="/usr/local/packages"), so it shouldn't be doing anything in pwd:

Code:

$ src2pkg ~/downloads/audacious-plugins-3.3.2.tar.bz2
FATAL! Home directory was given as a critical src2pkg variable,
or is the current directory. Please read the src2pkg documentation for help.

I couldn't find the string, "was given as a critical" anywhere in /etc, /usr/local/bin, and /usr/bin, and 'strings makepkg' didn't show anything for "as a critical", so I'm thinking it's in a localised file somewhere else. Anyway, I was just looking for that in order to find out why it had a problem with being in $HOME.

I have read the documentation but the only related mention of the home directory I found is in the tutorial, where it says one can create a directory off there.

gnashley 10-23-2012 11:44 AM

It's a safety precaution. Please use a subdir to create packages in. The process can create several temporary files which are unique to the build. Also, working directly in $HOME might leave some files there which would be messy.

The src2pkg program you run is a shell script. It sources most of the main code from files which are in /usr/libexec/src2pkg -that's where grepping will find 'given as a critical' mentioned. In that code you can also see more places listed where src2pkg will not allow you to work -basically any system directories are ruled out. Early on, one user was trying to run src2pkg from /usr/share or /usr/bin, so the checks were implemented.

It really is best to build each package in a separate directory, or use a subdir where you do nothing but builds.

lopid 10-23-2012 03:27 PM

Quote:

Originally Posted by gnashley (Post 4813178)
The process can create several temporary files which are unique to the build. Also, working directly in $HOME might leave some files there which would be messy.

It uses pwd as a place for temporary files? Why not /tmp?

Quote:

Originally Posted by gnashley (Post 4813178)
It really is best to build each package in a separate directory, or use a subdir where you do nothing but builds.

Isn't that what SRC_BUILDS_DIR et al are for?

I always cd into /tmp before running src2pkg, it's just a hassle having to do that.

gnashley 10-24-2012 05:09 AM

You have a good point, and it's one I thought about alot. I even did some of the work to make it possible to direct the creation of all temp files to a specific place.

But, there is a reason for using a separate dir -it allows you to run multiple builds at once using src2pkg. The problem is not just the path to where the temporary files are being created, but also one of their naming. To save complexity in naming, generic names can be used instead of having to name files by NAME, VERSION, BUILD, etc. src2pkg looks for existing files like doinst.sh, slack-desc, etc in the PWD. So you don't have to name them like NAME.doinst.sh, NAME-VERSION.slack-desc, etc.

src2pkg, as delivered for Slackware, does use /tmp for the creation of the main bulk of the temp files -I mean where the sources are unpacked and built, and where the package content is assembled. But you might try setting up your src2pkg.conf file the way I do for my use - Use $CWD for all temp files:
[[ $SOURCES_DIR ]] || SOURCES_DIR="$CWD"
[[ $SRC_BUILDS_DIR ]] || SRC_BUILDS_DIR="$CWD"
[[ $PKG_BUILDS_DIR ]] || PKG_BUILDS_DIR="$CWD"
[[ $PKG_DEST_DIR ]] || PKG_DEST_DIR="$CWD"
[[ $BACKUP_DIR ]] || BACKUP_DIR="$CWD"
That way, everything is one place and is much easier to browse through. You cd'ing into /tmp amounts to the same thing, except that there will usually be some 'clutter' in /tmp. I often run concurrent builds, so that won't work for me, plus I like to see 'all and only' the source and build files in the same place.

That said, I will see about fixing it so that what you want would work -at least for single builds.

lopid 10-24-2012 04:36 PM

Thanks, I understand now.

bnguyen 10-25-2012 05:40 AM

Quote:

Originally Posted by gnashley (Post 4813675)
That said, I will see about fixing it so that what you want would work -at least for single builds.

Also, please consider fixing permission bits on
http://distro.ibiblio.org/amigolinux/download/src2pkg/

Seems like almost all files have 'x' bit which makes it difficult to browse the source (e.g. Firefox would not show the content of "ChangeLog" but prompt for download instead).

gnashley 10-26-2012 04:40 AM

bnguyen, the perms don't seem to be the problem:
Code:

[src2pkg]$ ls -l
total 3024
-rw-r--r--  1 amigo users  230910 Feb 16  2012 ChangeLog
-rw-r--r--  1 amigo users  29059 Feb 15  2012 CHANGES
drwxr-xr-x 29 amigo users    4096 Feb 15  2012 pasture
drwxr-xr-x  4 amigo users    4096 Feb 16  2012 src2pkg-2.7
-rw-r--r--  1 amigo users 2798492 Feb 16  2012 src2pkg-2.7-noarch-2.txz
drwxr-xr-x  3 amigo users    4096 Jan 29  2009 src2pkg-extensions
drwxr-xr-x  2 amigo users    4096 Dec 20  2009 src2pkg-ng

[src2pkg]$ ls -l src2pkg-2.7
total 12040
-rw-r--r-- 1 amigo users  13691 Jan 25  2012 15-make_package_tar
-rw-r--r-- 1 amigo users    4735 Dec 29  2011 doinst.sh
-rwxr-xr-x 1 amigo users    264 Sep  7  2011 find-broken-links
-rw-r--r-- 1 amigo users    4318 Dec 29  2011 postinst
drwxr-xr-x 9 amigo users    4096 Feb 16  2012 Resources
-rw-r--r-- 1 amigo users    587 Jul 24  2011 slack-desc
-rw-r--r-- 1 amigo users 3050070 Feb 16  2012 src2pkg_2.7-2_all.deb
-rw-r--r-- 1 amigo users 3057195 Feb 16  2012 src2pkg-2.7-2.noarch.rpm
-rw-r--r-- 1 amigo users 3045202 Feb 16  2012 src2pkg-2.7-noarch-2.pet
-rw-r--r-- 1 amigo users 3065344 Feb 16  2012 src2pkg-2.7.tazpkg
-rwxr-xr-x 1 amigo users  19955 Feb 16  2012 src2pkg.build-noarch
drwxr-xr-x 3 amigo users    4096 Feb 16  2012 src2pkg-helpers

I seem to recall having the same behaviour with FF/SM. Try choosing to display the file in a new tab, or tell the browser to open the file with itself -after that it should remember.


All times are GMT -5. The time now is 02:17 AM.