not-a-blog, not-a-service, not-a-clue.

## get on the rpm bus

with one comment

This is a quickie script which streamlines my RPM building and submission to a single command. Note that this is entirely dependent on our shiny new Package Forge system, which feeds RPMs to multiple platforms for building and eventual submission into our RPM buckets.

All it does is chain up “rpmbuild -bs [spec]; pkgforge submit [srpm]” but it’s a nice timesaver nonetheless. Side-benefits include the automatic generation of a readable ID and provision of a tracking link for pkgforge so that you can anxiously refresh the page to watch the build progress (or you could just wait for the report email…).

So, here is is; my very simple and stupid RPM automation. Suggested name: ‘rpmbus’.

#!/bin/bash
if [[ -z $2 ]]; then echo "RPMbus: build -> submit assist" echo "Usage: basename$0   [pkgforge args]"
exit 1
fi
bucket=$1; shift spec=$1; shift
args=$* output=rpmbuild -bs${spec} | tail -n 1
pkg=echo ${output} | sed -e 's_^Wrote: __' if [[ ! -e${pkg} ]]; then
echo "Package wasn't built: ${output}" exit 1 fi id=basename${spec} | sed -e 's_\.spec__' -e 's_\.__g'-date +"%s"
echo -e "Found source package:\n  ${pkg}" echo " Extra args:${args:-none}"

read -p "Submit to '${bucket}'?" foo if [[${foo} != 'y' ]]; then
echo "Cancelled"
exit 1
fi

echo "Submitting to ${bucket}..." pkgforge submit --id${id} -B ${bucket}${args} ${pkg} && \ echo " https://pkgforge.inf.ed.ac.uk/job/view?id=${id}"


Caveats: well, they’re numerous and they’re pretty apparent. But it took five minutes to write and it WFM :)

Written by gdutton

11 May 2011 at 0855

Posted in DICE, scripty

Tagged with , , , ,

## losing locate

As much as MacOS’ Spotlight is an integral and indispensable part of my interaction with my laptop, a part of me still begrudges the “gratuitous” CPU and disk utilisation which is of course a necessary part of its operation.

However as a hardened Linux user unprepared to do without the luxury of the locate database, my inner resource miser was further upset on discovering that these databases were not shared, and with even more irritation enabled the periodic updatedb cron job, as was suggested by locate itself.

Whether it was SSD envy, a nagging sense of a job half-done or sheer procrastination I’m not sure, but last week I felt compelled to do away with the needless platter-spinning and found the answer far too quickly, in the form of the Spotlight shell utility mdfind.

One alias later:

alias locate="mdfind -name"


and I was able to destroy the locate database, and discontinue its indexing:

launchctl stop /System/Library/LaunchDaemons/com.apple.locate.plist
launchctl unload -w /System/Library/LaunchDaemons/com.apple.locate.plist


whew!

#### Some obligatory qualifications…

This applies largely to OS X 10.6, Snow Leopard. Leopard’s arrangement is slightly different, and I know nothing about earlier versions… And no, it doesn’t support all of locate’s arguments, but I rarely used them (apart from -i) anyway (and don’t have any case-sensitive, indexed filesystems on the mac right now). man mdfind provides workarounds for many of the more unusual uses of locate, and grep provides the rest…

Written by gdutton

5 May 2011 at 1222

Posted in Apple, howto, scripty

Tagged with , , ,