make pre-release repo-maker works on slave
authorHasan Wan <hasan.wan@intel.com>
Mon, 27 May 2013 08:55:06 +0000 (16:55 +0800)
committerHasan Wan <hasan.wan@intel.com>
Mon, 27 May 2013 09:38:34 +0000 (17:38 +0800)
Change-Id: I39d2b1904ed64460fc89ff8e3a12cbe86eb9dc6a
Signed-off-by: Hasan Wan <hasan.wan@intel.com>
job_pre_release_obs.py

index a387399..5d66c91 100755 (executable)
@@ -35,27 +35,40 @@ def make_repo(project, repo, redis_host, redis_port):
         raise LocalError("Can't get information about project '%s': %s" \
                          % (project, str(err)))
     latest_snapshot = data['latest_snapshot']
+
+    # Prerelease repo id: ${target_repo_id}.${time_stampe}
     build_id = '%s.%s' % (data['latest_snapshot'], project.split(':')[-1])
 
+    # The repo local path on the running target server
+    path_to_repo = os.path.join(os.getenv('PATH_REPO_BASE', '/srv/download'),
+                                data['prerelease_path'])
+
     # Convert live repo to download structure
-    repomaker = RepoMaker(build_id, data['prerelease_dir'])
-    live_repo_path = os.path.join('/srv/obs/repos/', project.replace(':', ':/'))
+    repomaker = RepoMaker(build_id, path_to_repo)
+    live_repo_path = os.path.join(os.getenv('PATH_LIVE_REPO_BASE','/srv/obs/repos/'),
+                                  project.replace(':', ':/'))
+
     # TODO: get buldconf from OBS
     try:
-        repomaker.add_repo(live_repo_path, repo, move=True) #,buildconf
+        repomaker.add_repo(live_repo_path, repo, move=False) #,buildconf
     except RepoMakerError, err:
         raise LocalError("Unable to create download repo: %s" % err)
 
     # TODO: remove output_dir
 
     # Assuming that there can be just one image-configurations- rpm in the repo
+
     if not repomaker.images:
         # repomaker did not found image-configurations in pre_release repo,
-        # let's take it from snapshot repo
-        snapshot_dir = os.path.join(data['snapshot_dir'], latest_snapshot, repo)
+        # let's take it from target repo
+        path_target_repo = os.path.join(os.getenv('PATH_REPO_BASE', '/srv/download'),
+                                    data['snapshot_path'],
+                                    latest_snapshot,
+                                    'repos',
+                                    repo)
         # Add image configuration to pre-release repo
-        repomaker.add_images(get_ks_files(snapshot_dir))
-
+        repomaker.add_images(get_ks_files(path_target_repo))
+        
     if not repomaker.images:
         raise LocalError("Image configuration not found")