My favorites | Sign in
Project Home Wiki Issues Source
Checkout   Browse   Changes  
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
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
// Copyright (c) 2008-2012, Romain Tartière <romain@blogreen.org>
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following condition are met:
//
// * Redistributions of source code must retain the above copyright notice,
// this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above copyright
// notice, this list of conditions and the following disclaimer in the
// documentation and/or other materials provided with the distribution.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
// POSSIBILITY OF SUCH DAMAGE.

using System;
using System.Collections.Generic;
using System.Diagnostics;

// This program will build all ports for TeXLive except print/texlive-core
// which is provided in the freebsd-texlive Subversion repository.
//
// Before running this tool, you have to install print/texlice-core (since some
// TeXLive packages include files that are provided by texlive-core, this
// utility checks the filesystem to determine if files will be installed when
// installing the package are skipped because they are part of texlive-core.
//
// You will have to specify path information at the command line. The first
// argument is the location of a directory containing all .tlpobj files
// provided in TeXLive tarballs, the second one is the location of the ports
// tree where TeXLive ports are to be built.

namespace TeXLive
{
class TLPort
{

public static int Verbosity {
get { return verbosity; }
}

private static int verbosity = 0;

private static void ShowHelp (NDesk.Options.OptionSet options)
{
Console.WriteLine("Usage: {0} [OPTIONS]+ <tlpobjdir> <portsdir>", AssemblyName());
Console.WriteLine("Generate TeXLive FreeBSD ports");
Console.WriteLine();
Console.WriteLine("Options:");
options.WriteOptionDescriptions(Console.Out);
}

private static string AssemblyName()
{
return System.Reflection.Assembly.GetExecutingAssembly().GetName().Name;
}

public static int Main(string[] args)
{
List<string> extra;
bool show_help = false;

var p = new NDesk.Options.OptionSet () {
{ "v|verbose", "Increase verbosity", v => { ++verbosity; } },
{ "h|help", "Display this message", v => { show_help = v != null; } }
};
try {
extra = p.Parse (args);
} catch (NDesk.Options.OptionException e) {
Console.Write("{0}: ", AssemblyName());
Console.WriteLine(e.Message);
Console.WriteLine("Try `{0} --help' for more information.", AssemblyName());
return 1;
}

if (show_help) {
ShowHelp (p);
return 0;
}

if (extra.Count != 2) {
ShowHelp (p);
return 1;
}

PackageCollection packages = new PackageCollection (extra[0], extra[1]);

if (Verbosity > 0)
Console.Error.WriteLine("===> Building package list (this takes a while)");

// Read all scheme-*. They reference all collections, that in turn
// reference each package.
foreach (string s in System.IO.Directory.GetFiles(packages.TlpObjDir, "scheme-*")) {
System.IO.FileInfo fi = new System.IO.FileInfo(s);
string package_name = fi.Name.Split('.')[0];

packages[package_name] = new DataPackage(package_name, packages);
}

foreach (Package pkg in packages.Values) {
if (pkg.Eligible) {
if (!pkg.Exists) {
pkg.CreatePort();
packages.moved.Remove (pkg.PortDirectory);
} else {
pkg.UpdatePort ();
}
} else {
if (Verbosity > 0)
Console.Error.WriteLine("{0}: not eligible for building a port.", pkg.Name);
}
}

// Detect deprecated packages
if (Verbosity > 0)
Console.Error.WriteLine ("===> Looking for deleted packages");

foreach (string path in System.IO.Directory.GetDirectories (System.IO.Path.Combine (packages.PortsDir, "print"))) {
string s = System.IO.Path.GetFileName (path);
if (s.StartsWith ("texlive-")) {
if (!packages.ContainsKey (s.Substring (8))) {
packages.moved.Add ("print/" + s);
DeletePort (packages.PortsDir, System.IO.Path.Combine ("print", s));
}
}
}

packages.moved.Save ();

return 0;
}

/// <summary>
/// Remove the ports from the repository
/// </summary>
static private void DeletePort (string PortsDir, string PortName)
{
// Remove the port from the repository
Process p = new Process ();
ProcessStartInfo psi = new ProcessStartInfo ("svn", string.Format ("delete --force {0}", System.IO.Path.Combine (PortsDir, PortName)));
if (TLPort.Verbosity < 2) {
psi.RedirectStandardOutput = true;
psi.UseShellExecute = false;
} else {
psi.UseShellExecute = true;
}
p.StartInfo = psi;
p.Start();
p.WaitForExit();
p.Dispose ();
}
}
}

Change log

r604 by romain.tartiere on Feb 7, 2012   Diff
Tools/tlport: Rework MOVED file
management.

Go to: 
Project members, sign in to write a code review

Older revisions

r283 by romain.tartiere on Nov 9, 2010   Diff
Fix detection and deletion of
deprecated ports.

PR:              Issue 7 
Reported By:    jhnd12867
r176 by romain.tartiere on Apr 11, 2010   Diff
* TLPort.cs:
* Package.cs: Indent after last
commit.
r175 by romain.tartiere on Apr 11, 2010   Diff
* TLPort.cs:
* Package.cs: Handle updating ports.

* IPackage.cs: Add property to check
for an existing FreeBSD port for
...
All revisions of this file

File info

Size: 5556 bytes, 162 lines
Powered by Google Project Hosting