summaryrefslogtreecommitdiffstats
path: root/build_tools/larch8/larch0/cli/archin.cachepacks_postprocess.patch
blob: d293abb84c5bb696afc189890adb46747711013d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
--- archin.py.orig	2010-11-28 14:48:27.000000000 +0000
+++ archin.py	2010-12-03 01:02:35.000000000 +0000
@@ -188,7 +188,19 @@
         self.add_packsfile(self.profile_dir, 'addedpacks')
 
         # Now do the actual installation.
-        ok = self.pacmancall('-S', ' '.join(self.packages))
+        ok = self.pacmancall('-Sf', ' '.join(self.packages))
+        if not ok:
+            errout(_("Package installation failed"))
+
+        #cachepacks goes here
+        
+        self.cache_packages=[]
+        cache_packs = self.add_cache_packsfile(self.profile_dir, 'cachepacks')
+        cachedir = "%s/data/var/cache/pacman/pkg/" % self.installation_dir
+        print cachedir
+        self.clearcache()
+        comment(" *** %s ***" % _("Installing Cache Packages"))
+        ok = self.pacmancall('-Sw --cachedir='+cachedir , ' '.join(self.cache_packages))
         if not ok:
             errout(_("Package installation failed"))
 
@@ -197,6 +209,18 @@
 
         # Build the final version of pacman.conf
         self.make_pacman_conf(True)
+
+        #post_process goes here
+        comment(" *** %s ***" % _("Start of post processing"))
+        post_process_file="%s/post-process.sh" %self.profile_dir
+        #try:
+        if os.path.isfile(post_process_file):
+            cmd = "%s %s %s" %(post_process_file,self.installation_dir,self.profile_dir)
+            print "this is my cmd: %s" %cmd
+            runcmd(cmd)
+        else:
+             comment(" *** %s ***" % _("Post processing file not found"))
+
         comment(" *** %s ***" % _("Arch installation completed"))
         return True
 
@@ -231,6 +255,39 @@
                         self.packages.append(line)
         fh.close()
 
+    def add_cache_packsfile(self, dir, packs_file, must=True):
+        path = dir + '/' + packs_file
+        if must and not os.path.isfile(path):
+            errout(_("No '%s' file") % path)
+        fh = open(path)
+        for line in fh:
+            line = line.strip()
+            if line and (line[0] != '#'):
+                if line[0] == '*':
+                    self.add_group(line[1:].split()[0])
+                elif line[0] == '+':
+                    # Include directive
+                    line = line[1:].split()[0]
+                    if line[0] != '/':
+                        line = dir + '/' + line
+                    d, pf = line.rsplit('/', 1)
+                    if not d:
+                        errout(_("Invalid package file include: %s"))
+                    print "calling myself with %s %s" %(d,pf)
+                    self.add_cache_packsfile(d, pf)
+
+                elif line.startswith('!!!'):
+                    # Ignore everything (!) entered previously.
+                    # Allows requiredpacks to be overridden in addedpacks.
+                    self.cache_packages = []
+                else:
+                    line = line.split()[0]
+                    if ((line not in self.cache_packages) and (line not in self.veto_packages)):
+                        self.cache_packages.append(line)
+        fh.close()
+
+
+        
 
     def add_group(self, gname):
         """Add the packages belonging to a group to the installaion list,
@@ -306,6 +363,9 @@
     def remove(self, *packs):
         return self.pacmancall('-Rs', ' '.join(packs))
 
+    def clearcache(self):
+        return self.pacmancall('-Swcc')
+
 
 
 if __name__ == "__main__":