Using XSLT 2.0 To Optimize Linux Distributions

by M. David Peterson

Update: So much thanks goes out to james (and of course, Ben for getting the party started with his first submission for a Unix 1 line command equivalent to my 60 lines of XSLT.), who has not only helped optimize the optimization process, but has also solved the bug that was excluding some of the necessary dependencies for everything to work properly.

I've checked the results into the repository, which can be viewed @ (see Changeset 3899 for the specific diff details)

Thanks for all of your help, james!


2007-02-18 15:19:39
using sed and sort that would be a one-liner...
M. David Peterson
2007-02-19 00:00:26

Looks like I need to do some quick research. That said, would you mind providing a quick sample? Would be *much* appreciated :D

2007-02-19 09:53:11
sort -u dep-list | grep -v 'dynamic' > deduped-del-list
M. David Peterson
2007-02-19 10:12:17
Gracias, Ben! Will bring this to the top of the post to ensure this handy tip is properly propagated.
2007-02-19 11:48:35
here comes my one-liner:

sed '/^[^/]/d' < dep-list | sort -u > deduped-del-list

Ben's solution leaves a blank line at the top of the file
which can be easily spotted by running diff.

M. David Peterson
2007-02-19 11:58:12

I *LOVE* it! The competition heats up... ;) Will bring this to the top now.

2007-02-19 11:59:05
"/lib/ld" is missing from your dep-list, yet it appears in the deduped one.

Apparently my first one-liner also left a blank line, heh. Here's a smarter one:

sed -n '/^\//p' < dep-list | sort -u > deduped-del-list

M. David Peterson
2007-02-19 12:20:58

> "/lib/ld" is missing from your dep-list, yet it appears in the deduped one.

Yeah, that's something I hacked into the transformation file @

for some reason the linux /lib/ld* library/symlink are not being copied into the dep list
As such, a hack, which will place this before the other entries.

<xsl:text>/lib/ld</xsl:text><xsl:value-of select="$linebreak"/>

I haven't figured out why the /lib/ld isn't in the dep-list as of yet, but it has something directly to do with which processes this > < list of directories to determine which dependencies are required. I think what I still need to do is to first dedup the result list from the first process, to then process the results with the same (or at least similar) process contained in "build-dep-list", which looks like,

for name in `cat bin-dir-list`; do
for name in $name*; do
ldd $name | cut -d ' ' -f3 | cut -d '.' -f1 >> dep-list

Which I think would make sense, given the fact that there are going to be shared libraries in which have dependencies on other shared libraries. Obviously there's still a bit work that needs to be done to perfect the overall optimization process. ;)

Thanks for the follow-up, james! I must admit, this is *MUCH* more fun that writing entries on ODF vs. EOOXML to then spend my days getting my a$$ virtually kicked by follow-up comments from members of my "M. David $uck$ rock$" not-so-much-a-fan club members ;) :D

2007-02-19 13:13:00
maybe this one would do the trick:

ldd $name | sed '/> (/d;s/^[^/]*\(\/[^ ][^ ]*\) .*$/\1/' >> dep-list

M. David Peterson
2007-02-19 13:17:50

let me try that now. Thanks! :D

M. David Peterson
2007-02-19 13:34:46

You are my new hero! That works *GREAT*! :D

M. David Peterson
2007-02-19 14:00:00
So I just pulled this all together into the same build-dep-list script, and checked in the result. via the changeset @

updated with a whole bunch of kick a17563 capabilities provided courtesy of james@ (as well as several comments above this one)

OF course, now I need to find out why "a$$" was expanded to "a17563" in the check-in notes, but that's less of a concern at this stage than is the fact that this now works the way it should. :)

Thanks again for your help, james!

2007-02-19 14:51:13
I'm glad 'sed' could help you.

As for the a$$ - $$ got replaced by the current process ID.

M. David Peterson
2007-02-19 14:57:58
> As for the a$$ - $$ got replaced by the current process ID.

Ahhh... Okay, that now makes sense. Thanks! Oh, and when you see 'sed' next, give (him/her/it) my thanks, would ya? ;)