[29947] trunk/dports/sysutils

source_changes at macosforge.org source_changes at macosforge.org
Tue Oct 16 00:40:12 PDT 2007


Revision: 29947
          http://trac.macosforge.org/projects/macports/changeset/29947
Author:   afb at macports.org
Date:     2007-10-16 00:40:11 -0700 (Tue, 16 Oct 2007)

Log Message:
-----------
new port: Zero Install, development version

Added Paths:
-----------
    trunk/dports/sysutils/zeroinstall-injector-devel/
    trunk/dports/sysutils/zeroinstall-injector-devel/Portfile
    trunk/dports/sysutils/zeroinstall-injector-devel/files/patch-distro.py

Copied: trunk/dports/sysutils/zeroinstall-injector-devel (from rev 29928, trunk/dports/sysutils/zeroinstall-injector)

Copied: trunk/dports/sysutils/zeroinstall-injector-devel/Portfile (from rev 29929, trunk/dports/sysutils/zeroinstall-injector/Portfile)
===================================================================
--- 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)
@@ -0,0 +1,54 @@
+# $Id$
+
+PortSystem 1.0
+
+name		zeroinstall-injector-devel
+version		0.30
+platforms	darwin freebsd linux
+categories	sysutils
+maintainers	afb at 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

Added: trunk/dports/sysutils/zeroinstall-injector-devel/files/patch-distro.py
===================================================================
--- 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)
@@ -0,0 +1,117 @@
+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()

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.macosforge.org/pipermail/macports-changes/attachments/20071016/2f80b24d/attachment.html


More information about the macports-changes mailing list