Changeset 106
- Timestamp:
- 11/15/06 21:13:28 (2 years ago)
- Files:
-
- trunk/hcf/path.d (modified) (1 diff)
- trunk/sss/main.d (modified) (1 diff)
- trunk/sss/net.d (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/hcf/path.d
r86 r106 170 170 } 171 171 } 172 173 /** Remove a file or directory and all of its children */ 174 void rmRecursive(char[] name) 175 { 176 if (isdir(name)) { 177 foreach (elem; listdir(name)) { 178 // don't delete . or .. 179 if (elem == "." || 180 elem == "..") continue; 181 rmRecursive(elem); 182 } 183 184 // remove the directory itself 185 rmdir(name); 186 } else { 187 std.file.remove(name); 188 } 189 } trunk/sss/main.d
r86 r106 310 310 deps: Install (from the network source) dependencies of the present 311 311 package 312 install: Install a package via the network source` 312 install: Install a package via the network source 313 fetch: Fetch but do not compile or install a package` 313 314 ); 314 315 trunk/sss/net.d
r99 r106 134 134 } 135 135 136 case "fetch": 136 137 case "install": 137 138 { 138 139 // download and install the specified package and its dependencies 139 140 if (args.length < 2) { 140 writefln(" The install command requires a package name as an argument.");141 writefln("No package name specified."); 141 142 return 1; 142 143 } … … 151 152 char[] srcDir = scratchPrefix ~ std.path.sep ~ "DSSS_" ~ args[1]; 152 153 mkdirP(srcDir); 153 writefln(" Building in %s", srcDir);154 writefln("Working in %s", srcDir); 154 155 155 156 // 2) chdir … … 157 158 chdir(srcDir); 158 159 160 // make sure the directory gets removed 161 scope(exit) { 162 chdir(origcwd); 163 rmRecursive(srcDir); 164 } 165 159 166 // 3) get sources 160 167 if (!getSources(args[1], conf)) return 1; 161 168 srcDir = getcwd(); 162 169 163 // 4) make sure it's not installed 164 uninstall(args[1..2]); 165 166 // 5) install prerequisites 167 char[][] netcmd; 168 netcmd ~= "deps"; 169 int netret = net(netcmd); 170 if (netret) return netret; 171 chdir(srcDir); 172 173 // 6) build 174 DSSSConf dconf = readConfig(null); 175 int buildret = build(args[2..$], dconf); 176 if (buildret) return buildret; 177 178 // 7) install 179 return install(args[2..$]); 170 // if we're just fetching, make the archive 171 if (args[0] == "fetch") { 172 char[] archname = args[1] ~ ".tar.gz"; 173 174 // compress 175 version (Windows) { 176 system("bsdtar zcf " ~ archname ~ " ~ std.string.join( 177 listdir(".", RegExp(r"^[^\.]")), 178 " ")); 179 } else { 180 system("tar -cf - * | gzip -c > " ~ archname); 181 } 182 183 // move into place 184 std.file.rename(archname, 185 origcwd ~ std.path.sep ~ archname); 186 187 writefln("Archive %s created.", archname); 188 return 0; 189 } else { 190 // 4) make sure it's not installed 191 uninstall(args[1..2]); 192 193 // 5) install prerequisites 194 char[][] netcmd; 195 netcmd ~= "deps"; 196 int netret = net(netcmd); 197 if (netret) return netret; 198 chdir(srcDir); 199 200 // 6) build 201 DSSSConf dconf = readConfig(null); 202 int buildret = build(args[2..$], dconf); 203 if (buildret) return buildret; 204 205 // 7) install 206 return install(args[2..$]); 207 } 180 208 } 181 209
