From a403e72e5c76c8f885b7b2120b7f5753c8f5006d Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Marek=20Marczykowski-G=C3=B3recki?=
 <marmarek@invisiblethingslab.com>
Date: Mon, 7 Apr 2014 00:49:29 +0200
Subject: [PATCH] Do not collect (or even check existence) src.rpms when
 --nosource given
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Organization: Invisible Things Lab
Cc: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>

Signed-off-by: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
---
 src/pypungi/__init__.py | 23 ++++++++++++++---------
 1 file changed, 14 insertions(+), 9 deletions(-)

diff --git a/src/pypungi/__init__.py b/src/pypungi/__init__.py
index e719f1a..67f4663 100644
--- a/src/pypungi/__init__.py
+++ b/src/pypungi/__init__.py
@@ -774,7 +774,8 @@ class Pungi(pypungi.PungiBase):
 
         # get package objects according to the input list
         self.getPackageObjects()
-        self.createSourceHashes()
+        if self.is_sources:
+            self.createSourceHashes()
 
         pass_num = 0
         added = set()
@@ -799,16 +800,18 @@ class Pungi(pypungi.PungiBase):
                 for po in sorted(self.po_list):
                     added.update(self.get_package_deps(po))
 
-            added_srpms = self.add_srpms()
-            added.update(added_srpms)
-            if self.is_selfhosting:
-                for srpm_po in sorted(added_srpms):
-                    added.update(self.get_package_deps(srpm_po))
+            if self.is_sources:
+                added_srpms = self.add_srpms()
+                added.update(added_srpms)
+                if self.is_selfhosting:
+                    for srpm_po in sorted(added_srpms):
+                        added.update(self.get_package_deps(srpm_po))
 
             if self.is_fulltree:
                 new = self.add_fulltree()
                 self.fulltree_packages.update(new)
-                self.fulltree_packages.update([ self.sourcerpm_srpmpo_map[i.sourcerpm] for i in new ])
+                if self.is_sources:
+                    self.fulltree_packages.update([ self.sourcerpm_srpmpo_map[i.sourcerpm] for i in new ])
                 added.update(new)
             if added:
                 continue
@@ -816,7 +819,8 @@ class Pungi(pypungi.PungiBase):
             # add langpacks
             new = self.add_langpacks(self.po_list)
             self.langpack_packages.update(new)
-            self.langpack_packages.update([ self.sourcerpm_srpmpo_map[i.sourcerpm] for i in new ])
+            if self.is_sources:
+                self.langpack_packages.update([ self.sourcerpm_srpmpo_map[i.sourcerpm] for i in new ])
             added.update(new)
             if added:
                 continue
@@ -824,7 +828,8 @@ class Pungi(pypungi.PungiBase):
             # add multilib packages
             new = self.add_multilib(self.po_list)
             self.multilib_packages.update(new)
-            self.multilib_packages.update([ self.sourcerpm_srpmpo_map[i.sourcerpm] for i in new ])
+            if self.is_sources:
+                self.multilib_packages.update([ self.sourcerpm_srpmpo_map[i.sourcerpm] for i in new ])
             added.update(new)
             if added:
                 continue
-- 
1.8.3.1

