summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoshua Ismael Haase Hernández <hahj87@gmail.com>2011-02-15 00:13:37 -0600
committerJoshua Ismael Haase Hernández <hahj87@gmail.com>2011-02-15 00:13:37 -0600
commitcf3253774c64e6430d4e3afb826cc6c8b0e4b91b (patch)
treef358ab39214272b044e8d55fd43de7b35ffa51c5
parent9de298a7b88f7f36aec4c9344356a935c67cfeb3 (diff)
* Upgraded sync_all_repo
-rw-r--r--config.py2
-rw-r--r--pato2.py22
2 files changed, 12 insertions, 12 deletions
diff --git a/config.py b/config.py
index 465a8a8..36b54df 100644
--- a/config.py
+++ b/config.py
@@ -44,7 +44,7 @@ rsync_blacklist = docs + "/rsyncBlacklist"
# Rsync commands
rsync_list_command="rsync -a --no-motd --list-only "
-
+rsync_update_command="rsync -av --delete-after --delay-updates "
# Classes and Exceptions
class NonValidFile(ValueError): pass
diff --git a/pato2.py b/pato2.py
index 5bc97a9..9b902f4 100644
--- a/pato2.py
+++ b/pato2.py
@@ -25,7 +25,7 @@
"""
from repm.config import *
-
+from repm.filter import *
import tarfile
from glob import glob
from os.path import isdir, isfile
@@ -52,12 +52,14 @@ def packages(repo_, arch_, expr="*"):
""" Get packages on a repo, arch folder """
return tuple( glob( repodir + "/" + repo_ + "/os/" + arch_ + "/" + expr ) )
-def sync_all_repo(verbose_=verbose):
- folders = ",".join(repo_list + dir_list)
- cmd_ = "rsync -av --delete-after --delay-updates " + mirror + mirrorpath + "/{" + folders + "} " + repodir
- printf(cmd_)
- a=commands.getoutput(cmd_)
- if verbose_: printf(a)
+def sync_all_repo(debug=verbose):
+ cmd=generate_rsync_command(rsync_list_command)
+ rsout=run_rsync(cmd)
+ pkgs=pkginfo_from_rsync_output(rsout)
+ generate_exclude_list_from_blacklist(pkgs,listado(blacklist))
+ cmd=generate_rsync_command(rsync_update_command,blacklist_file=blacklist)
+ a=run_rsync(cmd)
+ if debug: printf(a)
def get_from_desc(desc, var,db_tar_file=False):
""" Get a var from desc file """
@@ -166,7 +168,7 @@ def get_licenses(verbose_=verbose):
a=commands.getoutput(cmd_)
if verbose_: printf(a)
-def generate_rsync_command(base_command, dir_list, destdir=repodir,
+def generate_rsync_command(base_command, dir_list=(repo_list + dir_list), destdir=repodir,
source=mirror+mirrorpath, blacklist_file=False):
""" Generates an rsync command for executing it by combining all parameters.
@@ -198,10 +200,8 @@ def generate_rsync_command(base_command, dir_list, destdir=repodir,
os.path.join(source, dir_list), destdir))
return " ".join((base_command, os.path.join(source, dir_list), destdir))
-def run_rsync(base_for_rsync, dir_list_for_rsync=(repo_list + dir_list),
- debug=verbose):
+def run_rsync(command,debug=verbose):
""" Runs rsync and gets returns it's output """
- cmd = str(generate_rsync_command(base_for_rsync, (repo_list + dir_list)))
if debug:
printf("rsync_command: " + cmd)
return commands.getoutput(cmd)