Gentoo Archives: gentoo-commits

From: "André Erdmann" <dywi@×××××××.de>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] proj/R_overlay:master commit in: /
Date: Tue, 26 Jun 2012 15:43:29
Message-Id: 1340725363.fe770adcf35feaa79977fc7b78de26ab8e3766b0.dywi@gentoo
commit:     fe770adcf35feaa79977fc7b78de26ab8e3766b0
Author:     André Erdmann <dywi <AT> mailerd <DOT> de>
AuthorDate: Tue Jun 26 15:42:43 2012 +0000
Commit:     André Erdmann <dywi <AT> mailerd <DOT> de>
CommitDate: Tue Jun 26 15:42:43 2012 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/R_overlay.git;a=commit;h=fe770adc

test scripts

---
 Makefile                        |    7 +++++-
 run_sync.py                     |   40 ++++++++++++++++++++++++++++++++++
 run_sync_and_overlaycreation.py |   45 +++++++++++++++++++++++++++++++++++++++
 3 files changed, 91 insertions(+), 1 deletions(-)

diff --git a/Makefile b/Makefile
index 07dce33..7e60eb1 100644
--- a/Makefile
+++ b/Makefile
@@ -8,13 +8,18 @@ PY = python$(PYVER)
 
 LOGDIR = ./log
 
+SYNC   = ./run_sync.py
 PY_NOP = ./nop.py
 PY_OVL = ./run_overlaycreation.py
 
 .PHONY: default dummy \
 	test test-nop nop \
 	test-seewave seewave \
-	clean-log
+	clean-log \
+	download
+
+download: test-nop $(SYNC)
+	$(PY) $(SYNC)
 
 default: dummy test
 

diff --git a/run_sync.py b/run_sync.py
new file mode 100755
index 0000000..8d50d85
--- /dev/null
+++ b/run_sync.py
@@ -0,0 +1,40 @@
+#!/usr/bin/env python3
+from sys import exit
+from sys import argv as ARGV
+
+if True in ( x in ARGV for x in ( '--help', '-h', '?' ) ):
+	print ( '\n'.join ( (
+		"usage: %s <args>" % ARGV[0],
+		"* args ::= [arg]*",
+		"* arg  ::= --write|--show|--help",
+		"** write ^= write overlay (somewhere in /tmp by default)",
+		"** show  ^= print overlay to stdout",
+	) ) )
+	exit ( 0 )
+
+import roverlay
+
+from roverlay.overlay.creator import OverlayCreator
+from roverlay.remote import RepoList
+
+SHOW  = False
+WRITE = False
+
+for i, x in enumerate ( ARGV ):
+	if i == 0:
+		pass
+	elif x == '--show':
+		SHOW = True
+	elif x == '--write':
+		WRITE = True
+
+o = OverlayCreator()
+o.can_write_overlay = WRITE
+
+r = RepoList()
+r.load()
+
+r.sync()
+
+if not ( WRITE or SHOW ):
+	print ( "Use '--show' or '--write' if you want ebuild/metadata/Manifest output." )

diff --git a/run_sync_and_overlaycreation.py b/run_sync_and_overlaycreation.py
new file mode 100755
index 0000000..b7e472a
--- /dev/null
+++ b/run_sync_and_overlaycreation.py
@@ -0,0 +1,45 @@
+#!/usr/bin/env python3
+from sys import exit
+from sys import argv as ARGV
+
+if True in ( x in ARGV for x in ( '--help', '-h', '?' ) ):
+	print ( '\n'.join ( (
+		"usage: %s <args>" % ARGV[0],
+		"* args ::= [arg]*",
+		"* arg  ::= --write|--show|--help",
+		"** write ^= write overlay (somewhere in /tmp by default)",
+		"** show  ^= print overlay to stdout",
+	) ) )
+	exit ( 0 )
+
+import roverlay
+
+from roverlay.overlay.creator import OverlayCreator
+from roverlay.remote import RepoList
+
+SHOW  = False
+WRITE = False
+
+for i, x in enumerate ( ARGV ):
+	if i == 0:
+		pass
+	elif x == '--show':
+		SHOW = True
+	elif x == '--write':
+		WRITE = True
+
+o = OverlayCreator()
+o.can_write_overlay = WRITE
+
+r = RepoList()
+r.load()
+
+r.sync()
+r.add_packages ( o.add_package )
+o.run()
+
+if SHOW: o.show_overlay()
+o.close ( write=True )
+
+if not ( WRITE or SHOW ):
+	print ( "Use '--show' or '--write' if you want ebuild/metadata/Manifest output." )