SlackwareThis Forum is for the discussion of Slackware Linux.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
I decided to play around with src2pkg this weekend to help me get some stuff for a program built (including building qt4). I am, however, trying to use this program to compile a python based program. The program I am trying to compile is mutagen. I just wanted to see if I actually did this right.
try running the same command but with -VV
that will show you everything happening behind the scenes.
[code]src2pkg -m="setup.py build" -i="setup.py install" -VV mutagen-1.13.tar.gz
The only additional things it showed was unpacking the tarball, no stripping was needed, and the directory structure of the final tgz. It still seems that it doesn't run setup.py build
alright, i don't have linux up so if i am wrong about the correct option, sorry. however, try this.
Code:
src2pkg -N packagename.tar.gz
that should create packagename.src2pkg.auto and slack.desc file.
the src2pkg.auto file should look something like this.
Code:
#!/bin/bash
## src2pkg script for: cacti
## Auto-generated by src2pkg-1.6
## src2pkg Copyright 2005-2007 Gilbert Ashley <amigo@ibilio.org>
## Full package name: cacti-0.8.7-i486-1.tgz
SOURCE_NAME='cacti-0.8.7.tar.gz'
NAME='cacti'
VERSION='0.8.7'
ARCH='i486'
BUILD='1'
PRE_FIX='usr'
# Any extra options go here
# EXTRA_CONFIGS=''
# STD_FLAGS='-O2 -march=i486 -mtune=i686'
# Get the functions and configs
. /usr/libexec/src2pkg/FUNCTIONS ;
# do_all_processes can substitute these 16 steps:
pre_process
find_source
make_dirs
unpack_source
fix_source_perms
#configure_source
#compile_source
#fake_install
mkdir -p $PKG_DIR/opt/cacti
cp $SRC_DIR/* $PKG_DIR/opt/cacti
fix_pkg_perms
strip_bins
create_docs
compress_man_pages
make_description
make_doinst
make_package
post_process
# src2pkg - Copyright 2005-2007 Gilbert Ashley <amigo@ibiblio.org>
## See the documentation for more help and examples. Below are some of
# the most common Extras and Options for easy cut-and-paste use.
# EXTRA_CONFIGS='' PRE_FIX='' DOCLIST=''
# MAKE_COMMAND='' INSTALL_LINE=''
# SHELL_INSTALL='YES' CORRECT_PERMS='NO'
O'
for you, only comment out configure_source and compile_source
above fake_install add the line
Code:
$SRC_DIR/setup.py build
and then where it says
Code:
# Any extra options go here
add
Code:
INSTALL_LINE='setup.py install'
if you change the auto.slack.desc, remove the auto. from the file so it will be used.
then run
Code:
src2pkg -C -W -X -VV
C - puts the package in current dir
W - Deletes src and pkg dir
X - uses src2pkg.auto and slack.desc file
Well after fiddling with it for a while I couldn't figure it out. Luckily it turns out that this specific script will call the build when you run install, but I would still like to figure it out, because I am probably going to try to use this again on future python based builds.
This is the mutagen.src2pkg.auto
Code:
#!/bin/bash
## src2pkg script for: mutagen
## Auto-generated by src2pkg-1.7
## src2pkg Copyright 2005-2007 Gilbert Ashley <amigo@ibilio.org>
## Full package name: mutagen-1.13-i486-1.tgz
SOURCE_NAME='mutagen-1.13.tar.gz'
NAME='mutagen'
VERSION='1.13'
ARCH='i486'
BUILD='1'
PRE_FIX='usr'
# Any extra options go here
INSTALL_LINE='setup.py install'
# EXTRA_CONFIGS=''
# STD_FLAGS='-O2 -march=i486 -mtune=i686'
# Get the functions and configs
. /usr/libexec/src2pkg/FUNCTIONS ;
# do_all_processes can substitute these 16 steps:
pre_process
find_source
make_dirs
unpack_source
fix_source_perms
#configure_source
#compile_source
$SRC_DIR/setup.py build
fake_install
fix_pkg_perms
strip_bins
create_docs
compress_man_pages
make_description
make_doinst
make_package
post_process
# src2pkg - Copyright 2005-2007 Gilbert Ashley <amigo@ibiblio.org>
## See the documentation for more help and examples. Below are some of
# the most common Extras and Options for easy cut-and-paste use.
# EXTRA_CONFIGS='' PRE_FIX='' DOCLIST=''
# MAKE_COMMAND='' INSTALL_LINE=''
# SHELL_INSTALL='YES' CORRECT_PERMS='NO'
And this is what it spits out about it when I run it.
Code:
Found source archive: mutagen-1.13.tar.gz
Deleting old build files - Done
Creating working directories:
PKG_DIR=/tmp/mutagen-1.13-pkg-1
SRC_DIR=/tmp/mutagen-1.13-src-1
Unpacking source archive - Done
Correcting source permissions - Done
Checking for patches - None found
running build
running build_py
error: package directory 'mutagen' does not exist
Tracking Installation - Using: 'setup.py install'
running install
running build
running build_py
--snip--
I don't know what causes this. I tried manually going into the source folder and running setup.py build and it worked fine. It didn't dump any error, so I don't know where this "error: package directory 'mutagen' does not exist" is coming from. I assume it is an error from src2pkg.
Also as a side note... I couldn't get it to run using the command you listed above. I couldn't find anything on how to specify the build file to use, so I just used "sh mutagen.src2pkg.auto". Maybe that is part of the problem... I wouldn't know.
and, yes you are having problems because you ran it like you did.
$SRC_DIR is something known by src2pkg when it runs, hence the dir error message you got.
be sure you are in the dir with your tarball, src2pkg.auto and slack.desc file when you run that command.
Same thing as before... I will paste the whole code below (it isn't as bad as a lot of packages).
Code:
jbhansen@therapist:~/program-downloads/mut$ sudo src2pkg -C -W -X -VV
Running build script: mutagen.src2pkg.auto
Found source archive: mutagen-1.13.tar.gz
Removing existing package build directory from previous build -
Removing existing source build directory from previous build -
Creating working directories:
PKG_DIR=/tmp/mutagen-1.13-pkg-1
SRC_DIR=/tmp/mutagen-1.13-src-1
Unpacking source archive -
mutagen-1.13/
mutagen-1.13/man/
mutagen-1.13/man/mid3iconv.1
mutagen-1.13/man/mid3v2.1
mutagen-1.13/man/moggsplit.1
mutagen-1.13/man/mutagen-inspect.1
mutagen-1.13/man/mutagen-pony.1
mutagen-1.13/mutagen/
mutagen-1.13/mutagen/__init__.py
mutagen-1.13/mutagen/_constants.py
mutagen-1.13/mutagen/_util.py
mutagen-1.13/mutagen/_vorbis.py
mutagen-1.13/mutagen/apev2.py
mutagen-1.13/mutagen/asf.py
mutagen-1.13/mutagen/easyid3.py
mutagen-1.13/mutagen/flac.py
mutagen-1.13/mutagen/id3.py
mutagen-1.13/mutagen/m4a.py
mutagen-1.13/mutagen/monkeysaudio.py
mutagen-1.13/mutagen/mp3.py
mutagen-1.13/mutagen/mp4.py
mutagen-1.13/mutagen/musepack.py
mutagen-1.13/mutagen/ogg.py
mutagen-1.13/mutagen/oggflac.py
mutagen-1.13/mutagen/oggspeex.py
mutagen-1.13/mutagen/oggtheora.py
mutagen-1.13/mutagen/oggvorbis.py
mutagen-1.13/mutagen/optimfrog.py
mutagen-1.13/mutagen/trueaudio.py
mutagen-1.13/mutagen/wavpack.py
mutagen-1.13/tests/
mutagen-1.13/tests/data/
mutagen-1.13/tests/data/CVE-2007-4619-1.flac
mutagen-1.13/tests/data/CVE-2007-4619-12.flac
mutagen-1.13/tests/data/CVE-2007-4619-2.flac
mutagen-1.13/tests/data/apev2-lyricsv2.mp3
mutagen-1.13/tests/data/bad-TYER-frame.mp3
mutagen-1.13/tests/data/bad-xing.mp3
mutagen-1.13/tests/data/brokentag.apev2
mutagen-1.13/tests/data/click.mpc
mutagen-1.13/tests/data/empty.ofr
mutagen-1.13/tests/data/empty.ofs
mutagen-1.13/tests/data/empty.ogg
mutagen-1.13/tests/data/empty.oggflac
mutagen-1.13/tests/data/empty.spx
mutagen-1.13/tests/data/empty.tta
mutagen-1.13/tests/data/emptyfile.mp3
mutagen-1.13/tests/data/has-tags.m4a
mutagen-1.13/tests/data/id3v22-test.mp3
mutagen-1.13/tests/data/mac-390-hdr.ape
mutagen-1.13/tests/data/mac-396.ape
mutagen-1.13/tests/data/mac-399.ape
mutagen-1.13/tests/data/multipage-setup.ogg
mutagen-1.13/tests/data/multipagecomment.ogg
mutagen-1.13/tests/data/multiplexed.spx
mutagen-1.13/tests/data/no-tags.3g2
mutagen-1.13/tests/data/no-tags.flac
mutagen-1.13/tests/data/no-tags.m4a
mutagen-1.13/tests/data/oldtag.apev2
mutagen-1.13/tests/data/sample.oggtheora
mutagen-1.13/tests/data/silence-1.wma
mutagen-1.13/tests/data/silence-2.wma
mutagen-1.13/tests/data/silence-3.wma
mutagen-1.13/tests/data/silence-44-s-v1.mp3
mutagen-1.13/tests/data/silence-44-s.flac
mutagen-1.13/tests/data/silence-44-s.mp3
mutagen-1.13/tests/data/silence-44-s.wv
mutagen-1.13/tests/data/sv4_header.mpc
mutagen-1.13/tests/data/sv5_header.mpc
mutagen-1.13/tests/data/truncated-64bit.mp4
mutagen-1.13/tests/data/vbri.mp3
mutagen-1.13/tests/data/xing.mp3
mutagen-1.13/tests/__init__.py
mutagen-1.13/tests/test___init__.py
mutagen-1.13/tests/test__util.py
mutagen-1.13/tests/test__vorbis.py
mutagen-1.13/tests/test_apev2.py
mutagen-1.13/tests/test_asf.py
mutagen-1.13/tests/test_easyid3.py
mutagen-1.13/tests/test_flac.py
mutagen-1.13/tests/test_id3.py
mutagen-1.13/tests/test_m4a.py
mutagen-1.13/tests/test_monkeysaudio.py
mutagen-1.13/tests/test_mp3.py
mutagen-1.13/tests/test_mp4.py
mutagen-1.13/tests/test_musepack.py
mutagen-1.13/tests/test_ogg.py
mutagen-1.13/tests/test_oggflac.py
mutagen-1.13/tests/test_oggspeex.py
mutagen-1.13/tests/test_oggtheora.py
mutagen-1.13/tests/test_oggvorbis.py
mutagen-1.13/tests/test_optimfrog.py
mutagen-1.13/tests/test_trueaudio.py
mutagen-1.13/tests/test_wavpack.py
mutagen-1.13/tools/
mutagen-1.13/tools/mid3iconv
mutagen-1.13/tools/mid3v2
mutagen-1.13/tools/moggsplit
mutagen-1.13/tools/mutagen-inspect
mutagen-1.13/tools/mutagen-pony
mutagen-1.13/API-NOTES
mutagen-1.13/COPYING
mutagen-1.13/NEWS
mutagen-1.13/README
mutagen-1.13/TODO
mutagen-1.13/TUTORIAL
mutagen-1.13/setup.py
mutagen-1.13/PKG-INFO
Correcting source permissions - Done
Checking for patches - None found
running build
running build_py
error: package directory 'mutagen' does not exist
Tracking Installation - Using: 'setup.py install'
running install
running build
running build_py
creating build
creating build/lib
creating build/lib/mutagen
copying mutagen/__init__.py -> build/lib/mutagen
copying mutagen/_vorbis.py -> build/lib/mutagen
copying mutagen/_util.py -> build/lib/mutagen
copying mutagen/oggtheora.py -> build/lib/mutagen
copying mutagen/oggflac.py -> build/lib/mutagen
copying mutagen/oggspeex.py -> build/lib/mutagen
copying mutagen/m4a.py -> build/lib/mutagen
copying mutagen/asf.py -> build/lib/mutagen
copying mutagen/id3.py -> build/lib/mutagen
copying mutagen/monkeysaudio.py -> build/lib/mutagen
copying mutagen/wavpack.py -> build/lib/mutagen
copying mutagen/easyid3.py -> build/lib/mutagen
copying mutagen/musepack.py -> build/lib/mutagen
copying mutagen/mp4.py -> build/lib/mutagen
copying mutagen/apev2.py -> build/lib/mutagen
copying mutagen/ogg.py -> build/lib/mutagen
copying mutagen/optimfrog.py -> build/lib/mutagen
copying mutagen/flac.py -> build/lib/mutagen
copying mutagen/trueaudio.py -> build/lib/mutagen
copying mutagen/mp3.py -> build/lib/mutagen
copying mutagen/_constants.py -> build/lib/mutagen
copying mutagen/oggvorbis.py -> build/lib/mutagen
running build_scripts
creating build/scripts-2.5
copying and adjusting tools/mutagen-pony -> build/scripts-2.5
copying and adjusting tools/mutagen-inspect -> build/scripts-2.5
copying and adjusting tools/moggsplit -> build/scripts-2.5
copying and adjusting tools/mid3iconv -> build/scripts-2.5
copying and adjusting tools/mid3v2 -> build/scripts-2.5
changing mode of build/scripts-2.5/mutagen-pony from 666 to 777
changing mode of build/scripts-2.5/mutagen-inspect from 666 to 777
changing mode of build/scripts-2.5/moggsplit from 666 to 777
changing mode of build/scripts-2.5/mid3iconv from 666 to 777
changing mode of build/scripts-2.5/mid3v2 from 666 to 777
running install_lib
running install_scripts
copying build/scripts-2.5/mutagen-pony -> /usr/bin
copying build/scripts-2.5/mutagen-inspect -> /usr/bin
copying build/scripts-2.5/moggsplit -> /usr/bin
copying build/scripts-2.5/mid3iconv -> /usr/bin
copying build/scripts-2.5/mid3v2 -> /usr/bin
changing mode of /usr/bin/mutagen-pony to 777
changing mode of /usr/bin/mutagen-inspect to 777
changing mode of /usr/bin/moggsplit to 777
changing mode of /usr/bin/mid3iconv to 777
changing mode of /usr/bin/mid3v2 to 777
running install_data
copying man/moggsplit.1 -> /usr/share/man/man1
copying man/mutagen-inspect.1 -> /usr/share/man/man1
copying man/mutagen-pony.1 -> /usr/share/man/man1
copying man/mid3v2.1 -> /usr/share/man/man1
copying man/mid3iconv.1 -> /usr/share/man/man1
running install_egg_info
Removing /usr/lib/python2.5/site-packages/mutagen-1.13-py2.5.egg-info
Writing /usr/lib/python2.5/site-packages/mutagen-1.13-py2.5.egg-info
Safe installation - Successful!
Processing package content:
Correcting package permissions - Done
No unstripped ELF binaries were found. Skipping...
No unstripped static archives found. Skipping...
No unstripped shared libraries found. Skipping...
Checking for standard documents - Done
Compressing man pages - Done
Verified slack-desc found - Inserting in the package tree
Searching for links in the PKG_DIR - None found
Making installable package -
./
/usr/libexec/src2pkg/static/tar: mutagen-1.13-i486-1.tar is the archive; not dumped
install/
install/slack-desc
usr/
usr/doc/
usr/doc/mutagen-1.13/
usr/doc/mutagen-1.13/NEWS
usr/doc/mutagen-1.13/README
usr/doc/mutagen-1.13/TODO
usr/doc/mutagen-1.13/COPYING
usr/lib/
usr/lib/python2.5/
usr/lib/python2.5/site-packages/
usr/lib/python2.5/site-packages/mutagen-1.13-py2.5.egg-info
usr/bin/
usr/bin/mutagen-pony
usr/bin/mutagen-inspect
usr/bin/moggsplit
usr/bin/mid3iconv
usr/bin/mid3v2
usr/man/
usr/man/man1/
usr/man/man1/mid3v2.1.gz
usr/man/man1/mutagen-pony.1.gz
usr/man/man1/mutagen-inspect.1.gz
usr/man/man1/mid3iconv.1.gz
usr/man/man1/moggsplit.1.gz
Gzipping mutagen-1.13-i486-1.tar to mutagen-1.13-i486-1.tar.gz
Renaming mutagen-1.13-i486-1.tar.gz to mutagen-1.13-i486-1.tgz
Moving mutagen-1.13-i486-1.tgz to /home/jbhansen/program-downloads/mut
Package Creation - Successful! - Package Location:
/home/jbhansen/program-downloads/mut/mutagen-1.13-i486-1.tgz
Deleting build directories - SRC_DIR PKG_DIR Done
OT: I just noticed you are from Salt Lake... that is where I was from until I went into the Air Force and moved to Germany. I lived in Riverton. I never met very many Slackware users in Utah.
#!/bin/bash
## src2pkg script for: mutagen
## Auto-generated by src2pkg-1.7
## src2pkg Copyright 2005-2007 Gilbert Ashley <amigo@ibilio.org>
## Full package name: mutagen-1.13-i486-1.tgz
SOURCE_NAME='mutagen-1.13.tar.gz'
NAME='mutagen'
VERSION='1.13'
ARCH='i486'
BUILD='1'
PRE_FIX='usr'
# Any extra options go here
INSTALL_LINE='setup.py install'
# EXTRA_CONFIGS=''
# STD_FLAGS='-O2 -march=i486 -mtune=i686'
# Get the functions and configs
. /usr/libexec/src2pkg/FUNCTIONS ;
# do_all_processes can substitute these 16 steps:
pre_process
find_source
make_dirs
unpack_source
fix_source_perms
#configure_source
#compile_source
cd $SRC_DIR
./setup.py build
fake_install
fix_pkg_perms
strip_bins
create_docs
compress_man_pages
make_description
make_doinst
make_package
post_process
# src2pkg - Copyright 2005-2007 Gilbert Ashley <amigo@ibiblio.org>
## See the documentation for more help and examples. Below are some of
# the most common Extras and Options for easy cut-and-paste use.
# EXTRA_CONFIGS='' PRE_FIX='' DOCLIST=''
# MAKE_COMMAND='' INSTALL_LINE=''
# SHELL_INSTALL='YES' CORRECT_PERMS='NO'
Hehe, ya, i only know of one other and he's a friend.
i was in the military as well, Marine Corps. I went to Germany once, it was to fill up our airplane to continue on towards Kuwait .
gnashley might be able to answer that better. I know that a few of src2pkg builds i had to create a src2pkg build file and do it that way. I guess it can only do so much right now.
As far as it not running right the first few times, i think i know why. probably didn't need to CD into it before running the script. probably just needed to do
Well I already have the . added into my path... but just to try I changed it and tried again (good thing this isn't a big compile...)
Code:
/home/jbhansen/program-downloads/mut/mutagen.src2pkg.auto: line 29: .//tmp/mutagen-1.13-src-1/setup.py: No such file or directory
and if I just have $SRC_DIR/setup.py build
Code:
error: package directory 'mutagen' does not exist
I think it might be because it doesn't actually change into the directory when running it, so it executes it from your current location which doesn't have the uncompressed tarball. That would be why cd $SRC_DIR worked. It put you in the right directory.
OT: Yeah a lot of people refuel here. In fact I go out to most of those planes. The funny thing is I actually know 2 other people who use linux in SL. One of them is a big Slackware fan and he is the one that got me to switch. The other flip-flops a lot but he seems to like Gentoo, but he isn't all that knowledgeable (yet he thinks he is).
First of all, src2pkg skips the compile step because it didm't find any sort of Makefile or other recognizable keyfile during the configure_source step.
It seems to me the way to do this is a s suggested, by commenting out configure_source and complied_source. Then jus above fake_install put the lines suggested or as a one liner:
Code:
cd $SRC_DIR && ./setup.py build
This does probably need to be run from within the SRC_DIR since the script probably looks for other stiff relative to where it is run from.
It *might be possible to do this from the command line by using:
If I remember rightly, I tried once to get the 'keyfile' recognition to work for setup.py, but the routine would choke becaue it was trying to run script instead of just seeing that it was there. I finally gave up on it as it is an uncommon thing anyway. Don't expect to always be able to do everything just from the command line. src2pkg tries to do that for the most common sorts of builds. The fact of needing and using a script serves as a visual cue that building the package needs some sort of special handling. Also, as this case shows, it is often quicker to use a script with a couple of changes than to try to figure out how to do it with command-line options.
And about the last post, you have to be in the directory where the src2pkg script is to run it. src2pkg expects the CWD to contain the script if being used. And it will also create temporary files there.
Code:
cd /home/jbhansen/program-downloads/mut/
src2pkg -X
I'm glad that you all like src2pkg and are getting good use out of it. In a few days I'll be uploading a new version with a lot of *big* changes, including the ability to create packages as a normal user. I may try again (someday) to get the thing working more smoothly with python scripts.
I just downloaded the source to try it and sure enough this works fine:
The first didn't work. It complained about ; being an unrecognized command. I also tried && and it complained about that. The second seemed to work, but is that a normal command for setup.py scripts? I had just never heard of doing it that way before. Plus it might be that the script will automatically build if it hasn't been invoked when you run setup.py install.
As far as the CWD for the script I figured that. It is what makes sense.
Again thanks for the great program and I look forward to future releases.
Oops, I just edited my previous post but when the page refreshed I see that you have posted again.
"is that a normal command for setup.py scripts?"
These scripts usually function in th much the same way as a Makefile and will accept multiple commands or 'rules'. (example: make dep all install).
I was unsure whether it would work with the setup.py so I tried it and yes it works.
I also just tried putting the detection of setup.py back into the configure_source routine and it seems to work fine now. So with the next release you'll be able to use simply:
'src2pkg mutagen-1.13.tar.gz'
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.