[svn] r3537 - in trunk/tools/pydar2: pydar scripts

packagers at lists.rpmforge.net packagers at lists.rpmforge.net
Fri Aug 26 20:52:37 CEST 2005


Author: dries
Date: 2005-08-26 20:52:36 +0200 (Fri, 26 Aug 2005)
New Revision: 3537

Modified:
   trunk/tools/pydar2/pydar/specrepositoryspecfile.py
   trunk/tools/pydar2/pydar/tagsfile.py
   trunk/tools/pydar2/scripts/rpmforgesite.py
Log:
update

Modified: trunk/tools/pydar2/pydar/specrepositoryspecfile.py
===================================================================
--- trunk/tools/pydar2/pydar/specrepositoryspecfile.py	2005-08-26 08:30:56 UTC (rev 3536)
+++ trunk/tools/pydar2/pydar/specrepositoryspecfile.py	2005-08-26 18:52:36 UTC (rev 3537)
@@ -35,6 +35,7 @@
         self.rpmfilenames = []
         self.srpmfilenames = []
         self.binaryrpms = []
+        self.sourcerpms = []
         #self.cat.debug("start, specRepositoryName=" + self.specRepositoryName + ",specRepositoryRootDir=" + self.specRepositoryRootDir + ",subDir=" + self.subDir + ",fileName=" + self.fileName)
 
     def getCheckSum(self):

Modified: trunk/tools/pydar2/pydar/tagsfile.py
===================================================================
--- trunk/tools/pydar2/pydar/tagsfile.py	2005-08-26 08:30:56 UTC (rev 3536)
+++ trunk/tools/pydar2/pydar/tagsfile.py	2005-08-26 18:52:36 UTC (rev 3537)
@@ -33,15 +33,15 @@
         self.addToCommandLine = addToCommandLine
         self.defineargs = defineargs
         self.cat.debug("defineargs: " + defineargs)
+        self.__formatStringBeginTag = "::QFBEGINTAG::"
+        self.__formatStringEndTag = "::QFENDTAG::"
+        self.subpackageStandardTags = {}
         self.rpmforgetags = {}
         self.standardtags = {}
         self.queryformattags = ("PKGID","NAME","VERSION","RELEASE","EPOCH","SERIAL","SUMMARY","DESCRIPTION","DISTRIBUTION","VENDOR","LICENSE","PACKAGER","GROUP","URL","ARCH","EXCLUDEARCH","EXCLUDEOS","EXCLUSIVEARCH","EXCLUSIVEOS","BUILDARCHS","DISTURL","FILEMD5S","CHANGELOGNAME")
         self.getStandardTags()
         self.parseRpmForgeTags()
-        self.subpackageStandardTags = {}
         
-        self.__formatStringBeginTag = "::QFBEGINTAG::"
-        self.__formatStringEndTag = "::QFENDTAG::"
         
     def getStandardTags(self):
         self.cat.debug("start")

Modified: trunk/tools/pydar2/scripts/rpmforgesite.py
===================================================================
--- trunk/tools/pydar2/scripts/rpmforgesite.py	2005-08-26 08:30:56 UTC (rev 3536)
+++ trunk/tools/pydar2/scripts/rpmforgesite.py	2005-08-26 18:52:36 UTC (rev 3537)
@@ -157,6 +157,9 @@
         self.__packager = packager
         self.__localFile = localFile
     
+    def getAdditionalPaths(self):
+        return self.__additionalPaths
+    
     def getNumberOfBinaryRpms(self):
         return len(self.__binaryRpms)
       
@@ -215,7 +218,7 @@
         self.__specRepo = specRepo
         self.__Driesfullcontentstemplate = None
         self.__RFfullcontentstemplate = None
-        self.__Driessiterootdir =  "/tmp/packages/"
+        self.__Driessiterootdir =  "/tmp/packages/rpm/"
         self.__RFsiterootdir = "/tmp/rpmforgesite/"
         self.__storage = storagefactory.StorageFactory.getStorage()
         self.__timer("distArchPackagerLists init")
@@ -238,37 +241,41 @@
         self.__distArchPackagerLists.append(DistArchPackagerList("dries", "au1.92 sparc rpms", "http://ftp.belnet.be/packages/dries.ulyssis.org/aurora/1.92/sparc/RPMS.dries/", "Aurora 1.92 for sparc", addPaths, "scripts/cache/au1.92-sparc-dries.html", "au1.92-sparc"))
         addPaths = ['aurora/1.91/sparc']
         self.__distArchPackagerLists.append(DistArchPackagerList("dries", "au1.91 sparc rpms", "http://ftp.belnet.be/packages/dries.ulyssis.org/aurora/1.91/sparc/RPMS.dries/", "Aurora 1.91 for sparc", addPaths, "scripts/cache/au1.91-sparc-dries.html", "au1.91-sparc"))
-        #dag:
-        #http://apt.sw.be/fedora/3/en/i386/RPMS.dag/
-        #http://apt.sw.be/fedora/3/en/x86_64/RPMS.dag/
+        
+        if self.__buildRpmforgeSite:
+            #dag:
+            #http://apt.sw.be/fedora/3/en/i386/RPMS.dag/
+            #http://apt.sw.be/fedora/3/en/x86_64/RPMS.dag/
+            addPaths = []
+            self.__distArchPackagerLists.append(DistArchPackagerList("dag", "rh6 i386 rpms", "http://apt.sw.be/redhat/6.2/en/i386/RPMS.dag/", "Red Hat 6.2 for i386", addPaths, "scripts/cache/rh6-i386-dag.html", "rh6-i386"))
+            self.__distArchPackagerLists.append(DistArchPackagerList("dag", "rh7 i386 rpms", "http://apt.sw.be/redhat/7.3/en/i386/RPMS.dag/", "Red Hat 7.3 for i386", addPaths, "scripts/cache/rh7-i386-dag.html", "rh7-i386"))
+            self.__distArchPackagerLists.append(DistArchPackagerList("dag", "rh8 i386 rpms", "http://apt.sw.be/redhat/8.0/en/i386/RPMS.dag/", "Red Hat 8.0 for i386", addPaths, "scripts/cache/rh8-i386-dag.html", "rh8-i386"))
+            self.__distArchPackagerLists.append(DistArchPackagerList("dag", "rh9 i386 rpms", "http://apt.sw.be/redhat/9/en/i386/RPMS.dag/","Red Hat 9 for i386", addPaths, "scripts/cache/rh9-i386-dag.html", "rh9-i386"))
+            self.__distArchPackagerLists.append(DistArchPackagerList("dag", "el2 i386 rpms", "http://apt.sw.be/redhat/el2.1/en/i386/RPMS.dag/", "Red Hat Enterprise Linux 2.1 for i386", addPaths, "scripts/cache/el2-i386-dag.html", "el2-i386"))
+            self.__distArchPackagerLists.append(DistArchPackagerList("dag", "el3 i386 rpms", "http://apt.sw.be/redhat/el3/en/i386/RPMS.dag/", "Red Hat Enterprise Linux 3 for i386", addPaths, "scripts/cache/el3-i386-dag.html", "el3-i386"))
+            self.__distArchPackagerLists.append(DistArchPackagerList("dag", "el3 x86_64 rpms", "http://apt.sw.be/redhat/el3/en/x86_64/RPMS.dag/","Red Hat Enterprise Linux 3 for x86_64", addPaths, "scripts/cache/el3-x86_64-dag.html", "el3-x86_64"))
+            self.__distArchPackagerLists.append(DistArchPackagerList("dag", "el4 i386 rpms", "http://apt.sw.be/redhat/el4/en/i386/RPMS.dag/", "Red Hat Enterprise Linux 4 for i386", addPaths, "scripts/cache/el4-i386-dag.html", "el4-i386"))
+            self.__distArchPackagerLists.append(DistArchPackagerList("dag", "el4 x86_64 rpms", "http://apt.sw.be/redhat/el4/en/x86_64/RPMS.dag/", "Red Hat Enterprise Linux 4 for x86_64", addPaths, "scripts/cache/el4-x86_64-dag.html", "el4-x86_64"))
+            self.__distArchPackagerLists.append(DistArchPackagerList("dag", "fc1 i386 rpms", "http://apt.sw.be/fedora/1/en/i386/RPMS.dag/", "Fedora Core 1 for i386", addPaths, "scripts/cache/fc1-i386-dag.html", "fc1-i386"))
+            self.__distArchPackagerLists.append(DistArchPackagerList("dag", "fc2 i386 rpms", "http://apt.sw.be/fedora/2/en/i386/RPMS.dag/", "Fedora Core 2 for i386", addPaths, "scripts/cache/fc2-i386-dag.html", "fc2-i386"))
+            self.__distArchPackagerLists.append(DistArchPackagerList("dag", "fc2 x86_64 rpms", "http://apt.sw.be/fedora/2/en/x86_64/RPMS.dag/", "Fedora Core 2 for x86_64", addPaths, "scripts/cache/fc2-x86_64-dag.html", "fc2-x86_64"))
+            self.__distArchPackagerLists.append(DistArchPackagerList("dag", "fc3 i386 rpms", "http://apt.sw.be/fedora/3/en/i386/RPMS.dag/", "Fedora Core 3 for i386", addPaths, "scripts/cache/fc3-i386-dag.html", "fc3-i386"))
+            self.__distArchPackagerLists.append(DistArchPackagerList("dag", "fc3 x86_64 rpms", "http://apt.sw.be/fedora/3/en/x86_64/RPMS.dag/", "Fedora Core 3 for x86_64", addPaths, "scripts/cache/fc3-x86_64-dag.html", "fc3-x86_64"))
+        
+        # sources
+        self.__distArchPackagerListsSource = []
         addPaths = []
-        self.__distArchPackagerLists.append(DistArchPackagerList("dag", "rh6 i386 rpms", "http://apt.sw.be/redhat/6.2/en/i386/RPMS.dag/", "Red Hat 6.2 for i386", addPaths, "scripts/cache/rh6-i386-dag.html", "rh6-i386"))
-        addPaths = []
-        self.__distArchPackagerLists.append(DistArchPackagerList("dag", "rh7 i386 rpms", "http://apt.sw.be/redhat/7.3/en/i386/RPMS.dag/", "Red Hat 7.3 for i386", addPaths, "scripts/cache/rh7-i386-dag.html", "rh7-i386"))
-        addPaths = []
-        self.__distArchPackagerLists.append(DistArchPackagerList("dag", "rh8 i386 rpms", "http://apt.sw.be/redhat/8.0/en/i386/RPMS.dag/", "Red Hat 8.0 for i386", addPaths, "scripts/cache/rh8-i386-dag.html", "rh8-i386"))
-        addPaths = []
-        self.__distArchPackagerLists.append(DistArchPackagerList("dag", "rh9 i386 rpms", "http://apt.sw.be/redhat/9/en/i386/RPMS.dag/","Red Hat 9 for i386", addPaths, "scripts/cache/rh9-i386-dag.html", "rh9-i386"))
-        addPaths = []
-        self.__distArchPackagerLists.append(DistArchPackagerList("dag", "el2 i386 rpms", "http://apt.sw.be/redhat/el2.1/en/i386/RPMS.dag/", "Red Hat Enterprise Linux 2.1 for i386", addPaths, "scripts/cache/el2-i386-dag.html", "el2-i386"))
-        addPaths = []
-        self.__distArchPackagerLists.append(DistArchPackagerList("dag", "el3 i386 rpms", "http://apt.sw.be/redhat/el3/en/i386/RPMS.dag/", "Red Hat Enterprise Linux 3 for i386", addPaths, "scripts/cache/el3-i386-dag.html", "el3-i386"))
-        addPaths = []
-        self.__distArchPackagerLists.append(DistArchPackagerList("dag", "el3 x86_64 rpms", "http://apt.sw.be/redhat/el3/en/x86_64/RPMS.dag/","Red Hat Enterprise Linux 3 for x86_64", addPaths, "scripts/cache/el3-x86_64-dag.html", "el3-x86_64"))
-        addPaths = []
-        self.__distArchPackagerLists.append(DistArchPackagerList("dag", "el4 i386 rpms", "http://apt.sw.be/redhat/el4/en/i386/RPMS.dag/", "Red Hat Enterprise Linux 4 for i386", addPaths, "scripts/cache/el4-i386-dag.html", "el4-i386"))
-        addPaths = []
-        self.__distArchPackagerLists.append(DistArchPackagerList("dag", "el4 x86_64 rpms", "http://apt.sw.be/redhat/el4/en/x86_64/RPMS.dag/", "Red Hat Enterprise Linux 4 for x86_64", addPaths, "scripts/cache/el4-x86_64-dag.html", "el4-x86_64"))
-        addPaths = []
-        self.__distArchPackagerLists.append(DistArchPackagerList("dag", "fc1 i386 rpms", "http://apt.sw.be/fedora/1/en/i386/RPMS.dag/", "Fedora Core 1 for i386", addPaths, "scripts/cache/fc1-i386-dag.html", "fc1-i386"))
-        addPaths = []
-        self.__distArchPackagerLists.append(DistArchPackagerList("dag", "fc2 i386 rpms", "http://apt.sw.be/fedora/2/en/i386/RPMS.dag/", "Fedora Core 2 for i386", addPaths, "scripts/cache/fc2-i386-dag.html", "fc2-i386"))
-        addPaths = []
-        self.__distArchPackagerLists.append(DistArchPackagerList("dag", "fc2 x86_64 rpms", "http://apt.sw.be/fedora/2/en/x86_64/RPMS.dag/", "Fedora Core 2 for x86_64", addPaths, "scripts/cache/fc2-x86_64-dag.html", "fc2-x86_64"))
-        addPaths = []
-        self.__distArchPackagerLists.append(DistArchPackagerList("dag", "fc3 i386 rpms", "http://apt.sw.be/fedora/3/en/i386/RPMS.dag/", "Fedora Core 3 for i386", addPaths, "scripts/cache/fc3-i386-dag.html", "fc3-i386"))
-        addPaths = []
-        self.__distArchPackagerLists.append(DistArchPackagerList("dag", "fc3 x86_64 rpms", "http://apt.sw.be/fedora/3/en/x86_64/RPMS.dag/", "Fedora Core 3 for x86_64", addPaths, "scripts/cache/fc3-x86_64-dag.html", "fc3-x86_64"))
+        self.__distArchPackagerListsSource.append(DistArchPackagerList("dries", "el4 i386 rpms","http://ftp.belnet.be/packages/dries.ulyssis.org/redhat/el4/en/i386/SRPMS.dries/", "Red Hat Enterprise Linux 4 for i386", addPaths, "scripts/cache/srpms/el4-i386-dries.html", "el4-i386"))
+        self.__distArchPackagerListsSource.append(DistArchPackagerList("dries", "el3 i386 rpms","http://ftp.belnet.be/packages/dries.ulyssis.org/redhat/el3/en/i386/SRPMS.dries/", "Red Hat Enterprise Linux 3 for i386", addPaths, "scripts/cache/srpms/el3-i386-dries.html", "el3-i386"))
+        self.__distArchPackagerListsSource.append(DistArchPackagerList("dries", "fc3 i386 rpms", "http://ftp.belnet.be/packages/dries.ulyssis.org/fedora/fc3/i386/SRPMS.dries/", "Fedora Core 3 for i386", addPaths, "scripts/cache/srpms/fc3-i386-dries.html", "fc3-i386"))
+        self.__distArchPackagerListsSource.append(DistArchPackagerList("dries", "fc2 i386 rpms", "http://ftp.belnet.be/packages/dries.ulyssis.org/fedora/fc2/i386/SRPMS.dries/", "Fedora Core 2 for i386", addPaths, "scripts/cache/srpms/fc2-i386-dries.html", "fc2-i386"))
+        self.__distArchPackagerListsSource.append(DistArchPackagerList("dries", "fc1 i386 rpms", "http://ftp.belnet.be/packages/dries.ulyssis.org/fedora/fc1/i386/SRPMS.dries/", "Fedora Core 1 for i386", addPaths, "scripts/cache/srpms/fc1-i386-dries.html", "fc1-i386"))
+        self.__distArchPackagerListsSource.append(DistArchPackagerList("dries", "fc4 i386 rpms", "http://ftp.belnet.be/packages/dries.ulyssis.org/fedora/fc4/i386/SRPMS.dries/", "Fedora Core 4 for i386", addPaths, "scripts/cache/srpms/fc4-i386-dries.html", "fc4-i386"))
+        self.__distArchPackagerListsSource.append(DistArchPackagerList("dries", "fc4 x86_64 rpms", "http://ftp.belnet.be/packages/dries.ulyssis.org/fedora/fc4/x86_64/SRPMS.dries/", "Fedora Core 4 for x86_64", addPaths, "scripts/cache/srpms/fc4-x86_64-dries.html", "fc4-x86_64"))
+        self.__distArchPackagerListsSource.append(DistArchPackagerList("dries", "au1.92 sparc rpms", "http://ftp.belnet.be/packages/dries.ulyssis.org/aurora/1.92/sparc/SRPMS.dries/", "Aurora 1.92 for sparc", addPaths, "scripts/cache/srpms/au1.92-sparc-dries.html", "au1.92-sparc"))
+        self.__distArchPackagerListsSource.append(DistArchPackagerList("dries", "au1.91 sparc rpms", "http://ftp.belnet.be/packages/dries.ulyssis.org/aurora/1.91/sparc/SRPMS.dries/", "Aurora 1.91 for sparc", addPaths, "scripts/cache/srpms/au1.91-sparc-dries.html", "au1.91-sparc"))
+        
+        
         self.__timer("distArchPackagerLists init")
         
         self.__rpmNameToSpecSubDirName = {}
@@ -290,23 +297,33 @@
         totsrpms = 0
         totrpmsdries = 0
         totrpmsdag = 0
+        totsrpmsdries = 0
+        totsrpmsdag = 0
         for d in self.__distArchPackagerLists:
             totrpms = totrpms + d.getNumberOfBinaryRpms()
-            totsrpms = totsrpms + d.getNumberOfSourceRpms()
+            #totsrpms = totsrpms + d.getNumberOfSourceRpms()
             if d.getPackager() == "dries":
                 totrpmsdries = totrpmsdries + d.getNumberOfBinaryRpms()
             if d.getPackager() == "dag":
                 totrpmsdag = totrpmsdag + d.getNumberOfBinaryRpms()
+        for d in self.__distArchPackagerListsSource:
+            totsrpms = totsrpms + d.getNumberOfBinaryRpms()
+            if d.getPackager() == "dries":
+                totsrpmsdries = totsrpmsdries + d.getNumberOfBinaryRpms()
+            if d.getPackager() == "dag":
+                totsrpmsdag = totsrpmsdag + d.getNumberOfBinaryRpms()
         self.__siteValues["TOTALRPMS"] = totrpms
         self.__siteValues["TOTALSRPMS"] = totsrpms
         self.__siteValues["TOTAL-RPMS-DRIES"] = totrpmsdries
+        self.__siteValues["TOTAL-SRPMS-DAG"] = totsrpmsdag
+        self.__siteValues["TOTAL-SRPMS-DRIES"] = totsrpmsdries
         self.__siteValues["TOTAL-RPMS-DAG"] = totrpmsdag
         for k in self.__siteValues.keys():
           print "siteval,k:" + k + ",v:" + str(self.__siteValues[k])
         
     def __completeRpmsLists(self):
         self.__completeBinaryRpmsLists()
-        #self.__completeSourceRpmsLists()
+        self.__completeSourceRpmsLists()
     
     lastTimerTimestamp = {}
     totalTimerTimestamp = {}
@@ -405,7 +422,83 @@
             self.__siteValues[listje.getDistArchPackager().upper() + "-RPMS"] = listje.getNumberOfBinaryRpms()
         self.__timer("__completeBinaryRpmsLists")    
             
-    def completeSourceRpmsLists(self):    
+    def __completeSourceRpmsLists(self):
+        self.__timer("__completeSourceRpmsLists")
+        # list of packagenames
+        extendedPackagenames = self.__getPackageNameListSortedByLength()
+        # make a hash packagename -> specrepospecfile
+        nametospecrepospecfile = {}
+        for srsf in self.__specRepo.getSpecRepositorySpecFiles():
+            nametospecrepospecfile[srsf.getSubDir()] = srsf
+        #firstre = re.compile('<A HREF=".*\.rpm<\/A>')
+        secondre = re.compile('<[Aa] [Hh][Rr][Ee][Ff]="(.*\.rpm)">.*\.rpm</[Aa]> *([0-9]*)-([A-Za-z]*)-([0-9]*) ')
+        for listje in self.__distArchPackagerListsSource:
+            # ok get the list of rpms and srpms of this list
+            f = None
+            nbrOfLines = 0
+            if not self.__useLocalFilesOnly:
+                f = urllib.urlopen(listje.getRpmsUrl())
+            else:
+                print "localFile: " + listje.getLocalFile()
+                f = open(listje.getLocalFile())
+            #print f.info()
+            print  "start, " + listje.getRpmsUrl()
+            lijn = f.readline()
+            while lijn != "":
+                nbrOfLines = nbrOfLines + 1
+                #print l
+                # some stuff which should not get into the lists...
+                lijn = lijn.replace("gcc-c++-3.2.2-5.i386.rpm","")
+                mo = secondre.search(lijn)
+                if mo != None:
+                    rpm = mo.group(1)
+                    #listje.rpms.append(rpm)
+                    bo = RpmPackage(listje,rpm)
+                    listje.addBinaryRpm(bo)
+                    i = 0
+                    #self.__timer("search in packagenames")
+                    #print "rpm: " + rpm
+                    searchrpm = rpm
+                    # certain packages don't have normal subpackage names, for example clamd is a subpackage of clamav
+                    
+                    specials = {}
+                    specials['clamd'] = 'clamav'
+                    specials['gpsmap'] = 'gpsmap'
+                    for k in specials.keys():
+                        searchrpm = searchrpm.replace(k,specials[k])
+                    
+                    start = searchrpm[0:2]
+                    if start in extendedPackagenames.keys():
+                        packagenames = extendedPackagenames[start]
+                        while ((i < len(packagenames)) and (not searchrpm.startswith(packagenames[i]))):
+                            i = i + 1
+                            #print i, len(packagenames), packagenames[i]
+                        #self.__timer("search in packagenames")
+                        if i<len(packagenames):
+                            #print "match: " + rpm + ", package=" + packagenames[i]
+                            #nametospecrepospecfile[packagenames[i]].rpmfilenames.append(listje.getRpmsUrl() + rpm)
+                            #print "adding: " + rpm
+                            nametospecrepospecfile[packagenames[i]].sourcerpms.append(bo)
+                            bo.setSpecRepoSpecFile(nametospecrepospecfile[packagenames[i]])
+                            #self.__rpmNameToSpecSubDirName[rpm] = packagenames[i]
+                        else:
+                            print "not adding: " + rpm
+                    else:
+                        print "not in keys: "+ start
+                else:
+                    badLines = 1
+                    #print "bad line: " + lijn
+                lijn = f.readline()
+            f.close()
+            if nbrOfLines < 100:
+                print "nbrOflines < 100 !! not normal.."
+                os.exit(1)
+            self.__siteValues[listje.getDistArchPackager().upper() + "-SRPMS"] = listje.getNumberOfBinaryRpms()
+        self.__timer("__completeSourceRpmsLists")    
+             
+            
+            
+    def OLDOLDcompleteSourceRpmsLists(self):    
         # the same for the sprms
         for listje in self.__rpmlists:
             # ok get the list of rpms and srpms of this list
@@ -485,7 +578,7 @@
                     for v in versions:
                       self.generateOnePackagePageVersionPage(specRepoSpecFile, v)
                     
-                if self.__buildRpmforgeSite:        
+                if self.__buildRpmforgeSite:
                     #self.RFgenerateSpecPages(specRepoSpecFile)
                     self.RFgenerateUserPackagePage(specRepoSpecFile, hash)
                     self.RFgenerateDeveloperPackagePage(specRepoSpecFile, hash)
@@ -496,10 +589,11 @@
             self.RFgeneratePackagesPages()
         print "start, distropages"
         if self.__buildDriesSite:
+            self.DriesgeneratePackagesPages()
             for i in self.__distArchPackagerLists:
                 if i.getPackager() == "dries":
-                    self.generateDistroArchPageRpm(i)
-                    self.generateDistroArchPageSrpm(i)
+                    self.DriesgenerateDistroArchPageRpmRedirect(i)
+                    self.DriesgenerateDistroArchPageSrpmRedirect(i)
             # also create some directory indexes
             dirs = ["fedora", "redhat", "aurora"]
             for i in dirs:
@@ -618,6 +712,72 @@
         contents = contents + subcontents
         self.DriesgenerateFullPage(contents,[],"recentchanges.html", "Updated and new rpms: Dries RPM Repository")
         
+    def DriesgenerateDistroArchPageRpmRedirect(self,distroArch):
+        contents = "<html><head>\n"
+        contents = contents + "<meta http-equiv=\"refresh\" content=\"0;/rpm/packages/index.html\">\n"
+        contents = contents + "</head></html>"
+        self.createFile(distroArch.getDistArchPackager() + "-rpms.html",contents)
+        # also generate a page in redhat/el4/i386/ for example
+        for path in distroArch.getAdditionalPaths():
+            # 1 create a .htaccess file which links release.* files in this DIR
+            # 2 create a dir DIR/dries , DIR/dries/headers , DIR/base, DIR/RPMS.dries, DIR/SRPMS.dries DIR/RPMS.dries/repodata DIR/SRPMS.dries/repodata
+            # 3 create a symbolic link: DIR/dries/RPMS -> ../RPMS.dries
+            # 4 create a symbolic link: DIR/dries/SRPMS -> ../SRPMS.dries
+            # 5 create a DIR/dries/headers/.htaccess which redirects all .hdr files and the header.info file
+            # 6 create a DIR/base/.htaccess  which redirects all pkglist.* release.* and srclist.* files
+            # 7 create a DIR/RPMS.dries/.htaccess which redirects all  .*\.rpm files
+            # 8 create a DIR/RPMS.dries/repodata/.htaccess which redirects all filelist* other* primary* repomd* files
+            # 9 create a DIR/SRPMS.dries/.htaccess which redirects all .*\.rpm files
+            # 10 create a DIR/SRPMS.dries/repodata/.htaccess which redirects all filelist* other* primary* repomd* files
+            # 11 create dirindexes in DIR, DIR/dries, DIR/dries/headers, DIR/base
+            # 1
+            htcontents = "RewriteEngine on\n" + 'RewriteRule ^(release.*)$ http://ftp.belnet.be/packages/dries.ulyssis.org/' + path + '/$1' + "\n"
+            self.createFile(os.path.join(path,".htaccess"), htcontents)
+            # 2
+            self.createDirHierarchy(os.path.join(path,"dries/headers"))
+            self.createDirHierarchy(os.path.join(path,"base"))
+            self.createDirHierarchy(os.path.join(path,"RPMS.dries/repodata"))
+            self.createDirHierarchy(os.path.join(path,"SRPMS.dries/repodata"))
+            # 3
+            self.createSymbolicLink(os.path.join(path,"dries/RPMS"), "../RPMS.dries")
+            # 4
+            self.createSymbolicLink(os.path.join(path,"dries/SRPMS"), "../SRPMS.dries")
+            # 5
+            htcontents = "RewriteEngine on\n" + 'RewriteRule ^(.*hdr)$ http://ftp.belnet.be/packages/dries.ulyssis.org/' + path + '/dries/headers/$1' + "\n"
+            htcontents = htcontents + 'RewriteRule ^(header.info)$ http://ftp.belnet.be/packages/dries.ulyssis.org/' + path + '/dries/headers/$1' + "\n"
+            self.createFile(os.path.join(path,"dries/headers/.htaccess"), htcontents)
+            # 6
+            htcontents = "RewriteEngine on\n" + 'RewriteRule ^(pkglist.*)$ http://ftp.belnet.be/packages/dries.ulyssis.org/' + path + '/base/$1' + "\n"
+            htcontents = htcontents + 'RewriteRule ^(release.*)$ http://ftp.belnet.be/packages/dries.ulyssis.org/' + path + '/base/$1' + "\n"
+            htcontents = htcontents + 'RewriteRule ^(srclist.*)$ http://ftp.belnet.be/packages/dries.ulyssis.org/' + path + '/base/$1' + "\n"
+            self.createFile(os.path.join(path,"base/.htaccess"), htcontents)
+            # 7
+            htcontents = "RewriteEngine on\n" + 'RewriteRule ^(.*.rpm)$ http://ftp.belnet.be/packages/dries.ulyssis.org/' + path + '/RPMS.dries/$1' + "\n"
+            self.createFile(os.path.join(path,"RPMS.dries/.htaccess"), htcontents)
+            # 8
+            htcontents = "RewriteEngine on\n" + 'RewriteRule ^(filelist.*)$ http://ftp.belnet.be/packages/dries.ulyssis.org/' + path + '/RPMS.dries/repodata/$1' + "\n"
+            htcontents = htcontents + 'RewriteRule ^(other.*)$ http://ftp.belnet.be/packages/dries.ulyssis.org/' + path + '/RPMS.dries/repodata/$1' + "\n"
+            htcontents = htcontents + 'RewriteRule ^(primary.*)$ http://ftp.belnet.be/packages/dries.ulyssis.org/' + path + '/RPMS.dries/repodata/$1' + "\n"
+            htcontents = htcontents + 'RewriteRule ^(repomd.*)$ http://ftp.belnet.be/packages/dries.ulyssis.org/' + path + '/RPMS.dries/repodata/$1' + "\n"
+            self.createFile(os.path.join(path,"RPMS.dries/repodata/.htaccess"), htcontents)
+            # 9
+            htcontents = "RewriteEngine on\n" + 'RewriteRule ^(.*.rpm)$ http://ftp.belnet.be/packages/dries.ulyssis.org/' + path + '/SRPMS.dries/$1' + "\n"
+            self.createFile(os.path.join(path,"SRPMS.dries/.htaccess"), htcontents)
+            # 10
+            htcontents = "RewriteEngine on\n" + 'RewriteRule ^(filelist.*)$ http://ftp.belnet.be/packages/dries.ulyssis.org/' + path + '/SRPMS.dries/repodata/$1' + "\n"
+            htcontents = htcontents + 'RewriteRule ^(other.*)$ http://ftp.belnet.be/packages/dries.ulyssis.org/' + path + '/SRPMS.dries/repodata/$1' + "\n"
+            htcontents = htcontents + 'RewriteRule ^(primary.*)$ http://ftp.belnet.be/packages/dries.ulyssis.org/' + path + '/SRPMS.dries/repodata/$1' + "\n"
+            htcontents = htcontents + 'RewriteRule ^(repomd.*)$ http://ftp.belnet.be/packages/dries.ulyssis.org/' + path + '/SRPMS.dries/repodata/$1' + "\n"
+            self.createFile(os.path.join(path,"SRPMS.dries/repodata/.htaccess"), htcontents)
+            # 11
+            self.generateDirectoryView(path)
+            self.generateDirectoryView(path + "/dries")
+            self.generateDirectoryView(path + "/dries/headers")
+            self.generateDirectoryView(path + "/base")
+            
+            contents = "This page now contains links to the rpms on one of the mirrors because the page is generating way too much traffic for this server.<br /><br />" + contents
+            self.DriesgenerateFullPage(contents, [distroArch.getDisplayShortName()], path + "/RPMS.dries/index.html",distroArch.getDisplayFullName() + " (" + distroArch.getDisplayShortName() + "): Dries RPM Repository")
+        
     def generateDistroArchPageRpm(self,distroArch):
         contents = ""
         contents = "<h2>Rpms for " + distroArch.getDisplayFullName() + " (" + distroArch.getDisplayShortName() + ")</h2>"
@@ -630,7 +790,7 @@
             contents = contents + "<a href=\"" + r.getFullUrl() + "\">" + r.getName() + "</a>" + linkToPackage + "<br />"
         self.DriesgenerateFullPage(contents, [distroArch.getDisplayShortName()], distroArch.getDistArchPackager() + "-rpms.html",distroArch.getDisplayFullName() + " (" + distroArch.getDisplayShortName() + "): Dries RPM Repository")
         # also generate a page in redhat/el4/i386/ for example
-        for path in distroArch.additionalPaths:
+        for path in distroArch.getAdditionalPaths():
             # 1 create a .htaccess file which links release.* files in this DIR
             # 2 create a dir DIR/dries , DIR/dries/headers , DIR/base, DIR/RPMS.dries, DIR/SRPMS.dries DIR/RPMS.dries/repodata DIR/SRPMS.dries/repodata
             # 3 create a symbolic link: DIR/dries/RPMS -> ../RPMS.dries
@@ -688,7 +848,7 @@
             self.generateDirectoryView(path + "/base")
             
             contents = "This page now contains links to the rpms on one of the mirrors because the page is generating way too much traffic for this server.<br /><br />" + contents
-            self.DriesgenerateFullPage(contents, [distroArch.displayName], path + "/RPMS.dries/index.html",distroArch.fullName + " (" + distroArch.displayName + "): Dries RPM Repository")
+            self.DriesgenerateFullPage(contents, [distroArch.getDisplayShortName()], path + "/RPMS.dries/index.html",distroArch.getDisplayFullName() + " (" + distroArch.getDisplayShortName() + "): Dries RPM Repository")
     
     def createSymbolicLink(self, filename, target):
         (tempdir, fname) = os.path.split(filename)
@@ -728,7 +888,17 @@
         except:
             errors = errors + 1
             
-    def generateDistroArchPageSrpm(self,distroArch):
+    def DriesgenerateDistroArchPageSrpmRedirect(self,distroArch):
+        contents = "<html><head>\n"
+        contents = contents + "<meta http-equiv=\"refresh\" content=\"0;/rpm/packages/index.html\">\n"
+        contents = contents + "</head></html>"
+        self.createFile(distroArch.getDistArchPackager() + "-srpms.html",contents)
+        for path in distroArch.getAdditionalPaths():
+            contents = "This page now contains links to the source rpms on one of the mirrors because the page is generating way too much traffic for this server.<br /><br />" + contents
+            self.DriesgenerateFullPage(contents, [distroArch.getDisplayShortName()], path + "/SRPMS.dries/index.html",distroArch.getDisplayFullName() + " (" + distroArch.getDisplayShortName() + "): Dries RPM Repository")
+            
+            
+    def OLDOLDgenerateDistroArchPageSrpm(self,distroArch):
         contents = ""
         url = distroArch.rpmsUrl.replace("RPMS","SRPMS")
         contents = "<h2>Srpms for " + distroArch.fullName + " (" + distroArch.displayName + ")</h2>"
@@ -738,7 +908,7 @@
                 linkToPackage = "&nbsp;-&nbsp<a href=\"/rpm/packages/" + self.__rpmNameToSpecSubDirName[r] + "/info.html\">" + self.__rpmNameToSpecSubDirName[r] + "</a>"
             contents = contents + "<a href=\"" + url + r + "\">" + r + "</a>" + linkToPackage + "<br />"
         self.DriesgenerateFullPage(contents, [distroArch.displayName], distroArch.getDistArchPackager() + "-srpms.html",distroArch.getDisplayFullName() + " (" + distroArch.getDisplayShortName() + "): Dries RPM Repository")
-        for path in distroArch.additionalPaths:
+        for path in distroArch.getAdditionalPaths():
             contents = "This page now contains links to the source rpms on one of the mirrors because the page is generating way too much traffic for this server.<br /><br />" + contents
             self.DriesgenerateFullPage(contents, [distroArch.displayName], path + "/SRPMS.dries/index.html",distroArch.fullName + " (" + distroArch.displayName + "): Dries RPM Repository")
             
@@ -773,19 +943,19 @@
         menu = menu + ""
         menu = menu + "<a href=\"/rpm/\">Start</a><br />"
         menu = menu + "<a href=\"/rpm/clientconfig.html\">APT/YUM/Smart config</a><br />"
-        menu = menu + "<a href=\"/rpm/packages.html\">List of packages</a><br />"
+        menu = menu + "<a href=\"/rpm/packages/index.html\">List of packages</a><br />"
         menu = menu + "<a href=\"/rpm/RPM-GPG-KEY.dries.html\">GPG key</a><br />"
         menu = menu + "<a href=\"/rpm/mirrors.html\">Mirrors</a><br />"
         menu = menu + "<a href=\"/rpm/recentchanges.html\">Recent changes</a><br />"
         menu = menu + "<a href=\"/rpm/pydar2/index.html\">Pydar2</a><br />"
-        menu = menu + "<strong>Rpms:</strong><br />"
-        for k in self.__distArchPackagerLists:
-            if k.getPackager() == "dries":
-                menu = menu + "<a href=\"/rpm/" + k.getDistArchPackager() + "-rpms.html\">" + k.getDisplayShortName() + "</a><br />"
-        menu = menu + "<strong>Srpms:</strong><br />"
-        for k in self.__distArchPackagerLists:
-            if k.getPackager() == "dries":
-                menu = menu + "<a href=\"/rpm/" + k.getDistArchPackager() + "-srpms.html\">" + k.getDisplayShortName().replace("rpms","srpms") + "</a><br />"
+        #menu = menu + "<strong>Rpms:</strong><br />"
+        #for k in self.__distArchPackagerLists:
+        #    if k.getPackager() == "dries":
+        #        menu = menu + "<a href=\"/rpm/" + k.getDistArchPackager() + "-rpms.html\">" + k.getDisplayShortName() + "</a><br />"
+        #menu = menu + "<strong>Srpms:</strong><br />"
+        #for k in self.__distArchPackagerLists:
+        #    if k.getPackager() == "dries":
+        #        menu = menu + "<a href=\"/rpm/" + k.getDistArchPackager() + "-srpms.html\">" + k.getDisplayShortName().replace("rpms","srpms") + "</a><br />"
         menu = menu + "<strong>Thanks:</strong><br />"
         menu = menu + "Buildsystem hosted at <a href=\"http://www.ithomi.com/\">ithomi</a><br />"
         menu = menu + "Static site hosted at <a href=\"http://www.ulyssis.org/\">ULYSSIS</a><br />"
@@ -854,6 +1024,10 @@
         
     def RFgroupTagToPageName(self,groupTag):
         urlpart = groupTag.replace('/','-').replace(' ','').lower()
+        return "group-" + urlpart + ".html"
+
+    def DriesgroupTagToPageName(self,groupTag):
+        urlpart = groupTag.replace('/','-').replace(' ','').lower()
         return "group-" + urlpart + ".php"
         
     def RFgeneratePackagesPages(self):
@@ -919,7 +1093,73 @@
                             
         self.RFgenerateFullPage(contents,["Packages","User track: list of packages"], "user/packages/index.php","RPM packages for Red Hat / Fedora / Aurora")
         self.__timer("RFgeneratePackagesPages")    
+    
+
+    def DriesgeneratePackagesPages(self):
+        # 1 pagina met daarop:
+        #  - de lijst van groepen
+        #  - de lijst van beginletters
+        # 1 pagina per beginletter
+        # 1 pagina per groep
+        self.__timer("DriesgeneratePackagesPages")
+        groupcount = {}
+        grouppages = {}
+        letterpages = {}
         
+        specArr = self.__storage.getNameSummaryAndGroupOfLastVersionsOfSpecFiles('rpmforge')        
+        for specHash in specArr:
+            name = specHash['name']
+            summary = specHash['summary']
+            group = specHash['group']
+            #print "name: " + str(name)
+            beginletter = name[0].capitalize()
+            #print "name: "+ name + ",beginletter:"+ beginletter + ",group:"+ group
+        
+            currentgroupcontents = ""
+            if group in grouppages.keys():
+                currentgroupcontents = grouppages[group]
+                groupcount[group] = groupcount[group] + 1
+            else:
+                currentgroupcontents = "<h2>Group " + group + "</h2>"
+                groupcount[group] = 1
+            currentgroupcontents = currentgroupcontents + "<a href=\"" + name + "/info.html\">" + name + "</a>: " + summary + "<br />"
+            grouppages[group] = currentgroupcontents
+            
+            currentlettercontents = ""
+            if beginletter in letterpages.keys():
+                currentlettercontents = letterpages[beginletter]
+            else:
+                currentlettercontents = "<h2>Letter " + beginletter + "</h2>"
+            currentlettercontents = currentlettercontents + "<a href=\"" + name + "/info.html\">" + name + "</a>: " + summary + "<br />"
+            letterpages[beginletter] = currentlettercontents
+            
+        contents = ""
+        
+        contents = contents + "<h2>Packages sorted by group</h2>"
+        
+        groupcnt = 0
+        keys = grouppages.keys()
+        keys.sort()
+        for key in keys:
+            contents = contents + "<a href=\"" + self.DriesgroupTagToPageName(key) + "\">" + key + "</a><br />"
+            self.DriesgenerateFullPage(grouppages[key],["Packages","list of packages"], "packages/" + self.DriesgroupTagToPageName(key),key + " RPM packages for Red Hat / Fedora / Aurora")
+            groupcnt = groupcnt + 1
+                       
+        contents = contents + "<h2>Packages sorted by first letter</h2>"
+
+        lettercnt = 0
+        keys = letterpages.keys()
+        keys.sort()
+        for key in keys:
+            contents = contents + "<a href=\"packages-" + key.lower() + ".html\">" + key + "</a> "
+            self.DriesgenerateFullPage(letterpages[key],["Packages","User track: list of packages"], "packages/packages-" + key.lower() + ".html","Packages starting with " + key + ": RPM packages for Red Hat / Fedora / Aurora")
+            lettercnt = lettercnt + 1
+        contents = contents + "<br />"
+                            
+        self.DriesgenerateFullPage(contents,["Packages","User track: list of packages"], "packages/index.html","RPM packages for Red Hat / Fedora / Aurora")
+        self.__timer("DriesgeneratePackagesPages")    
+    
+    
     def RFgenerateUserPackagePage(self, specRepoSpecFile, distNameValueHash):
         shortName = specRepoSpecFile.getSubDir()
         contents = ""
@@ -1158,8 +1398,16 @@
                     contents = contents + "<h4>" + lastdadesc + " (" + lastda + ")</h4>\n"
                 url = b.getDistArchPackagerList().getRpmsUrl() + b.getName()
                 contents = contents + "<a href=\"" + url + "\">" + b.getName() + "</a><br />\n" # (" + b.getDistArchPackagerList().getPackager() + ")<br />\n"
-            
         
+        if len(specRepoSpecFile.sourcerpms) > 0:
+            contents = contents + "<h2>Source rpms:</h2>"
+        
+        for b in specRepoSpecFile.sourcerpms:
+            if b.getDistArchPackagerList().getPackager() == "dries":
+                url = b.getDistArchPackagerList().getRpmsUrl() + b.getName()
+                contents = contents + "<a href=\"" + url + "\">" + b.getName() + "</a> (" + b.getDistArchPackagerList().getDistArch() + ")<br />\n"
+                
+        
 #         for f in specRepoSpecFile.rpmfilenames:
 #             #print f.rfind("/") , len(f)
 #             short = f[f.rfind("/") +1: len(f)]
@@ -1191,4 +1439,4 @@
 c.specifyGetOptOptions(TmpOptions())
 c.getSpecRepositoryList().updateAllFileLists()
 r = c.getSpecRepositoryList().getSpecRepositoryByName("rpmforge")
-RpmforgeSite(r,False,False,True)
+RpmforgeSite(r,True,True,False)




More information about the commits mailing list