summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--g_cran/cran_read.py5
-rw-r--r--g_cran/g_cran.py21
2 files changed, 13 insertions, 13 deletions
diff --git a/g_cran/cran_read.py b/g_cran/cran_read.py
index f648830..c243a7f 100644
--- a/g_cran/cran_read.py
+++ b/g_cran/cran_read.py
@@ -194,10 +194,7 @@ def read_packages(package_filename,local_repository):
#find a package in this repository... we really should cache this
#into some sqlite database once
def find_package(repo_location,package_name):
- database_tarball=tarfile.open(os.path.join(repo_location,REPO_MYDIR,'database.tgz'),'r')
- package_file=database_tarball.extractfile(package_name)
- if package_file==None:
- raise DoesNotExist
+ package_file=open(os.path.join(repo_location,REPO_MYDIR,'DESCRIPTION',package_name))
repository_file=open(os.path.join(repo_location,REPO_MYDIR,'remote_uri'),'r')
remote_uri=repository_file.read().strip()
diff --git a/g_cran/g_cran.py b/g_cran/g_cran.py
index 9a7a347..545ef0d 100644
--- a/g_cran/g_cran.py
+++ b/g_cran/g_cran.py
@@ -1,5 +1,5 @@
#!/usr/bin/python
-import getopt, sys, os, string, urllib, re, tarfile, StringIO
+import getopt, sys, os, string, urllib, re, StringIO
from ebuild import *
import phases
from cran_read import *
@@ -30,7 +30,11 @@ def action_sync(repo_location,remote_uri):
import rfc822
packages_file=open(packages_filename,"r")
file_parts=EmptyLinesFile(packages_file)
- database_tarball=tarfile.open(os.path.join(repo_location,REPO_MYDIR,'database.tgz'),'w:gz')
+ database_dir=os.path.join(repo_location,REPO_MYDIR,'DESCRIPTION')
+ try:
+ os.makedirs(database_dir)
+ except:
+ pass
#read PACKAGES file
while not file_parts.eof:
current_package=''
@@ -43,13 +47,12 @@ def action_sync(repo_location,remote_uri):
rfc822_file=StringIO.StringIO(current_package)
cran_package=dict(rfc822.Message(rfc822_file).items()) #read part of PACKAGES file
if len(cran_package):
- pms_package=pmsify_package_data(cran_package,remote_uri) #fix values
- #now add the package to the database tarball
- file_contents=StringIO.StringIO(current_package)
- new_tar_file=tarfile.TarInfo(name=pms_package.ebuild_vars['pn'])
- new_tar_file.size=len(file_contents.buf)
- database_tarball.addfile(tarinfo=new_tar_file,fileobj=file_contents)
- database_tarball.close()
+ pms_package=pmsify_package_data(cran_package,remote_uri) #we need to know the PMS name
+ #now add the package to the database
+ filename=os.path.join(database_dir,pms_package.ebuild_vars['pn'])
+ description_file=open(filename,'w')
+ description_file.write(current_package)
+ description_file.close()
return 0
#list categories in this repository