Ok, I see.
I'm against it.
It would be easy to build a virus removing at least all user data
with this, just by writing a quarks file and adding it to the
repository.
2c
Till
On 19 Dec 2006, at 16:46, stefan kersten wrote:
> Till Bovermann wrote:
>> What do you wanna build/cleanup when installing quarks?
>
> ugens, scum, anything. i've attached a changeset that gives an idea of
> what i mean.
>
> <sk>
> Index: build/SCClassLibrary/Platform/Platform.sc
> ===================================================================
> --- build/SCClassLibrary/Platform/Platform.sc (revision 5713)
> +++ build/SCClassLibrary/Platform/Platform.sc (working copy)
> @@ -1,16 +1,56 @@
> Platform
> {
> + var features;
> +
> + *new {
> + ^super.new.initPlatform
> + }
> + initPlatform {
> + features = IdentityDictionary.new;
> + }
> +
> name { ^this.subclassResponsibility }
>
> + // directories
> systemAppSupportDir { _Platform_systemAppSupportDir }
> userAppSupportDir { _Platform_userAppSupportDir }
> systemExtensionDir { _Platform_systemExtensionDir }
> userExtensionDir { _Platform_userExtensionDir }
> + platformDir { ^this.name.asString }
> pathSeparator { ^this.subclassResponsibility }
>
> + // startup/shutdown hooks
> startup { }
> shutdown { }
>
> + // features
> + declareFeature { | aFeature |
> + if (aFeature.asString.first == $_) {
> + Error("cannot declare primitive features").throw;
> + };
> + features.put(aFeature, true);
> + }
> + hasFeature { | aFeature |
> + var isPrimitive;
> + ^features.at(aFeature) ?? {
> + isPrimitive = (aFeature.asString.first == $_) and: {
> + try {
> + Object.allSubclasses.do { |class|
> + class.methods.do { |method|
> + if (method.primitiveName === aFeature) {
> + throw(true);
> + }
> + }
> + };
> + false
> + }
> + };
> + features.put(aFeature, isPrimitive);
> + isPrimitive
> + }
> + }
> +
> + // convenience accessors
> *systemAppSupportDir { ^thisProcess.platform.systemAppSupportDir }
> *userAppSupportDir { ^thisProcess.platform.userAppSupportDir }
> *systemExtensionDir { ^thisProcess.platform.systemExtensionDir }
> Index: build/SCClassLibrary/Common/Files/PathName.sc
> ===================================================================
> --- build/SCClassLibrary/Common/Files/PathName.sc (revision 5713)
> +++ build/SCClassLibrary/Common/Files/PathName.sc (working copy)
> @@ -174,6 +174,12 @@
> ^number
> }
>
> + /* concatenation */
> + +/+ { | path |
> + var otherFullPath = (path.respondsTo(\fullPath)).if
> ({ path.fullPath }, { path.asString });
> + ^this.class.new(fullPath +/+ otherFullPath)
> + }
> +
> /* additional methods jrh */
>
> entries {
> Index: build/SCClassLibrary/Common/Quarks/Quark.sc
> ===================================================================
> --- build/SCClassLibrary/Common/Quarks/Quark.sc (revision 5713)
> +++ build/SCClassLibrary/Common/Quarks/Quark.sc (working copy)
> @@ -37,7 +37,7 @@
> if (blob.isNil or: { blob.isKindOf(IdentityDictionary).not }) {
> Error("invalid quark").throw;
> };
> - ^this.new(blob)
> + ^this.new(blob.know_(false))
> }
> *new { | blob |
> ^super.new.init(blob)
> @@ -113,5 +113,18 @@
> string = string ++ "\n";
> string.postln;
> }
> +
> + // install action support
> + doAction { |action|
> + info[action].value(this);
> + }
> + localPath {
> + // only valid in postInstall!
> + ^Quarks.local.path +/+ path
> + }
> + build_scons { | ... args |
> + if (systemCmd("scons --directory=% %".format(this.localPath,
> args.join(" "))) != 0) {
> + Error("scons failed").throw;
> + }
> + }
> }
> -
> Index: build/SCClassLibrary/Common/Quarks/Quarks.sc
> ===================================================================
> --- build/SCClassLibrary/Common/Quarks/Quarks.sc (revision 5713)
> +++ build/SCClassLibrary/Common/Quarks/Quarks.sc (working copy)
> @@ -144,7 +144,7 @@
> })
> }
> install { | name |
> - var q, deps, installed;
> + var q, localPath, installedPath;
>
> if(this.isInstalled(name),{
> (name + "already installed").inform;
> @@ -158,9 +158,15 @@
>
> // do we have to create /quarks/ directory ? If so, do it.
> this.checkDir;
> -
> + localPath = local.path +/+ q.path;
> + installedPath = Platform.userExtensionDir.escapeChar($ ) ++ "/" +
> + local.name ++ "/" ++ q.path;
> // install via symlink to Extensions/<quarks-dir>
> - ("ln -s " + local.path ++ "/" ++ q.path +
> Platform.userExtensionDir.escapeChar($ ) ++ "/" ++ local.name ++
> "/" ++ q.path).systemCmd;
> + q.doAction(\preInstall);
> + ("ln -s " + localPath + installedPath).systemCmd;
> + q.doAction(\postInstall) { |e|
> + ("rm -f " + installedPath).systemCmd;
> + e.throw;
> + };
> (q.name + "installed").inform;
> }
> listInstalled {
> @@ -182,7 +188,9 @@
> });
>
> // install via symlink to Extensions/Quarks
> + q.doAction(\preUninstall);
> ("rm " + Platform.userExtensionDir.escapeChar($ ) ++ "/" ++
> local.name ++ "/" ++ q.path).systemCmd;
> + q.doAction(\postUninstall);
> (q.name + "uninstalled").inform;
> }
> }
> (
> name: "scum",
> path: "scum",
> summary: "hmmm ...",
> author: "stefan kersten",
> organization: "scum",
> country: "germany",
> since: "2004",
> url: "http://space.k-hornz.de/space/supercollider::scum",
> postInstall: { |quark|
> quark.build_scons("install-local");
> },
> preUninstall: { |quark|
> quark.build_scons("-c install-local");
> }
> )
> _______________________________________________
> sc-dev mailing list
> sc-dev@xxxxxxxxxxxxxxx
> http://www.create.ucsb.edu/mailman/listinfo/sc-dev
_______________________________________________
sc-dev mailing list
sc-dev@xxxxxxxxxxxxxxx
http://www.create.ucsb.edu/mailman/listinfo/sc-dev