Mailinglist Archive: opensuse-buildservice (213 mails)

< Previous Next >
[opensuse-buildservice] [Patch/RFC] osc: only use needed packages for createrepos
  • From: "Jan-Simon Möller" <dl9pf@xxxxxx>
  • Date: Wed, 3 Jun 2009 01:11:27 +0200
  • Message-id: <200906030111.28127.dl9pf@xxxxxx>
Hi!

While doing some kiwi builds with "osc build foo.kiwi", I noticed that it took
ages
to setup the chroot and also to run createrepo. This is because _all_
repositories
in the cache get copied and indexed.
This can be more than annoying (read: pita) if you've a big cache.

The attached patch is a first shot to use only the needed packages (or repos).

Comments ?

Best,
Jan-Simon
Index: src/clientlib/python/osc/osc/build.py
===================================================================
--- src/clientlib/python/osc/osc/build.py (Revision 7472)
+++ src/clientlib/python/osc/osc/build.py (Arbeitskopie)
@@ -9,6 +9,7 @@
import re
import sys
from tempfile import NamedTemporaryFile
+from shutil import rmtree
from osc.fetch import *
from osc.core import get_buildinfo, store_read_apiurl, store_read_project,
store_read_package, meta_exists, quote_plus, get_buildconfig
import osc.conf
@@ -418,8 +419,46 @@
# now update the package cache
fetcher.run(bi)

- if build_type == 'kiwi' and not os.path.exists('repos'):
- os.symlink(config['packagecachedir'], 'repos')
+ newkiwirepo = true
+ # its bad linking the complete packagecache as createrepo will run over
_all_
+ # so lets just link the needed packages
+ if newkiwirepo:
+ if build_type == 'kiwi':
+ if not os.path.exists('repos'):
+ os.mkdir('repos')
+ else:
+ rmtree('repos')
+ os.mkdir('repos')
+ for i in bi.deps:
+ # project
+ pdir = str(i.extproject).replace(':/', ':')
+ # repo
+ rdir = str(i.extrepository).replace(':/', ':')
+ # arch
+ adir = i.repoarch
+ # source dir
+ sdir = config['packagecachedir']+"/"+pdir+"/"+rdir+"/"+adir
+ # project/repo
+ prdir = "repos/"+pdir+"/"+rdir
+ # project/repo/arch
+ pradir = prdir+"/"+adir
+ # source ffn
+ sffn = i.fullfilename
+ print "Using package: "+sffn
+ # target ffn
+ tffn = pradir+"/"+sffn.split("/")[-1]
+ if not os.path.exists(os.path.join(pradir)):
+ os.makedirs(os.path.join(pradir))
+ if not os.path.exists(tffn):
+ os.symlink(sffn, tffn)
+ # or - linking complete arch dirs instead of single files
+ #if not os.path.exists(os.path.join(prdir)):
+ # os.makedirs(os.path.join(prdir))
+ #if not os.path.exists(pradir):
+ # os.symlink(sdir, pradir)
+ else:
+ if build_type == 'kiwi' and not os.path.exists('repos'):
+ os.symlink(config['packagecachedir'], 'repos')

if bi.pacsuffix == 'rpm':
"""don't know how to verify .deb packages. They are verified on install
< Previous Next >
Follow Ups