[tools] Patch for displaying repo config info on the distro index page

Chowdhury, Chandan Dutta (STSD) chandan-dutta.chowdhury at hp.com
Fri Jan 5 08:10:52 CET 2007


Hello All,
 
I have made a patch to mrepo-0.8.4 to show the repo configuration info
on the index page (per distro), I think this might be useful for others
too. 
 
The patch and a sample index html are attached here.
 
 
Regards
Chandan Dutta Chowdhury
 
 
mrepo-show-repo-conf.patch
====================
diff -Nur mrepo-0.8.4/config/httpd/mrepo.conf
mrepo-0.8.4-new/config/httpd/mrepo.conf
--- mrepo-0.8.4/config/httpd/mrepo.conf	2006-12-08 20:53:27.000000000
+0100
+++ mrepo-0.8.4-new/config/httpd/mrepo.conf	2007-01-05
12:05:25.000000000 +0100
@@ -2,7 +2,7 @@
 Alias /mrepo /var/www/mrepo
 
 <Directory /var/www/mrepo>
-	Options Indexes FollowSymlinks SymLinksifOwnerMatch
IncludesNOEXEC
+	Options Indexes FollowSymlinks SymLinksifOwnerMatch Includes
 	IndexOptions NameWidth=* DescriptionWidth=*
 
 	### Authentication options
diff -Nur mrepo-0.8.4/html/HEADER.repo.shtml
mrepo-0.8.4-new/html/HEADER.repo.shtml
--- mrepo-0.8.4/html/HEADER.repo.shtml	2006-12-08 20:53:27.000000000
+0100
+++ mrepo-0.8.4-new/html/HEADER.repo.shtml	2007-01-05
12:36:26.000000000 +0100
@@ -5,12 +5,12 @@
 
 <!-- To install Red Hat from the network, select the <b>HTTP
installation method</b> and then specify for Web site name: <b><!--#echo
var="SERVER_NAME" --></b> or <b><!--#echo var="SERVER_ADDR" --></b> and
as Red Hat directory: <b><!--#echo var="REQUEST_URI" --></b>.<br> -->
 
-<u>Apt configuration</u>: Add "rpm http://<!--#echo var="SERVER_NAME"
--> <!--#echo var="REQUEST_URI" --> os updates <i>repo1 repo2 ...</i>"
to /etc/apt/sources.list<br>
+<u>Apt configuration</u>: Add the following to /etc/apt/sources.list OR
/etc/apt/sources.list.d/&lt;list_name&gt;.list<br>"rpm http://<!--#echo
var="SERVER_NAME" --> <!--#exec cmd="python
/usr/share/mrepo/mrepo-header-apt.py" -->"<br>
 
 <!-- The configuration of this Apt repository is:
 <nobr><b>rpm http://<!--#echo var="SERVER_NAME" --> <!--#echo
var="REQUEST_URI" --> <i>os</i> <i>updates</i> <i>extras</i>
<i>&lt;repo&gt;</i></b></nobr><br> -->
 
-<u>Yum configuration</u>: Add "baseurl=http://<!--#echo
var="SERVER_NAME" --><!--#echo var="REQUEST_URI" -->RPMS.<i>repo</i>" to
/etc/yum.conf<br>
+<u>Yum configuration</u>: Add the following to /etc/yum.conf OR
/etc/yum.repos.d/&lt;repo_name&gt;.repo <br> <!--#exec cmd="python
/usr/share/mrepo/mrepo-header-yum.py" --><br>
 
 <!-- The configuration of this Yum repository is:
 <nobr><b>baseurl=http://<!--#echo var="SERVER_NAME" --><!--#echo
var="REQUEST_URI" -->RPMS.<i>&lt;repo&gt;</i></b></nobr><br> -->
diff -Nur mrepo-0.8.4/Makefile mrepo-0.8.4-new/Makefile
--- mrepo-0.8.4/Makefile	2006-12-08 20:53:27.000000000 +0100
+++ mrepo-0.8.4-new/Makefile	2007-01-05 12:36:46.000000000 +0100
@@ -32,6 +32,7 @@
 
 	install -d -m0755 $(DESTDIR)$(htmldir)
 	install -p -m0644 html/* $(DESTDIR)$(htmldir)
+	install -p -m0644 mrepo-header-*.py $(DESTDIR)$(datadir)/mrepo
 
 	install -d -m0755 $(DESTDIR)$(srcdir)/all/
 	install -d -m0755 $(DESTDIR)$(wwwdir)
diff -Nur mrepo-0.8.4/mrepo-header-apt.py
mrepo-0.8.4-new/mrepo-header-apt.py
--- mrepo-0.8.4/mrepo-header-apt.py	1970-01-01 01:00:00.000000000
+0100
+++ mrepo-0.8.4-new/mrepo-header-apt.py	2007-01-05 12:40:38.000000000
+0100
@@ -0,0 +1,16 @@
+#!/bin/env python
+import glob
+import os
+import string
+
+REQUEST_URI=os.getenv("REQUEST_URI")
+CLEAN_URI=string.strip(REQUEST_URI,"/")
+print CLEAN_URI
+
+REPL="/var/www"+REQUEST_URI
+REPOS=glob.glob(REPL+"RPMS.*")
+REPOS.insert(0,"<b>")
+REPOS.append("</b>")
+REPOS=" ".join(REPOS)
+print REPOS.replace(REPL+"RPMS.", "")
+
diff -Nur mrepo-0.8.4/mrepo-header-yum.py
mrepo-0.8.4-new/mrepo-header-yum.py
--- mrepo-0.8.4/mrepo-header-yum.py	1970-01-01 01:00:00.000000000
+0100
+++ mrepo-0.8.4-new/mrepo-header-yum.py	2007-01-05 12:40:30.000000000
+0100
@@ -0,0 +1,15 @@
+#!/bin/env python
+import glob
+import string
+import os
+
+REQUEST_URI=os.getenv("REQUEST_URI")
+SERVER_NAME=os.getenv("SERVER_NAME")
+REPL="/var/www"+REQUEST_URI
+REPOS=" ".join(glob.glob(REPL+"RPMS.*")).replace(REPL+"RPMS.", '')
+for repo in REPOS.split(" "):
+        print "<b>["+repo+"]</b><br>"
+        print "baseurl=http://%s%s<b>RPMS.%s</b><br>" % (SERVER_NAME,
REQUEST_URI, repo)
+        print "enabled=1<br>"
+        print "gpgcheck=0<br>"
+

-------------- next part --------------
A non-text attachment was scrubbed...
Name: mrepo-show-repo-conf.patch
Type: application/octet-stream
Size: 3913 bytes
Desc: mrepo-show-repo-conf.patch
Url : http://lists.rpmforge.net/pipermail/tools/attachments/20070105/ac1acd88/mrepo-show-repo-conf.obj
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.rpmforge.net/pipermail/tools/attachments/20070105/ac1acd88/sample.htm


More information about the tools mailing list