View previous topic :: View next topic |
Author |
Message |
turtles Veteran
Joined: 31 Dec 2004 Posts: 1657
|
Posted: Fri May 17, 2013 6:24 pm Post subject: help with subversion_src_unpack and ${A} |
|
|
I am working on an ebuild for a webapp that optionally can just checkout the latest svn.
I am not sure how it should work though.
I have different SRC_URI= and
ESVN_REPO_URI=
in a block like this:
Code: | if [[ ${PV} != *9999* ]]; then
SRC_URI="http://downloads.sourceforge.net/ledger-smb/files/${P}.tar.gz"
KEYWORDS="amd64 x86 ppc"
WEBAPP_MANUAL_SLOT="yes"
SLOT="3"
else
ESVN_REPO_URI="svn://svn.code.sf.net/p/ledger-smb/code/trunk"
ESVN_PROJECT="${PN}"
KEYWORDS="~x86 ~amd64 ~ppc"
WEBAPP_MANUAL_SLOT="yes"
SLOT="4"
fi |
Then I have Code: |
if [[ ${PV} != *9999* ]]; then
src_unpack() {
unpack ${A}
cd "${S}"
# clean up unwanted cruft
rm -rf configure_apache.sh winprint.bat dists/{deb,rpm,slackware,source,win32} doc/COPYRIGHT
rm -f dists/gentoo/*.ebuild dists/gentoo/{ChangeLog,metadata.xml}
mv doc/manual/*.txt doc/
use doc || rm -rf doc/coding-standard.* doc/API doc/samples doc/manual
mv {Build,Makefile}.PL contrib/
mv utils/ contrib/
}
else
subversion_src_unpack() {
unpack ${A}
cd "${S}"
}
fi
|
With this on the 9999 ebuild I get Quote: | "Nothing passed to the 'unpack' command" |
I read through:
http://devmanual.gentoo.org/ebuild-writing/functions/src_unpack/svn-sources/index.html
http://devmanual.gentoo.org/ebuild-writing/functions/src_unpack/index.html
States:
The ${A} variable contains all of the SRC_URI components...
So what contains the ESVN_REPO_URI components ?
Thanks in advance _________________ Donate to Gentoo |
|
Back to top |
|
|
Hu Moderator
Joined: 06 Mar 2007 Posts: 21635
|
Posted: Sat May 18, 2013 1:55 am Post subject: |
|
|
When using a live ebuild, do not define subversion_src_unpack. Let the eclass handle it. |
|
Back to top |
|
|
turtles Veteran
Joined: 31 Dec 2004 Posts: 1657
|
Posted: Sat May 18, 2013 2:02 pm Post subject: |
|
|
Thanks for the guidance on that .
That is what I tried first and the
Code: | src_unpack() {
unpack ${A}
cd "${S}" | complained
"Nothing passed to the 'unpack' command" _________________ Donate to Gentoo |
|
Back to top |
|
|
Hu Moderator
Joined: 06 Mar 2007 Posts: 21635
|
Posted: Sat May 18, 2013 5:00 pm Post subject: |
|
|
When you use a live ebuild, $A is not set. Do not define an unpack function if you do not need one. The default function defined by the eclass is sufficient. Go back to the second code block in your first post and delete the else clause and everything in it. Cleanup of unwanted cruft should be done in src_prepare, not src_unpack. If you must use src_unpack, then define your src_unpack as: Code: | src_unpack() {
subversion_src_unpack
# Clean up cruft
#... rm statements ...
} |
|
|
Back to top |
|
|
turtles Veteran
Joined: 31 Dec 2004 Posts: 1657
|
Posted: Sun May 19, 2013 9:06 am Post subject: |
|
|
Thanks Hu that worked well.
I can run the ebuild without errors
I am sure it needs lots of tweaking since it is a web application.
One more question:
How can I check which version of apache is installed and install the appropriate config file?
webapp-config?
So far I have
Code: | #Check apache version
version=$(apache2 -v | grep "Server version")
if [[ $version =~ "2.4" ]];
then echo "Configuring for new Apache 2.4 series: " $version
config_file='ledgersmb-httpd-2.4.conf.template'
else echo "Configuring for Apache2 series: " $version
let config_file='ledgersmb-httpd.conf.template'
webapp_server_configfile apache dists/gentoo/config_file |
Which works as a bash script but not a ebuild.
Thanks in advance _________________ Donate to Gentoo |
|
Back to top |
|
|
steveL Watchman
Joined: 13 Sep 2006 Posts: 5153 Location: The Peanut Gallery
|
Posted: Sun May 19, 2013 3:28 pm Post subject: |
|
|
turtles wrote: | How can I check which version of apache is installed and install the appropriate config file? |
Use has_version or best_version. eg: Code: | if has_version '>=www-servers/apache-2.4'; then
einfo "Configuring for new Apache 2.4 series"
..
elif has_version '>=www-servers/apache-2.2'; then
..
elif has_version '>=www-servers/nginx-1.4'; then
..
else ..
fi |
Note that you must quote the atom, or > will be seen as a redirection to filename '=www-servers/...'
- or using best_version:
Code: | some_func() {
local conf httpd httpd_ver
httpd_ver=$(best_version www-servers/apache)
case $httpd_ver in
2.4.*) einfo "Configuring for new Apache 2.4 series: $httpd_ver"
httpd=apache conf='...'
;; 2.2.*) einfo "Configuring for Apache 2.2: $httpd_ver"
httpd=apache conf='...'
;; '') false
;; *) ewarn "Unsupported apache version: $httpd_ver"; false
esac || {
# look for other web-servers
}
[[ $conf ]] || return # returns 1 (ie false)
..
return 0
}
|
Don't ask me why that doesn't line up, it does perfectly well in the edit-box.
HTH,
steveL.
edit: couple of $apache_ver remaining, needed to be $httpd_ver
Last edited by steveL on Mon May 20, 2013 11:53 am; edited 1 time in total |
|
Back to top |
|
|
turtles Veteran
Joined: 31 Dec 2004 Posts: 1657
|
Posted: Mon May 20, 2013 1:02 am Post subject: |
|
|
Thanks Steve! _________________ Donate to Gentoo |
|
Back to top |
|
|
steveL Watchman
Joined: 13 Sep 2006 Posts: 5153 Location: The Peanut Gallery
|
Posted: Mon May 20, 2013 11:55 am Post subject: |
|
|
You're very welcome, turtles :-)
Can I just check: you're doing a conditional inherit of the svn eclass? |
|
Back to top |
|
|
mv Watchman
Joined: 20 Apr 2005 Posts: 6747
|
Posted: Mon May 20, 2013 12:24 pm Post subject: |
|
|
steveL wrote: | Can I just check: you're doing a conditional inherit of the svn eclass? |
Conditional inherits depending on the filename are fine. This is used many times in the tree and in overlays to make the same ebuild working for "normal" as well as "live" ebuilds. |
|
Back to top |
|
|
|