Yum Static Repos

Paul B Schroeder paul.schroeder at bluecoat.com
Wed Oct 22 19:41:48 UTC 2008


Mike McLean wrote:
> So, this term 'static-repo' is unfortunate. What folks really mean is 
> 'slowly changing repo at a convenient location.' One way to get such a 
> thing is to make a cronjob that periodically copies the current active 
> repo for a tag to a fixed location.
Just saw this old post.  Coincidentally, I recently patched my kojid (patch below)
to create a symlink to the "latest" repo.  Unless I'm missing something that's
fundamentally wrong with this, it seems easier/better.

So I can now always get to the latest repo via
/mnt/koji/repos/repo_tag/latest.  Add this to kojiweb.conf:
Alias /repos/ "/mnt/koji/repos/"
<Directory "/mnt/koji/repos">
    Options Indexes MultiViews FollowSymLinks
    AllowOverride None
    Order allow,deny
    Allow from all
</Directory>

And the "latest" can be had via http://koji.foo.com/repos/repo_tag/latest.
Be sure to also add this to kojiweb.conf so that your packages can be found:
Alias /packages/ "/mnt/koji/packages/"
<Directory "/mnt/koji/packages">
    Options Indexes MultiViews FollowSymLinks
    AllowOverride None
    Order allow,deny
    Allow from all
</Directory>

Cheers...Paul...


diff --git a/builder/kojid b/builder/kojid
index 8b566a3..aab0f0b 100755
--- a/builder/kojid
+++ b/builder/kojid
@@ -2223,6 +2223,7 @@ class CreaterepoTask(BaseTaskHandler):
             raise koji.GenericError, "Repo %(id)s not in INIT state (got %(state)s)" % rinfo
         pathinfo = koji.PathInfo(options.topdir)
         toprepodir = pathinfo.repo(repo_id, rinfo['tag_name'])
+        latestrepolink = pathinfo.repo('latest', rinfo['tag_name'])
         repodir = "%s/%s" % (toprepodir, arch)
         groupdata = os.path.join(toprepodir, 'groups', 'comps.xml')
         if not os.path.isdir(repodir):
@@ -2266,6 +2267,10 @@ class CreaterepoTask(BaseTaskHandler):
                 files.append(f)
                 session.uploadWrapper("%s/%s" % (datadir, f), uploadpath, f)
 
+        if os.path.lexists(latestrepolink):
+            os.unlink(latestrepolink)
+        os.symlink(toprepodir, latestrepolink)
+
         return [uploadpath, files]
         
 class WaitrepoTask(BaseTaskHandler):





More information about the Fedora-buildsys-list mailing list