<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" /><style type="text/css"><!--
#msg dl { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; }
#msg dl a { font-weight: bold}
#msg dl a:link { color:#fc3; }
#msg dl a:active { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fc0 solid; padding: 6px; }
#msg ul, pre { overflow: auto; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<title>[29947] trunk/dports/sysutils</title>
</head>
<body>
<div id="msg">
<dl>
<dt>Revision</dt> <dd><a href="http://trac.macosforge.org/projects/macports/changeset/29947">29947</a></dd>
<dt>Author</dt> <dd>afb@macports.org</dd>
<dt>Date</dt> <dd>2007-10-16 00:40:11 -0700 (Tue, 16 Oct 2007)</dd>
</dl>
<h3>Log Message</h3>
<pre>new port: Zero Install, development version</pre>
<h3>Added Paths</h3>
<ul>
<li>trunk/dports/sysutils/zeroinstall-injector-devel/</li>
<li><a href="#trunkdportssysutilszeroinstallinjectordevelPortfile">trunk/dports/sysutils/zeroinstall-injector-devel/Portfile</a></li>
<li><a href="#trunkdportssysutilszeroinstallinjectordevelfilespatchdistropy">trunk/dports/sysutils/zeroinstall-injector-devel/files/patch-distro.py</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkdportssysutilszeroinstallinjectordevelfromrev29928trunkdportssysutilszeroinstallinjector"></a>
<div class="copfile"><h4>Copied: trunk/dports/sysutils/zeroinstall-injector-devel (from rev 29928, trunk/dports/sysutils/zeroinstall-injector)</h4></div>
<a id="trunkdportssysutilszeroinstallinjectordevelPortfilefromrev29929trunkdportssysutilszeroinstallinjectorPortfile"></a>
<div class="copfile"><h4>Copied: trunk/dports/sysutils/zeroinstall-injector-devel/Portfile (from rev 29929, trunk/dports/sysutils/zeroinstall-injector/Portfile) (0 => 29947)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/dports/sysutils/zeroinstall-injector-devel/Portfile         (rev 0)
+++ trunk/dports/sysutils/zeroinstall-injector-devel/Portfile        2007-10-16 07:40:11 UTC (rev 29947)
</span><span class="lines">@@ -0,0 +1,54 @@
</span><ins>+# $Id$
+
+PortSystem 1.0
+
+name                zeroinstall-injector-devel
+version                0.30
+platforms        darwin freebsd linux
+categories        sysutils
+maintainers        afb@macports.org
+description        The Zero Install Injector (0launch)
+long_description \
+The Zero Install Injector makes it easy for users to install software without \
+needing root privileges. It takes the URL of a program and runs it (downloading \
+it first if necessary). Any dependencies of the program are fetched in the same \
+way. The user controls which version of the program and its dependencies to \
+use.
+
+homepage        http://0install.net
+master_sites        sourceforge
+master_sites.mirror_subdir        zero-install
+extract.suffix        .tar.gz.gpg
+checksums        md5 c539dc6ffa39f18700220f5565d8eac3 \
+                sha1 c3cdc1bec37f62f9dbd8e938590a6097a259904a \
+                rmd160 eff6aee9b81ce8aa9a92272de6526ac6753f3fd0
+
+depends_lib        port:python25 bin:gpg:gnupg
+depends_run        port:py25-gtk port:py25-xml bin:sudo:sudo
+
+fetch.type        svn
+svn.url                https://zero-install.svn.sourceforge.net/svnroot/zero-install/trunk/0launch
+worksrcdir        0launch        
+
+patchfiles        patch-setup.py patch-arch.py patch-unpack.py \
+                patch-distro.py
+
+use_configure        no
+post-configure {
+        reinplace s,/var/cache/0install.net,${prefix}/var/cache/0install.net, \
+         ${worksrcpath}/zeroinstall/zerostore/__init__.py
+}
+
+build.cmd        ${prefix}/bin/python2.5 setup.py
+build.target                build
+
+destroot.cmd        ${prefix}/bin/python2.5 setup.py
+destroot.destdir        --prefix=${prefix} --skip-build --root=${destroot}
+
+livecheck.name        zero-install
+livecheck.distname        injector
+
+# This is not used by default, but is required if you want to
+# set up sharing of downloads later.
+adduser                zeroinst shell=/sbin/nologin
+destroot.keepdirs        ${destroot}${prefix}/var/cache/0install.net/implementations
</ins></span></pre></div>
<a id="trunkdportssysutilszeroinstallinjectordevelfilespatchdistropy"></a>
<div class="addfile"><h4>Added: trunk/dports/sysutils/zeroinstall-injector-devel/files/patch-distro.py (0 => 29947)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/dports/sysutils/zeroinstall-injector-devel/files/patch-distro.py         (rev 0)
+++ trunk/dports/sysutils/zeroinstall-injector-devel/files/patch-distro.py        2007-10-16 07:40:11 UTC (rev 29947)
</span><span class="lines">@@ -0,0 +1,117 @@
</span><ins>+Index: zeroinstall/injector/distro.py
+===================================================================
+--- zeroinstall/injector/distro.py        (revision 2053)
++++ zeroinstall/injector/distro.py        (arbetskopia)
+@@ -228,12 +228,112 @@
+                 impl = factory('package:rpm:%s:%s' % (package, version))
+                 impl.version = model.parse_version(version)
+
++class MacPortsDistribution(Distribution):
++        cache_leaf = 'mp-status.cache'
++        
++        def __init__(self, db_dir):
++                self.db_dir = db_dir
++                rcpt_status = os.path.join(db_dir, 'receipts')
++                self.status_details = os.stat(rcpt_status)
++
++                self.versions = {}
++                self.cache_dir=basedir.save_cache_path(namespaces.config_site,
++                                                 namespaces.config_prog)
++
++                try:
++                        self.load_cache()
++                except Exception, ex:
++                        info("Failed to load cache (%s). Regenerating...",
++                         ex)
++                        try:
++                                self.generate_cache()
++                                self.load_cache()
++                        except Exception, ex:
++                                warn("Failed to regenerate cache: %s", ex)
++
++        def load_cache(self):
++                stream = file(os.path.join(self.cache_dir, self.cache_leaf))
++
++                for line in stream:
++                        if line == '\n':
++                                break
++                        name, value = line.split(': ')
++                        if name == 'mtime' and (int(value) !=
++                                         int(self.status_details.st_mtime)):
++                                raise Exception("Modification time of mp status file has changed")
++                        if name == 'size' and (int(value) !=
++                                         self.status_details.st_size):
++                                raise Exception("Size of mp status file has changed")
++                else:
++                        raise Exception('Invalid cache format (bad header)')
++                        
++                versions = self.versions
++                for line in stream:
++                        package, version = line[:-1].split('\t')
++                        versions[package] = version
++
++        def __parse_port_line(self, line):
++
++                package, version, category = line.strip().split()
++                if version.startswith('@'):
++                        version = version.lstrip('@')
++                if '_' in version:
++                        # MacPorts's 'revision' system
++                        version = version.split('_', 1)[0]
++                clean_version = try_cleanup_distro_version(version)
++                if clean_version:
++                        return package, clean_version
++                else:
++                        return None, None
++                
++        def generate_cache(self):
++                cache = []
++
++                for line in os.popen("port list installed"):
++                        package, version = self.__parse_port_line(line)
++                        if package and version:
++                                cache.append('%s\t%s' % (package, version))
++
++                cache = list(set(cache)) # Remove duplicates (from images)
++                cache.sort() # Might be useful later; currently we don't care
++                
++                import tempfile
++                fd, tmpname = tempfile.mkstemp(prefix = 'mp-cache-tmp',
++                                         dir = self.cache_dir)
++                try:
++                        stream = os.fdopen(fd, 'wb')
++                        stream.write('mtime: %d\n' % int(self.status_details.st_mtime))
++                        stream.write('size: %d\n' % self.status_details.st_size)
++                        stream.write('\n')
++                        for line in cache:
++                                stream.write(line + '\n')
++                        stream.close()
++
++                        os.rename(tmpname,
++                                 os.path.join(self.cache_dir,
++                                         self.cache_leaf))
++                except:
++                        os.unlink(tmpname)
++                        raise
++
++        def get_package_info(self, package, factory):
++                try:
++                        version = self.versions[package]
++                except KeyError:
++                        return
++
++                impl = factory('package:mp:%s:%s' % (package, version))
++                impl.version = model.parse_version(version)
++
+ _dpkg_db_dir = '/var/lib/dpkg'
+ _rpm_db_dir = '/var/lib/rpm'
++_mp_db_dir = '/opt/local/var/macports'
+
+ if os.path.isdir(_dpkg_db_dir):
+         host_distribution = DebianDistribution(_dpkg_db_dir)
+ elif os.path.isdir(_rpm_db_dir):
+         host_distribution = RPMDistribution(_rpm_db_dir)
++elif os.path.isdir(_mp_db_dir):
++        host_distribution = MacPortsDistribution(_mp_db_dir)
+ else:
+         host_distribution = Distribution()
</ins></span></pre>
</div>
</div>
</body>
</html>