Summary: | app-admin/eselect-postgresql contains bashisms | ||
---|---|---|---|
Product: | Gentoo/Alt | Reporter: | Dmitri Bogomolov <4glitch> |
Component: | FreeBSD | Assignee: | Aaron W. Swenson <titanofold> |
Status: | RESOLVED FIXED | ||
Severity: | normal | CC: | nigoro.dev, sean-gentoo |
Priority: | Normal | ||
Version: | unspecified | ||
Hardware: | All | ||
OS: | FreeBSD | ||
Whiteboard: | |||
Package list: | Runtime testing required: | --- | |
Attachments: | patch for postgresql.eselect |
Description
Dmitri Bogomolov
2011-04-20 13:16:19 UTC
eselect modules are explicitly Bash scripts. Bash-style anything is permitted. I'll figure out a solution to the find stuff. (In reply to comment #1) > eselect modules are explicitly Bash scripts. Bash-style anything is permitted. > > I'll figure out a solution to the find stuff. OK for dev-db/postgresql-base: after rollback to app-admin/eselect-postgresql-0.4 I've been able to do `eselect postgresql set 8.4` on my g/fbsd-8.0. Created attachment 270769 [details]
patch for postgresql.eselect
sample patch for postgresql.eselect
find of FreeBSD doesn't support printf.
Additionally, I do not think that perhaps, there is a command that takes out only the file name.
Therefore, the file name has been taken out by using gawk.
FYI,
-E option
this is necessary so that regex operate appropriately.
Or I can go the easy route and just use a system agnostic approach to the regex: -regex '.*postgresql-[0-9][0-9]*\.[0-9][0-9]*' New version coming soon. 22 Apr 2011; Aaron W. Swenson <titanofold@gentoo.org> -eselect-postgresql-1.0.6.ebuild, -eselect-postgresql-1.0.7.ebuild, +eselect-postgresql-1.0.8.ebuild, metadata.xml: Fixes bug 364257 and bug 364237 (In reply to comment #5) > 22 Apr 2011; Aaron W. Swenson <titanofold@gentoo.org> > -eselect-postgresql-1.0.6.ebuild, -eselect-postgresql-1.0.7.ebuild, > +eselect-postgresql-1.0.8.ebuild, metadata.xml: > Fixes bug 364257 and bug 364237 This is not enough. Look: # eix -Ic postgres [I] app-admin/eselect-postgresql (1.0.8@04/23/11): Utility to select the default PostgreSQL slot [I] dev-db/postgresql-base (8.4.8(8.4)@04/23/11): PostgreSQL libraries and clients [I] dev-db/postgresql-server (8.4.8(8.4)@04/23/11): PostgreSQL server Found 3 matches. # eselect postgresql set 8.4 Setting 8.4 as the default installation... Removing old links...done. Generating new links...find: -xtype: unknown option done. Setting 8.4 as default was successful! # psql -U postgres bash: psql: command not found # grep xtype /usr/share/eselect/modules/postgresql.eselect "-xtype f" "${B_PATH}/bin" "-xtype f" "${B_PATH}/bin" "${curslot//.}" i couldn't get the eselect-postgresql-1.0.8 to work correctly until i modified the find command in /usr/share/eselect/modules/postgresql.eselect - i had to specify the flavor of regex in the find command, and i also had to modify the regex (just like Yuta SATOH). $ find --version $ find (GNU findutils) 4.4.2 RCS file: RCS/postgresql.eselect,v retrieving revision 1.1 diff -uBbw -r1.1 postgresql.eselect --- postgresql.eselect 2011/04/24 03:53:13 1.1 +++ postgresql.eselect 2011/04/24 06:46:36 @@ -87,8 +93,8 @@ ### Get Slots Function ### # Find all available slots in the preferred lib_dir() and return them. get_slots() { - echo $(find "${B_PATH}/$(lib_dir)" -maxdepth 1 -type d \ - -regex '.*postgresql-[0-9][0-9]*\.[0-9][0-9]*' | \ + echo $(find "${B_PATH}/$(lib_dir)/" -regextype posix-extended -maxdepth 1 -type d \ + -regex '.*postgresql-([0-9]+\.[0-9]+)' | \ sed -re 's#.*([0-9]+\.[0-9]+)$#\1#' | sort -n) } (In reply to comment #7) > i couldn't get the eselect-postgresql-1.0.8 to work correctly until i modified > the find command in /usr/share/eselect/modules/postgresql.eselect - i had to > specify the flavor of regex in the find command, and i also had to modify the > regex (just like Yuta SATOH). > > $ find --version > $ find (GNU findutils) 4.4.2 > > RCS file: RCS/postgresql.eselect,v > retrieving revision 1.1 > diff -uBbw -r1.1 postgresql.eselect > --- postgresql.eselect 2011/04/24 03:53:13 1.1 > +++ postgresql.eselect 2011/04/24 06:46:36 > @@ -87,8 +93,8 @@ > ### Get Slots Function ### > # Find all available slots in the preferred lib_dir() and return them. > get_slots() { > - echo $(find "${B_PATH}/$(lib_dir)" -maxdepth 1 -type d \ > - -regex '.*postgresql-[0-9][0-9]*\.[0-9][0-9]*' | \ > + echo $(find "${B_PATH}/$(lib_dir)/" -regextype posix-extended -maxdepth > 1 -type d \ > + -regex '.*postgresql-([0-9]+\.[0-9]+)' | \ > sed -re 's#.*([0-9]+\.[0-9]+)$#\1#' | sort -n) > } The type of regular expression in use doesn't make a difference. Also, '-regextype' is not compatible with BSD. atrus ~ # find /usr/lib -maxdepth 1 -regextype posix-egrep -regex '.*postgresql-[0-9][0-9]*\.[0-9][0-9]*' /usr/lib/postgresql-8.2 /usr/lib/postgresql-8.3 /usr/lib/postgresql-8.4 /usr/lib/postgresql-9.0 /usr/lib/postgresql-9.1 atrus ~ # find /usr/lib -maxdepth 1 -regextype posix-awk -regex '.*postgresql-[0-9][0-9]*\.[0-9][0-9]*' /usr/lib/postgresql-8.2 /usr/lib/postgresql-8.3 /usr/lib/postgresql-8.4 /usr/lib/postgresql-9.0 /usr/lib/postgresql-9.1 atrus ~ # find /usr/lib -maxdepth 1 -regextype posix-basic -regex '.*postgresql-[0-9][0-9]*\.[0-9][0-9]*' /usr/lib/postgresql-8.2 /usr/lib/postgresql-8.3 /usr/lib/postgresql-8.4 /usr/lib/postgresql-9.0 /usr/lib/postgresql-9.1 atrus ~ # find /usr/lib -maxdepth 1 -regextype posix-extended -regex '.*postgresql-[0-9][0-9]*\.[0-9][0-9]*' /usr/lib/postgresql-8.2 /usr/lib/postgresql-8.3 /usr/lib/postgresql-8.4 /usr/lib/postgresql-9.0 /usr/lib/postgresql-9.1 atrus ~ # find /usr/lib -maxdepth 1 -regextype emacs -regex '.*postgresql-[0-9][0-9]*\.[0-9][0-9]*' /usr/lib/postgresql-8.2 /usr/lib/postgresql-8.3 /usr/lib/postgresql-8.4 /usr/lib/postgresql-9.0 /usr/lib/postgresql-9.1 25 Apr 2011; Aaron W. Swenson <titanofold@gentoo.org> -eselect-postgresql-1.0.8.ebuild, +eselect-postgresql-1.0.9.ebuild: Fix bug 364237 again eselect-postgresql-1.0.9 wouldn't work here until i added a trailing slash to the find path, perhaps this was the problem all along: RCS file: RCS/postgresql.eselect,v retrieving revision 1.2 diff -uBbw -r1.2 postgresql.eselect --- postgresql.eselect 2011/04/26 05:02:36 1.2 +++ postgresql.eselect 2011/04/26 05:09:42 @@ -90,7 +90,7 @@ ### Get Slots Function ### # Find all available slots in the preferred lib_dir() and return them. get_slots() { - echo $(find "${B_PATH}/$(lib_dir)" -maxdepth 1 -type d \ + echo $(find "${B_PATH}/$(lib_dir)/" -maxdepth 1 -type d \ -regex '.*postgresql-[0-9][0-9]*\.[0-9][0-9]*' | \ sed -re 's#.*([0-9]+\.[0-9]+)$#\1#' | sort -n) } comment 10 works for me |