~rbn/buildslack

8044e2da47947641e347769959846dea61b8c043 — Ruben Schuller 5 months ago 759850d v0.1.5
add switch to continue upgrades after failed build
5 files changed, 26 insertions(+), 10 deletions(-)

M README.md
M buildslack
M doc/buildslack.html
M pkgIndex.tcl
M queue.tcl
M README.md => README.md +2 -0
@@ 19,7 19,9 @@
	 -index               build slackbuilds/patches index
	 -build               build a package
	 -upgrade             upgrade package / upgrade all packages
	 -backup              keep backup of previous build
	 -keep                keep environments of broken builds
	 -cont                continue upgrade after failed builds
	 -debug               print debug output
	 -force               force redownload and rebuild
	 --                   Forcibly stop option processing

M buildslack => buildslack +3 -2
@@ 20,7 20,7 @@ package require cmdline
# try loading package, if that fails, try sourcing the scripts from
# the directory of the current script
try { 
	package require buildslack 0.1.4
	package require buildslack 0.1.5
} on error {} {
	source [file join [file dirname [info script]] index.tcl ]
	source [file join [file dirname [info script]] repository.tcl ]


@@ 119,7 119,7 @@ proc upgrade { opts } {

	::buildslack::repository::index db [ dict get $opts packages ]

	::buildslack::queue::upgrade $environment db [ dict get $opts custom ] $sources [ dict get $opts packages ] [ dict get $opts force ] [ dict get $opts keep ] [ dict get $opts backup ] [ lindex $argv 0 ] 
	::buildslack::queue::upgrade $environment db [ dict get $opts custom ] $sources [ dict get $opts packages ] [ dict get $opts force ] [ dict get $opts keep ] [ dict get $opts backup ] [ dict get $opts cont ] [ lindex $argv 0 ] 
	exit 0
}



@@ 188,6 188,7 @@ set options {
		{ upgrade								"upgrade package / upgrade all packages" }
		{ backup								"keep backup of previous build" }
		{ keep									"keep environments of broken builds" }
		{ cont									"continue upgrade after failed builds" }
		{ debug									"print debug output" }
		{ force									"force redownload and rebuild" }


M doc/buildslack.html => doc/buildslack.html +9 -4
@@ 37,7 37,9 @@
     -index               build slackbuilds/patches index
     -build               build a package
     -upgrade             upgrade package / upgrade all packages
     -backup              keep backup of previous build
     -keep                keep environments of broken builds
     -cont                continue upgrade after failed builds
     -debug               print debug output
     -force               force redownload and rebuild
     --                   Forcibly stop option processing


@@ 384,7 386,7 @@
<h3 class='ruffproc'><a name='::buildslack::queue::build'>build</a><span class='ns_scope'> [<a href="buildslack.html#::buildslack::queue" title="::buildslack::queue" class='ruff_cmd'>::buildslack::queue</a>]</span><span class='ruff-uplink'><a href='buildslack.html#::buildslack::queue'>queue</a>, <a href='#top'>Top</a></span></h3>
<div style='clear:both;'></div>
<p class='ruff'>build a slackbuild</p>
<div class='ruff_synopsis'><span class='ruff_cmd'>build</span> <span class='ruff_arg'>environment db croot sources packages force keep prgnam</span></div>
<div class='ruff_synopsis'><span class='ruff_cmd'>build</span> <span class='ruff_arg'>environment db croot sources packages force keep backup prgnam</span></div>
<h5 class='ruff'>Parameters</h5><table class='ruff_deflist'>
<tr><td><code>environment</code></td><td>environment as returned by <a href="buildslack.html#::buildslack::environment::new" title="::buildslack::environment::new" class='ruff_cmd'>::buildslack::environment::new</a></td></tr>
<tr><td><code>db</code></td><td>opened database</td></tr>


@@ 393,6 395,7 @@
<tr><td><code>packages</code></td><td>root to package repository</td></tr>
<tr><td><code>force</code></td><td>force redownload of sources and rebuild</td></tr>
<tr><td><code>keep</code></td><td>keep environments of broken builds</td></tr>
<tr><td><code>backup</code></td><td>keep backup of the last package instead of replacing it</td></tr>
<tr><td><code>prgnam</code></td><td>name of slackbuild to build</td></tr>
</table>
<h3 class='ruffproc'><a name='::buildslack::queue::dependencies'>dependencies</a><span class='ns_scope'> [<a href="buildslack.html#::buildslack::queue" title="::buildslack::queue" class='ruff_cmd'>::buildslack::queue</a>]</span><span class='ruff-uplink'><a href='buildslack.html#::buildslack::queue'>queue</a>, <a href='#top'>Top</a></span></h3>


@@ 446,7 449,7 @@
<h3 class='ruffproc'><a name='::buildslack::queue::upgrade'>upgrade</a><span class='ns_scope'> [<a href="buildslack.html#::buildslack::queue" title="::buildslack::queue" class='ruff_cmd'>::buildslack::queue</a>]</span><span class='ruff-uplink'><a href='buildslack.html#::buildslack::queue'>queue</a>, <a href='#top'>Top</a></span></h3>
<div style='clear:both;'></div>
<p class='ruff'>upgrade packages</p>
<div class='ruff_synopsis'><span class='ruff_cmd'>upgrade</span> <span class='ruff_arg'>environment db croot sources packages force keep prgnam</span></div>
<div class='ruff_synopsis'><span class='ruff_cmd'>upgrade</span> <span class='ruff_arg'>environment db croot sources packages force keep backup cont prgnam</span></div>
<h5 class='ruff'>Parameters</h5><table class='ruff_deflist'>
<tr><td><code>environment</code></td><td>environment as returned by <a href="buildslack.html#::buildslack::environment::new" title="::buildslack::environment::new" class='ruff_cmd'>::buildslack::environment::new</a></td></tr>
<tr><td><code>db</code></td><td>opened database</td></tr>


@@ 455,6 458,8 @@
<tr><td><code>packages</code></td><td>root to package repository</td></tr>
<tr><td><code>force</code></td><td>Not documented.</td></tr>
<tr><td><code>keep</code></td><td>keep environments of broken builds</td></tr>
<tr><td><code>backup</code></td><td>keep backup of the last package instead of replacing it</td></tr>
<tr><td><code>cont</code></td><td>continue with next package after build fails</td></tr>
<tr><td><code>prgnam</code></td><td>either name of slackbuild OR empty string &quot;&quot; to upgrade all outdated slackbuilds</td></tr>
</table>
<h1 class='ruff'><a name='::buildslack::repository'></a>::buildslack::repository<span class='ruff-uplink'><a href='#top'>Top</a></span></h1>


@@ 653,13 658,13 @@
</span></li><li class='ruff-toc1'><a href='#::buildslack::nfo'>buildslack::nfo</a></li><li class='ruff-toc2'><a href='#::buildslack::nfo-Commands'>Commands</a></li><li class='ruff-toc3 ruff-tip'><a href='buildslack.html#::buildslack::nfo::joinlines'>joinlines</a><span class='ruff-tiptext'><pre><span class='ruff_cmd'>joinlines</span> <span class='ruff_arg'>inchan</span></pre>joinlines concatenates lines which belong together.
</span></li><li class='ruff-toc3 ruff-tip'><a href='buildslack.html#::buildslack::nfo::new'>new</a><span class='ruff-tiptext'><pre><span class='ruff_cmd'>new</span> <span class='ruff_arg'>inchan</span></pre>new parses an info file.
</span></li><li class='ruff-toc3 ruff-tip'><a href='buildslack.html#::buildslack::nfo::parse'>parse</a><span class='ruff-tiptext'><pre><span class='ruff_cmd'>parse</span> <span class='ruff_arg'>inchan</span></pre>parse a info file from a channel.
</span></li><li class='ruff-toc1'><a href='#::buildslack::queue'>buildslack::queue</a></li><li class='ruff-toc2'><a href='#::buildslack::queue-Commands'>Commands</a></li><li class='ruff-toc3 ruff-tip'><a href='buildslack.html#::buildslack::queue::build'>build</a><span class='ruff-tiptext'><pre><span class='ruff_cmd'>build</span> <span class='ruff_arg'>environment db croot sources packages force keep prgnam</span></pre>build a slackbuild
</span></li><li class='ruff-toc1'><a href='#::buildslack::queue'>buildslack::queue</a></li><li class='ruff-toc2'><a href='#::buildslack::queue-Commands'>Commands</a></li><li class='ruff-toc3 ruff-tip'><a href='buildslack.html#::buildslack::queue::build'>build</a><span class='ruff-tiptext'><pre><span class='ruff_cmd'>build</span> <span class='ruff_arg'>environment db croot sources packages force keep backup prgnam</span></pre>build a slackbuild
</span></li><li class='ruff-toc3 ruff-tip'><a href='buildslack.html#::buildslack::queue::dependencies'>dependencies</a><span class='ruff-tiptext'><pre><span class='ruff_cmd'>dependencies</span> <span class='ruff_arg'>db prgnam</span></pre>recursively collect all dependencies of a slackbuild
</span></li><li class='ruff-toc3 ruff-tip'><a href='buildslack.html#::buildslack::queue::filterNotPresent'>filterNotPresent</a><span class='ruff-tiptext'><pre><span class='ruff_cmd'>filterNotPresent</span> <span class='ruff_arg'>db queue</span></pre>filter packages not already present in the database.
</span></li><li class='ruff-toc3 ruff-tip'><a href='buildslack.html#::buildslack::queue::filterPresent'>filterPresent</a><span class='ruff-tiptext'><pre><span class='ruff_cmd'>filterPresent</span> <span class='ruff_arg'>db queue</span></pre>filter packages already present in the database.
</span></li><li class='ruff-toc3 ruff-tip'><a href='buildslack.html#::buildslack::queue::reverseDependencies'>reverseDependencies</a><span class='ruff-tiptext'><pre><span class='ruff_cmd'>reverseDependencies</span> <span class='ruff_arg'>db prgnam</span></pre>recursively collect all packages which depend on prgnam
</span></li><li class='ruff-toc3 ruff-tip'><a href='buildslack.html#::buildslack::queue::uniqueList'>uniqueList</a><span class='ruff-tiptext'><pre><span class='ruff_cmd'>uniqueList</span> <span class='ruff_arg'>list</span></pre>uniqueList filters duplicates from a list, keeping the order intact.
</span></li><li class='ruff-toc3 ruff-tip'><a href='buildslack.html#::buildslack::queue::upgrade'>upgrade</a><span class='ruff-tiptext'><pre><span class='ruff_cmd'>upgrade</span> <span class='ruff_arg'>environment db croot sources packages force keep prgnam</span></pre>upgrade packages
</span></li><li class='ruff-toc3 ruff-tip'><a href='buildslack.html#::buildslack::queue::upgrade'>upgrade</a><span class='ruff-tiptext'><pre><span class='ruff_cmd'>upgrade</span> <span class='ruff_arg'>environment db croot sources packages force keep backup cont prgnam</span></pre>upgrade packages
</span></li><li class='ruff-toc1'><a href='#::buildslack::repository'>buildslack::repository</a></li><li class='ruff-toc2'><a href='#::buildslack::repository-Commands'>Commands</a></li><li class='ruff-toc3 ruff-tip'><a href='buildslack.html#::buildslack::repository::add'>add</a><span class='ruff-tiptext'><pre><span class='ruff_cmd'>add</span> <span class='ruff_arg'>db root path</span></pre>add a package file to the package repository
</span></li><li class='ruff-toc3 ruff-tip'><a href='buildslack.html#::buildslack::repository::addSQL'>addSQL</a><span class='ruff-tiptext'><pre><span class='ruff_cmd'>addSQL</span> <span class='ruff_arg'>db pkg</span></pre>add package info to the database
</span></li><li class='ruff-toc3 ruff-tip'><a href='buildslack.html#::buildslack::repository::all'>all</a><span class='ruff-tiptext'><pre><span class='ruff_cmd'>all</span> <span class='ruff_arg'>db</span></pre>all known packages.

M pkgIndex.tcl => pkgIndex.tcl +2 -2
@@ 1,6 1,6 @@
package ifneeded buildslack 0.1.4 [ subst {
package ifneeded buildslack 0.1.5 [ subst {
	foreach f {build.tcl database.tcl environment.tcl index.tcl queue.tcl repository.tcl slackbuild.tcl sources.tcl} { 
		source [file join $dir \$f] 
	}
	package provide buildslack 0.1.4
	package provide buildslack 0.1.5
} ]

M queue.tcl => queue.tcl +10 -2
@@ 122,7 122,7 @@ namespace eval ::buildslack::queue {
		return $out
	}

	proc upgrade { environment db croot sources packages force keep backup prgnam } {
	proc upgrade { environment db croot sources packages force keep backup cont prgnam } {
		# upgrade packages
		#  environment - environment as returned by [::buildslack::environment::new]
		#  db - opened database


@@ 131,6 131,7 @@ namespace eval ::buildslack::queue {
		#  sources - sources as returned by [::buildslack::sources::new]
		#  keep - keep environments of broken builds
		#  backup - keep backup of the last package instead of replacing it
		#  cont - continue with next package after build fails
		#  prgnam - either name of slackbuild OR empty string "" to upgrade all outdated slackbuilds
		lappend pkgs [ ::buildslack::repository::sb $db $prgnam ]



@@ 187,6 188,8 @@ namespace eval ::buildslack::queue {

		log::log info "queue: $q"

		lappend failed

		foreach x $q {
			try {
				::buildslack::environment::initialize environment


@@ 207,7 210,10 @@ namespace eval ::buildslack::queue {
				}
			} on error { result options } {
				log::log error "building $x failed"
				return -options $options $result
				if { !$cont } {
					return -options $options $result
				}
				lappend failed "$x"
			} finally {
				if { !$keep } {
					::buildslack::environment::umount $environment


@@ 215,6 221,8 @@ namespace eval ::buildslack::queue {
				}
			}
		}

		log::log info "failed packages: [ join $failed { } ]"
	}

	proc build { environment db croot sources packages force keep backup prgnam } {