[packagekit] packagekit: Branch 'master' - 8 commits
Richard Hughes
hughsient at kemper.freedesktop.org
Mon Dec 3 14:56:19 PST 2007
HACKING | 2
NEWS | 2
backends/test/pk-backend-test-succeed.c | 1
backends/yum/helpers/yumBackend.py | 6
backends/zypp/Makefile.am | 6
backends/zypp/pk-backend-zypp.cpp | 7
backends/zypp/zypp-utils.cpp | 8
backends/zypp/zypp-utils.h | 2
client/pk-console.c | 4
docs/pk-introduction.xml | 17 +
html/pk-faq.html | 3
libpackagekit/pk-client.c | 6
libpackagekit/pk-enum.c | 2
libpackagekit/pk-enum.h | 2
po/wscript_build | 3
python/packagekit/backend.py | 6
src/pk-backend.c | 6
src/pk-backend.h | 2
src/pk-engine.c | 6
src/pk-interface.xml | 2
waf-light | 396 +++++++-------------------------
wscript | 2
22 files changed, 155 insertions(+), 336 deletions(-)
New commits:
commit 0d345a8b8b6361e930a33b76a51b12734e9fb793
Author: Boyd Timothy <btimothy at gmail.com>
Date: Mon Dec 3 15:30:35 2007 -0700
Check installed packages when grabbing description because the pk-application may need it when looking at an installed package (zypp backend).
diff --git a/backends/zypp/pk-backend-zypp.cpp b/backends/zypp/pk-backend-zypp.cpp
index 1cf02e9..58be21f 100644
--- a/backends/zypp/pk-backend-zypp.cpp
+++ b/backends/zypp/pk-backend-zypp.cpp
@@ -145,7 +145,7 @@ backend_get_description_thread (PkBackend *backend, gpointer data)
pk_backend_change_status (backend, PK_STATUS_ENUM_QUERY);
std::vector<zypp::PoolItem> *v;
- v = zypp_get_packages_by_name ((const gchar *)pi->name, FALSE);
+ v = zypp_get_packages_by_name ((const gchar *)pi->name, TRUE);
zypp::ResObject::constPtr package;
for (std::vector<zypp::PoolItem>::iterator it = v->begin ();
@@ -457,7 +457,7 @@ backend_resolve_thread (PkBackend *backend, gpointer data)
pk_backend_change_status (backend, PK_STATUS_ENUM_QUERY);
std::vector<zypp::PoolItem> *v;
- v = zypp_get_packages_by_name ((const gchar *)rdata->name, FALSE);
+ v = zypp_get_packages_by_name ((const gchar *)rdata->name, TRUE);
zypp::ResObject::constPtr package = NULL;
for (std::vector<zypp::PoolItem>::iterator it = v->begin ();
commit ec8f1711d78f4cf42411eb640542b4b2b62db296
Author: Boyd Timothy <btimothy at gmail.com>
Date: Mon Dec 3 14:52:26 2007 -0700
Modified the code so searching by name with the zypp backend will return both installed and available packgaes
diff --git a/backends/zypp/Makefile.am b/backends/zypp/Makefile.am
index ac7e7da..8504f4b 100644
--- a/backends/zypp/Makefile.am
+++ b/backends/zypp/Makefile.am
@@ -7,7 +7,7 @@ libpk_backend_zypp_la_SOURCES = \
libpk_backend_zypp_la_LIBADD = @PK_PLUGIN_LIBS@
libpk_backend_zypp_la_LDFLAGS = -module -avoid-version $(ZYPP_LIBS)
libpk_backend_zypp_la_CFLAGS = @PK_PLUGIN_CFLAGS@
-libpk_backend_zypp_la_CPPFLAGS = @PK_PLUGIN_CFLAGS@ $(ZYPP_CFLAGS)
+libpk_backend_zypp_la_CPPFLAGS = @PK_PLUGIN_CFLAGS@ $(ZYPP_CFLAGS) -Wno-deprecated
EXTRA_DIST = \
zypp-utils.h \
diff --git a/backends/zypp/pk-backend-zypp.cpp b/backends/zypp/pk-backend-zypp.cpp
index a228149..1cf02e9 100644
--- a/backends/zypp/pk-backend-zypp.cpp
+++ b/backends/zypp/pk-backend-zypp.cpp
@@ -145,7 +145,7 @@ backend_get_description_thread (PkBackend *backend, gpointer data)
pk_backend_change_status (backend, PK_STATUS_ENUM_QUERY);
std::vector<zypp::PoolItem> *v;
- v = zypp_get_packages_by_name ((const gchar *)pi->name);
+ v = zypp_get_packages_by_name ((const gchar *)pi->name, FALSE);
zypp::ResObject::constPtr package;
for (std::vector<zypp::PoolItem>::iterator it = v->begin ();
@@ -457,7 +457,7 @@ backend_resolve_thread (PkBackend *backend, gpointer data)
pk_backend_change_status (backend, PK_STATUS_ENUM_QUERY);
std::vector<zypp::PoolItem> *v;
- v = zypp_get_packages_by_name ((const gchar *)rdata->name);
+ v = zypp_get_packages_by_name ((const gchar *)rdata->name, FALSE);
zypp::ResObject::constPtr package = NULL;
for (std::vector<zypp::PoolItem>::iterator it = v->begin ();
@@ -572,7 +572,7 @@ find_packages_real (PkBackend *backend, const gchar *search, const gchar *filter
switch (mode) {
case SEARCH_TYPE_NAME:
- std::vector<zypp::PoolItem> *v = zypp_get_packages_by_name (search);
+ std::vector<zypp::PoolItem> *v = zypp_get_packages_by_name (search, TRUE);
zypp_emit_packages_in_list (backend, v);
delete (v);
break;
diff --git a/backends/zypp/zypp-utils.cpp b/backends/zypp/zypp-utils.cpp
index 866016a..f4e5667 100644
--- a/backends/zypp/zypp-utils.cpp
+++ b/backends/zypp/zypp-utils.cpp
@@ -96,11 +96,11 @@ fprintf (stderr, "TODO: Handle exceptions: %s\n", ex.asUserString ().c_str ());
}
std::vector<zypp::PoolItem> *
-zypp_get_packages_by_name (const gchar *package_name)
+zypp_get_packages_by_name (const gchar *package_name, gboolean include_local)
{
std::vector<zypp::PoolItem> *v = new std::vector<zypp::PoolItem> ();
- zypp::ResPool pool = zypp_build_pool (FALSE);
+ zypp::ResPool pool = zypp_build_pool (include_local);
std::string name (package_name);
for (zypp::ResPool::byName_iterator it = pool.byNameBegin (name);
@@ -141,7 +141,9 @@ zypp_emit_packages_in_list (PkBackend *backend, std::vector<zypp::PoolItem> *v)
// TODO: Determine whether this package is installed or not
gchar *package_id = zypp_build_package_id_from_resolvable (pkg);
pk_backend_package (backend,
- PK_INFO_ENUM_AVAILABLE,
+ it->status().isInstalled() == true ?
+ PK_INFO_ENUM_INSTALLED :
+ PK_INFO_ENUM_AVAILABLE,
package_id,
pkg->description ().c_str ());
g_free (package_id);
diff --git a/backends/zypp/zypp-utils.h b/backends/zypp/zypp-utils.h
index b9c97db..a68834e 100644
--- a/backends/zypp/zypp-utils.h
+++ b/backends/zypp/zypp-utils.h
@@ -36,7 +36,7 @@ zypp::ResPool zypp_build_pool (gboolean include_local);
/**
* Returns a list of packages that match the specified package_name.
*/
-std::vector<zypp::PoolItem> * zypp_get_packages_by_name (const gchar *package_name);
+std::vector<zypp::PoolItem> * zypp_get_packages_by_name (const gchar *package_name, gboolean include_local);
gchar * zypp_build_package_id_from_resolvable (zypp::Resolvable::constPtr resolvable);
commit 39d69258058e6d1982ebfa1e5fd40e922d59c99e
Author: Robin Norwood <rnorwood at redhat.com>
Date: Mon Dec 3 16:49:42 2007 -0500
o Change from 'licence' to 'license' throughout.
o Add some more explanatory text to docs for definition of 'free'.
o Specify US English as language of choice in HACKING.
diff --git a/HACKING b/HACKING
index 2c54f3c..02fade9 100644
--- a/HACKING
+++ b/HACKING
@@ -6,6 +6,8 @@ Please stick to the existing coding style.
Tabs should be hard (not expanded to spaces), and set equivalent to
8 spaces.
+All documentation and code should be in US English.
+
Please consider enabling git's default pre-commit hook:
$> cd PackageKit
diff --git a/NEWS b/NEWS
index 3402227..6b0eb16 100644
--- a/NEWS
+++ b/NEWS
@@ -174,7 +174,7 @@ Version 0.1.1
* Bugfixes:
- Fix the resolve method parameter passing - now pk-install-package should work
correctly (James Bowes)
- - Fix all the copyright notices to be a standard GPL2+ boilerplate licence
+ - Fix all the copyright notices to be a standard GPL2+ boilerplate license
text (Tom Parker, Robin Norwood)
- Dist the local apt headers so the apt backend can be compiled from a tarball
rather than just from git (Richard Hughes)
diff --git a/backends/yum/helpers/yumBackend.py b/backends/yum/helpers/yumBackend.py
index 451d24e..887abd0 100644
--- a/backends/yum/helpers/yumBackend.py
+++ b/backends/yum/helpers/yumBackend.py
@@ -214,11 +214,11 @@ class PackageKitYumBackend(PackageKitBaseBackend):
if lock:
self.doLock()
- def description(self,id,licence,group,desc,url,bytes,file_list):
+ def description(self,id,license,group,desc,url,bytes,file_list):
'''
Send 'description' signal
@param id: The package ID name, e.g. openoffice-clipart;2.6.22;ppc64;fedora
- @param licence: The licence of the package
+ @param license: The license of the package
@param group: The enumerated group
@param desc: The multi line package description
@param url: The upstream project homepage
@@ -227,7 +227,7 @@ class PackageKitYumBackend(PackageKitBaseBackend):
convert the description to UTF before sending
'''
desc = self._toUTF(desc)
- PackageKitBaseBackend.description(self,id,licence,group,desc,url,bytes,file_list)
+ PackageKitBaseBackend.description(self,id,license,group,desc,url,bytes,file_list)
def package(self,id,status,summary):
'''
diff --git a/client/pk-console.c b/client/pk-console.c
index eff8db2..4199841 100644
--- a/client/pk-console.c
+++ b/client/pk-console.c
@@ -899,7 +899,7 @@ pk_console_error_code_cb (PkClient *client, PkErrorCodeEnum error_code, const gc
**/
static void
pk_console_description_cb (PkClient *client, const gchar *package_id,
- const gchar *licence, PkGroupEnum group,
+ const gchar *license, PkGroupEnum group,
const gchar *description, const gchar *url,
gulong size, gpointer data)
{
@@ -909,7 +909,7 @@ pk_console_description_cb (PkClient *client, const gchar *package_id,
}
g_print ("Package description\n");
g_print (" package: '%s'\n", package_id);
- g_print (" licence: '%s'\n", licence);
+ g_print (" license: '%s'\n", license);
g_print (" group: '%s'\n", pk_group_enum_to_text (group));
g_print (" description: '%s'\n", description);
g_print (" size: '%ld' bytes\n", size);
diff --git a/docs/pk-introduction.xml b/docs/pk-introduction.xml
index 46aed22..b02c072 100644
--- a/docs/pk-introduction.xml
+++ b/docs/pk-introduction.xml
@@ -186,7 +186,16 @@
</row>
<row>
<entry><literal>free</literal> or <literal>~free</literal></entry>
- <entry>Free software, where the definition of free is given by the FSF</entry>
+
+ <entry>
+ Free software, where the definition of free is given
+ by the Free Software Foundation. See
+ http://www.fsf.org/licensing/licenses/ for a list of
+ free licenses. If a license cannot be determined from
+ the package metadata, or the status of the license is
+ not known, the package will be marked as 'non-free'.
+ </entry>
+
</row>
</tbody>
</tgroup>
@@ -1650,9 +1659,9 @@
<entry>The package ID</entry>
</row>
<row>
- <entry><literal>licence</literal></entry>
+ <entry><literal>license</literal></entry>
<entry>
- The licence, e.g. "GPLv2+" or "proprietary".
+ The license, e.g. "GPLv2+" or "proprietary".
If you need to add a EULA then do it like this:
"proprietary;By installing this software\nyou may kill a kitten."
</entry>
diff --git a/html/pk-faq.html b/html/pk-faq.html
index 7f11b7e..0a5146e 100644
--- a/html/pk-faq.html
+++ b/html/pk-faq.html
@@ -179,7 +179,7 @@ No more fighting over <code>yum</code>, <code>yum-updatesd</code>,
<h3>What is Hughsie's law?</h3>
<p>
A joke that started on IRC late one night in '07.
-Put formally it is: <i>Authentication or licence prompts can only be done before the
+Put formally it is: <i>Authentication or license prompts can only be done before the
transaction has started, and messages or notices about the transaction
can only be shown after the transaction has completed.</i>
</p>
diff --git a/libpackagekit/pk-client.c b/libpackagekit/pk-client.c
index 09ee9dc..c6740fa 100644
--- a/libpackagekit/pk-client.c
+++ b/libpackagekit/pk-client.c
@@ -540,7 +540,7 @@ static void
pk_client_description_cb (DBusGProxy *proxy,
const gchar *tid,
const gchar *package_id,
- const gchar *licence,
+ const gchar *license,
const gchar *group_text,
const gchar *description,
const gchar *url,
@@ -558,9 +558,9 @@ pk_client_description_cb (DBusGProxy *proxy,
group = pk_group_enum_from_text (group_text);
pk_debug ("emit description %s, %s, %i, %s, %s, %ld",
- package_id, licence, group, description, url, (long int) size);
+ package_id, license, group, description, url, (long int) size);
g_signal_emit (client , signals [PK_CLIENT_DESCRIPTION], 0,
- package_id, licence, group, description, url, size);
+ package_id, license, group, description, url, size);
}
/**
diff --git a/python/packagekit/backend.py b/python/packagekit/backend.py
index 23223bd..ba93015 100644
--- a/python/packagekit/backend.py
+++ b/python/packagekit/backend.py
@@ -105,18 +105,18 @@ class PackageKitBaseBackend:
'''
print >> sys.stderr,"data\t%s" % (data)
- def description(self,id,licence,group,desc,url,bytes,file_list):
+ def description(self,id,license,group,desc,url,bytes,file_list):
'''
Send 'description' signal
@param id: The package ID name, e.g. openoffice-clipart;2.6.22;ppc64;fedora
- @param licence: The licence of the package
+ @param license: The license of the package
@param group: The enumerated group
@param desc: The multi line package description
@param url: The upstream project homepage
@param bytes: The size of the package, in bytes
@param file_list: List of the files in the package, separated by ';'
'''
- print >> sys.stdout,"description\t%s\t%s\t%s\t%s\t%s\t%ld\t%s" % (id,licence,group,desc,url,bytes,file_list)
+ print >> sys.stdout,"description\t%s\t%s\t%s\t%s\t%s\t%ld\t%s" % (id,license,group,desc,url,bytes,file_list)
def files(self, id, file_list):
'''
diff --git a/src/pk-backend.c b/src/pk-backend.c
index 1437811..e93fb81 100644
--- a/src/pk-backend.c
+++ b/src/pk-backend.c
@@ -910,7 +910,7 @@ pk_backend_change_transaction_data (PkBackend *backend, const gchar *data)
**/
gboolean
pk_backend_description (PkBackend *backend, const gchar *package_id,
- const gchar *licence, PkGroupEnum group,
+ const gchar *license, PkGroupEnum group,
const gchar *description, const gchar *url,
gulong size, const gchar *filelist)
{
@@ -922,10 +922,10 @@ pk_backend_description (PkBackend *backend, const gchar *package_id,
description_safe = pk_strsafe (description);
pk_debug ("emit description %s, %s, %i, %s, %s, %ld",
- package_id, licence, group, description_safe, url,
+ package_id, license, group, description_safe, url,
size);
g_signal_emit (backend, signals [PK_BACKEND_DESCRIPTION], 0,
- package_id, licence, group, description_safe, url,
+ package_id, license, group, description_safe, url,
size);
g_free (description_safe);
return TRUE;
diff --git a/src/pk-backend.h b/src/pk-backend.h
index cd3b99c..912bd46 100644
--- a/src/pk-backend.h
+++ b/src/pk-backend.h
@@ -65,7 +65,7 @@ gboolean pk_backend_message (PkBackend *backend,
const gchar *details);
gboolean pk_backend_description (PkBackend *backend,
const gchar *package_id,
- const gchar *licence,
+ const gchar *license,
PkGroupEnum group,
const gchar *description,
const gchar *url,
diff --git a/src/pk-engine.c b/src/pk-engine.c
index a9ef7e0..9241a20 100644
--- a/src/pk-engine.c
+++ b/src/pk-engine.c
@@ -458,7 +458,7 @@ pk_engine_message_cb (PkBackend *backend, PkMessageEnum restart, const gchar *de
* pk_engine_description_cb:
**/
static void
-pk_engine_description_cb (PkBackend *backend, const gchar *package_id, const gchar *licence, PkGroupEnum group,
+pk_engine_description_cb (PkBackend *backend, const gchar *package_id, const gchar *license, PkGroupEnum group,
const gchar *detail, const gchar *url,
guint64 size, PkEngine *engine)
{
@@ -476,9 +476,9 @@ pk_engine_description_cb (PkBackend *backend, const gchar *package_id, const gch
group_text = pk_group_enum_to_text (group);
pk_debug ("emitting description tid:%s, %s, %s, %s, %s, %s, %ld",
- item->tid, package_id, licence, group_text, detail, url, (long int) size);
+ item->tid, package_id, license, group_text, detail, url, (long int) size);
g_signal_emit (engine, signals [PK_ENGINE_DESCRIPTION], 0,
- item->tid, package_id, licence, group_text, detail, url, size);
+ item->tid, package_id, license, group_text, detail, url, size);
}
/**
diff --git a/src/pk-interface.xml b/src/pk-interface.xml
index 8147a20..cc0f1d9 100644
--- a/src/pk-interface.xml
+++ b/src/pk-interface.xml
@@ -124,7 +124,7 @@
<signal name="Description">
<arg type="s" name="tid" direction="out"/>
<arg type="s" name="package_id" direction="out"/>
- <arg type="s" name="licence" direction="out"/>
+ <arg type="s" name="license" direction="out"/>
<arg type="s" name="group" direction="out"/>
<arg type="s" name="detail" direction="out"/>
<arg type="s" name="url" direction="out"/>
commit ce4a409ec474e0d5e8d27d571d400bced7d1ac32
Merge: ad23a13... a28ee4a...
Author: Richard Hughes <richard at hughsie.com>
Date: Mon Dec 3 18:51:54 2007 +0000
Merge branch 'master' of git+ssh://hughsie@git.packagekit.org/srv/git/PackageKit
commit ad23a1330a1ce76e1c340008a23f48327b55b9d7
Author: Richard Hughes <richard at hughsie.com>
Date: Mon Dec 3 18:51:36 2007 +0000
add another filter line in the html docs
diff --git a/html/pk-faq.html b/html/pk-faq.html
index 054fe30..7f11b7e 100644
--- a/html/pk-faq.html
+++ b/html/pk-faq.html
@@ -55,6 +55,7 @@ cancel-transaction| X | X | | | | | X | |
installed | X | X | X | X | X | X | X | |
development | | X | X | X | | | | |
gui | | X | X | X | | | X | |
+free | | | | | | | | |
</pre>
<h3>Why doesn't PackageKit work with SELinux?</h3>
commit a28ee4ae99a2527317f480301895af5affd29912
Author: Boyd Timothy <btimothy at gmail.com>
Date: Mon Dec 3 11:48:28 2007 -0700
Removed <string.h> include and also include zypp backend header files in Makefile for EXTRA_DIST
diff --git a/backends/zypp/Makefile.am b/backends/zypp/Makefile.am
index f14f672..ac7e7da 100644
--- a/backends/zypp/Makefile.am
+++ b/backends/zypp/Makefile.am
@@ -9,3 +9,7 @@ libpk_backend_zypp_la_LDFLAGS = -module -avoid-version $(ZYPP_LIBS)
libpk_backend_zypp_la_CFLAGS = @PK_PLUGIN_CFLAGS@
libpk_backend_zypp_la_CPPFLAGS = @PK_PLUGIN_CFLAGS@ $(ZYPP_CFLAGS)
+EXTRA_DIST = \
+ zypp-utils.h \
+ zypp-events.h
+
diff --git a/backends/zypp/pk-backend-zypp.cpp b/backends/zypp/pk-backend-zypp.cpp
index 7de76df..a228149 100644
--- a/backends/zypp/pk-backend-zypp.cpp
+++ b/backends/zypp/pk-backend-zypp.cpp
@@ -21,7 +21,6 @@
#include <gmodule.h>
#include <glib.h>
-#include <string.h>
#include <pk-backend.h>
#include <unistd.h>
#include <pk-debug.h>
commit 84b06931948ca1c0f865f2f9cf7715fdf6682e90
Author: Richard Hughes <richard at hughsie.com>
Date: Mon Dec 3 18:41:25 2007 +0000
add in a free filter as discussed on the mailing list
diff --git a/backends/test/pk-backend-test-succeed.c b/backends/test/pk-backend-test-succeed.c
index f8e1c70..29cbdd5 100644
--- a/backends/test/pk-backend-test-succeed.c
+++ b/backends/test/pk-backend-test-succeed.c
@@ -67,6 +67,7 @@ backend_get_filters (PkBackend *backend, PkEnumList *elist)
PK_FILTER_ENUM_GUI,
PK_FILTER_ENUM_INSTALLED,
PK_FILTER_ENUM_DEVELOPMENT,
+ PK_FILTER_ENUM_FREE,
-1);
}
diff --git a/docs/pk-introduction.xml b/docs/pk-introduction.xml
index ec6acad..46aed22 100644
--- a/docs/pk-introduction.xml
+++ b/docs/pk-introduction.xml
@@ -184,6 +184,10 @@
<entry><literal>gui</literal> or <literal>~gui</literal></entry>
<entry>GUI programs typically depend on gtk, libkde or libxfce.</entry>
</row>
+ <row>
+ <entry><literal>free</literal> or <literal>~free</literal></entry>
+ <entry>Free software, where the definition of free is given by the FSF</entry>
+ </row>
</tbody>
</tgroup>
</informaltable>
diff --git a/libpackagekit/pk-enum.c b/libpackagekit/pk-enum.c
index ab7da25..1cb6a37 100644
--- a/libpackagekit/pk-enum.c
+++ b/libpackagekit/pk-enum.c
@@ -138,9 +138,11 @@ static PkEnumMatch enum_filter[] = {
{PK_FILTER_ENUM_DEVELOPMENT, "devel"},
{PK_FILTER_ENUM_INSTALLED, "installed"},
{PK_FILTER_ENUM_GUI, "gui"},
+ {PK_FILTER_ENUM_FREE, "free"},
{PK_FILTER_ENUM_NOT_DEVELOPMENT, "~devel"},
{PK_FILTER_ENUM_NOT_INSTALLED, "~installed"},
{PK_FILTER_ENUM_NOT_GUI, "~gui"},
+ {PK_FILTER_ENUM_NOT_FREE, "~free"},
{0, NULL},
};
diff --git a/libpackagekit/pk-enum.h b/libpackagekit/pk-enum.h
index b1091c5..fdb88a6 100644
--- a/libpackagekit/pk-enum.h
+++ b/libpackagekit/pk-enum.h
@@ -100,9 +100,11 @@ typedef enum {
PK_FILTER_ENUM_DEVELOPMENT,
PK_FILTER_ENUM_INSTALLED,
PK_FILTER_ENUM_GUI,
+ PK_FILTER_ENUM_FREE,
PK_FILTER_ENUM_NOT_DEVELOPMENT,
PK_FILTER_ENUM_NOT_INSTALLED,
PK_FILTER_ENUM_NOT_GUI,
+ PK_FILTER_ENUM_NOT_FREE,
PK_FILTER_ENUM_NONE,
PK_FILTER_ENUM_UNKNOWN
} PkFilterEnum;
commit 28524cac03410b761b091789ddb015cde970f536
Author: Richard Hughes <richard at hughsie.com>
Date: Mon Dec 3 08:05:53 2007 +0000
fix waf build
diff --git a/po/wscript_build b/po/wscript_build
index b813a82..3ea90c6 100644
--- a/po/wscript_build
+++ b/po/wscript_build
@@ -9,6 +9,5 @@
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
-def build(bld):
- obj=bld.create_obj('gnome_translations', 'PackageKit')
+obj=bld.create_obj('intltool_po', 'PackageKit')
diff --git a/waf-light b/waf-light
index 1bae1d5..c1f1f4b 100755
--- a/waf-light
+++ b/waf-light
@@ -1,6 +1,6 @@
#! /usr/bin/env python
# encoding: utf-8
-# Thomas Nagy, 2005, 2006, 2007 (ita)
+# Thomas Nagy, 2005-2008
"""
Redistribution and use in source and binary forms, with or without
@@ -17,7 +17,7 @@ are met:
3. The name of the author may not be used to endorse or promote products
derived from this software without specific prior written permission.
-THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
@@ -32,335 +32,129 @@ POSSIBILITY OF SUCH DAMAGE.
import os, sys
if 'PSYCOWAF' in os.environ:
- try:
- import psyco
- psyco.full()
- except:
- pass
+ try: import psyco; psyco.full()
+ except: pass
-VERSION="1.2.0"
+VERSION="1.3.0"
REVISION="x"
INSTALL="x"
-cwd = os.getcwd()
+cwd=os.getcwd()
+j=os.path.join
-def decodeAscii85(s):
+def decode(s):
out=[]
app=out.append
- s=''.join(s.split()).replace('z','!!!!!')
- p1,p2=divmod(len(s), 5)
+ s='!!!!!'.join(s.split('z'))
+ d=divmod
+ p1,p2=d(len(s),5)
stop=5*p1
p3,p4=s[0:stop],s[stop:]
+
+ def u(v, o):
+ return ord(v[o])-33
for i in range(p1):
- off=i*5
- a=ord(p3[off])-33
- b=ord(p3[off+1])-33
- c=ord(p3[off+2])-33
- d=ord(p3[off+3])-33
- e=ord(p3[off+4])-33
- num=(52200625L*a)+(614125*b)+(7225*c)+(85*d)+e
- x,p=divmod(num,256)
- x,o=divmod(x,256)
- m,n=divmod(x,256)
+ o=i*5
+ x=52200625L*u(p3,o)+614125*u(p3,o+1)+7225*u(p3,o+2)+85*u(p3,o+3)+u(p3,o+4)
+ x,p=d(x,256)
+ x,o=d(x,256)
+ m,n=d(x,256)
app(chr(m)+chr(n)+chr(o)+chr(p))
if p2:
while len(p4)<5: p4=p4+'!'
- a=ord(p4[0])-33
- b=ord(p4[1])-33
- c=ord(p4[2])-33
- d=ord(p4[3])-33
- e=ord(p4[4])-33
- num=(52200625L*a)+(614125*b)+(7225*c)+(85*d)+e
- x,p=divmod(num,256)
- x,o=divmod(x,256)
- m,n=divmod(x, 256)
- if p2==2: app(chr(m))
- elif p2==3: app(chr(m)+chr(n))
- elif p2==4: app(chr(m)+chr(n)+chr(o))
+ x=52200625L*u(p4,0)+614125*u(p4,1)+7225*u(p4,2)+85*u(p4,3)+u(p4,4)
+ x,p=d(x,256)
+ x,o=d(x,256)
+ m,n=d(x,256)
+ app(chr(m))
+ if p2>2:app(chr(n))
+ if p2>3:app(chr(o))
return ''.join(out)
-# wafdir is needed to parse the command-line arguments or print the version number
-wafdir=None # SPECIAL LINE
+def err(m):
+ print m; sys.exit(1)
-def uncompress_wafdir(newdir):
- file = open(sys.argv[0], 'rb')
+def unpack_wafdir(dir):
+ f=open(sys.argv[0],'rb')
+ c="Error: corrupted (%d)"
while 1:
- line = file.readline()
- if not line:
- print "This is a stripped-down waf, there is no wafadmin directory available"
- print "Please set WAFDIR to a directory containing a directory named wafadmin"
- print "Or use the full waf version available freely at http://freehackers.org/~tnagy/bksys.html"
- print "\033[91mNo wafadmin: cannot execute anything (error)\033[0m"
- sys.exit(1)
- line=line.rstrip()
- if line=='# ===>BEGIN WOOF<===':
- cnt = file.readline()
- if not cnt:
- print "Corrupted waf (1)"
- sys.exit(1)
-
- line = file.readline().rstrip()
- if line!='# ===>END WOOF<===':
- print "Corrupted waf (2)"
- sys.exit(1)
+ line=f.readline()
+ if not line: err("\033[91mError: waf-light must be run from a folder containing wafadmin\033[0m")
+ if line=='#==>\n':
+ txt=f.readline()
+ if not txt: err(c%1)
+ if f.readline()!='#<==\n': err(c%2)
break
- if not cnt:
- print "Corrupted waf (3)"
- sys.exit(1)
-
- cnt = decodeAscii85(cnt[1:])
+ if not txt: err(c%3)
+ txt=decode(txt[1:])
- # create wafadmin
- import shutil
- try: shutil.rmtree(newdir)
+ import shutil, tarfile
+ try: shutil.rmtree(dir)
except OSError: pass
- try: os.makedirs(newdir)
- except OSError:
- print "Could uncompress waf-local into %s"%newdir
- print "Please install waf system-wide or move waf in a writeable directory"
- sys.exit(1)
-
- os.chdir(newdir)
- file = open('wafadmin.tar.bz2', 'wb')
- file.write(cnt)
- file.close()
-
- # now we have the tar file to open
- import tarfile
- tar = tarfile.open('wafadmin.tar.bz2')
- for tarinfo in tar:
- tar.extract(tarinfo)
- tar.close()
-
- # cleanup the tarfile and chdir to the previous directory
- os.chmod('wafadmin', 0755)
- os.chmod('wafadmin'+os.sep+'Tools', 0755)
- os.unlink('wafadmin.tar.bz2')
+ try: os.makedirs(dir)
+ except OSError: err("Error: could not unpack waf-local into %s\
+Install waf system-wide or move waf into a writeable directory"%dir)
+
+ os.chdir(dir)
+ tmp='t.tbz2'
+ f=open(tmp,'wb')
+ f.write(txt)
+ f.close()
+
+ t=tarfile.open(tmp)
+ for x in t: t.extract(x)
+ t.close()
+
+ os.chmod('wafadmin',0755)#TODO
+ os.chmod('wafadmin%sTools'%os.sep,0755)
+ os.unlink(tmp)
os.chdir(cwd)
- global wafdir
- wafdir = newdir
-
-def try_wafdir(dir):
- global wafdir
- if wafdir: return
- try:
- os.stat(os.path.join(dir, 'wafadmin'))
- wafdir = os.path.abspath(dir)
- except OSError:
- pass
-
-def find_wafadmin():
- global wafdir
- name = sys.argv[0]
-
- # wafadmin may be in $WAFDIR (developers)
- if 'WAFDIR' in os.environ:
- try_wafdir(os.environ['WAFDIR'])
- if wafdir: return
+def test(dir):
+ try: os.stat(j(dir,'wafadmin')); return os.path.abspath(dir)
+ except OSError: pass
- # waf-light is a special beast
- if name[-5:] == 'light':
- try_wafdir(os.path.dirname(os.path.abspath(name)))
- if wafdir: return
- print "\033[91mwaf-light in use, wafadmin not found -> export WAFDIR=/folder\033[0m"
- sys.exit(1)
+def find_lib():
+ name=sys.argv[0]
+ base=os.path.dirname(os.path.abspath(name))
- if not wafdir:
- dir = "/lib/waf-%s-%s/" % (VERSION, REVISION)
- for i in [INSTALL, '/usr', '/usr/local', '/opt']:
- try_wafdir(i+dir)
- if wafdir: return
+ #devs use $WAFDIR
+ w=test(os.environ.get('WAFDIR',''))
+ if w:return w
- # remove $HOME/.waf-version if asked to
- if wafdir:
- if "--nocache" in sys.argv:
- import shutil
- print "removing the local wafdir", wafdir
- try: shutil.rmtree(wafdir)
- except OSError: pass
- try: os.stat(wafdir)
- except OSError: wafdir=None
+ #waf-light
+ if name=='waf-light':
+ w=test(base)
+ if w:return w
+ err("\033[91mwaf-light in use, wafadmin not found -> export WAFDIR=/folder\033[0m")
- if wafdir: return
+ dir="/lib/waf-%s-%s/" % (VERSION, REVISION)
+ for i in [INSTALL,'/usr','/usr/local','/opt']:
+ w=test(i+dir)
+ if w:return w
- # look in the directory containing waf
- if sys.platform == 'win32': s='waf-%s-%s'
+ #waf-local
+ if sys.platform=='win32': s='waf-%s-%s'
else: s='.waf-%s-%s'
- dir = os.path.join(os.path.dirname(os.path.abspath(name)), s % (VERSION, REVISION))
- try_wafdir(dir)
- if wafdir: return
-
- # not found, uncompress
- wafdir = dir
- uncompress_wafdir(dir)
-
-# run the test
-find_wafadmin()
-if "-vv" in sys.argv: print "wafdir is ", wafdir
-
-# Update sys.path and import our modules
-wafadmindir = os.path.join(wafdir, 'wafadmin')
-tooldir = os.path.join(wafadmindir, 'Tools')
-sys.path = [wafadmindir, tooldir] + sys.path
-
-import Options, Params, Utils
-from Params import fatal, warning
-
-# Set the directory containing the tools
-Params.g_tooldir = [tooldir]
-Params.g_cwd_launch = cwd
-
-if Params.g_version != VERSION:
- fatal('version mismatch waf %s <-> wafadmin %s (wafdir %s)' % (VERSION, Params.g_version, wafdir))
-
-# some command-line options can be processed immediately
-if '--version' in sys.argv:
- opt_obj = Options.Handler()
- opt_obj.parse_args()
- sys.exit(0)
-
-# now find the wscript file
-msg1 = 'Waf: *** Nothing to do! Please run waf from a directory containing a file named "wscript"'
-
-# Some people want to configure their projects gcc-style:
-# mkdir build && cd build && ../waf configure && ../waf
-# check that this is really what is wanted
-build_dir_override = None
-candidate = None
-
-lst = os.listdir(cwd)
-xml = 0
-#check if a wscript or a wscript_xml file is in current directory
-if (not 'wscript' in lst) and (not 'wscript_xml' in lst):
- if 'configure' in sys.argv:
- #set the build directory with the current directory
- build_dir_override = cwd
- if 'wscript_build' in lst:
- #try to find the wscript root
- candidate = cwd
-else:
- #wscript or wscript_xml is in current directory, use this directory as candidate
- candidate = cwd
-
-try:
- #check the following dirs for wscript or wscript_xml
- search_for_candidate = True
- if not candidate:
- #check first the calldir if there is wscript or wscript_xml
- #for example: /usr/src/configure the calldir would be /usr/src
- calldir = os.path.abspath(os.path.dirname(sys.argv[0]))
- lst_calldir = os.listdir(calldir)
- if 'wscript' in lst_calldir:
- candidate = calldir
- search_for_candidate = False
- if 'wscript_xml' in lst_calldir:
- candidate = calldir
- xml = 1
- search_for_candidate = False
- if "--make-waf" in sys.argv and candidate:
- search_for_candidate = False
-
- #check all directories above current dir for wscript or wscript_xml if still not found
- while search_for_candidate:
- if len(cwd) <= 3:
- break # stop at / or c:
- dirlst = os.listdir(cwd)
- if 'wscript' in dirlst:
- candidate = cwd
- xml = 0
- if 'wscript_xml' in dirlst:
- candidate = cwd
- xml = 1
- break
- if 'configure' in sys.argv and candidate:
- break
- if Params.g_lockfile in dirlst:
- break
- cwd = cwd[:cwd.rfind(os.sep)] # climb up
-except:
- fatal(msg1)
-
-if not candidate:
- # check if the user only wanted to display the help
- if '-h' in sys.argv or '--help' in sys.argv:
- warning('No wscript file found: the help message may be incomplete')
- opt_obj = Options.Handler()
- opt_obj.parse_args()
- sys.exit(0)
- else:
- fatal(msg1)
-
-# We have found wscript, but there is no guarantee that it is valid
-os.chdir(candidate)
-
-# xml -> jump to the parser
-if xml:
- from XMLScripting import compile
- compile(candidate+os.sep+'wscript_xml')
-else:
- # define the main module containing the functions init, shutdown, ..
- Utils.set_main_module(os.path.join(candidate, 'wscript'))
-
-if build_dir_override:
- d = getattr(Utils.g_module, 'blddir', None)
- if d:
- # test if user has set the blddir in wscript.
- msg = 'Overriding build directory %s with %s' % (d, build_dir_override)
- Params.niceprint(msg, 'WARNING', 'waf')
- Utils.g_module.blddir = build_dir_override
-
-# fetch the custom command-line options recursively and in a procedural way
-opt_obj = Options.Handler()
-opt_obj.sub_options('') # will look in wscript
-opt_obj.parse_args()
-
-# use the parser results
-if Params.g_commands['dist']:
- # try to use the user-defined dist function first, fallback to the waf scheme
- fun = getattr(Utils.g_module, 'dist', None)
- if fun: fun(); sys.exit(0)
-
- appname = getattr(Utils.g_module, 'APPNAME', 'noname')
-
- get_version = getattr(Utils.g_module, 'get_version', None)
- if get_version: version = get_version()
- else: version = getattr(Utils.g_module, 'VERSION', None)
- if not version: version = '1.0'
-
- from Scripting import Dist
- Dist(appname, version)
- sys.exit(0)
-elif Params.g_commands['distclean']:
- # try to use the user-defined distclean first, fallback to the waf scheme
- fun = getattr(Utils.g_module, 'distclean', None)
- if fun: fun(); sys.exit(0)
- from Scripting import DistClean
- DistClean()
- sys.exit(0)
-elif Params.g_commands['distcheck']:
- # try to use the user-defined dist function first, fallback to the waf scheme
- fun = getattr(Utils.g_module, 'dist', None)
- if fun: fun(); sys.exit(0)
+ dir=j(base,s%(VERSION,REVISION))
+ w=test(dir)
+ if w:return w
- appname = getattr(Utils.g_module, 'APPNAME', 'noname')
+ #unpack
+ unpack_wafdir(dir)
+ return dir
- get_version = getattr(Utils.g_module, 'get_version', None)
- if get_version: version = get_version()
- else: version = getattr(Utils.g_module, 'VERSION', None)
- if not version: version = '1.0'
+wafdir=find_lib()
+if "-vv" in sys.argv: print "wafdir is %s"%wafdir
- from Scripting import DistCheck
- DistCheck(appname, version)
- sys.exit(0)
+w=j(wafdir,'wafadmin')
+t=j(w,'Tools')
+sys.path=[w, t]+sys.path
-fun=getattr(Utils.g_module, 'init', None)
-if fun: fun()
+import Params, Scripting
+Params.g_tooldir=[t]
+Params.g_cwd_launch=cwd
-import Scripting
-try: Scripting.Main()
-except KeyboardInterrupt: Params.fatal('build interrupted')
-#import hotshot
-#prof=hotshot.Profile("/tmp/proftest.txt")
-#prof.runcall(Scripting.Main)
-#prof.close()
+if Params.g_version!=VERSION:
+ err('Version mismatch: waf %s <> wafadmin %s (wafdir %s)'%(VERSION,Params.g_version,wafdir))
+Scripting.prepare()
diff --git a/wscript b/wscript
index bdb10f7..1fbc82c 100644
--- a/wscript
+++ b/wscript
@@ -39,7 +39,7 @@ def set_options(opt):
opt.sub_options('backends')
def configure(conf):
- conf.check_tool('gcc gnome misc')
+ conf.check_tool('gcc gnome intltool misc')
conf.check_pkg('glib-2.0', destvar='GLIB', vnum='2.14.0')
conf.check_pkg('gobject-2.0', destvar='GOBJECT', vnum='2.14.0')
More information about the PackageKit
mailing list