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

Chowdhury, Chandan Dutta (STSD) chandan-dutta.chowdhury at hp.com
Mon Jan 8 04:43:46 CET 2007


Sorry for replying to my own mail, but it seems the attachments were not
of much help. So here is the output for the index page for distro
rhel4-as. There are 4 repositories
Custom, repo1, repo2, repo3 (and also all). This is the config info
available on http://15.42.229.246/mrepo/rhel4as-i386/ after applying the
patch (submitted in the previous mail)


Network installation: Select "HTTP installation method" >
"15.42.229.246" > "/mrepo/rhel4as-i386/" during installation
Apt configuration: Add the following to /etc/apt/sources.list OR
/etc/apt/sources.list.d/<list_name>.list
"rpm http://15.42.229.246 mrepo/rhel4as-i386 repo3 repo2 all repo1
custom "
Yum configuration: Add the following to /etc/yum.conf OR
/etc/yum.repos.d/<repo_name>.repo
[repo3]
baseurl=http://15.42.229.246/mrepo/rhel4as-i386/RPMS.repo3
enabled=1
gpgcheck=0
[repo2]
baseurl=http://15.42.229.246/mrepo/rhel4as-i386/RPMS.repo2
enabled=1
gpgcheck=0
[all]
baseurl=http://15.42.229.246/mrepo/rhel4as-i386/RPMS.all
enabled=1
gpgcheck=0
[repo1]
baseurl=http://15.42.229.246/mrepo/rhel4as-i386/RPMS.repo1
enabled=1
gpgcheck=0
[custom]
baseurl=http://15.42.229.246/mrepo/rhel4as-i386/RPMS.custom
enabled=1
gpgcheck=0


Regards
Chandan Dutta Chowdhury

-----Original Message-----
From: Chowdhury, Chandan Dutta (STSD) 
Sent: Friday, January 05, 2007 12:41 PM
To: 'tools at lists.rpmforge.net'
Subject: Patch for displaying repo config info on the distro index page

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>"
+



More information about the tools mailing list