Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
help with subversion_src_unpack and ${A}
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Portage & Programming
View previous topic :: View next topic  
Author Message
turtles
Veteran
Veteran


Joined: 31 Dec 2004
Posts: 1234

PostPosted: Fri May 17, 2013 6:24 pm    Post subject: help with subversion_src_unpack and ${A} Reply with quote

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
View user's profile Send private message
Hu
Watchman
Watchman


Joined: 06 Mar 2007
Posts: 8854

PostPosted: Sat May 18, 2013 1:55 am    Post subject: Reply with quote

When using a live ebuild, do not define subversion_src_unpack. Let the eclass handle it.
Back to top
View user's profile Send private message
turtles
Veteran
Veteran


Joined: 31 Dec 2004
Posts: 1234

PostPosted: Sat May 18, 2013 2:02 pm    Post subject: Reply with quote

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
View user's profile Send private message
Hu
Watchman
Watchman


Joined: 06 Mar 2007
Posts: 8854

PostPosted: Sat May 18, 2013 5:00 pm    Post subject: Reply with quote

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
View user's profile Send private message
turtles
Veteran
Veteran


Joined: 31 Dec 2004
Posts: 1234

PostPosted: Sun May 19, 2013 9:06 am    Post subject: Reply with quote

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
View user's profile Send private message
steveL
Advocate
Advocate


Joined: 13 Sep 2006
Posts: 2414
Location: The Peanut Gallery

PostPosted: Sun May 19, 2013 3:28 pm    Post subject: Reply with quote

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
View user's profile Send private message
turtles
Veteran
Veteran


Joined: 31 Dec 2004
Posts: 1234

PostPosted: Mon May 20, 2013 1:02 am    Post subject: Reply with quote

Thanks Steve!
_________________
Donate to Gentoo
Back to top
View user's profile Send private message
steveL
Advocate
Advocate


Joined: 13 Sep 2006
Posts: 2414
Location: The Peanut Gallery

PostPosted: Mon May 20, 2013 11:55 am    Post subject: Reply with quote

You're very welcome, turtles :-)

Can I just check: you're doing a conditional inherit of the svn eclass?
Back to top
View user's profile Send private message
mv
Advocate
Advocate


Joined: 20 Apr 2005
Posts: 4011

PostPosted: Mon May 20, 2013 12:24 pm    Post subject: Reply with quote

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
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Portage & Programming All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum