This really is nasty, please have a look at portageq and use that for the script internals, instead of doing grep on hardcoded VDB location. I really don't have time to rewrite this ATM, but here's some idea: `portageq match / ''` gives you a list of installed packages, save it to pkg `portageq metadata / ebuild $pkg DEPEND` gives you DEPENDs of $pkg, grep it for dev-lang/ocaml and dev-ml/findlib, if you get a match, save it to tocleanstr/tobuildstr - do your job now...
Created attachment 142729 [details] ocaml-rebuild.sh A quick rewrite... play with this. :)
$ time dash ocaml-rebuild2.sh [...] real 10m39.998s user 8m45.153s sys 0m47.599s $ time dash /usr/sbin/ocaml-rebuild.sh [...] real 0m38.953s user 0m5.736s sys 0m0.468s is that really something we want to move to ?!?
Created attachment 155605 [details] Some clean up without messing too much around I got an error in line 38 of the old script anyway, so I cleaned up the script at least. Even fixed some typos.
(In reply to comment #3) > Created an attachment (id=155605) [edit] > Some clean up without messing too much around > > I got an error in line 38 of the old script anyway, so I cleaned up the script > at least. Even fixed some typos. > hmm yeah that's the slot stuff I had been poked about. I was thinking about simplifying the stuff here, but first the story: - the script removes & reinstalls ocaml packages - it used to do =cat/pkg-version, which fails if the package has been removed since it was installed - it was then changed to >=cat/pkg-version - then it didnt reinstall slotted packages So what I'm thinking about is something: emerge >=cat/pkg-version:slot that'll remove the slot hack and should fix your syntax error. About the change from `` to $(), I'd prefer the former as it seems `` is supported by more shells (even if we force bash for now, and even if $() is "nicer")
(In reply to comment #4) > hmm yeah that's the slot stuff I had been poked about. > I was thinking about simplifying the stuff here, but first the story: > - the script removes & reinstalls ocaml packages > - it used to do =cat/pkg-version, which fails if the package has been removed > since it was installed > - it was then changed to >=cat/pkg-version > - then it didnt reinstall slotted packages Just by the way, there exist qatom which can do the atom extraction for you. > So what I'm thinking about is something: > emerge >=cat/pkg-version:slot > > that'll remove the slot hack and should fix your syntax error. I am fine with it. > About the change from `` to $(), I'd prefer the former as it seems `` is > supported by more shells (even if we force bash for now, and even if $() is > "nicer") That makes me sad. :)
well, now ocaml-3.12.0-r1 installs a portage set file to replace ocaml-rebuild.sh; emerge @ocaml-rebuild ->fixed