AuthorTopic: Help me with scripting this... (Read 6725 times)

I'm planning on really working on the multimedia disc this next week. I'm going to have some days off. I've got all my scripting stuff done but I want to tie it all together. Here's the problem: I need to be able to (re)compile all of my programs with one script. But first, I need to know the order that they should be compiled. That's where I need help. Let's say that I've already compiled every program individually and have the slack-required file there. What I think needs to happen is this:

1. Search for all the slack-required files (They will be named like the name of the program i.e. ardour-slack-required)

2. Go through the dependencies of those files one by one and check and see if I have a $NAME.SlackBuild available. If there is one, then put that the name of the dependency above the name of the program who's slack-required file we are searching.

3. Output it all to a file

Basically I want to be able to run this script and it would search through all the slack-required files, ordering the programs that I have by dependency and outputs it to a file.

Here's an example:Say I have just sox and libsndfile and libmad and libA in my compiling folder. The script would read the sox slack-required and see that libsndfile and libmad are both in there. So, it would put them before sox. The resulting "order" file would look like this:

Quote

libsndfilelibmadsox

Now say that it reads the libmad slack-required file and finds that it depends on libA. The script searches my compileing folder and finds that the libA.SlackBuild is there. It would then put libA before libmad:

Quote

libsndfilelibAlibmadsox

Does this make sense? Could I get some help with the technical details of writing this script? Is there a better way of resolving all these dependencies and compiling them all? Thanks in advance!

2. Go through the dependencies of those files one by one and check and see if I have a $NAME.SlackBuild available. If there is one, then put that the name of the dependency above the name of the program who's slack-required file we are searching.

Where would I search for the SlackBuild files? Is case sensitivity important? (I've seen .slackbuild also.)

Does this make sense? Could I get some help with the technical details of writing this script? Is there a better way of resolving all these dependencies and compiling them all? Thanks in advance!

My idea would be to have an array of dependency tiers and a tabela associativa (rbistolfi would know indicating the tier level for each dependency. Assume that there is only one tier to begin with. Every program added without any dependencies is on tier 0 and recorded as such. Then dependencies come along for programs in tier 0 and are added at tier 1 below. If it so happens that something on tier 0 is required by something, a new tier 0 is formed and the old one gets shifted down with entries in the associative array updated accordingly; if something on tier n has dependencies, they are recorded on tier n+1, etc...

A crappy algorithm indeed, but maybe I'll be able to think of something better when I complete the next semester.

Take a look at my vectorcontrib/Dweeberkitty/BonusDisc/. You will see what I'm talking about. I have an organized set of folders with a standard naming scheme across all of them. Also, the slackbuilds are all named "NAME.SlackBuild" there aren't any that are lower case. Here is what folders and files I have:

Every single package that I have built follows this standard and it is uniform enough that the algorithm used does not have to be written in a broad manner to account for several different scenarios but can be specific for this standard.

If you look in my BonusDisc/Configurations/ORDER file, you'll see why I want to be able to automate this. It is quite daunting to keep track of all dependencies to ensure that a complete rebuild of everything on a clean machine will be successful later down the road.

libmadsoundtouchsconscvsimagingdvd-slideshowfftwfltklibgsaslgst-pythonwxGTKscrollkeeperlibavc1394libiec61883libloilmbaseopenexrlibsndfilelibsampleratetwolameladspaVCO-pluginsREV-pluginsMCP-pluginsFIL-pluginsAMB-pluginscaps-pluginsswh-pluginstap-pluginsjackdssiportaudiojackbeatbitmeterlibquicktimemjpegtoolstranscodesoxlibgnomecanvasffmpeg2theoraraptorliblrdfdvgrabdvdauthordenemolashgtickkinoardourmandvdterminatorXaudacitymusemixxxjackEQjdelayjaminjack-rackqjackctlvkeybdhydrogenlibgiglinuxsamplerliblscpqsamplermanslideavidemuxbloptovidominslibpano13libpano12glewlibxmifreeglutenblendcinepaintsweepmhwaveeditgcpigmentpython-setuptoolsqtractorlivesfluidsynthswamicsoundqsynthTiMidity++guilefontforgeautotracepotracet1utilsmftracetetexqdvdauthorXML-Twigrosegardenlibatomic_opspulseaudiotapiirlibsigc++yafrayblendertse3ttf2pt1lilypondfluidsynth-dssilmmsgavlgmerlinopenmovieeditorspeexhugink9copyoggconvertThis is what the final product should look like. Only the process of getting to that should be automated. Anyway, take a look in my contrib and see if that helps clear things up. Oh, also take a look at my CompileAll.sh script. That might give you some ideas.

In a way, yes. The first thing that the script will have to do is search for all the .SlackBuilds that exist. After that is done we will have a list of all packages that then needs to be ordered. Whatever the process that is used to generate the order, at the end of the day, it must be able to work much the same way as Gslapt and make sure that each dependency is met. However, unlike Gslapt where the dependency of the dependency order doesn't matter because it is all recompiled, we are compiling the dependencies which in turn possibly require other programs to be present which should have been compiled before them. So to answer your question, yes, it does need to detect dependencies of dependencies. Sorry!

You unpack this guy somewhere, cd gen-order, then run python gen-order.py with the root sources directory as the only argument. The default source directory is the current directory, but that would make no sense for this distribution. At the moment, I don't have it looking for SlackBuild files, only printing out the order. Should I raise an exception or something if none is found?? Not sure.

from the link. Could you either reupload it or send it to the email address in my profile. Thanks!

If hanumizzle made a script for you already that`s OK. But if not then I could try. I don`t promise it will be fast as I constantly lack time but I`ll try to do my best. I don`t know where to look for vectorcontrib/Dweeberkitty/BonusDisc/ so if you could specify where to exactly find those example files, that would be nice. Technical note: I will use Tcl (interpreter for this language is present in Vector, it`s tclsh)

Cool. It works! However, I find that it produces dependencies that the packager doesn't care about because they are not compiling it. In other words, the script needs to search to see if the .SlackBuild for the dep exists before adding it to the list. Could you do this? Thanks!