RPM Community Forums

Mailing List Message of <rpm-users>

Utilizing _Rsourcedir to employ local cache of files

From: Tobias Gerschner <tobias.gerschner@gmail.com>
Date: Sat 03 Dec 2011 - 03:08:17 CET
Message-ID: <CANTR+TftiBqctOxFL8tn9n34CU_qABxmPY26ci96TQ6T=wGiUg@mail.gmail.com>
I'm trying to improve the local caching of files to speed up a few elements
for our distributed build system. I recall conversations with Jeff that and
/or Per that _Rsourcedir might be the right tunable for this task.

The basic idea is to create a variable prefix , based on the name of the
processed pkg to make the cache roughly human readable.

PKG=primary name of the package i.e. `rpm -q --specfile /path/to/foo.spec
--qf '%{name}\n' | head -n 1` = 'foo'

if  [ "${PKG:0:3}" == "lib" ]
then
  prefix_length=4
else
  prefix_length=1
fi

source_cache_prefix="/var/source-cache/${PKG:0:$prefix_length}"

[[ -n "${source_cache_prefix}" ]] ||
source_cache_prefix="/var/source-cache/default"
[[ -d "${source_cache_prefix}" ]] || mkdir -p ${source_cache_prefix}
rpmbuild -v -bs --nodeps --define _Rsourcedir${source_cache_prefix}
--define _topdir${_topdir} --define _patchdir${_topdir} --define
_sourcedir${_topdir} --define _srcrpmdir${srcrpmdir} ${tspec}

The expectation from my end is that the file is retrieved from the
_Rsourcedir resource (if existing) instead of the full URL provided in the
spec file. Is that assumption / expectation correct? According to ntop and
tcpdump the files are downloaded every single time.

Is Rsourcedir the right tool for the task or do I need to tune it somehow
different - or can what I am trying to do, not be achieved. is _RSourcedir
even dynamically definable?

I am still using rpm 5.2.x with a snapshot from 2010-10-19

Thanks for any input.

-- 
Tobias Gerschner
Yoper Linux - www.yoper-linux.org

Knowing is not enough; we must apply. Willing is not enough; we must do.
Received on Sat Dec 3 03:14:36 2011
Driven by Jeff Johnson and the RPM project team.
Hosted by OpenPKG and Ralf S. Engelschall.
Powered by FreeBSD and OpenPKG.