Re: The Missing Arch patch for reposync -- Updated Patch

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



As promised, here's the updated patch. FYI, worked great with the
current source from git. I'm just getting used to git--I use Subversion
most of the time. Do you call it HEAD? I looked for a revision number to
specify, show you are aware of what the patch was against in case there
were updates prior to my getting this back to you, but could not find
any. Guess git requires some study... :-)

-Dan

-- 
C. Daniel Chase               (423) 949-4086         http://cdChase.com/
Get Firefox!     http://www.spreadfirefox.com/?q=affiliates&id=58708&t=1
Queensbury High School 1977 30th Reunion  http://cdchase.com/QHSReunion/
diff --git a/cobbler/cobbler/action_reposync.py b/cobbler.patched/cobbler/action_reposync.py
index e932309..7fac220 100644
--- a/cobbler/cobbler/action_reposync.py
+++ b/cobbler.patched/cobbler/action_reposync.py
@@ -118,9 +118,11 @@ class RepoSync:
             temp_file = self.create_local_file(repo, temp_path, output=False)
 
             if not has_rpm_list:
-
                 # if we have not requested only certain RPMs, use reposync
                 cmd = "/usr/bin/reposync --config=%s --repoid=%s --download_path=%s" % (temp_file, repo.name, store_path)
+                if repo.arch != "":
+                    cmd = "%s -a %s" % (cmd, repo.arch)
+                    
                 print _("- %s") % cmd
                 cmds.append(cmd)
 
@@ -130,9 +132,13 @@ class RepoSync:
                 if not os.path.exists(dest_path):
                    os.makedirs(dest_path)
 
+                use_source = ""
+                if repo.arch == "src":
+                    use_source = "--source"
+ 
                 # older yumdownloader sometimes explodes on --resolvedeps
                 # if this happens to you, upgrade yum & yum-utils
-                cmd = "/usr/bin/yumdownloader --resolve -c %s --destdir=%s %s" %(temp_file, dest_path, " ".join(repo.rpm_list))
+                cmd = "/usr/bin/yumdownloader --resolve %s -c %s --destdir=%s %s" % (use_source, temp_file, dest_path, " ".join(repo.rpm_list))
                 print _("- %s") % cmd
                 cmds.append(cmd)
         else:
@@ -144,6 +150,10 @@ class RepoSync:
                 print _("- warning: --rpm-list is not supported for RHN content")
             rest = repo.mirror[6:] # everything after rhn://
             cmd = "/usr/bin/reposync -r %s --download_path=%s" % (rest, store_path)
+
+            if repo.arch != "":
+                cmd = "%s -a %s" % (cmd, repo.arch)
+
             print _("- %s") %  cmd
             cmds.append(cmd)
 
diff --git a/cobbler/cobbler/cobbler.py b/cobbler.patched/cobbler/cobbler.py
index 5aea511..4b035a1 100755
--- a/cobbler/cobbler/cobbler.py
+++ b/cobbler.patched/cobbler/cobbler.py
@@ -467,7 +467,8 @@ class BootCLI:
            '--keep-updated'     :  lambda(a): repo.set_keep_updated(a),
            '--local-filename'   :  lambda(a): repo.set_local_filename(a),
            '--rpm-list'         :  lambda(a): repo.set_rpm_list(a),
-           '--createrepo-flags' :  lambda(a): repo.set_createrepo_flags(a)
+           '--createrepo-flags' :  lambda(a): repo.set_createrepo_flags(a),
+           '--arch'             :  lambda(a): repo.set_arch(a)
         }
         def on_ok():
             if newname is not None:
diff --git a/cobbler/cobbler/item_repo.py b/cobbler.patched/cobbler/item_repo.py
index 48fefc5..84fcf1f 100644
--- a/cobbler/cobbler/item_repo.py
+++ b/cobbler.patched/cobbler/item_repo.py
@@ -36,7 +36,8 @@ class Repo(item.Item):
         self.local_filename   = ("",         '<<inherit>>')[is_subobject]
         self.rpm_list         = ("",         '<<inherit>>')[is_subobject]
         self.createrepo_flags = ("-c cache", '<<inherit>>')[is_subobject]
-        self.depth            = 2  # arbitrary, as not really apart of the graph         
+        self.depth            = 2  # arbitrary, as not really apart of the graph
+        self.arch             = "" # use default arch
 
     def from_datastruct(self,seed_data):
         self.parent           = self.load_item(seed_data, 'parent')
@@ -46,6 +47,7 @@ class Repo(item.Item):
         self.local_filename   = self.load_item(seed_data, 'local_filename')
         self.rpm_list         = self.load_item(seed_data, 'rpm_list')
         self.createrepo_flags = self.load_item(seed_data, 'createrepo_flags', '-c cache')
+        self.arch             = self.load_item(seed_data, 'arch')
         self.depth            = self.load_item(seed_data, 'depth', 2)
 
         # force this to be saved as a boolean 
@@ -123,6 +125,13 @@ class Repo(item.Item):
         self.createrepo_flags = createrepo_flags
         return True
 
+    def set_arch(self,arch):
+        """
+        Override the arch used for reposync
+        """
+        self.arch = arch
+        return True
+
     def is_valid(self):
         """
 	A repo is valid if it has a name and a mirror URL
@@ -141,6 +150,7 @@ class Repo(item.Item):
            'local_filename'   : self.local_filename,
            'rpm_list'         : self.rpm_list,
            'createrepo_flags' : self.createrepo_flags,
+           'arch'             : self.arch,
            'parent'           : self.parent,
            'depth'            : self.depth
         }
@@ -152,6 +162,7 @@ class Repo(item.Item):
         buf = buf + _("local filename   : %s\n") % self.local_filename
         buf = buf + _("rpm list         : %s\n") % self.rpm_list
         buf = buf + _("createrepo_flags : %s\n") % self.createrepo_flags
+        buf = buf + _("arch             : %s\n") % self.arch
         return buf
 
     def get_parent(self):
_______________________________________________
et-mgmt-tools mailing list
et-mgmt-tools@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/et-mgmt-tools

[Index of Archives]     [Fedora Users]     [Fedora Legacy List]     [Fedora Maintainers]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux