Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
portage depending on apps-shells/bash?
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Installing Gentoo
View previous topic :: View next topic  
Author Message
totony
n00b
n00b


Joined: 03 Dec 2014
Posts: 40

PostPosted: Mon Mar 30, 2015 9:55 pm    Post subject: portage depending on apps-shells/bash? Reply with quote

Hi,

It may be a bug in the ebuilds, but bash is currently a dependency to portage. Is it really a dependency, or could any sh shell work?

Is there a virtual package for a sh-compatible shell that could be given as a dependency instead (I use zsh, which is sh-compatible)?

Thanks,
Totony.

EDIT: Nevermind, I just found out I could put bash in portage/provided
Back to top
View user's profile Send private message
yoshi314
l33t
l33t


Joined: 30 Dec 2004
Posts: 848
Location: PL

PostPosted: Tue Mar 31, 2015 8:04 am    Post subject: Reply with quote

I think ebuilds or some portage functions expect bash to be there.
_________________
~amd64
shrink your /usr/portage with squashfs+aufs
Back to top
View user's profile Send private message
yngwin
Retired Dev
Retired Dev


Joined: 19 Dec 2002
Posts: 4572
Location: Suzhou, China

PostPosted: Tue Mar 31, 2015 1:59 pm    Post subject: Reply with quote

Portage specifically needs bash. It won't work with just any sh-compatible shell.
_________________
"Those who deny freedom to others deserve it not for themselves." - Abraham Lincoln
Free Culture | Defective by Design | EFF
Back to top
View user's profile Send private message
Ant P.
Watchman
Watchman


Joined: 18 Apr 2009
Posts: 5761

PostPosted: Tue Mar 31, 2015 6:18 pm    Post subject: Reply with quote

Unless you feel like rewriting 100000 ebuilds, eclasses and internal functions, Portage needs bash.
Back to top
View user's profile Send private message
totony
n00b
n00b


Joined: 03 Dec 2014
Posts: 40

PostPosted: Wed Apr 01, 2015 12:11 am    Post subject: Reply with quote

yngwin wrote:
Portage specifically needs bash. It won't work with just any sh-compatible shell.


Thanks for the precision, may I ask what function it uses (in what case)? (If you know, or could you point me to where i could learn about it?)

I will test it in some days, but I just did ln -s zsh /bin/bash for now (i'll see if it works)
Back to top
View user's profile Send private message
Ant P.
Watchman
Watchman


Joined: 18 Apr 2009
Posts: 5761

PostPosted: Wed Apr 01, 2015 1:18 am    Post subject: Reply with quote

totony wrote:
yngwin wrote:
Portage specifically needs bash. It won't work with just any sh-compatible shell.


Thanks for the precision, may I ask what function it uses (in what case)?

The entire ebuild tree is written in Bash syntax. The minimum required version is 4.0.
Quote:
(If you know, or could you point me to where i could learn about it?)

/usr/portage
app-doc/pms

Quote:
I will test it in some days, but I just did ln -s zsh /bin/bash for now (i'll see if it works)

It won't. You're going to brick your system.
Back to top
View user's profile Send private message
totony
n00b
n00b


Joined: 03 Dec 2014
Posts: 40

PostPosted: Wed Apr 01, 2015 2:13 am    Post subject: Reply with quote

Ant P. wrote:
totony wrote:
yngwin wrote:
Portage specifically needs bash. It won't work with just any sh-compatible shell.


Thanks for the precision, may I ask what function it uses (in what case)?

The entire ebuild tree is written in Bash syntax. The minimum required version is 4.0.


Thank you, I thought this was sh syntax. I'll report back whether my system gets bricked or not (I'm testing things, so it does not really matter if it does).

Totony
Back to top
View user's profile Send private message
steveL
Watchman
Watchman


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

PostPosted: Thu Apr 02, 2015 4:05 am    Post subject: Reply with quote

No, ebuilds (and thus portage) absolutely require bash, and that is not going to change.

That's not sh syntax, btw, except insofar as bash is a superset of sh; extensions are principally ksh-derived in bash, but there are some things (like printf -v) that are specific to bash itself.

#bash on IRC: chat.freenode.net are your friends (if a little grumpy, on occasion. ;)

See the FAQ (and whatever you do, beware other sources on the Net, especially TLDP/ABS which is well-known to be crap.)
Back to top
View user's profile Send private message
totony
n00b
n00b


Joined: 03 Dec 2014
Posts: 40

PostPosted: Thu Apr 02, 2015 4:36 am    Post subject: Reply with quote

Yep, won't work with zsh as you expected, crashes quite early trying to select a profile.

Quote:
require bash, and that is not going to change.

I understand why it wouldn't change (it would take way[/quote] too much work), but why wasn't portage made only in python? It already has a (good) interpreter as a dependency, was/is bash really needed?
Back to top
View user's profile Send private message
steveL
Watchman
Watchman


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

PostPosted: Thu Apr 02, 2015 4:11 pm    Post subject: Reply with quote

totony wrote:
I understand why it wouldn't change (it would take way too much work), but why wasn't portage made only in python? It already has a (good) interpreter as a dependency, was/is bash really needed?

Huh? The question would be more about why use python at all, for most people.

At some point you're going to need to do things in a shell; for things like eclasses et al, bash is much more flexible than sh, and already a mandated part of every GNU/Linux installation, so we might as well use it.

eg: arrays are very useful.
Back to top
View user's profile Send private message
yngwin
Retired Dev
Retired Dev


Joined: 19 Dec 2002
Posts: 4572
Location: Suzhou, China

PostPosted: Sat Apr 04, 2015 2:51 pm    Post subject: Reply with quote

totony wrote:
yngwin wrote:
Portage specifically needs bash. It won't work with just any sh-compatible shell.


Thanks for the precision, may I ask what function it uses (in what case)? (If you know, or could you point me to where i could learn about it?)

I will test it in some days, but I just did ln -s zsh /bin/bash for now (i'll see if it works)

First of all, several helper functions use bash syntax and because of that call /bin/bash directly. Look at /usr/lib/portage/python*/*.sh.

Also, as already mentioned, ebuilds and eclasses and profiles are written in bash-4. While most of this is zsh compatible, some use advanced bash features.
_________________
"Those who deny freedom to others deserve it not for themselves." - Abraham Lincoln
Free Culture | Defective by Design | EFF
Back to top
View user's profile Send private message
mv
Watchman
Watchman


Joined: 20 Apr 2005
Posts: 6281

PostPosted: Sat Apr 04, 2015 5:07 pm    Post subject: Reply with quote

Not to forget: portage needs a way to save the state of all variables (even those not in an environment!); this is not possible in POSIX and works probably differently in zsh. There are really many places in the portage code itself where advanced bash features are used.
Not to speak about all the code in the eclasses where things like "$FUNCNAME" and other special bash variables are used regularly.
Back to top
View user's profile Send private message
steveL
Watchman
Watchman


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

PostPosted: Sat Apr 04, 2015 6:50 pm    Post subject: Reply with quote

yngwin wrote:
Also, as already mentioned, ebuilds and eclasses and profiles are written in bash-4. While most of this is zsh compatible, some use advanced bash features.

It was the same when there was no bash-4; ebuilds still required bash.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Installing Gentoo 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