[PackageKit-commit] packagekit: Branch 'master' - 21 commits
Richard Hughes
hughsient at kemper.freedesktop.org
Thu Oct 9 09:52:15 PDT 2008
backends/zypp/pk-backend-zypp.cpp | 1
client/Makefile.am | 2
client/pk-generate-pack.c | 21
client/pk-service-pack.c | 1
client/pk-service-pack.h | 1
docs/html/img/Makefile.am | 1
docs/html/img/gpk-service-pack.png |binary
docs/html/pk-screenshots.html | 3
docs/html/upload.sh | 5
libpackagekit/Makefile.am | 5
libpackagekit/pk-common.h | 7
libpackagekit/pk-control.c | 38 -
libpackagekit/pk-self-test.c | 2
libpackagekit/pk-service-pack.c | 1071 +++++++++++++++++++++++++++++++++++++
libpackagekit/pk-service-pack.h | 101 +++
man/pkgenpack.xml | 36 -
po/pt_BR.po | 186 +++---
po/sk.po | 594 ++++++++++++--------
src/Makefile.am | 2
src/pk-refresh.c | 4
src/pk-service-pack.c | 935 --------------------------------
src/pk-service-pack.h | 99 ---
22 files changed, 1724 insertions(+), 1391 deletions(-)
New commits:
commit 34fc97830dd9ced41b9f8873ea5c357de25e3c46
Author: Richard Hughes <richard at hughsie.com>
Date: Thu Oct 9 16:44:24 2008 +0100
bugfix: don't crash the client tools if PkControl launches the daemon
If the daemon is launched with PkControl, rather than PkClient, then we attempt to refresh the transaction
list when the PkControl object is not finished initialising, and we send a critical warning.
The fix is to only do the refresh in an idle handler, making sure we kill it if nothing ever runs on
the object
diff --git a/libpackagekit/pk-control.c b/libpackagekit/pk-control.c
index e22082d..03769e8 100644
--- a/libpackagekit/pk-control.c
+++ b/libpackagekit/pk-control.c
@@ -66,6 +66,7 @@ struct _PkControlPrivate
DBusGConnection *connection;
PkConnection *pconnection;
gchar **array;
+ guint idle_id;
};
enum {
@@ -653,6 +654,26 @@ pk_control_transaction_list_refresh (PkControl *control, GError **error)
}
/**
+ * pk_control_transaction_list_refresh_idle_cb:
+ * @control: This class instance
+ **/
+static gboolean
+pk_control_transaction_list_refresh_idle_cb (PkControl *control)
+{
+ gboolean ret;
+ GError *error = NULL;
+
+ /* refresh the internal lists */
+ ret = pk_control_transaction_list_refresh (control, &error);
+ if (!ret) {
+ egg_warning ("failed to get list: %s", error->message);
+ g_error_free (error);
+ }
+ control->priv->idle_id = 0;
+ return FALSE;
+}
+
+/**
* pk_control_transaction_list_get:
**/
const gchar **
@@ -685,8 +706,8 @@ static void
pk_control_connection_changed_cb (PkConnection *pconnection, gboolean connected, PkControl *control)
{
/* force a refresh so we have valid data*/
- if (connected)
- pk_control_transaction_list_refresh (control, NULL);
+ if (connected && control->priv->idle_id == 0)
+ control->priv->idle_id = g_idle_add ((GSourceFunc) pk_control_transaction_list_refresh_idle_cb, control);
}
/**
@@ -851,7 +872,6 @@ pk_control_class_init (PkControlClass *klass)
static void
pk_control_init (PkControl *control)
{
- gboolean ret;
GError *error = NULL;
control->priv = PK_CONTROL_GET_PRIVATE (control);
@@ -865,6 +885,7 @@ pk_control_init (PkControl *control)
/* we maintain a local copy */
control->priv->array = NULL;
+ control->priv->idle_id = 0;
/* watch for PackageKit on the bus, and try to connect up at start */
control->priv->pconnection = pk_connection_new ();
@@ -908,12 +929,8 @@ pk_control_init (PkControl *control)
dbus_g_proxy_connect_signal (control->priv->proxy, "Locked",
G_CALLBACK (pk_control_locked_cb), control, NULL);
- /* force a refresh so we have valid data*/
- ret = pk_control_transaction_list_refresh (control, &error);
- if (!ret) {
- egg_warning ("failed to get list: %s", error->message);
- g_error_free (error);
- }
+ /* idle add a refresh so we have valid data */
+ control->priv->idle_id = g_idle_add ((GSourceFunc) pk_control_transaction_list_refresh_idle_cb, control);
}
/**
@@ -944,7 +961,8 @@ pk_control_finalize (GObject *object)
dbus_g_proxy_disconnect_signal (control->priv->proxy, "RestartSchedule",
G_CALLBACK (pk_control_restart_schedule_cb), control);
- /* free the proxy */
+ if (control->priv->idle_id != 0)
+ g_source_remove (control->priv->idle_id);
g_object_unref (G_OBJECT (control->priv->proxy));
g_strfreev (control->priv->array);
commit bbd57b3c025487581d10445361f3131738ad0f3a
Merge: 4a07b8f... 8d4d031...
Author: Richard Hughes <richard at hughsie.com>
Date: Thu Oct 9 16:04:33 2008 +0100
Merge branch 'master' of git+ssh://hughsie@git.packagekit.org/srv/git/PackageKit
commit 8d4d0316d6508185c1b40b90373f99fc387f23c5
Merge: 8cf5f11... bc98616...
Author: Stefan Haas <shaas at suse.de>
Date: Thu Oct 9 17:09:13 2008 +0200
Merge branch 'master' of git+ssh://shaas@git.packagekit.org/srv/git/PackageKit
commit 8cf5f11f4038d54316267b4763a01f1c11a01f1f
Author: Stefan Haas <shaas at suse.de>
Date: Thu Oct 9 17:08:56 2008 +0200
zypp: fixed BNC#402372
diff --git a/backends/zypp/pk-backend-zypp.cpp b/backends/zypp/pk-backend-zypp.cpp
index a9fe902..6305749 100644
--- a/backends/zypp/pk-backend-zypp.cpp
+++ b/backends/zypp/pk-backend-zypp.cpp
@@ -793,6 +793,7 @@ backend_install_files_thread (PkBackend *backend)
tmpRepo.setAutorefresh (true);
tmpRepo.setAlias ("PK_TMP_DIR");
tmpRepo.setName ("PK_TMP_DIR");
+ zypp_build_pool(true);
// add Repo to pool
commit 4a07b8f0768e2e4949430da80a1f41b3f932a7f1
Author: Richard Hughes <richard at hughsie.com>
Date: Thu Oct 9 16:03:36 2008 +0100
feature: lots of updates to the pkgenpack manpage
diff --git a/man/pkgenpack.xml b/man/pkgenpack.xml
index ce0cc3d..5c19cdb 100644
--- a/man/pkgenpack.xml
+++ b/man/pkgenpack.xml
@@ -110,7 +110,7 @@ manpage.1: manpage.xml
Generally, the file list of packages is generated using
<command>pk-generate-package-list</command> on the target system.
If not specified, <command>pkgenpack</command> uses
- /var/lib/PackageKit/system.package-list by default.
+ <filename>/var/lib/PackageKit/system.package-list</filename> by default.
</para>
</listitem>
</varlistentry>
@@ -153,28 +153,33 @@ manpage.1: manpage.xml
He needs a service pack with valgrind and it's dependencies for his system.
He asks James to generate a pack for him.
Both know James's system should contain similar packages as Tim's system,
- as both of them have installed Fedora 9 two days ago. James simply runs:
+ as both of them have installed Fedora 9 two days ago.
</para>
<para>
- [james at jamesbook:~]$ pkgenpack --output=/media/USB/TimPacks --package=valgrind
+ James simply runs:
</para>
+<programlisting>
+[james at jamesbook:~]$ pkgenpack --output=/media/USB/TimPacks --package=valgrind
+</programlisting>
<para>
- This generates a file /media/USB/TimPacks/valgrind-fedora-9-i686.servicepack
+ This generates a file <filename>/media/USB/TimPacks/valgrind-fedora-9-i686.servicepack</filename>
on the USB key Tim gave to James.
Tim can now go home, insert the USB key and double clicks on the
- valgrind-fedora-9-i686.servicepack file to be prompted to install these packages.
+ <filename>valgrind-fedora-9-i686.servicepack</filename> file to be prompted
+ to install these packages.
</para>
<para>
- 2. Bill wants to create a service pack named kdegames-fedora-9-i686.servicepack for
- his new system which does not have an internet connection.
+ 2. Bill wants to create a service pack named <filename>kdegames-fedora-9-i686.servicepack</filename>
+ for his new system which does not have an internet connection.
He generates a list of packages on his system using <command>pk-generate-package-list</command>
and copies that list to his USB key.
He then gives that USB to Rishi who has a good internet connectivity.
Rishi runs the following command on his system:
</para>
- <para>
- [rishi at devils-temple:~]$ pkgenpack --with-package-list=/media/USB/bill.package-list --output=/home/rishi/Desktop --program=kdegames
- </para>
+<programlisting>
+[rishi at devils-temple:~]$ pkgenpack --with-package-list=/media/USB/bill.package-list \
+ --output=/home/rishi/Desktop --program=kdegames
+</programlisting>
<para>
This generates a service pack, kdegames-fedora-9-i686.servicepack, on Rishi's
Desktop, which can be distributed to Bill and users with similar requirements.
@@ -186,18 +191,19 @@ manpage.1: manpage.xml
Service Packs can be installed using pkcon.
For example:
</para>
- <para>
- [hacker at tim-lounge:~]$ pkcon install /home/USB/TimPacks/valgrind-fedora-9-i686.servicepack
- </para>
+<programlisting>
+[hacker at tim-lounge:~]$ pkcon install /media/USB/TimPacks/valgrind-fedora-9-i686.servicepack
+</programlisting>
</refsect1>
<refsect1>
<title>See Also</title>
- <para>pkmon (1). pkcon(1).</para>
+ <para><command>pkmon</command> (1). <command>pkcon</command>(1).</para>
</refsect1>
<refsect1>
<title>Author</title>
<para>
- This manual page was written by Shishir Goel <email>crazyontheedge at gmail.com</email>.
+ This manual page was written by Shishir Goel <email>crazyontheedge at gmail.com</email> and
+ Richard Hughes <email>richard at hughsie.com</email>.
</para>
</refsect1>
</refentry>
commit bc98616780773c614a3e5353050868cedd07a776
Author: Igor Pires Soares <igorsoares at gmail.com>
Date: Thu Oct 9 14:49:31 2008 +0000
Updated Brazilian Portuguese translation
Transmitted-via: Transifex (translate.fedoraproject.org)
diff --git a/po/pt_BR.po b/po/pt_BR.po
index 3d3abd3..2bbdb30 100644
--- a/po/pt_BR.po
+++ b/po/pt_BR.po
@@ -8,8 +8,8 @@ msgid ""
msgstr ""
"Project-Id-Version: PackageKit\n"
"Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2008-08-28 01:24+0000\n"
-"PO-Revision-Date: 2008-08-30 11:14-0300\n"
+"POT-Creation-Date: 2008-10-02 01:26+0000\n"
+"PO-Revision-Date: 2008-10-09 11:46-0300\n"
"Last-Translator: Igor Pires Soares <igor at projetofedora.org>\n"
"Language-Team: Brazilian Portuguese <fedora-trans-pt_br at redhat.com>\n"
"MIME-Version: 1.0\n"
@@ -19,258 +19,258 @@ msgstr ""
"X-Poedit-Language: Portuguese\n"
"X-Poedit-Country: BRAZIL\n"
-#: ../client/pk-console.c:235
+#: ../client/pk-console.c:274
msgid "Update detail"
msgstr "Detalhe da atualização"
-#: ../client/pk-console.c:452
+#: ../client/pk-console.c:491
msgid "A system restart is required"
msgstr "à necessário reiniciar o sistema"
-#: ../client/pk-console.c:454
+#: ../client/pk-console.c:493
msgid "A logout and login is required"
msgstr "à necessário sair da sessão e autenticar novamente"
-#: ../client/pk-console.c:456
+#: ../client/pk-console.c:495
msgid "An application restart is required"
msgstr "à necessário reiniciar a aplicação"
-#: ../client/pk-console.c:549
-#: ../client/pk-generate-pack.c:124
+#: ../client/pk-console.c:588
+#: ../client/pk-generate-pack.c:126
msgid "There are multiple package matches"
msgstr "Há múltiplos pacotes correspondentes"
#. find out what package the user wants to use
-#: ../client/pk-console.c:556
-#: ../client/pk-generate-pack.c:131
+#: ../client/pk-console.c:595
+#: ../client/pk-generate-pack.c:133
msgid "Please enter the package number: "
msgstr "Por favor, insira o número do pacote: "
-#: ../client/pk-console.c:590
+#: ../client/pk-console.c:629
msgid "Could not find package to install"
msgstr "Não foi possÃvel localizar o pacote a ser instalado"
-#: ../client/pk-console.c:696
+#: ../client/pk-console.c:735
msgid "Could not find package to remove"
msgstr "Não foi possÃvel localizar o pacote a ser removido"
-#: ../client/pk-console.c:757
+#: ../client/pk-console.c:796
msgid "The following packages have to be removed"
msgstr "Os seguintes pacotes têm que ser removidos"
#. get user input
-#: ../client/pk-console.c:764
+#: ../client/pk-console.c:803
msgid "Okay to remove additional packages?"
msgstr "Os pacotes adicionais podem ser removidos?"
-#: ../client/pk-console.c:768
-#: ../client/pk-generate-pack.c:523
+#: ../client/pk-console.c:807
+#: ../client/pk-generate-pack.c:528
#: ../client/pk-generate-pack-main.c:131
msgid "Cancelled!"
msgstr "Cancelado!"
-#: ../client/pk-console.c:802
+#: ../client/pk-console.c:841
msgid "Could not find package to download"
msgstr "Não foi possÃvel localizar um pacote a ser baixado"
-#: ../client/pk-console.c:853
+#: ../client/pk-console.c:893
msgid "Could not find package to update"
msgstr "Não foi possÃvel localizar o pacote a ser atualizado"
-#: ../client/pk-console.c:875
+#: ../client/pk-console.c:915
msgid "Could not find what packages require"
msgstr "Não foi possÃvel localizar quais pacotes necessitam desse pacote"
-#: ../client/pk-console.c:896
+#: ../client/pk-console.c:936
msgid "Could not get dependencies for"
msgstr "Não foi possÃvel obter as dependências para"
-#: ../client/pk-console.c:917
+#: ../client/pk-console.c:957
msgid "Could not find details for"
msgstr "Não foi possÃvel localizar os detalhes para"
-#: ../client/pk-console.c:940
+#: ../client/pk-console.c:980
msgid "Could not find the files for this package"
msgstr "Não foi possÃvel encontrar os arquivos para este pacote"
-#: ../client/pk-console.c:947
+#: ../client/pk-console.c:987
msgid "Could not get the file list"
msgstr "Não foi possÃvel obter a lista de arquivos"
-#: ../client/pk-console.c:966
+#: ../client/pk-console.c:1006
msgid "Could not find the update details for"
msgstr "Não foi possÃvel localizar os detalhes de atualização para"
-#: ../client/pk-console.c:1027
+#: ../client/pk-console.c:1067
msgid "Package description"
msgstr "Descrição do pacote"
-#: ../client/pk-console.c:1060
+#: ../client/pk-console.c:1100
msgid "Package files"
msgstr "Arquivos do pacote"
-#: ../client/pk-console.c:1068
+#: ../client/pk-console.c:1108
msgid "No files"
msgstr "Nenhum arquivo"
#. get user input
-#: ../client/pk-console.c:1100
+#: ../client/pk-console.c:1140
msgid "Okay to import key?"
msgstr "A chave pode ser importada?"
-#: ../client/pk-console.c:1103
+#: ../client/pk-console.c:1143
msgid "Did not import key"
msgstr "Não importar a chave"
#. get user input
-#: ../client/pk-console.c:1143
+#: ../client/pk-console.c:1183
msgid "Do you agree?"
msgstr "Você concorda?"
-#: ../client/pk-console.c:1146
+#: ../client/pk-console.c:1186
msgid "Did not agree to licence, task will fail"
msgstr "Se você não concordar com a licença a tarefa irá falhar"
-#: ../client/pk-console.c:1175
+#: ../client/pk-console.c:1215
msgid "The daemon crashed mid-transaction!"
msgstr "O daemon travou no meio da transação!"
#. header
-#: ../client/pk-console.c:1228
+#: ../client/pk-console.c:1268
msgid "PackageKit Console Interface"
msgstr "Interface em Console do PackageKit"
-#: ../client/pk-console.c:1228
+#: ../client/pk-console.c:1268
msgid "Subcommands:"
msgstr "Subcomandos:"
-#: ../client/pk-console.c:1338
+#: ../client/pk-console.c:1378
#: ../client/pk-generate-pack-main.c:64
-#: ../client/pk-monitor.c:104
-#: ../src/pk-main.c:189
+#: ../client/pk-monitor.c:118
+#: ../src/pk-main.c:192
msgid "Show extra debugging information"
msgstr "Mostrar informações extras de depuração"
-#: ../client/pk-console.c:1340
-#: ../client/pk-monitor.c:106
+#: ../client/pk-console.c:1380
+#: ../client/pk-monitor.c:120
msgid "Show the program version and exit"
msgstr "Mostrar a versão do programa e sair"
-#: ../client/pk-console.c:1342
+#: ../client/pk-console.c:1382
msgid "Set the filter, e.g. installed"
msgstr "Definir o filtro, p. ex.: instalados"
-#: ../client/pk-console.c:1344
+#: ../client/pk-console.c:1384
msgid "Exit without waiting for actions to complete"
msgstr "Sair sem esperar pelo término das ações"
-#: ../client/pk-console.c:1367
+#: ../client/pk-console.c:1407
msgid "Could not connect to system DBUS."
msgstr "Não foi possÃvel conectar ao DBUS do sistema."
-#: ../client/pk-console.c:1464
+#: ../client/pk-console.c:1500
msgid "You need to specify a search type, e.g. name"
msgstr "Você precisa especificar um tipo de pesquisa, p. ex. nome"
-#: ../client/pk-console.c:1469
-#: ../client/pk-console.c:1476
-#: ../client/pk-console.c:1483
-#: ../client/pk-console.c:1490
-#: ../client/pk-console.c:1601
-#: ../client/pk-console.c:1611
-#: ../client/pk-console.c:1618
-#: ../client/pk-console.c:1625
+#: ../client/pk-console.c:1505
+#: ../client/pk-console.c:1512
+#: ../client/pk-console.c:1519
+#: ../client/pk-console.c:1526
+#: ../client/pk-console.c:1637
+#: ../client/pk-console.c:1647
+#: ../client/pk-console.c:1654
+#: ../client/pk-console.c:1661
msgid "You need to specify a search term"
msgstr "Você precisa especificar um termo de pesquisa"
-#: ../client/pk-console.c:1495
+#: ../client/pk-console.c:1531
msgid "Invalid search type"
msgstr "Tipo de pesquisa inválido"
-#: ../client/pk-console.c:1500
+#: ../client/pk-console.c:1536
msgid "You need to specify a package or file to install"
msgstr "Você precisa especificar um pacote ou programa a ser instalado"
-#: ../client/pk-console.c:1507
+#: ../client/pk-console.c:1543
msgid "You need to specify a type, key_id and package_id"
msgstr "Você precisa especificar um tipo, key_id e package_id"
-#: ../client/pk-console.c:1514
+#: ../client/pk-console.c:1550
msgid "You need to specify a package to remove"
msgstr "Você precisa especificar um pacote a ser removido"
-#: ../client/pk-console.c:1520
+#: ../client/pk-console.c:1556
msgid "You need to specify the destination directory and then the packages to download"
msgstr "Você precisa especificar o diretório de destino e em seguida os pacotes a serem baixados"
-#: ../client/pk-console.c:1525
+#: ../client/pk-console.c:1561
msgid "Directory not found"
msgstr "Diretório não encontrado"
-#: ../client/pk-console.c:1531
+#: ../client/pk-console.c:1567
msgid "You need to specify a eula-id"
msgstr "Você precisa especificar um eula-id"
-#: ../client/pk-console.c:1547
+#: ../client/pk-console.c:1583
msgid "You need to specify a package name to resolve"
msgstr "Você precisa especificar um nome de pacote a ser analisado"
-#: ../client/pk-console.c:1556
-#: ../client/pk-console.c:1563
+#: ../client/pk-console.c:1592
+#: ../client/pk-console.c:1599
msgid "You need to specify a repo name"
msgstr "Você precisa especificar um nome de repositório"
-#: ../client/pk-console.c:1570
+#: ../client/pk-console.c:1606
msgid "You need to specify a repo name/parameter and value"
msgstr "Você precisa especificar um nome/parâmetro de repositório e um valor"
-#: ../client/pk-console.c:1583
+#: ../client/pk-console.c:1619
msgid "You need to specify a time term"
msgstr "Você precisa especificar um termo de horário"
-#: ../client/pk-console.c:1588
+#: ../client/pk-console.c:1624
msgid "You need to specify a correct role"
msgstr "Você precisa especificar um papel correto"
-#: ../client/pk-console.c:1593
+#: ../client/pk-console.c:1629
msgid "Failed to get last time"
msgstr "Falha ao obter o último horário"
-#: ../client/pk-console.c:1632
+#: ../client/pk-console.c:1668
msgid "You need to specify a package to find the details for"
msgstr "Você precisa especificar o pacote para o qual você quer localizar os detalhes"
-#: ../client/pk-console.c:1639
+#: ../client/pk-console.c:1675
msgid "You need to specify a package to find the files for"
msgstr "Você precisa especificar o pacote para o qual você quer localizar os arquivos"
-#: ../client/pk-console.c:1688
+#: ../client/pk-console.c:1724
#, c-format
msgid "Option '%s' not supported"
msgstr "A opção \"%s\" não é suportada"
-#: ../client/pk-console.c:1701
+#: ../client/pk-console.c:1737
msgid "You don't have the necessary privileges for this operation"
msgstr "Você não tem os privilégios necessários para esta operação"
-#: ../client/pk-console.c:1703
+#: ../client/pk-console.c:1739
msgid "Command failed"
msgstr "O comando falhou"
-#: ../client/pk-generate-pack.c:115
+#: ../client/pk-generate-pack.c:117
msgid "Could not find a package match"
msgstr "Não foi possÃvel encontrar um pacote correspondente"
-#: ../client/pk-generate-pack.c:149
+#: ../client/pk-generate-pack.c:151
msgid "failed to download: invalid package_id and/or directory"
msgstr "falha ao baixar: package_id e/ou diretório inválidos"
-#: ../client/pk-generate-pack.c:230
+#: ../client/pk-generate-pack.c:232
msgid "Could not find a valid metadata file"
msgstr "Não foi possÃvel localizar um arquivo de metadados válido"
#. get user input
-#: ../client/pk-generate-pack.c:519
+#: ../client/pk-generate-pack.c:524
msgid "Okay to download the additional packages"
msgstr "Os pacotes adicionais podem ser baixados"
@@ -298,18 +298,20 @@ msgstr "Falha ao criar o diretório"
msgid "Failed to create pack"
msgstr "Falha ao criar o pacote de serviços"
-#: ../client/pk-import-desktop.c:279
-#: ../client/pk-import-specspo.c:177
+#: ../client/pk-import-specspo.c:185
+msgid "Could not set database readonly"
+msgstr "Não foi possÃvel configurar o banco de dados para somente leitura"
+
+#: ../client/pk-import-specspo.c:192
#, c-format
msgid "Could not open database: %s"
msgstr "Não foi possÃvel abrir o banco de dados: %s"
-#: ../client/pk-import-desktop.c:280
-#: ../client/pk-import-specspo.c:178
+#: ../client/pk-import-specspo.c:193
msgid "You probably need to run this program as the root user"
msgstr "Você provavelmente precisa executar este programa como usuário root"
-#: ../client/pk-monitor.c:117
+#: ../client/pk-monitor.c:131
msgid "PackageKit Monitor"
msgstr "Monitor do PackageKit"
@@ -409,55 +411,55 @@ msgstr "Catálogo do PackageKit"
msgid "PackageKit Service Pack"
msgstr "Pacote de serviços do PackageKit"
-#: ../src/pk-main.c:83
+#: ../src/pk-main.c:85
msgid "Startup failed due to security policies on this machine."
msgstr "A inicialização falhou devido à polÃticas de segurança desta máquina"
-#: ../src/pk-main.c:84
+#: ../src/pk-main.c:86
msgid "This can happen for two reasons:"
msgstr "Isso pode acontecer por duas razões:"
-#: ../src/pk-main.c:85
+#: ../src/pk-main.c:87
msgid "The correct user is not launching the executable (usually root)"
msgstr "O usuário correto não está iniciando o executável (normalmente o root)"
-#: ../src/pk-main.c:86
+#: ../src/pk-main.c:88
msgid "The org.freedesktop.PackageKit.conf file is not installed in the system /etc/dbus-1/system.d directory"
msgstr "O arquivo org.freedesktop.PackageKit.conf não está instalado no diretório /etc/dbus-1/system.d do sistema"
-#: ../src/pk-main.c:185
+#: ../src/pk-main.c:188
msgid "Packaging backend to use, e.g. dummy"
msgstr "O backend de empacotamento a ser utilizado, p. ex.: dummy"
-#: ../src/pk-main.c:187
+#: ../src/pk-main.c:190
msgid "Daemonize and detach from the terminal"
msgstr "Tornar um daemon e separar do terminal"
-#: ../src/pk-main.c:191
+#: ../src/pk-main.c:194
msgid "Disable the idle timer"
msgstr "Desabilitar o tempo de ociosidade"
-#: ../src/pk-main.c:193
+#: ../src/pk-main.c:196
msgid "Show version and exit"
msgstr "Mostrar a versão e sair"
-#: ../src/pk-main.c:195
+#: ../src/pk-main.c:198
msgid "Exit after a small delay"
msgstr "Sair após um pequeno atraso"
-#: ../src/pk-main.c:197
+#: ../src/pk-main.c:200
msgid "Exit after the engine has loaded"
msgstr "Sair após o carregamento do mecanismo"
-#: ../src/pk-main.c:207
+#: ../src/pk-main.c:210
msgid "PackageKit service"
msgstr "Serviço do PackageKit"
-#: ../src/pk-main.c:233
+#: ../src/pk-main.c:246
msgid "Cannot connect to the system bus"
msgstr "Não foi possÃvel conectar ao barramento do sistema"
-#: ../src/pk-main.c:273
+#: ../src/pk-main.c:286
#, c-format
msgid "Error trying to start: %s\n"
msgstr "Erro ao tentar iniciar: %s\n"
commit 1156d344737214d5529e7b4cf80801c40eb3c069
Author: Richard Hughes <richard at hughsie.com>
Date: Thu Oct 9 15:39:49 2008 +0100
trivial: add another screenshot
diff --git a/docs/html/img/Makefile.am b/docs/html/img/Makefile.am
index bb94122..3026ce5 100644
--- a/docs/html/img/Makefile.am
+++ b/docs/html/img/Makefile.am
@@ -30,6 +30,7 @@ IMAGE_FILES = \
gpk-repo-more.png \
gpk-require-restart.png \
gpk-log.png \
+ gpk-service-pack.png \
gpk-updates.png \
gpk-updates-warning.png \
gpk-waiting.png \
diff --git a/docs/html/img/gpk-service-pack.png b/docs/html/img/gpk-service-pack.png
new file mode 100644
index 0000000..801a003
Binary files /dev/null and b/docs/html/img/gpk-service-pack.png differ
diff --git a/docs/html/pk-screenshots.html b/docs/html/pk-screenshots.html
index 5d002fc..a31e620 100644
--- a/docs/html/pk-screenshots.html
+++ b/docs/html/pk-screenshots.html
@@ -102,6 +102,9 @@
<center><img src="img/gpk-client-mime-type.png" alt=""/></center>
<p class="caption">Session installer for MIME types</p>
+<center><img src="img/gpk-service-pack.png" alt=""/></center>
+<p class="caption">Service pack generator</p>
+
<h1><a name="kde">KDE Screenshots</a></h1>
<center><img src="img/kpk-update.png" alt=""/></center>
diff --git a/docs/html/upload.sh b/docs/html/upload.sh
index e08053b..ef0fbd8 100755
--- a/docs/html/upload.sh
+++ b/docs/html/upload.sh
@@ -11,15 +11,14 @@ USER="hughsie"
SERVER="packagekit.org"
LOCATION="/srv/www/html"
-scp files/*.c $USER@$SERVER:/$LOCATION/files/
scp img/*.png $USER@$SERVER:/$LOCATION/img/
scp *.html $USER@$SERVER:/$LOCATION/
scp *.css $USER@$SERVER:/$LOCATION/
scp ../api/html/*.html $USER@$SERVER:/$LOCATION/gtk-doc/
scp ../api/html/*.png $USER@$SERVER:/$LOCATION/gtk-doc/
scp ../api/html/*.css $USER@$SERVER:/$LOCATION/gtk-doc/
-docbook2pdf ../../man/pkcon.xml --output ./man
-docbook2pdf ../../man/pkmon.xml --output ./man
-docbook2pdf ../../man/pkgenpack.xml --output ./man
-scp man/*.pdf $USER@$SERVER:/$LOCATION/files/
+docbook2pdf ../../man/pkcon.xml --output ./files
+docbook2pdf ../../man/pkmon.xml --output ./files
+docbook2pdf ../../man/pkgenpack.xml --output ./files
+scp files/* $USER@$SERVER:/$LOCATION/files/
commit b745e1e74aa6e9fc27f0764c5841f4e830e85105
Author: Richard Hughes <richard at hughsie.com>
Date: Thu Oct 9 14:59:57 2008 +0100
trivial: add a percentage signal to PkServicePack
diff --git a/client/pk-generate-pack.c b/client/pk-generate-pack.c
index cea63da..d1d91a8 100644
--- a/client/pk-generate-pack.c
+++ b/client/pk-generate-pack.c
@@ -39,6 +39,8 @@
#include "pk-tools-common.h"
+static guint last_percentage = 0;
+
/**
* pk_generate_pack_get_filename:
**/
@@ -156,7 +158,16 @@ static void
pk_generate_pack_package_cb (PkServicePack *pack, const PkPackageObj *obj, gpointer data)
{
g_return_if_fail (obj != NULL);
- g_print ("%s %s-%s.%s\n", _("Downloading"), obj->id->name, obj->id->version, obj->id->arch);
+ g_print ("%i%%\t%s %s-%s.%s\n", last_percentage, _("Downloading"), obj->id->name, obj->id->version, obj->id->arch);
+}
+
+/**
+ * pk_generate_pack_percentage_cb:
+ **/
+static void
+pk_generate_pack_percentage_cb (PkServicePack *pack, guint percentage, gpointer data)
+{
+ last_percentage = percentage;
}
/**
@@ -296,8 +307,8 @@ main (int argc, char *argv[])
/* create pack and set initial values */
pack = pk_service_pack_new ();
- g_signal_connect (pack, "package",
- G_CALLBACK (pk_generate_pack_package_cb), pack);
+ g_signal_connect (pack, "package", G_CALLBACK (pk_generate_pack_package_cb), pack);
+ g_signal_connect (pack, "percentage", G_CALLBACK (pk_generate_pack_percentage_cb), pack);
pk_service_pack_set_filename (pack, filename);
pk_service_pack_set_temp_directory (pack, tempdir);
pk_service_pack_set_exclude_list (pack, list);
diff --git a/libpackagekit/pk-service-pack.c b/libpackagekit/pk-service-pack.c
index 52b17ad..8aa26b1 100644
--- a/libpackagekit/pk-service-pack.c
+++ b/libpackagekit/pk-service-pack.c
@@ -54,6 +54,7 @@ struct PkServicePackPrivate
typedef enum {
PK_SERVICE_PACK_PACKAGE,
+ PK_SERVICE_PACK_PERCENTAGE,
PK_SERVICE_PACK_LAST_SIGNAL
} PkSignals;
@@ -420,26 +421,28 @@ pk_service_pack_set_exclude_list (PkServicePack *pack, PkPackageList *list)
* pk_service_pack_download_package_ids:
**/
static gboolean
-pk_service_pack_download_package_ids (PkServicePack *pack, gchar **package_ids)
+pk_service_pack_download_package_ids (PkServicePack *pack, gchar **package_ids, GError **error)
{
gboolean ret;
- GError *error = NULL;
+ GError *error_local = NULL;
g_return_val_if_fail (PK_IS_SERVICE_PACK (pack), FALSE);
g_return_val_if_fail (package_ids != NULL, FALSE);
g_return_val_if_fail (pack->priv->directory != NULL, FALSE);
egg_debug ("download+ %s", package_ids[0]);
- ret = pk_client_reset (pack->priv->client, &error);
+ ret = pk_client_reset (pack->priv->client, &error_local);
if (!ret) {
- egg_warning ("failed to download: %s", error->message);
- g_error_free (error);
+ *error = g_error_new (PK_SERVICE_PACK_ERROR, PK_SERVICE_PACK_ERROR_FAILED_SETUP,
+ "failed to reset: %s", error_local->message);
+ g_error_free (error_local);
goto out;
}
- ret = pk_client_download_packages (pack->priv->client, package_ids, pack->priv->directory, &error);
+ ret = pk_client_download_packages (pack->priv->client, package_ids, pack->priv->directory, &error_local);
if (!ret) {
- egg_warning ("failed to download: %s", error->message);
- g_error_free (error);
+ *error = g_error_new (PK_SERVICE_PACK_ERROR, PK_SERVICE_PACK_ERROR_FAILED_DOWNLOAD,
+ "failed to download: %s", error_local->message);
+ g_error_free (error_local);
goto out;
}
out:
@@ -472,6 +475,7 @@ pk_service_pack_exclude_packages (PkServicePack *pack, PkPackageList *list)
return TRUE;
}
+#ifdef HAVE_ARCHIVE_H
/**
* pk_service_pack_create_metadata_file:
**/
@@ -524,7 +528,6 @@ out:
return ret;
}
-#ifdef HAVE_ARCHIVE_H
/**
* pk_service_pack_archive_add_file:
**/
@@ -718,6 +721,17 @@ pk_service_pack_package_cb (PkClient *client, const PkPackageObj *obj, PkService
}
/**
+ * pk_service_pack_progress_changed_cb:
+ **/
+static void
+pk_service_pack_progress_changed_cb (PkClient *client, guint percentage, guint subpercentage,
+ guint elapsed, guint remaining, PkServicePack *pack)
+{
+ egg_debug ("emit percentage %i", percentage);
+ g_signal_emit (pack, signals [PK_SERVICE_PACK_PERCENTAGE], 0, percentage);
+}
+
+/**
* pk_service_pack_setup_client:
**/
static gboolean
@@ -728,6 +742,8 @@ pk_service_pack_setup_client (PkServicePack *pack)
pack->priv->client = pk_client_new ();
g_signal_connect (pack->priv->client, "package",
G_CALLBACK (pk_service_pack_package_cb), pack);
+ g_signal_connect (pack->priv->client, "progress-changed",
+ G_CALLBACK (pk_service_pack_progress_changed_cb), pack);
pk_client_set_use_buffer (pack->priv->client, TRUE, NULL);
pk_client_set_synchronous (pack->priv->client, TRUE, NULL);
return TRUE;
@@ -758,6 +774,7 @@ pk_service_pack_create_for_package_ids (PkServicePack *pack, gchar **package_ids
g_return_val_if_fail (PK_IS_SERVICE_PACK (pack), FALSE);
g_return_val_if_fail (package_ids != NULL, FALSE);
+ g_return_val_if_fail (error != NULL, FALSE);
g_return_val_if_fail (pack->priv->filename != NULL, FALSE);
g_return_val_if_fail (pack->priv->directory != NULL, FALSE);
@@ -765,7 +782,7 @@ pk_service_pack_create_for_package_ids (PkServicePack *pack, gchar **package_ids
pk_service_pack_setup_client (pack);
/* download this package */
- ret = pk_service_pack_download_package_ids (pack, package_ids);
+ ret = pk_service_pack_download_package_ids (pack, package_ids, &error_local);
if (!ret) {
*error = g_error_new (PK_SERVICE_PACK_ERROR, error_local->code,
"failed to download main package: %s", error_local->message);
@@ -811,13 +828,14 @@ pk_service_pack_create_for_package_ids (PkServicePack *pack, gchar **package_ids
if (length != 0) {
/* download additional package_ids */
package_ids_deps = pk_package_list_to_strv (list);
- ret = pk_service_pack_download_package_ids (pack, package_ids_deps);
+ ret = pk_service_pack_download_package_ids (pack, package_ids_deps, &error_local);
g_strfreev (package_ids_deps);
/* failed to get deps */
if (!ret) {
- *error = g_error_new (PK_SERVICE_PACK_ERROR, PK_SERVICE_PACK_ERROR_FAILED_DOWNLOAD,
- "failed to download deps of package: %s", package_ids[0]);
+ *error = g_error_new (PK_SERVICE_PACK_ERROR, error_local->code,
+ "failed to download deps of package: %s", error_local->message);
+ g_error_free (error_local);
goto out;
}
}
@@ -867,6 +885,7 @@ pk_service_pack_create_for_package_id (PkServicePack *pack, const gchar *package
g_return_val_if_fail (PK_IS_SERVICE_PACK (pack), FALSE);
g_return_val_if_fail (package_id != NULL, FALSE);
+ g_return_val_if_fail (error != NULL, FALSE);
g_return_val_if_fail (pack->priv->filename != NULL, FALSE);
g_return_val_if_fail (pack->priv->directory != NULL, FALSE);
@@ -895,6 +914,7 @@ pk_service_pack_create_for_updates (PkServicePack *pack, GError **error)
guint len;
g_return_val_if_fail (PK_IS_SERVICE_PACK (pack), FALSE);
+ g_return_val_if_fail (error != NULL, FALSE);
g_return_val_if_fail (pack->priv->filename != NULL, FALSE);
g_return_val_if_fail (pack->priv->directory != NULL, FALSE);
@@ -984,6 +1004,20 @@ pk_service_pack_class_init (PkServicePackClass *klass)
NULL, NULL, g_cclosure_marshal_VOID__POINTER,
G_TYPE_NONE, 1, G_TYPE_POINTER);
+ /**
+ * PkServicePack::percentage:
+ * @pack: the #PkServicePack instance that emitted the signal
+ * @percentage: the #PkPackageObj that has just been downloaded
+ *
+ * The ::package signal is emitted when a file is being downloaded.
+ **/
+ signals [PK_SERVICE_PACK_PERCENTAGE] =
+ g_signal_new ("percentage",
+ G_TYPE_FROM_CLASS (object_class), G_SIGNAL_RUN_LAST,
+ G_STRUCT_OFFSET (PkServicePackClass, percentage),
+ NULL, NULL, g_cclosure_marshal_VOID__UINT,
+ G_TYPE_NONE, 1, G_TYPE_UINT);
+
g_type_class_add_private (klass, sizeof (PkServicePackPrivate));
}
diff --git a/libpackagekit/pk-service-pack.h b/libpackagekit/pk-service-pack.h
index 947be52..a766507 100644
--- a/libpackagekit/pk-service-pack.h
+++ b/libpackagekit/pk-service-pack.h
@@ -59,6 +59,8 @@ typedef struct
GObjectClass parent_class;
void (* package) (PkServicePack *pack,
const PkPackageObj *obj);
+ void (* percentage) (PkServicePack *pack,
+ guint percentage);
/* Padding for future expansion */
void (*_pk_reserved1) (void);
void (*_pk_reserved2) (void);
commit 7c9c834e0f9495525fa1aaf53d4f644e138b2f05
Merge: 9e80685... 8fbfe58...
Author: Stefan Haas <shaas at suse.de>
Date: Thu Oct 9 15:33:58 2008 +0200
Merge branch 'master' of git+ssh://shaas@git.packagekit.org/srv/git/PackageKit
commit 8fab5fecd9a062bfd1aa9248ff59fcee8f152f72
Author: Richard Hughes <richard at hughsie.com>
Date: Thu Oct 9 12:57:08 2008 +0100
trivial: change the filename of the system package lists
diff --git a/client/pk-generate-pack.c b/client/pk-generate-pack.c
index f0bc031..cea63da 100644
--- a/client/pk-generate-pack.c
+++ b/client/pk-generate-pack.c
@@ -230,7 +230,7 @@ main (int argc, char *argv[])
/* fall back to the system copy */
if (package_list == NULL)
- package_list = g_strdup ("/var/lib/PackageKit/package-list.txt");
+ package_list = g_strdup (PK_SYSTEM_PACKAGE_LIST_FILENAME);
/* fall back to CWD */
if (directory == NULL)
diff --git a/libpackagekit/pk-common.h b/libpackagekit/pk-common.h
index e3faf26..a01a809 100644
--- a/libpackagekit/pk-common.h
+++ b/libpackagekit/pk-common.h
@@ -61,6 +61,13 @@ G_BEGIN_DECLS
*/
#define PK_SERVICE_PACK_GROUP_NAME "PackageKit Service Pack"
+/**
+ * PK_PACKAGE_LIST_FILENAME:
+ *
+ * The default location of the package list
+ */
+#define PK_SYSTEM_PACKAGE_LIST_FILENAME "/var/lib/PackageKit/system.package-list"
+
gboolean pk_strvalidate (const gchar *text)
G_GNUC_WARN_UNUSED_RESULT;
gchar *pk_strsafe (const gchar *text)
diff --git a/man/pkgenpack.xml b/man/pkgenpack.xml
index e3a09f1..ce0cc3d 100644
--- a/man/pkgenpack.xml
+++ b/man/pkgenpack.xml
@@ -110,7 +110,7 @@ manpage.1: manpage.xml
Generally, the file list of packages is generated using
<command>pk-generate-package-list</command> on the target system.
If not specified, <command>pkgenpack</command> uses
- /var/lib/PackageKit/package-list.txt by default.
+ /var/lib/PackageKit/system.package-list by default.
</para>
</listitem>
</varlistentry>
@@ -173,7 +173,7 @@ manpage.1: manpage.xml
Rishi runs the following command on his system:
</para>
<para>
- [rishi at devils-temple:~]$ pkgenpack --with-package-list=/media/USB/package-list.txt --output=/home/rishi/Desktop --program=kdegames
+ [rishi at devils-temple:~]$ pkgenpack --with-package-list=/media/USB/bill.package-list --output=/home/rishi/Desktop --program=kdegames
</para>
<para>
This generates a service pack, kdegames-fedora-9-i686.servicepack, on Rishi's
diff --git a/src/pk-refresh.c b/src/pk-refresh.c
index 469081d..ab214bc 100644
--- a/src/pk-refresh.c
+++ b/src/pk-refresh.c
@@ -31,6 +31,8 @@
#include <gio/gio.h>
#endif
+#include <pk-common.h>
+
#include "egg-debug.h"
#include "egg-string-list.h"
@@ -472,7 +474,7 @@ pk_refresh_update_package_list (PkRefresh *refresh)
pk_refresh_emit_progress_changed (refresh, 90);
/* convert to a file */
- ret = pk_package_list_to_file (refresh->priv->list, "/var/lib/PackageKit/package-list.txt");
+ ret = pk_package_list_to_file (refresh->priv->list, PK_SYSTEM_PACKAGE_LIST_FILENAME);
if (!ret)
egg_warning ("failed to save to file");
commit aadb6c6fa97c164cc9ac50640dd8022af919a889
Author: Richard Hughes <richard at hughsie.com>
Date: Thu Oct 9 11:52:36 2008 +0100
feature: more PkServicePack into libpackagekit so that client GUI tools can be built on top
diff --git a/client/Makefile.am b/client/Makefile.am
index 77482f8..490677a 100644
--- a/client/Makefile.am
+++ b/client/Makefile.am
@@ -69,8 +69,6 @@ pkgenpack_SOURCES = \
egg-string.c \
egg-string.h \
pk-generate-pack.c \
- pk-service-pack.c \
- pk-service-pack.h \
pk-tools-common.c \
pk-tools-common.h \
$(NULL)
diff --git a/client/pk-generate-pack.c b/client/pk-generate-pack.c
index 80eb4eb..f0bc031 100644
--- a/client/pk-generate-pack.c
+++ b/client/pk-generate-pack.c
@@ -35,9 +35,9 @@
#include <pk-package-id.h>
#include <pk-package-ids.h>
#include <pk-client.h>
+#include <pk-service-pack.h>
#include "pk-tools-common.h"
-#include "pk-service-pack.h"
/**
* pk_generate_pack_get_filename:
diff --git a/client/pk-service-pack.c b/client/pk-service-pack.c
deleted file mode 120000
index e8dbe96..0000000
--- a/client/pk-service-pack.c
+++ /dev/null
@@ -1 +0,0 @@
-../src/pk-service-pack.c
\ No newline at end of file
diff --git a/client/pk-service-pack.h b/client/pk-service-pack.h
deleted file mode 120000
index 700ac31..0000000
--- a/client/pk-service-pack.h
+++ /dev/null
@@ -1 +0,0 @@
-../src/pk-service-pack.h
\ No newline at end of file
diff --git a/libpackagekit/Makefile.am b/libpackagekit/Makefile.am
index 40d55da..1f4ec38 100644
--- a/libpackagekit/Makefile.am
+++ b/libpackagekit/Makefile.am
@@ -39,6 +39,7 @@ libpackagekit_include_HEADERS = \
pk-catalog.h \
pk-control.h \
pk-task-list.h \
+ pk-service-pack.h \
$(NULL)
libpackagekit_la_SOURCES = \
@@ -54,6 +55,8 @@ libpackagekit_la_SOURCES = \
pk-extra.h \
pk-connection.c \
pk-connection.h \
+ pk-service-pack.c \
+ pk-service-pack.h \
pk-package-id.c \
pk-package-id.h \
pk-package-ids.c \
@@ -91,6 +94,7 @@ libpackagekit_la_LIBADD = \
$(DBUS_LIBS) \
$(POLKIT_LIBS) \
$(SQLITE_LIBS) \
+ $(ARCHIVE_LIBS) \
$(NULL)
libpackagekit_la_LDFLAGS = \
@@ -117,6 +121,7 @@ pk_self_test_LDADD = \
$(SELFTEST_LIBS) \
$(POLKIT_LIBS) \
$(SQLITE_LIBS) \
+ $(ARCHIVE_LIBS) \
$(NULL)
pk_self_test_CFLAGS = -DEGG_TEST $(AM_CFLAGS)
diff --git a/libpackagekit/pk-self-test.c b/libpackagekit/pk-self-test.c
index 6048bcb..56c0303 100644
--- a/libpackagekit/pk-self-test.c
+++ b/libpackagekit/pk-self-test.c
@@ -44,6 +44,7 @@ void pk_task_list_test (EggTest *test);
void pk_catalog_test (EggTest *test);
void pk_update_detail_test (EggTest *test);
void pk_details_test (EggTest *test);
+void pk_service_pack_test (EggTest *test);
int
main (int argc, char **argv)
@@ -71,6 +72,7 @@ main (int argc, char **argv)
pk_task_list_test (test);
pk_update_detail_test (test);
pk_details_test (test);
+ pk_service_pack_test (test);
return (egg_test_finish (test));
}
diff --git a/libpackagekit/pk-service-pack.c b/libpackagekit/pk-service-pack.c
new file mode 100644
index 0000000..52b17ad
--- /dev/null
+++ b/libpackagekit/pk-service-pack.c
@@ -0,0 +1,1037 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*-
+ *
+ * Copyright (C) 2008 Richard Hughes <richard at hughsie.com>
+ * Copyright (C) 2008 Shishir Goel <crazyontheedge at gmail.com>
+ *
+ * Licensed under the GNU General Public License Version 2
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+#include <fcntl.h>
+
+#ifdef HAVE_ARCHIVE_H
+#include <archive.h>
+#include <archive_entry.h>
+#endif /* HAVE_ARCHIVE_H */
+
+#include <glib.h>
+#include <glib/gstdio.h>
+
+#include "egg-debug.h"
+#include "egg-string.h"
+
+#include <pk-common.h>
+#include <pk-client.h>
+#include <pk-package-ids.h>
+#include <pk-service-pack.h>
+
+#define PK_SERVICE_PACK_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), PK_TYPE_SERVICE_PACK, PkServicePackPrivate))
+
+struct PkServicePackPrivate
+{
+ PkPackageList *exclude_list;
+ gchar *filename;
+ gchar *directory;
+ PkClient *client;
+};
+
+typedef enum {
+ PK_SERVICE_PACK_PACKAGE,
+ PK_SERVICE_PACK_LAST_SIGNAL
+} PkSignals;
+
+static guint signals [PK_SERVICE_PACK_LAST_SIGNAL] = { 0 };
+G_DEFINE_TYPE (PkServicePack, pk_service_pack, G_TYPE_OBJECT)
+
+/**
+ * pk_service_pack_error_quark:
+ *
+ * Return value: Our personal error quark.
+ **/
+GQuark
+pk_service_pack_error_quark (void)
+{
+ static GQuark quark = 0;
+ if (!quark)
+ quark = g_quark_from_static_string ("pk_service_pack_error");
+ return quark;
+}
+
+/**
+ * pk_service_pack_error_get_type:
+ **/
+#define ENUM_ENTRY(NAME, DESC) { NAME, "" #NAME "", DESC }
+GType
+pk_service_pack_error_get_type (void)
+{
+ static GType etype = 0;
+
+ if (etype == 0) {
+ static const GEnumValue values[] =
+ {
+ ENUM_ENTRY (PK_SERVICE_PACK_ERROR_FAILED_SETUP, "FailedSetup"),
+ ENUM_ENTRY (PK_SERVICE_PACK_ERROR_FAILED_DOWNLOAD, "FailedDownload"),
+ ENUM_ENTRY (PK_SERVICE_PACK_ERROR_FAILED_EXTRACTION, "FailedExtraction"),
+ ENUM_ENTRY (PK_SERVICE_PACK_ERROR_FAILED_CREATE, "FailedCreate"),
+ ENUM_ENTRY (PK_SERVICE_PACK_ERROR_NOTHING_TO_DO, "NothingToDo"),
+ ENUM_ENTRY (PK_SERVICE_PACK_ERROR_NOT_COMPATIBLE, "NotCompatible"),
+ { 0, NULL, NULL }
+ };
+ etype = g_enum_register_static ("PkServicePackError", values);
+ }
+ return etype;
+}
+
+/**
+ * pk_service_pack_check_metadata_file:
+ **/
+static gboolean
+pk_service_pack_check_metadata_file (const gchar *full_path)
+{
+ GKeyFile *file;
+ gboolean ret;
+ GError *error = NULL;
+ gchar *distro_id = NULL;
+ gchar *distro_id_us = NULL;
+
+ /* load the file */
+ file = g_key_file_new ();
+ ret = g_key_file_load_from_file (file, full_path, G_KEY_FILE_NONE, &error);
+ if (!ret) {
+ egg_warning ("failed to load file: %s", error->message);
+ g_error_free (error);
+ goto out;
+ }
+
+ /* read the value */
+ distro_id = g_key_file_get_string (file, PK_SERVICE_PACK_GROUP_NAME, "distro_id", &error);
+ if (!ret) {
+ egg_warning ("failed to get value: %s", error->message);
+ g_error_free (error);
+ goto out;
+ }
+
+ /* get this system id */
+ distro_id_us = pk_get_distro_id ();
+
+ /* do we match? */
+ ret = egg_strequal (distro_id_us, distro_id);
+
+out:
+ g_key_file_free (file);
+ g_free (distro_id);
+ g_free (distro_id_us);
+ return ret;
+}
+
+/**
+ * pk_service_pack_extract:
+ * @directory: the directory to unpack into
+ * @error: a valid %GError
+ *
+ * Decompress a tar file
+ *
+ * Return value: %TRUE if the file was decompressed
+ **/
+#ifdef HAVE_ARCHIVE_H
+static gboolean
+pk_service_pack_extract (const gchar *filename, const gchar *directory, GError **error)
+{
+ gboolean ret = FALSE;
+ struct archive *arch = NULL;
+ struct archive_entry *entry;
+ int r;
+ int retval;
+ gchar *retcwd;
+ gchar buf[PATH_MAX];
+
+ /* save the PWD as we chdir to extract */
+ retcwd = getcwd (buf, PATH_MAX);
+ if (retcwd == NULL) {
+ *error = g_error_new (PK_SERVICE_PACK_ERROR, PK_SERVICE_PACK_ERROR_FAILED_SETUP,
+ "failed to get cwd");
+ goto out;
+ }
+
+ /* we can only read tar achives */
+ arch = archive_read_new ();
+ archive_read_support_format_tar (arch);
+
+ /* open the tar file */
+ r = archive_read_open_file (arch, filename, 10240);
+ if (r) {
+ *error = g_error_new (PK_SERVICE_PACK_ERROR, PK_SERVICE_PACK_ERROR_FAILED_EXTRACTION,
+ "cannot open: %s", archive_error_string (arch));
+ goto out;
+ }
+
+ /* switch to our destination directory */
+ retval = chdir (directory);
+ if (retval != 0) {
+ *error = g_error_new (PK_SERVICE_PACK_ERROR, PK_SERVICE_PACK_ERROR_FAILED_SETUP,
+ "failed chdir to %s", directory);
+ goto out;
+ }
+
+ /* decompress each file */
+ for (;;) {
+ r = archive_read_next_header (arch, &entry);
+ if (r == ARCHIVE_EOF)
+ break;
+ if (r != ARCHIVE_OK) {
+ *error = g_error_new (PK_SERVICE_PACK_ERROR, PK_SERVICE_PACK_ERROR_FAILED_EXTRACTION,
+ "cannot read header: %s", archive_error_string (arch));
+ goto out;
+ }
+ r = archive_read_extract (arch, entry, 0);
+ if (r != ARCHIVE_OK) {
+ *error = g_error_new (PK_SERVICE_PACK_ERROR, PK_SERVICE_PACK_ERROR_FAILED_EXTRACTION,
+ "cannot extract: %s", archive_error_string (arch));
+ goto out;
+ }
+ }
+
+ /* completed all okay */
+ ret = TRUE;
+out:
+ /* close the archive */
+ if (arch != NULL) {
+ archive_read_close (arch);
+ archive_read_finish (arch);
+ }
+
+ /* switch back to PWD */
+ retval = chdir (buf);
+ if (retval != 0)
+ egg_warning ("cannot chdir back!");
+
+ return ret;
+}
+#else /* HAVE_ARCHIVE_H */
+gboolean
+pk_service_pack_extract (const gchar *filename, const gchar *directory, GError **error)
+{
+ *error = g_error_new (PK_SERVICE_PACK_ERROR, PK_SERVICE_PACK_ERROR_FAILED_EXTRACTION,
+ "Cannot check PackageKit as not built with libarchive support");
+ return FALSE;
+}
+#endif /* HAVE_ARCHIVE_H */
+
+/**
+ * pk_service_pack_get_random:
+ **/
+static gchar *
+pk_service_pack_get_random (const gchar *prefix, guint length)
+{
+ guint32 n;
+ gchar *str;
+ guint i;
+ guint prefix_len;
+
+ /* make a string to hold both parts */
+ prefix_len = egg_strlen (prefix, 28);
+ str = g_strnfill (length + prefix_len, 'X');
+
+ /* copy over prefix */
+ for (i=0; i<prefix_len; i++)
+ str[i] = prefix[i];
+
+ /* use random string */
+ for (i=prefix_len; i<length+prefix_len; i++) {
+ n = g_random_int_range (97, 122);
+ str[i] = (gchar) n;
+ }
+ return str;
+}
+
+/**
+ * pk_service_pack_create_temporary_directory:
+ **/
+static gchar *
+pk_service_pack_create_temporary_directory (const gchar *prefix)
+{
+ gboolean ret;
+ gchar *random;
+ gchar *directory = NULL;
+
+ /* ensure path does not already exist */
+ do {
+ /* last iter results, or NULL */
+ g_free (directory);
+
+ /* get a random path */
+ random = pk_service_pack_get_random (prefix, 8);
+
+ /* ITS4: ignore, the user has no control over the daemon envp */
+ directory = g_build_filename (g_get_tmp_dir (), random, NULL);
+ g_free (random);
+ ret = g_file_test (directory, G_FILE_TEST_IS_DIR);
+ } while (ret);
+
+ /* create so only user (root) has rwx access */
+ g_mkdir (directory, 0700);
+
+ return directory;
+}
+
+/**
+ * pk_service_pack_check_valid:
+ * @pack: a valid #PkServicePack instance
+ * @error: a %GError to put the error code and message in, or %NULL
+ *
+ * Checks to see if a service pack file is valid, and usable with this system.
+ *
+ * Return value: %TRUE if the service pack is valid
+ **/
+gboolean
+pk_service_pack_check_valid (PkServicePack *pack, GError **error)
+{
+ gboolean ret = TRUE;
+ gchar *directory = NULL;
+ gchar *metafile = NULL;
+ GDir *dir = NULL;
+ const gchar *filename_entry;
+ GError *error_local = NULL;
+
+ g_return_val_if_fail (PK_IS_SERVICE_PACK (pack), FALSE);
+ g_return_val_if_fail (pack->priv->filename != NULL, FALSE);
+
+ /* create a random directory */
+ directory = pk_service_pack_create_temporary_directory ("PackageKit-");
+ ret = pk_service_pack_extract (pack->priv->filename, directory, &error_local);
+ if (!ret) {
+ *error = g_error_new (PK_SERVICE_PACK_ERROR, error_local->code,
+ "failed to check %s: %s", pack->priv->filename, error_local->message);
+ g_error_free (error_local);
+ goto out;
+ }
+
+ /* get the files */
+ dir = g_dir_open (directory, 0, NULL);
+ if (dir == NULL) {
+ *error = g_error_new (PK_SERVICE_PACK_ERROR, PK_SERVICE_PACK_ERROR_FAILED_SETUP,
+ "failed to get directory for %s", directory);
+ ret = FALSE;
+ goto out;
+ }
+
+ /* find the file, and check the metadata */
+ while ((filename_entry = g_dir_read_name (dir))) {
+ metafile = g_build_filename (directory, filename_entry, NULL);
+ if (egg_strequal (filename_entry, "metadata.conf")) {
+ ret = pk_service_pack_check_metadata_file (metafile);
+ if (!ret) {
+ *error = g_error_new (PK_SERVICE_PACK_ERROR, PK_SERVICE_PACK_ERROR_NOT_COMPATIBLE,
+ "Service Pack %s not compatible with your distro", pack->priv->filename);
+ ret = FALSE;
+ goto out;
+ }
+ }
+ g_free (metafile);
+ }
+out:
+ g_rmdir (directory);
+ g_free (directory);
+ if (dir != NULL)
+ g_dir_close (dir);
+ return ret;
+}
+
+/**
+ * pk_service_pack_set_filename:
+ * @pack: a valid #PkServicePack instance
+ * @filename: the filename to use
+ *
+ * Sets the filename to use when reading or writing a service pack
+ *
+ * Return value: %TRUE if the name was set
+ **/
+gboolean
+pk_service_pack_set_filename (PkServicePack *pack, const gchar *filename)
+{
+ g_return_val_if_fail (PK_IS_SERVICE_PACK (pack), FALSE);
+ g_return_val_if_fail (filename != NULL, FALSE);
+ g_free (pack->priv->filename);
+ pack->priv->filename = g_strdup (filename);
+ return TRUE;
+}
+
+/**
+ * pk_service_pack_set_temp_directory:
+ * @pack: a valid #PkServicePack instance
+ * @directory: the directory to use, or %NULL to use the default
+ *
+ * Sets the directory to use when decompressing the service pack
+ *
+ * Return value: %TRUE if the directory was set
+ **/
+gboolean
+pk_service_pack_set_temp_directory (PkServicePack *pack, const gchar *directory)
+{
+ g_return_val_if_fail (PK_IS_SERVICE_PACK (pack), FALSE);
+ g_free (pack->priv->directory);
+
+ /* use default */
+ if (directory == NULL)
+ directory = pk_service_pack_create_temporary_directory ("PackageKit-");
+
+ pack->priv->directory = g_strdup (directory);
+ return TRUE;
+}
+
+/**
+ * pk_service_pack_set_exclude_list:
+ * @pack: a valid #PkServicePack instance
+ * @list: the list of packages to exclude
+ *
+ * Sets the list of packages to exclude from the dependency downloads.
+ *
+ * Return value: %TRUE if the list was set
+ **/
+gboolean
+pk_service_pack_set_exclude_list (PkServicePack *pack, PkPackageList *list)
+{
+ g_return_val_if_fail (PK_IS_SERVICE_PACK (pack), FALSE);
+ g_return_val_if_fail (list != NULL, FALSE);
+ if (pack->priv->exclude_list != NULL)
+ g_object_unref (pack->priv->exclude_list);
+ pack->priv->exclude_list = g_object_ref (list);
+ return TRUE;
+}
+
+/**
+ * pk_service_pack_download_package_ids:
+ **/
+static gboolean
+pk_service_pack_download_package_ids (PkServicePack *pack, gchar **package_ids)
+{
+ gboolean ret;
+ GError *error = NULL;
+
+ g_return_val_if_fail (PK_IS_SERVICE_PACK (pack), FALSE);
+ g_return_val_if_fail (package_ids != NULL, FALSE);
+ g_return_val_if_fail (pack->priv->directory != NULL, FALSE);
+
+ egg_debug ("download+ %s", package_ids[0]);
+ ret = pk_client_reset (pack->priv->client, &error);
+ if (!ret) {
+ egg_warning ("failed to download: %s", error->message);
+ g_error_free (error);
+ goto out;
+ }
+ ret = pk_client_download_packages (pack->priv->client, package_ids, pack->priv->directory, &error);
+ if (!ret) {
+ egg_warning ("failed to download: %s", error->message);
+ g_error_free (error);
+ goto out;
+ }
+out:
+ return ret;
+}
+
+/**
+ * pk_service_pack_exclude_packages:
+ **/
+static gboolean
+pk_service_pack_exclude_packages (PkServicePack *pack, PkPackageList *list)
+{
+ guint i;
+ guint length;
+ gboolean found;
+ const PkPackageObj *obj;
+
+ g_return_val_if_fail (PK_IS_SERVICE_PACK (pack), FALSE);
+ g_return_val_if_fail (pack->priv->exclude_list != NULL, FALSE);
+
+ /* do not just download everything, uselessly */
+ length = pk_package_list_get_size (pack->priv->exclude_list);
+ for (i=0; i<length; i++) {
+ obj = pk_package_list_get_obj (pack->priv->exclude_list, i);
+ /* will just ignore if the obj is not there */
+ found = pk_package_list_remove_obj (list, obj);
+ if (found)
+ egg_debug ("removed %s", obj->id->name);
+ }
+ return TRUE;
+}
+
+/**
+ * pk_service_pack_create_metadata_file:
+ **/
+static gboolean
+pk_service_pack_create_metadata_file (const gchar *filename)
+{
+ gboolean ret = FALSE;
+ gchar *distro_id = NULL;
+ gchar *iso_time = NULL;
+ GError *error = NULL;
+ GKeyFile *file = NULL;
+ gchar *data = NULL;
+
+ g_return_val_if_fail (filename != NULL, FALSE);
+
+ file = g_key_file_new ();
+
+ /* get needed data */
+ distro_id = pk_get_distro_id ();
+ if (distro_id == NULL)
+ goto out;
+ iso_time = pk_iso8601_present ();
+ if (iso_time == NULL)
+ goto out;
+
+ g_key_file_set_string (file, PK_SERVICE_PACK_GROUP_NAME, "distro_id", distro_id);
+ g_key_file_set_string (file, PK_SERVICE_PACK_GROUP_NAME, "created", iso_time);
+
+ /* convert to text */
+ data = g_key_file_to_data (file, NULL, &error);
+ if (data == NULL) {
+ egg_warning ("failed to convert to text: %s", error->message);
+ g_error_free (error);
+ goto out;
+ }
+
+ /* save contents */
+ ret = g_file_set_contents (filename, data, -1, &error);
+ if (!ret) {
+ egg_warning ("failed to save file: %s", error->message);
+ g_error_free (error);
+ goto out;
+ }
+
+out:
+ g_key_file_free (file);
+ g_free (data);
+ g_free (distro_id);
+ g_free (iso_time);
+ return ret;
+}
+
+#ifdef HAVE_ARCHIVE_H
+/**
+ * pk_service_pack_archive_add_file:
+ **/
+static gboolean
+pk_service_pack_archive_add_file (struct archive *arch, const gchar *filename, GError **error)
+{
+ int retval;
+ int len;
+ int fd = -1;
+ int wrote;
+ gboolean ret = FALSE;
+ gchar *filename_basename = NULL;
+ struct archive_entry *entry = NULL;
+ struct stat st;
+ gchar buff[8192];
+
+ /* stat file */
+ retval = stat (filename, &st);
+ if (retval != 0) {
+ *error = g_error_new (PK_SERVICE_PACK_ERROR, PK_SERVICE_PACK_ERROR_FAILED_CREATE,
+ "file not found %s", filename);
+ goto out;
+ }
+ egg_debug ("stat(%s), size=%lu bytes\n", filename, st.st_size);
+
+ /* create new entry */
+ entry = archive_entry_new ();
+ archive_entry_copy_stat (entry, &st);
+ filename_basename = g_path_get_basename (filename);
+ archive_entry_set_pathname (entry, filename_basename);
+
+ /* ._BIG FAT BUG_. We should not have to do this, as it should be
+ * set from archive_entry_copy_stat() */
+ archive_entry_set_size (entry, st.st_size);
+
+ /* write header */
+ retval = archive_write_header (arch, entry);
+ if (retval != ARCHIVE_OK) {
+ *error = g_error_new (PK_SERVICE_PACK_ERROR, PK_SERVICE_PACK_ERROR_FAILED_CREATE,
+ "failed to write header: %s\n", archive_error_string (arch));
+ goto out;
+ }
+
+ /* open file to copy */
+ fd = open (filename, O_RDONLY);
+ if (fd < 0) {
+ *error = g_error_new (PK_SERVICE_PACK_ERROR, PK_SERVICE_PACK_ERROR_FAILED_CREATE,
+ "failed to get fd for %s", filename);
+ goto out;
+ }
+
+ /* ITS4: ignore, buffer statically preallocated */
+ len = read (fd, buff, sizeof (buff));
+ /* write data to archive -- how come no convenience function? */
+ while (len > 0) {
+ wrote = archive_write_data (arch, buff, len);
+ if (wrote != len)
+ egg_warning("wrote %i instead of %i\n", wrote, len);
+ /* ITS4: ignore, buffer statically preallocated */
+ len = read (fd, buff, sizeof (buff));
+ }
+ ret = TRUE;
+out:
+ if (fd >= 0)
+ close (fd);
+ if (entry != NULL)
+ archive_entry_free (entry);
+ g_free (filename_basename);
+ return ret;
+}
+
+/**
+ * pk_service_pack_create_from_files:
+ **/
+static gboolean
+pk_service_pack_create_from_files (PkServicePack *pack, GPtrArray *file_array, GError **error)
+{
+ struct archive *arch = NULL;
+ gboolean ret = FALSE;
+ const gchar *src;
+ guint i;
+ gchar *filename;
+
+ g_return_val_if_fail (PK_IS_SERVICE_PACK (pack), FALSE);
+ g_return_val_if_fail (file_array != NULL, FALSE);
+ g_return_val_if_fail (error != NULL, FALSE);
+
+ /* create a file with metadata in it */
+ filename = g_build_filename (g_get_tmp_dir (), "metadata.conf", NULL);
+ ret = pk_service_pack_create_metadata_file (filename);
+ if (!ret) {
+ *error = g_error_new (PK_SERVICE_PACK_ERROR, PK_SERVICE_PACK_ERROR_FAILED_CREATE,
+ "failed to generate metadata file %s", filename);
+ goto out;
+ }
+ g_ptr_array_add (file_array, g_strdup (filename));
+
+ /* we can only write tar achives */
+ arch = archive_write_new ();
+ archive_write_set_compression_none (arch);
+ archive_write_set_format_ustar (arch);
+ archive_write_open_filename (arch, pack->priv->filename);
+
+ /* for each filename */
+ for (i=0; i<file_array->len; i++) {
+ src = (const gchar *) g_ptr_array_index (file_array, i);
+ /* try to add to archive */
+ ret = pk_service_pack_archive_add_file (arch, src, error);
+ if (!ret)
+ goto out;
+ }
+
+ /* completed all okay */
+ ret = TRUE;
+out:
+ g_free (filename);
+ /* delete each filename */
+ for (i=0; i<file_array->len; i++) {
+ src = (const gchar *) g_ptr_array_index (file_array, i);
+ g_remove (src);
+ }
+
+ /* close the archive */
+ if (arch != NULL) {
+ archive_write_close (arch);
+ archive_write_finish (arch);
+ }
+ return ret;
+}
+#else
+/**
+ * pk_service_pack_create_from_files:
+ **/
+static gboolean
+pk_service_pack_create_from_files (PkServicePack *pack, GPtrArray *file_array, GError **error)
+{
+ g_return_val_if_fail (PK_IS_SERVICE_PACK (pack), FALSE);
+ *error = g_error_new (PK_SERVICE_PACK_ERROR, PK_SERVICE_PACK_ERROR_FAILED_CREATE,
+ "Cannot create pack as PackageKit as not built with libarchive support");
+ return FALSE;
+}
+#endif
+
+/**
+ * pk_service_pack_scan_files_in_directory:
+ **/
+static GPtrArray *
+pk_service_pack_scan_files_in_directory (PkServicePack *pack)
+{
+ gchar *src;
+ GPtrArray *file_array = NULL;
+ GDir *dir;
+ const gchar *filename;
+
+ g_return_val_if_fail (PK_IS_SERVICE_PACK (pack), FALSE);
+ g_return_val_if_fail (pack->priv->directory != NULL, FALSE);
+
+ /* try and open the directory */
+ dir = g_dir_open (pack->priv->directory, 0, NULL);
+ if (dir == NULL) {
+ egg_warning ("failed to get directory for %s", pack->priv->directory);
+ goto out;
+ }
+
+ /* add each file to an array */
+ file_array = g_ptr_array_new ();
+ while ((filename = g_dir_read_name (dir))) {
+ src = g_build_filename (pack->priv->directory, filename, NULL);
+ g_ptr_array_add (file_array, src);
+ }
+ g_dir_close (dir);
+out:
+ return file_array;
+}
+
+/**
+ * pk_service_pack_package_cb:
+ **/
+static void
+pk_service_pack_package_cb (PkClient *client, const PkPackageObj *obj, PkServicePack *pack)
+{
+ g_return_if_fail (PK_IS_SERVICE_PACK (pack));
+ g_return_if_fail (obj != NULL);
+
+ /* only shown downloading */
+ if (obj->info != PK_INFO_ENUM_DOWNLOADING)
+ return;
+
+ egg_debug ("emit package %s", obj->id->name);
+ g_signal_emit (pack, signals [PK_SERVICE_PACK_PACKAGE], 0, obj);
+}
+
+/**
+ * pk_service_pack_setup_client:
+ **/
+static gboolean
+pk_service_pack_setup_client (PkServicePack *pack)
+{
+ if (pack->priv->client != NULL)
+ return FALSE;
+ pack->priv->client = pk_client_new ();
+ g_signal_connect (pack->priv->client, "package",
+ G_CALLBACK (pk_service_pack_package_cb), pack);
+ pk_client_set_use_buffer (pack->priv->client, TRUE, NULL);
+ pk_client_set_synchronous (pack->priv->client, TRUE, NULL);
+ return TRUE;
+}
+
+/**
+ * pk_service_pack_create_for_package_ids:
+ * @pack: a valid #PkServicePack instance
+ * @package_ids: A list of package_ids to download
+ * @error: a %GError to put the error code and message in, or %NULL
+ *
+ * Adds the packages specified to a service pack.
+ *
+ * Return value: %TRUE if the service pack was created successfully
+ **/
+gboolean
+pk_service_pack_create_for_package_ids (PkServicePack *pack, gchar **package_ids, GError **error)
+{
+ gchar **package_ids_deps = NULL;
+ PkPackageList *list = NULL;
+ guint length;
+ guint i;
+ const PkPackageObj *obj;
+ GPtrArray *file_array = NULL;
+ GError *error_local = NULL;
+ gboolean ret = FALSE;
+ gchar *text;
+
+ g_return_val_if_fail (PK_IS_SERVICE_PACK (pack), FALSE);
+ g_return_val_if_fail (package_ids != NULL, FALSE);
+ g_return_val_if_fail (pack->priv->filename != NULL, FALSE);
+ g_return_val_if_fail (pack->priv->directory != NULL, FALSE);
+
+ /* don't setup by default to not block the server */
+ pk_service_pack_setup_client (pack);
+
+ /* download this package */
+ ret = pk_service_pack_download_package_ids (pack, package_ids);
+ if (!ret) {
+ *error = g_error_new (PK_SERVICE_PACK_ERROR, error_local->code,
+ "failed to download main package: %s", error_local->message);
+ g_error_free (error_local);
+ goto out;
+ }
+
+ /* get depends */
+ ret = pk_client_reset (pack->priv->client, &error_local);
+ if (!ret) {
+ *error = g_error_new (PK_SERVICE_PACK_ERROR, PK_SERVICE_PACK_ERROR_FAILED_SETUP,
+ "failed to reset: %s", error_local->message);
+ g_error_free (error_local);
+ goto out;
+ }
+
+ egg_debug ("Getting depends for %s", package_ids[0]);
+ ret = pk_client_get_depends (pack->priv->client, PK_FILTER_ENUM_NONE, package_ids, TRUE, &error_local);
+ if (!ret) {
+ *error = g_error_new (PK_SERVICE_PACK_ERROR, PK_SERVICE_PACK_ERROR_FAILED_SETUP,
+ "failed to get depends: %s", error_local->message);
+ g_error_free (error_local);
+ goto out;
+ }
+
+ /* get the deps */
+ list = pk_client_get_package_list (pack->priv->client);
+
+ /* remove some deps */
+ pk_package_list_set_fuzzy_arch (list, TRUE);
+ pk_service_pack_exclude_packages (pack, list);
+
+ /* list deps */
+ length = pk_package_list_get_size (list);
+ for (i=0; i<length; i++) {
+ obj = pk_package_list_get_obj (list, i);
+ text = pk_package_obj_to_string (obj);
+ g_print ("downloading %s\n", text);
+ g_free (text);
+ }
+
+ /* confirm we want the deps */
+ if (length != 0) {
+ /* download additional package_ids */
+ package_ids_deps = pk_package_list_to_strv (list);
+ ret = pk_service_pack_download_package_ids (pack, package_ids_deps);
+ g_strfreev (package_ids_deps);
+
+ /* failed to get deps */
+ if (!ret) {
+ *error = g_error_new (PK_SERVICE_PACK_ERROR, PK_SERVICE_PACK_ERROR_FAILED_DOWNLOAD,
+ "failed to download deps of package: %s", package_ids[0]);
+ goto out;
+ }
+ }
+
+ /* find packages that were downloaded */
+ file_array = pk_service_pack_scan_files_in_directory (pack);
+ if (file_array == NULL) {
+ *error = g_error_new (PK_SERVICE_PACK_ERROR, PK_SERVICE_PACK_ERROR_FAILED_SETUP,
+ "failed to scan directory: %s", pack->priv->directory);
+ goto out;
+ }
+
+ /* generate pack file */
+ ret = pk_service_pack_create_from_files (pack, file_array, &error_local);
+ if (!ret) {
+ *error = g_error_new (PK_SERVICE_PACK_ERROR, error_local->code,
+ "failed to create archive: %s", error_local->message);
+ g_error_free (error_local);
+ goto out;
+ }
+
+out:
+ if (list != NULL)
+ g_object_unref (list);
+ if (file_array != NULL) {
+ g_ptr_array_foreach (file_array, (GFunc) g_free, NULL);
+ g_ptr_array_free (file_array, TRUE);
+ }
+ return ret;
+}
+
+/**
+ * pk_service_pack_create_for_package_id:
+ * @pack: a valid #PkServicePack instance
+ * @package_id: A single package_id to download
+ * @error: a %GError to put the error code and message in, or %NULL
+ *
+ * Adds the package specified to a service pack.
+ *
+ * Return value: %TRUE if the service pack was created successfully
+ **/
+gboolean
+pk_service_pack_create_for_package_id (PkServicePack *pack, const gchar *package_id, GError **error)
+{
+ gchar **package_ids;
+ gboolean ret;
+
+ g_return_val_if_fail (PK_IS_SERVICE_PACK (pack), FALSE);
+ g_return_val_if_fail (package_id != NULL, FALSE);
+ g_return_val_if_fail (pack->priv->filename != NULL, FALSE);
+ g_return_val_if_fail (pack->priv->directory != NULL, FALSE);
+
+ package_ids = pk_package_ids_from_id (package_id);
+ ret = pk_service_pack_create_for_package_ids (pack, package_ids, error);
+ g_strfreev (package_ids);
+ return ret;
+}
+
+/**
+ * pk_service_pack_create_for_updates:
+ * @pack: a valid #PkServicePack instance
+ * @error: a %GError to put the error code and message in, or %NULL
+ *
+ * Adds any pending updates to a service pack.
+ *
+ * Return value: %TRUE if the service pack was created successfully
+ **/
+gboolean
+pk_service_pack_create_for_updates (PkServicePack *pack, GError **error)
+{
+ gchar **package_ids = NULL;
+ GError *error_local = NULL;
+ gboolean ret = FALSE;
+ PkPackageList *list;
+ guint len;
+
+ g_return_val_if_fail (PK_IS_SERVICE_PACK (pack), FALSE);
+ g_return_val_if_fail (pack->priv->filename != NULL, FALSE);
+ g_return_val_if_fail (pack->priv->directory != NULL, FALSE);
+
+ /* don't setup by default to not block the server */
+ pk_service_pack_setup_client (pack);
+
+ /* get updates */
+ ret = pk_client_reset (pack->priv->client, &error_local);
+ if (!ret) {
+ *error = g_error_new (PK_SERVICE_PACK_ERROR, PK_SERVICE_PACK_ERROR_FAILED_SETUP,
+ "failed to reset: %s", error_local->message);
+ g_error_free (error_local);
+ goto out;
+ }
+
+ egg_debug ("Getting updates");
+ ret = pk_client_get_updates (pack->priv->client, PK_FILTER_ENUM_NONE, &error_local);
+ if (!ret) {
+ *error = g_error_new (PK_SERVICE_PACK_ERROR, PK_SERVICE_PACK_ERROR_FAILED_SETUP,
+ "failed to get updates: %s", error_local->message);
+ g_error_free (error_local);
+ goto out;
+ }
+
+ /* get the updates, and download them with deps */
+ list = pk_client_get_package_list (pack->priv->client);
+ len = pk_package_list_get_size (list);
+
+ /* no updates */
+ if (len == 0) {
+ *error = g_error_new (PK_SERVICE_PACK_ERROR, PK_SERVICE_PACK_ERROR_NOTHING_TO_DO,
+ "there are no updates to download");
+ ret = FALSE;
+ goto out;
+ }
+
+ package_ids = pk_package_list_to_strv (list);
+ g_object_unref (list);
+ ret = pk_service_pack_create_for_package_ids (pack, package_ids, error);
+out:
+ g_strfreev (package_ids);
+ return ret;
+}
+
+/**
+ * pk_service_pack_finalize:
+ **/
+static void
+pk_service_pack_finalize (GObject *object)
+{
+ PkServicePack *pack;
+
+ g_return_if_fail (object != NULL);
+ g_return_if_fail (PK_IS_SERVICE_PACK (object));
+ pack = PK_SERVICE_PACK (object);
+
+ if (pack->priv->exclude_list != NULL)
+ g_object_unref (pack->priv->exclude_list);
+ if (pack->priv->client != NULL)
+ g_object_unref (pack->priv->client);
+ g_free (pack->priv->directory);
+ g_free (pack->priv->filename);
+
+ G_OBJECT_CLASS (pk_service_pack_parent_class)->finalize (object);
+}
+
+/**
+ * pk_service_pack_class_init:
+ **/
+static void
+pk_service_pack_class_init (PkServicePackClass *klass)
+{
+ GObjectClass *object_class = G_OBJECT_CLASS (klass);
+ object_class->finalize = pk_service_pack_finalize;
+
+ /**
+ * PkServicePack::package:
+ * @pack: the #PkServicePack instance that emitted the signal
+ * @obj: the #PkPackageObj that has just been downloaded
+ *
+ * The ::package signal is emitted when a file is being downloaded.
+ **/
+ signals [PK_SERVICE_PACK_PACKAGE] =
+ g_signal_new ("package",
+ G_TYPE_FROM_CLASS (object_class), G_SIGNAL_RUN_LAST,
+ G_STRUCT_OFFSET (PkServicePackClass, package),
+ NULL, NULL, g_cclosure_marshal_VOID__POINTER,
+ G_TYPE_NONE, 1, G_TYPE_POINTER);
+
+ g_type_class_add_private (klass, sizeof (PkServicePackPrivate));
+}
+
+/**
+ * pk_service_pack_init:
+ **/
+static void
+pk_service_pack_init (PkServicePack *pack)
+{
+ pack->priv = PK_SERVICE_PACK_GET_PRIVATE (pack);
+ pack->priv->exclude_list = NULL;
+ pack->priv->filename = NULL;
+ pack->priv->directory = NULL;
+}
+
+/**
+ * pk_service_pack_new:
+ * Return value: A new service_pack class instance.
+ **/
+PkServicePack *
+pk_service_pack_new (void)
+{
+ PkServicePack *pack;
+ pack = g_object_new (PK_TYPE_SERVICE_PACK, NULL);
+ return PK_SERVICE_PACK (pack);
+}
+
+/***************************************************************************
+ *** MAKE CHECK TESTS ***
+ ***************************************************************************/
+#ifdef EGG_TEST
+#include "egg-test.h"
+
+void
+pk_service_pack_test (EggTest *test)
+{
+ PkServicePack *pack;
+
+ if (!egg_test_start (test, "PkServicePack"))
+ return;
+
+ /************************************************************/
+ egg_test_title (test, "get an instance");
+ pack = pk_service_pack_new ();
+ egg_test_assert (test, pack != NULL);
+ g_object_unref (pack);
+
+ egg_test_end (test);
+}
+#endif
+
diff --git a/libpackagekit/pk-service-pack.h b/libpackagekit/pk-service-pack.h
new file mode 100644
index 0000000..947be52
--- /dev/null
+++ b/libpackagekit/pk-service-pack.h
@@ -0,0 +1,99 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*-
+ *
+ * Copyright (C) 2008 Richard Hughes <richard at hughsie.com>
+ *
+ * Licensed under the GNU General Public License Version 2
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+#ifndef __PK_SERVICE_PACK_H
+#define __PK_SERVICE_PACK_H
+
+#include <glib-object.h>
+#include <pk-package-list.h>
+
+G_BEGIN_DECLS
+
+#define PK_TYPE_SERVICE_PACK (pk_service_pack_get_type ())
+#define PK_SERVICE_PACK(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), PK_TYPE_SERVICE_PACK, PkServicePack))
+#define PK_SERVICE_PACK_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), PK_TYPE_SERVICE_PACK, PkServicePackClass))
+#define PK_IS_SERVICE_PACK(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), PK_TYPE_SERVICE_PACK))
+#define PK_IS_SERVICE_PACK_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), PK_TYPE_SERVICE_PACK))
+#define PK_SERVICE_PACK_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), PK_TYPE_SERVICE_PACK, PkServicePackClass))
+#define PK_SERVICE_PACK_ERROR (pk_service_pack_error_quark ())
+#define PK_SERVICE_PACK_TYPE_ERROR (pk_service_pack_error_get_type ())
+
+typedef struct PkServicePackPrivate PkServicePackPrivate;
+
+typedef enum
+{
+ PK_SERVICE_PACK_ERROR_FAILED_SETUP,
+ PK_SERVICE_PACK_ERROR_FAILED_DOWNLOAD,
+ PK_SERVICE_PACK_ERROR_FAILED_EXTRACTION,
+ PK_SERVICE_PACK_ERROR_FAILED_CREATE,
+ PK_SERVICE_PACK_ERROR_NOTHING_TO_DO,
+ PK_SERVICE_PACK_ERROR_NOT_COMPATIBLE
+} PkServicePackError;
+
+typedef struct
+{
+ GObject parent;
+ PkServicePackPrivate *priv;
+} PkServicePack;
+
+typedef struct
+{
+ GObjectClass parent_class;
+ void (* package) (PkServicePack *pack,
+ const PkPackageObj *obj);
+ /* Padding for future expansion */
+ void (*_pk_reserved1) (void);
+ void (*_pk_reserved2) (void);
+ void (*_pk_reserved3) (void);
+ void (*_pk_reserved4) (void);
+ void (*_pk_reserved5) (void);
+} PkServicePackClass;
+
+GQuark pk_service_pack_error_quark (void);
+GType pk_service_pack_error_get_type (void);
+GType pk_service_pack_get_type (void) G_GNUC_CONST;
+PkServicePack *pk_service_pack_new (void);
+
+/* used by the server */
+gboolean pk_service_pack_check_valid (PkServicePack *pack,
+ GError **error);
+
+/* used by clients */
+gboolean pk_service_pack_set_filename (PkServicePack *pack,
+ const gchar *filename);
+gboolean pk_service_pack_set_temp_directory (PkServicePack *pack,
+ const gchar *directory);
+gboolean pk_service_pack_set_exclude_list (PkServicePack *pack,
+ PkPackageList *list);
+
+gboolean pk_service_pack_create_for_package_id (PkServicePack *pack,
+ const gchar *package_id,
+ GError **error);
+gboolean pk_service_pack_create_for_package_ids (PkServicePack *pack,
+ gchar **package_ids,
+ GError **error);
+gboolean pk_service_pack_create_for_updates (PkServicePack *pack,
+ GError **error);
+
+G_END_DECLS
+
+#endif /* __PK_SERVICE_PACK_H */
+
diff --git a/src/Makefile.am b/src/Makefile.am
index 0b04919..bebee18 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -53,8 +53,6 @@ shared_SOURCES = \
egg-dbus-monitor.h \
pk-marshal.c \
pk-marshal.h \
- pk-service-pack.c \
- pk-service-pack.h \
pk-transaction.c \
pk-transaction.h \
pk-backend.c \
diff --git a/src/pk-service-pack.c b/src/pk-service-pack.c
deleted file mode 100644
index f4d2267..0000000
--- a/src/pk-service-pack.c
+++ /dev/null
@@ -1,1039 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*-
- *
- * Copyright (C) 2008 Richard Hughes <richard at hughsie.com>
- * Copyright (C) 2008 Shishir Goel <crazyontheedge at gmail.com>
- *
- * Licensed under the GNU General Public License Version 2
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- */
-
-#ifdef HAVE_CONFIG_H
-# include <config.h>
-#endif
-
-#include <fcntl.h>
-
-#ifdef HAVE_ARCHIVE_H
-#include <archive.h>
-#include <archive_entry.h>
-#endif /* HAVE_ARCHIVE_H */
-
-#include <glib.h>
-#include <glib/gstdio.h>
-
-#include "egg-debug.h"
-#include "egg-string.h"
-
-#include <pk-common.h>
-#include <pk-client.h>
-#include <pk-package-ids.h>
-
-#include "pk-service-pack.h"
-
-#define PK_SERVICE_PACK_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), PK_TYPE_SERVICE_PACK, PkServicePackPrivate))
-
-struct PkServicePackPrivate
-{
- PkPackageList *exclude_list;
- gchar *filename;
- gchar *directory;
- PkClient *client;
-};
-
-typedef enum {
- PK_SERVICE_PACK_PACKAGE,
- PK_SERVICE_PACK_LAST_SIGNAL
-} PkSignals;
-
-static guint signals [PK_SERVICE_PACK_LAST_SIGNAL] = { 0 };
-G_DEFINE_TYPE (PkServicePack, pk_service_pack, G_TYPE_OBJECT)
-
-/**
- * pk_service_pack_error_quark:
- *
- * Return value: Our personal error quark.
- **/
-GQuark
-pk_service_pack_error_quark (void)
-{
- static GQuark quark = 0;
- if (!quark)
- quark = g_quark_from_static_string ("pk_service_pack_error");
- return quark;
-}
-
-/**
- * pk_service_pack_error_get_type:
- **/
-#define ENUM_ENTRY(NAME, DESC) { NAME, "" #NAME "", DESC }
-GType
-pk_service_pack_error_get_type (void)
-{
- static GType etype = 0;
-
- if (etype == 0) {
- static const GEnumValue values[] =
- {
- ENUM_ENTRY (PK_SERVICE_PACK_ERROR_FAILED_SETUP, "FailedSetup"),
- ENUM_ENTRY (PK_SERVICE_PACK_ERROR_FAILED_DOWNLOAD, "FailedDownload"),
- ENUM_ENTRY (PK_SERVICE_PACK_ERROR_FAILED_EXTRACTION, "FailedExtraction"),
- ENUM_ENTRY (PK_SERVICE_PACK_ERROR_FAILED_CREATE, "FailedCreate"),
- ENUM_ENTRY (PK_SERVICE_PACK_ERROR_NOTHING_TO_DO, "NothingToDo"),
- ENUM_ENTRY (PK_SERVICE_PACK_ERROR_NOT_COMPATIBLE, "NotCompatible"),
- { 0, NULL, NULL }
- };
- etype = g_enum_register_static ("PkServicePackError", values);
- }
- return etype;
-}
-
-/**
- * pk_service_pack_check_metadata_file:
- **/
-static gboolean
-pk_service_pack_check_metadata_file (const gchar *full_path)
-{
- GKeyFile *file;
- gboolean ret;
- GError *error = NULL;
- gchar *distro_id = NULL;
- gchar *distro_id_us = NULL;
-
- /* load the file */
- file = g_key_file_new ();
- ret = g_key_file_load_from_file (file, full_path, G_KEY_FILE_NONE, &error);
- if (!ret) {
- egg_warning ("failed to load file: %s", error->message);
- g_error_free (error);
- goto out;
- }
-
- /* read the value */
- distro_id = g_key_file_get_string (file, PK_SERVICE_PACK_GROUP_NAME, "distro_id", &error);
- if (!ret) {
- egg_warning ("failed to get value: %s", error->message);
- g_error_free (error);
- goto out;
- }
-
- /* get this system id */
- distro_id_us = pk_get_distro_id ();
-
- /* do we match? */
- ret = egg_strequal (distro_id_us, distro_id);
-
-out:
- g_key_file_free (file);
- g_free (distro_id);
- g_free (distro_id_us);
- return ret;
-}
-
-/**
- * pk_service_pack_extract:
- * @directory: the directory to unpack into
- * @error: a valid %GError
- *
- * Decompress a tar file
- *
- * Return value: %TRUE if the file was decompressed
- **/
-#ifdef HAVE_ARCHIVE_H
-static gboolean
-pk_service_pack_extract (const gchar *filename, const gchar *directory, GError **error)
-{
- gboolean ret = FALSE;
- struct archive *arch = NULL;
- struct archive_entry *entry;
- int r;
- int retval;
- gchar *retcwd;
- gchar buf[PATH_MAX];
-
- /* save the PWD as we chdir to extract */
- retcwd = getcwd (buf, PATH_MAX);
- if (retcwd == NULL) {
- *error = g_error_new (PK_SERVICE_PACK_ERROR, PK_SERVICE_PACK_ERROR_FAILED_SETUP,
- "failed to get cwd");
- goto out;
- }
-
- /* we can only read tar achives */
- arch = archive_read_new ();
- archive_read_support_format_tar (arch);
-
- /* open the tar file */
- r = archive_read_open_file (arch, filename, 10240);
- if (r) {
- *error = g_error_new (PK_SERVICE_PACK_ERROR, PK_SERVICE_PACK_ERROR_FAILED_EXTRACTION,
- "cannot open: %s", archive_error_string (arch));
- goto out;
- }
-
- /* switch to our destination directory */
- retval = chdir (directory);
- if (retval != 0) {
- *error = g_error_new (PK_SERVICE_PACK_ERROR, PK_SERVICE_PACK_ERROR_FAILED_SETUP,
- "failed chdir to %s", directory);
- goto out;
- }
-
- /* decompress each file */
- for (;;) {
- r = archive_read_next_header (arch, &entry);
- if (r == ARCHIVE_EOF)
- break;
- if (r != ARCHIVE_OK) {
- *error = g_error_new (PK_SERVICE_PACK_ERROR, PK_SERVICE_PACK_ERROR_FAILED_EXTRACTION,
- "cannot read header: %s", archive_error_string (arch));
- goto out;
- }
- r = archive_read_extract (arch, entry, 0);
- if (r != ARCHIVE_OK) {
- *error = g_error_new (PK_SERVICE_PACK_ERROR, PK_SERVICE_PACK_ERROR_FAILED_EXTRACTION,
- "cannot extract: %s", archive_error_string (arch));
- goto out;
- }
- }
-
- /* completed all okay */
- ret = TRUE;
-out:
- /* close the archive */
- if (arch != NULL) {
- archive_read_close (arch);
- archive_read_finish (arch);
- }
-
- /* switch back to PWD */
- retval = chdir (buf);
- if (retval != 0)
- egg_warning ("cannot chdir back!");
-
- return ret;
-}
-#else /* HAVE_ARCHIVE_H */
-gboolean
-pk_service_pack_extract (const gchar *filename, const gchar *directory, GError **error)
-{
- *error = g_error_new (PK_SERVICE_PACK_ERROR, PK_SERVICE_PACK_ERROR_FAILED_EXTRACTION,
- "Cannot check PackageKit as not built with libarchive support");
- return FALSE;
-}
-#endif /* HAVE_ARCHIVE_H */
-
-/**
- * pk_service_pack_get_random:
- **/
-static gchar *
-pk_service_pack_get_random (const gchar *prefix, guint length)
-{
- guint32 n;
- gchar *str;
- guint i;
- guint prefix_len;
-
- /* make a string to hold both parts */
- prefix_len = egg_strlen (prefix, 28);
- str = g_strnfill (length + prefix_len, 'X');
-
- /* copy over prefix */
- for (i=0; i<prefix_len; i++)
- str[i] = prefix[i];
-
- /* use random string */
- for (i=prefix_len; i<length+prefix_len; i++) {
- n = g_random_int_range (97, 122);
- str[i] = (gchar) n;
- }
- return str;
-}
-
-/**
- * pk_service_pack_create_temporary_directory:
- **/
-static gchar *
-pk_service_pack_create_temporary_directory (const gchar *prefix)
-{
- gboolean ret;
- gchar *random;
- gchar *directory = NULL;
-
- /* ensure path does not already exist */
- do {
- /* last iter results, or NULL */
- g_free (directory);
-
- /* get a random path */
- random = pk_service_pack_get_random (prefix, 8);
-
- /* ITS4: ignore, the user has no control over the daemon envp */
- directory = g_build_filename (g_get_tmp_dir (), random, NULL);
- g_free (random);
- ret = g_file_test (directory, G_FILE_TEST_IS_DIR);
- } while (ret);
-
- /* create so only user (root) has rwx access */
- g_mkdir (directory, 0700);
-
- return directory;
-}
-
-/**
- * pk_service_pack_check_valid:
- * @pack: a valid #PkServicePack instance
- * @error: a %GError to put the error code and message in, or %NULL
- *
- * Checks to see if a service pack file is valid, and usable with this system.
- *
- * Return value: %TRUE if the service pack is valid
- **/
-gboolean
-pk_service_pack_check_valid (PkServicePack *pack, GError **error)
-{
- gboolean ret = TRUE;
- gchar *directory = NULL;
- gchar *metafile = NULL;
- GDir *dir = NULL;
- const gchar *filename_entry;
- GError *error_local = NULL;
-
- g_return_val_if_fail (PK_IS_SERVICE_PACK (pack), FALSE);
- g_return_val_if_fail (pack->priv->filename != NULL, FALSE);
-
- /* create a random directory */
- directory = pk_service_pack_create_temporary_directory ("PackageKit-");
- ret = pk_service_pack_extract (pack->priv->filename, directory, &error_local);
- if (!ret) {
- *error = g_error_new (PK_SERVICE_PACK_ERROR, error_local->code,
- "failed to check %s: %s", pack->priv->filename, error_local->message);
- g_error_free (error_local);
- goto out;
- }
-
- /* get the files */
- dir = g_dir_open (directory, 0, NULL);
- if (dir == NULL) {
- *error = g_error_new (PK_SERVICE_PACK_ERROR, PK_SERVICE_PACK_ERROR_FAILED_SETUP,
- "failed to get directory for %s", directory);
- ret = FALSE;
- goto out;
- }
-
- /* find the file, and check the metadata */
- while ((filename_entry = g_dir_read_name (dir))) {
- metafile = g_build_filename (directory, filename_entry, NULL);
- if (egg_strequal (filename_entry, "metadata.conf")) {
- ret = pk_service_pack_check_metadata_file (metafile);
- if (!ret) {
- *error = g_error_new (PK_SERVICE_PACK_ERROR, PK_SERVICE_PACK_ERROR_NOT_COMPATIBLE,
- "Service Pack %s not compatible with your distro", pack->priv->filename);
- ret = FALSE;
- goto out;
- }
- }
- g_free (metafile);
- }
-out:
- g_rmdir (directory);
- g_free (directory);
- if (dir != NULL)
- g_dir_close (dir);
- return ret;
-}
-
-/**
- * pk_service_pack_set_filename:
- * @pack: a valid #PkServicePack instance
- * @filename: the filename to use
- *
- * Sets the filename to use when reading or writing a service pack
- *
- * Return value: %TRUE if the name was set
- **/
-gboolean
-pk_service_pack_set_filename (PkServicePack *pack, const gchar *filename)
-{
- g_return_val_if_fail (PK_IS_SERVICE_PACK (pack), FALSE);
- g_return_val_if_fail (filename != NULL, FALSE);
- g_free (pack->priv->filename);
- pack->priv->filename = g_strdup (filename);
- return TRUE;
-}
-
-/**
- * pk_service_pack_set_temp_directory:
- * @pack: a valid #PkServicePack instance
- * @directory: the directory to use, or %NULL to use the default
- *
- * Sets the directory to use when decompressing the service pack
- *
- * Return value: %TRUE if the directory was set
- **/
-gboolean
-pk_service_pack_set_temp_directory (PkServicePack *pack, const gchar *directory)
-{
- g_return_val_if_fail (PK_IS_SERVICE_PACK (pack), FALSE);
- g_free (pack->priv->directory);
-
- /* use default */
- if (directory == NULL)
- directory = pk_service_pack_create_temporary_directory ("PackageKit-");
-
- pack->priv->directory = g_strdup (directory);
- return TRUE;
-}
-
-/**
- * pk_service_pack_set_exclude_list:
- * @pack: a valid #PkServicePack instance
- * @list: the list of packages to exclude
- *
- * Sets the list of packages to exclude from the dependency downloads.
- *
- * Return value: %TRUE if the list was set
- **/
-gboolean
-pk_service_pack_set_exclude_list (PkServicePack *pack, PkPackageList *list)
-{
- g_return_val_if_fail (PK_IS_SERVICE_PACK (pack), FALSE);
- g_return_val_if_fail (list != NULL, FALSE);
- if (pack->priv->exclude_list != NULL)
- g_object_unref (pack->priv->exclude_list);
- pack->priv->exclude_list = g_object_ref (list);
- return TRUE;
-}
-
-/**
- * pk_service_pack_download_package_ids:
- **/
-static gboolean
-pk_service_pack_download_package_ids (PkServicePack *pack, gchar **package_ids)
-{
- gboolean ret;
- GError *error = NULL;
-
- g_return_val_if_fail (PK_IS_SERVICE_PACK (pack), FALSE);
- g_return_val_if_fail (package_ids != NULL, FALSE);
- g_return_val_if_fail (pack->priv->directory != NULL, FALSE);
-
- egg_debug ("download+ %s", package_ids[0]);
- ret = pk_client_reset (pack->priv->client, &error);
- if (!ret) {
- egg_warning ("failed to download: %s", error->message);
- g_error_free (error);
- goto out;
- }
- ret = pk_client_download_packages (pack->priv->client, package_ids, pack->priv->directory, &error);
- if (!ret) {
- egg_warning ("failed to download: %s", error->message);
- g_error_free (error);
- goto out;
- }
-out:
- return ret;
-}
-
-/**
- * pk_service_pack_exclude_packages:
- **/
-static gboolean
-pk_service_pack_exclude_packages (PkServicePack *pack, PkPackageList *list)
-{
- guint i;
- guint length;
- gboolean found;
- const PkPackageObj *obj;
-
- g_return_val_if_fail (PK_IS_SERVICE_PACK (pack), FALSE);
- g_return_val_if_fail (pack->priv->exclude_list != NULL, FALSE);
-
- /* do not just download everything, uselessly */
- length = pk_package_list_get_size (pack->priv->exclude_list);
- for (i=0; i<length; i++) {
- obj = pk_package_list_get_obj (pack->priv->exclude_list, i);
- /* will just ignore if the obj is not there */
- found = pk_package_list_remove_obj (list, obj);
- if (found)
- egg_debug ("removed %s", obj->id->name);
- }
- return TRUE;
-}
-
-/**
- * pk_service_pack_create_metadata_file:
- **/
-static gboolean
-pk_service_pack_create_metadata_file (const gchar *filename)
-{
- gboolean ret = FALSE;
- gchar *distro_id = NULL;
- gchar *iso_time = NULL;
- GError *error = NULL;
- GKeyFile *file = NULL;
- gchar *data = NULL;
-
- g_return_val_if_fail (filename != NULL, FALSE);
-
- file = g_key_file_new ();
-
- /* get needed data */
- distro_id = pk_get_distro_id ();
- if (distro_id == NULL)
- goto out;
- iso_time = pk_iso8601_present ();
- if (iso_time == NULL)
- goto out;
-
- g_key_file_set_string (file, PK_SERVICE_PACK_GROUP_NAME, "distro_id", distro_id);
- g_key_file_set_string (file, PK_SERVICE_PACK_GROUP_NAME, "created", iso_time);
-
- /* convert to text */
- data = g_key_file_to_data (file, NULL, &error);
- if (data == NULL) {
- egg_warning ("failed to convert to text: %s", error->message);
- g_error_free (error);
- goto out;
- }
-
- /* save contents */
- ret = g_file_set_contents (filename, data, -1, &error);
- if (!ret) {
- egg_warning ("failed to save file: %s", error->message);
- g_error_free (error);
- goto out;
- }
-
-out:
- g_key_file_free (file);
- g_free (data);
- g_free (distro_id);
- g_free (iso_time);
- return ret;
-}
-
-#ifdef HAVE_ARCHIVE_H
-/**
- * pk_service_pack_archive_add_file:
- **/
-static gboolean
-pk_service_pack_archive_add_file (struct archive *arch, const gchar *filename, GError **error)
-{
- int retval;
- int len;
- int fd = -1;
- int wrote;
- gboolean ret = FALSE;
- gchar *filename_basename = NULL;
- struct archive_entry *entry = NULL;
- struct stat st;
- gchar buff[8192];
-
- /* stat file */
- retval = stat (filename, &st);
- if (retval != 0) {
- *error = g_error_new (PK_SERVICE_PACK_ERROR, PK_SERVICE_PACK_ERROR_FAILED_CREATE,
- "file not found %s", filename);
- goto out;
- }
- egg_debug ("stat(%s), size=%lu bytes\n", filename, st.st_size);
-
- /* create new entry */
- entry = archive_entry_new ();
- archive_entry_copy_stat (entry, &st);
- filename_basename = g_path_get_basename (filename);
- archive_entry_set_pathname (entry, filename_basename);
-
- /* ._BIG FAT BUG_. We should not have to do this, as it should be
- * set from archive_entry_copy_stat() */
- archive_entry_set_size (entry, st.st_size);
-
- /* write header */
- retval = archive_write_header (arch, entry);
- if (retval != ARCHIVE_OK) {
- *error = g_error_new (PK_SERVICE_PACK_ERROR, PK_SERVICE_PACK_ERROR_FAILED_CREATE,
- "failed to write header: %s\n", archive_error_string (arch));
- goto out;
- }
-
- /* open file to copy */
- fd = open (filename, O_RDONLY);
- if (fd < 0) {
- *error = g_error_new (PK_SERVICE_PACK_ERROR, PK_SERVICE_PACK_ERROR_FAILED_CREATE,
- "failed to get fd for %s", filename);
- goto out;
- }
-
- /* ITS4: ignore, buffer statically preallocated */
- len = read (fd, buff, sizeof (buff));
- /* write data to archive -- how come no convenience function? */
- while (len > 0) {
- wrote = archive_write_data (arch, buff, len);
- if (wrote != len)
- egg_warning("wrote %i instead of %i\n", wrote, len);
- /* ITS4: ignore, buffer statically preallocated */
- len = read (fd, buff, sizeof (buff));
- }
- ret = TRUE;
-out:
- if (fd >= 0)
- close (fd);
- if (entry != NULL)
- archive_entry_free (entry);
- g_free (filename_basename);
- return ret;
-}
-
-/**
- * pk_service_pack_create_from_files:
- **/
-static gboolean
-pk_service_pack_create_from_files (PkServicePack *pack, GPtrArray *file_array, GError **error)
-{
- struct archive *arch = NULL;
- gboolean ret = FALSE;
- const gchar *src;
- guint i;
- gchar *filename;
-
- g_return_val_if_fail (PK_IS_SERVICE_PACK (pack), FALSE);
- g_return_val_if_fail (file_array != NULL, FALSE);
- g_return_val_if_fail (error != NULL, FALSE);
-
- /* create a file with metadata in it */
- filename = g_build_filename (g_get_tmp_dir (), "metadata.conf", NULL);
- ret = pk_service_pack_create_metadata_file (filename);
- if (!ret) {
- *error = g_error_new (PK_SERVICE_PACK_ERROR, PK_SERVICE_PACK_ERROR_FAILED_CREATE,
- "failed to generate metadata file %s", filename);
- goto out;
- }
- g_ptr_array_add (file_array, g_strdup (filename));
-
- /* we can only write tar achives */
- arch = archive_write_new ();
- archive_write_set_compression_none (arch);
- archive_write_set_format_ustar (arch);
- archive_write_open_filename (arch, pack->priv->filename);
-
- /* for each filename */
- for (i=0; i<file_array->len; i++) {
- src = (const gchar *) g_ptr_array_index (file_array, i);
- /* try to add to archive */
- ret = pk_service_pack_archive_add_file (arch, src, error);
- if (!ret)
- goto out;
- }
-
- /* completed all okay */
- ret = TRUE;
-out:
- g_free (filename);
- /* delete each filename */
- for (i=0; i<file_array->len; i++) {
- src = (const gchar *) g_ptr_array_index (file_array, i);
- g_remove (src);
- }
-
- /* close the archive */
- if (arch != NULL) {
- archive_write_close (arch);
- archive_write_finish (arch);
- }
- return ret;
-}
-#else
-/**
- * pk_service_pack_create_from_files:
- **/
-static gboolean
-pk_service_pack_create_from_files (PkServicePack *pack, GPtrArray *file_array, GError **error)
-{
- g_return_val_if_fail (PK_IS_SERVICE_PACK (pack), FALSE);
- *error = g_error_new (PK_SERVICE_PACK_ERROR, PK_SERVICE_PACK_ERROR_FAILED_CREATE,
- "Cannot create pack as PackageKit as not built with libarchive support");
- return FALSE;
-}
-#endif
-
-/**
- * pk_service_pack_scan_files_in_directory:
- **/
-static GPtrArray *
-pk_service_pack_scan_files_in_directory (PkServicePack *pack)
-{
- gchar *src;
- GPtrArray *file_array = NULL;
- GDir *dir;
- const gchar *filename;
-
- g_return_val_if_fail (PK_IS_SERVICE_PACK (pack), FALSE);
- g_return_val_if_fail (pack->priv->directory != NULL, FALSE);
-
- /* try and open the directory */
- dir = g_dir_open (pack->priv->directory, 0, NULL);
- if (dir == NULL) {
- egg_warning ("failed to get directory for %s", pack->priv->directory);
- goto out;
- }
-
- /* add each file to an array */
- file_array = g_ptr_array_new ();
- while ((filename = g_dir_read_name (dir))) {
- src = g_build_filename (pack->priv->directory, filename, NULL);
- g_ptr_array_add (file_array, src);
- }
- g_dir_close (dir);
-out:
- return file_array;
-}
-
-/**
- * pk_service_pack_package_cb:
- **/
-static void
-pk_service_pack_package_cb (PkClient *client, const PkPackageObj *obj, PkServicePack *pack)
-{
- g_return_if_fail (PK_IS_SERVICE_PACK (pack));
- g_return_if_fail (obj != NULL);
-
- /* only shown downloading */
- if (obj->info != PK_INFO_ENUM_DOWNLOADING)
- return;
-
- egg_debug ("emit package %s", obj->id->name);
- g_signal_emit (pack, signals [PK_SERVICE_PACK_PACKAGE], 0, obj);
-}
-
-/**
- * pk_service_pack_setup_client:
- **/
-static gboolean
-pk_service_pack_setup_client (PkServicePack *pack)
-{
- if (pack->priv->client != NULL)
- return FALSE;
- pack->priv->client = pk_client_new ();
- g_signal_connect (pack->priv->client, "package",
- G_CALLBACK (pk_service_pack_package_cb), pack);
- pk_client_set_use_buffer (pack->priv->client, TRUE, NULL);
- pk_client_set_synchronous (pack->priv->client, TRUE, NULL);
- return TRUE;
-}
-
-/**
- * pk_service_pack_create_for_package_ids:
- * @pack: a valid #PkServicePack instance
- * @package_ids: A list of package_ids to download
- * @error: a %GError to put the error code and message in, or %NULL
- *
- * Adds the packages specified to a service pack.
- *
- * Return value: %TRUE if the service pack was created successfully
- **/
-gboolean
-pk_service_pack_create_for_package_ids (PkServicePack *pack, gchar **package_ids, GError **error)
-{
- gchar **package_ids_deps = NULL;
- PkPackageList *list = NULL;
- guint length;
- guint i;
- const PkPackageObj *obj;
- GPtrArray *file_array = NULL;
- GError *error_local = NULL;
- gboolean ret = FALSE;
- gchar *text;
-
- g_return_val_if_fail (PK_IS_SERVICE_PACK (pack), FALSE);
- g_return_val_if_fail (package_ids != NULL, FALSE);
- g_return_val_if_fail (pack->priv->filename != NULL, FALSE);
- g_return_val_if_fail (pack->priv->directory != NULL, FALSE);
-
- /* don't setup by default to not block the server */
- pk_service_pack_setup_client (pack);
-
- /* download this package */
- ret = pk_service_pack_download_package_ids (pack, package_ids);
- if (!ret) {
- *error = g_error_new (PK_SERVICE_PACK_ERROR, error_local->code,
- "failed to download main package: %s", error_local->message);
- g_error_free (error_local);
- goto out;
- }
-
- /* get depends */
- ret = pk_client_reset (pack->priv->client, &error_local);
- if (!ret) {
- *error = g_error_new (PK_SERVICE_PACK_ERROR, PK_SERVICE_PACK_ERROR_FAILED_SETUP,
- "failed to reset: %s", error_local->message);
- g_error_free (error_local);
- goto out;
- }
-
- egg_debug ("Getting depends for %s", package_ids[0]);
- ret = pk_client_get_depends (pack->priv->client, PK_FILTER_ENUM_NONE, package_ids, TRUE, &error_local);
- if (!ret) {
- *error = g_error_new (PK_SERVICE_PACK_ERROR, PK_SERVICE_PACK_ERROR_FAILED_SETUP,
- "failed to get depends: %s", error_local->message);
- g_error_free (error_local);
- goto out;
- }
-
- /* get the deps */
- list = pk_client_get_package_list (pack->priv->client);
-
- /* remove some deps */
- pk_package_list_set_fuzzy_arch (list, TRUE);
- pk_service_pack_exclude_packages (pack, list);
-
- /* list deps */
- length = pk_package_list_get_size (list);
- for (i=0; i<length; i++) {
- obj = pk_package_list_get_obj (list, i);
- text = pk_package_obj_to_string (obj);
- g_print ("downloading %s\n", text);
- g_free (text);
- }
-
- /* confirm we want the deps */
- if (length != 0) {
- /* download additional package_ids */
- package_ids_deps = pk_package_list_to_strv (list);
- ret = pk_service_pack_download_package_ids (pack, package_ids_deps);
- g_strfreev (package_ids_deps);
-
- /* failed to get deps */
- if (!ret) {
- *error = g_error_new (PK_SERVICE_PACK_ERROR, PK_SERVICE_PACK_ERROR_FAILED_DOWNLOAD,
- "failed to download deps of package: %s", package_ids[0]);
- goto out;
- }
- }
-
- /* find packages that were downloaded */
- file_array = pk_service_pack_scan_files_in_directory (pack);
- if (file_array == NULL) {
- *error = g_error_new (PK_SERVICE_PACK_ERROR, PK_SERVICE_PACK_ERROR_FAILED_SETUP,
- "failed to scan directory: %s", pack->priv->directory);
- goto out;
- }
-
- /* generate pack file */
- ret = pk_service_pack_create_from_files (pack, file_array, &error_local);
- if (!ret) {
- *error = g_error_new (PK_SERVICE_PACK_ERROR, error_local->code,
- "failed to create archive: %s", error_local->message);
- g_error_free (error_local);
- goto out;
- }
-
-out:
- if (list != NULL)
- g_object_unref (list);
- if (file_array != NULL) {
- g_ptr_array_foreach (file_array, (GFunc) g_free, NULL);
- g_ptr_array_free (file_array, TRUE);
- }
- return ret;
-}
-
-/**
- * pk_service_pack_create_for_package_id:
- * @pack: a valid #PkServicePack instance
- * @package_id: A single package_id to download
- * @error: a %GError to put the error code and message in, or %NULL
- *
- * Adds the package specified to a service pack.
- *
- * Return value: %TRUE if the service pack was created successfully
- **/
-gboolean
-pk_service_pack_create_for_package_id (PkServicePack *pack, const gchar *package_id, GError **error)
-{
- gchar **package_ids;
- gboolean ret;
-
- g_return_val_if_fail (PK_IS_SERVICE_PACK (pack), FALSE);
- g_return_val_if_fail (package_id != NULL, FALSE);
- g_return_val_if_fail (pack->priv->filename != NULL, FALSE);
- g_return_val_if_fail (pack->priv->directory != NULL, FALSE);
-
- package_ids = pk_package_ids_from_id (package_id);
- ret = pk_service_pack_create_for_package_ids (pack, package_ids, error);
- g_strfreev (package_ids);
- return ret;
-}
-
-/**
- * pk_service_pack_create_for_updates:
- * @pack: a valid #PkServicePack instance
- * @error: a %GError to put the error code and message in, or %NULL
- *
- * Adds any pending updates to a service pack.
- *
- * Return value: %TRUE if the service pack was created successfully
- **/
-gboolean
-pk_service_pack_create_for_updates (PkServicePack *pack, GError **error)
-{
- gchar **package_ids = NULL;
- GError *error_local = NULL;
- gboolean ret = FALSE;
- PkPackageList *list;
- guint len;
-
- g_return_val_if_fail (PK_IS_SERVICE_PACK (pack), FALSE);
- g_return_val_if_fail (pack->priv->filename != NULL, FALSE);
- g_return_val_if_fail (pack->priv->directory != NULL, FALSE);
-
- /* don't setup by default to not block the server */
- pk_service_pack_setup_client (pack);
-
- /* get updates */
- ret = pk_client_reset (pack->priv->client, &error_local);
- if (!ret) {
- *error = g_error_new (PK_SERVICE_PACK_ERROR, PK_SERVICE_PACK_ERROR_FAILED_SETUP,
- "failed to reset: %s", error_local->message);
- g_error_free (error_local);
- goto out;
- }
-
- egg_debug ("Getting updates");
- ret = pk_client_get_updates (pack->priv->client, PK_FILTER_ENUM_NONE, &error_local);
- if (!ret) {
- *error = g_error_new (PK_SERVICE_PACK_ERROR, PK_SERVICE_PACK_ERROR_FAILED_SETUP,
- "failed to get updates: %s", error_local->message);
- g_error_free (error_local);
- goto out;
- }
-
- /* get the updates, and download them with deps */
- list = pk_client_get_package_list (pack->priv->client);
- len = pk_package_list_get_size (list);
-
- /* no updates */
- if (len == 0) {
- *error = g_error_new (PK_SERVICE_PACK_ERROR, PK_SERVICE_PACK_ERROR_NOTHING_TO_DO,
- "there are no updates to download");
- ret = FALSE;
- goto out;
- }
-
- package_ids = pk_package_list_to_strv (list);
- g_object_unref (list);
- ret = pk_service_pack_create_for_package_ids (pack, package_ids, error);
-out:
- g_strfreev (package_ids);
- return ret;
-}
-
-/**
- * pk_service_pack_finalize:
- **/
-static void
-pk_service_pack_finalize (GObject *object)
-{
- PkServicePack *pack;
-
- g_return_if_fail (object != NULL);
- g_return_if_fail (PK_IS_SERVICE_PACK (object));
- pack = PK_SERVICE_PACK (object);
-
- if (pack->priv->exclude_list != NULL)
- g_object_unref (pack->priv->exclude_list);
- if (pack->priv->client != NULL)
- g_object_unref (pack->priv->client);
- g_free (pack->priv->directory);
- g_free (pack->priv->filename);
-
- G_OBJECT_CLASS (pk_service_pack_parent_class)->finalize (object);
-}
-
-/**
- * pk_service_pack_class_init:
- **/
-static void
-pk_service_pack_class_init (PkServicePackClass *klass)
-{
- GObjectClass *object_class = G_OBJECT_CLASS (klass);
- object_class->finalize = pk_service_pack_finalize;
-
- /**
- * PkServicePack::package:
- * @pack: the #PkServicePack instance that emitted the signal
- * @obj: the #PkPackageObj that has just been downloaded
- *
- * The ::package signal is emitted when a file is being downloaded.
- **/
- signals [PK_SERVICE_PACK_PACKAGE] =
- g_signal_new ("package",
- G_TYPE_FROM_CLASS (object_class), G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (PkServicePackClass, package),
- NULL, NULL, g_cclosure_marshal_VOID__POINTER,
- G_TYPE_NONE, 1, G_TYPE_POINTER);
-
- g_type_class_add_private (klass, sizeof (PkServicePackPrivate));
-}
-
-/**
- * pk_service_pack_init:
- **/
-static void
-pk_service_pack_init (PkServicePack *pack)
-{
- pack->priv = PK_SERVICE_PACK_GET_PRIVATE (pack);
- pack->priv->exclude_list = NULL;
- pack->priv->filename = NULL;
- pack->priv->directory = NULL;
-}
-
-/**
- * pk_service_pack_new:
- * Return value: A new service_pack class instance.
- **/
-PkServicePack *
-pk_service_pack_new (void)
-{
- PkServicePack *pack;
- pack = g_object_new (PK_TYPE_SERVICE_PACK, NULL);
- return PK_SERVICE_PACK (pack);
-}
-
-/***************************************************************************
- *** MAKE CHECK TESTS ***
- ***************************************************************************/
-#ifdef EGG_TEST
-#include "egg-test.h"
-
-void
-egg_test_service_pack (EggTest *test)
-{
- PkServicePack *pack;
-
- if (!egg_test_start (test, "PkServicePack"))
- return;
-
- /************************************************************/
- egg_test_title (test, "get an instance");
- pack = pk_service_pack_new ();
- egg_test_assert (test, pack != NULL);
-
- g_object_unref (pack);
-
- egg_test_end (test);
-}
-#endif
-
diff --git a/src/pk-service-pack.h b/src/pk-service-pack.h
deleted file mode 100644
index 947be52..0000000
--- a/src/pk-service-pack.h
+++ /dev/null
@@ -1,99 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*-
- *
- * Copyright (C) 2008 Richard Hughes <richard at hughsie.com>
- *
- * Licensed under the GNU General Public License Version 2
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- */
-
-#ifndef __PK_SERVICE_PACK_H
-#define __PK_SERVICE_PACK_H
-
-#include <glib-object.h>
-#include <pk-package-list.h>
-
-G_BEGIN_DECLS
-
-#define PK_TYPE_SERVICE_PACK (pk_service_pack_get_type ())
-#define PK_SERVICE_PACK(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), PK_TYPE_SERVICE_PACK, PkServicePack))
-#define PK_SERVICE_PACK_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), PK_TYPE_SERVICE_PACK, PkServicePackClass))
-#define PK_IS_SERVICE_PACK(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), PK_TYPE_SERVICE_PACK))
-#define PK_IS_SERVICE_PACK_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), PK_TYPE_SERVICE_PACK))
-#define PK_SERVICE_PACK_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), PK_TYPE_SERVICE_PACK, PkServicePackClass))
-#define PK_SERVICE_PACK_ERROR (pk_service_pack_error_quark ())
-#define PK_SERVICE_PACK_TYPE_ERROR (pk_service_pack_error_get_type ())
-
-typedef struct PkServicePackPrivate PkServicePackPrivate;
-
-typedef enum
-{
- PK_SERVICE_PACK_ERROR_FAILED_SETUP,
- PK_SERVICE_PACK_ERROR_FAILED_DOWNLOAD,
- PK_SERVICE_PACK_ERROR_FAILED_EXTRACTION,
- PK_SERVICE_PACK_ERROR_FAILED_CREATE,
- PK_SERVICE_PACK_ERROR_NOTHING_TO_DO,
- PK_SERVICE_PACK_ERROR_NOT_COMPATIBLE
-} PkServicePackError;
-
-typedef struct
-{
- GObject parent;
- PkServicePackPrivate *priv;
-} PkServicePack;
-
-typedef struct
-{
- GObjectClass parent_class;
- void (* package) (PkServicePack *pack,
- const PkPackageObj *obj);
- /* Padding for future expansion */
- void (*_pk_reserved1) (void);
- void (*_pk_reserved2) (void);
- void (*_pk_reserved3) (void);
- void (*_pk_reserved4) (void);
- void (*_pk_reserved5) (void);
-} PkServicePackClass;
-
-GQuark pk_service_pack_error_quark (void);
-GType pk_service_pack_error_get_type (void);
-GType pk_service_pack_get_type (void) G_GNUC_CONST;
-PkServicePack *pk_service_pack_new (void);
-
-/* used by the server */
-gboolean pk_service_pack_check_valid (PkServicePack *pack,
- GError **error);
-
-/* used by clients */
-gboolean pk_service_pack_set_filename (PkServicePack *pack,
- const gchar *filename);
-gboolean pk_service_pack_set_temp_directory (PkServicePack *pack,
- const gchar *directory);
-gboolean pk_service_pack_set_exclude_list (PkServicePack *pack,
- PkPackageList *list);
-
-gboolean pk_service_pack_create_for_package_id (PkServicePack *pack,
- const gchar *package_id,
- GError **error);
-gboolean pk_service_pack_create_for_package_ids (PkServicePack *pack,
- gchar **package_ids,
- GError **error);
-gboolean pk_service_pack_create_for_updates (PkServicePack *pack,
- GError **error);
-
-G_END_DECLS
-
-#endif /* __PK_SERVICE_PACK_H */
-
commit 8fbfe589f6f821937c5d22eca6a0b331f54412aa
Author: Richard Hughes <richard at hughsie.com>
Date: Thu Oct 9 11:08:02 2008 +0100
trivial: use a known blank temp directory when decompressing the service pack
diff --git a/src/pk-service-pack.c b/src/pk-service-pack.c
index 7bbb1f9..f4d2267 100644
--- a/src/pk-service-pack.c
+++ b/src/pk-service-pack.c
@@ -236,7 +236,70 @@ pk_service_pack_extract (const gchar *filename, const gchar *directory, GError *
#endif /* HAVE_ARCHIVE_H */
/**
+ * pk_service_pack_get_random:
+ **/
+static gchar *
+pk_service_pack_get_random (const gchar *prefix, guint length)
+{
+ guint32 n;
+ gchar *str;
+ guint i;
+ guint prefix_len;
+
+ /* make a string to hold both parts */
+ prefix_len = egg_strlen (prefix, 28);
+ str = g_strnfill (length + prefix_len, 'X');
+
+ /* copy over prefix */
+ for (i=0; i<prefix_len; i++)
+ str[i] = prefix[i];
+
+ /* use random string */
+ for (i=prefix_len; i<length+prefix_len; i++) {
+ n = g_random_int_range (97, 122);
+ str[i] = (gchar) n;
+ }
+ return str;
+}
+
+/**
+ * pk_service_pack_create_temporary_directory:
+ **/
+static gchar *
+pk_service_pack_create_temporary_directory (const gchar *prefix)
+{
+ gboolean ret;
+ gchar *random;
+ gchar *directory = NULL;
+
+ /* ensure path does not already exist */
+ do {
+ /* last iter results, or NULL */
+ g_free (directory);
+
+ /* get a random path */
+ random = pk_service_pack_get_random (prefix, 8);
+
+ /* ITS4: ignore, the user has no control over the daemon envp */
+ directory = g_build_filename (g_get_tmp_dir (), random, NULL);
+ g_free (random);
+ ret = g_file_test (directory, G_FILE_TEST_IS_DIR);
+ } while (ret);
+
+ /* create so only user (root) has rwx access */
+ g_mkdir (directory, 0700);
+
+ return directory;
+}
+
+/**
* pk_service_pack_check_valid:
+ * @pack: a valid #PkServicePack instance
+ * @error: a %GError to put the error code and message in, or %NULL
+ *
+ * Checks to see if a service pack file is valid, and usable with this system.
+ *
+ * Return value: %TRUE if the service pack is valid
**/
gboolean
pk_service_pack_check_valid (PkServicePack *pack, GError **error)
@@ -251,9 +314,8 @@ pk_service_pack_check_valid (PkServicePack *pack, GError **error)
g_return_val_if_fail (PK_IS_SERVICE_PACK (pack), FALSE);
g_return_val_if_fail (pack->priv->filename != NULL, FALSE);
- /* ITS4: ignore, the user has no control over the daemon envp */
- directory = g_build_filename (g_get_tmp_dir (), "meta", NULL);
- g_mkdir (directory, 0700);
+ /* create a random directory */
+ directory = pk_service_pack_create_temporary_directory ("PackageKit-");
ret = pk_service_pack_extract (pack->priv->filename, directory, &error_local);
if (!ret) {
*error = g_error_new (PK_SERVICE_PACK_ERROR, error_local->code,
@@ -295,6 +357,12 @@ out:
/**
* pk_service_pack_set_filename:
+ * @pack: a valid #PkServicePack instance
+ * @filename: the filename to use
+ *
+ * Sets the filename to use when reading or writing a service pack
+ *
+ * Return value: %TRUE if the name was set
**/
gboolean
pk_service_pack_set_filename (PkServicePack *pack, const gchar *filename)
@@ -308,19 +376,35 @@ pk_service_pack_set_filename (PkServicePack *pack, const gchar *filename)
/**
* pk_service_pack_set_temp_directory:
+ * @pack: a valid #PkServicePack instance
+ * @directory: the directory to use, or %NULL to use the default
+ *
+ * Sets the directory to use when decompressing the service pack
+ *
+ * Return value: %TRUE if the directory was set
**/
gboolean
pk_service_pack_set_temp_directory (PkServicePack *pack, const gchar *directory)
{
g_return_val_if_fail (PK_IS_SERVICE_PACK (pack), FALSE);
- g_return_val_if_fail (directory != NULL, FALSE);
g_free (pack->priv->directory);
+
+ /* use default */
+ if (directory == NULL)
+ directory = pk_service_pack_create_temporary_directory ("PackageKit-");
+
pack->priv->directory = g_strdup (directory);
return TRUE;
}
/**
* pk_service_pack_set_exclude_list:
+ * @pack: a valid #PkServicePack instance
+ * @list: the list of packages to exclude
+ *
+ * Sets the list of packages to exclude from the dependency downloads.
+ *
+ * Return value: %TRUE if the list was set
**/
gboolean
pk_service_pack_set_exclude_list (PkServicePack *pack, PkPackageList *list)
@@ -652,6 +736,13 @@ pk_service_pack_setup_client (PkServicePack *pack)
/**
* pk_service_pack_create_for_package_ids:
+ * @pack: a valid #PkServicePack instance
+ * @package_ids: A list of package_ids to download
+ * @error: a %GError to put the error code and message in, or %NULL
+ *
+ * Adds the packages specified to a service pack.
+ *
+ * Return value: %TRUE if the service pack was created successfully
**/
gboolean
pk_service_pack_create_for_package_ids (PkServicePack *pack, gchar **package_ids, GError **error)
@@ -761,6 +852,13 @@ out:
/**
* pk_service_pack_create_for_package_id:
+ * @pack: a valid #PkServicePack instance
+ * @package_id: A single package_id to download
+ * @error: a %GError to put the error code and message in, or %NULL
+ *
+ * Adds the package specified to a service pack.
+ *
+ * Return value: %TRUE if the service pack was created successfully
**/
gboolean
pk_service_pack_create_for_package_id (PkServicePack *pack, const gchar *package_id, GError **error)
@@ -781,6 +879,12 @@ pk_service_pack_create_for_package_id (PkServicePack *pack, const gchar *package
/**
* pk_service_pack_create_for_updates:
+ * @pack: a valid #PkServicePack instance
+ * @error: a %GError to put the error code and message in, or %NULL
+ *
+ * Adds any pending updates to a service pack.
+ *
+ * Return value: %TRUE if the service pack was created successfully
**/
gboolean
pk_service_pack_create_for_updates (PkServicePack *pack, GError **error)
commit f6978752f14a042b3d9b2ed94a1d0eb1f098caa7
Author: Richard Hughes <richard at hughsie.com>
Date: Thu Oct 9 10:26:54 2008 +0100
trivial: upload the man files as pdf's too
diff --git a/docs/html/upload.sh b/docs/html/upload.sh
index 1d70a6c..e08053b 100755
--- a/docs/html/upload.sh
+++ b/docs/html/upload.sh
@@ -18,4 +18,8 @@ scp *.css $USER@$SERVER:/$LOCATION/
scp ../api/html/*.html $USER@$SERVER:/$LOCATION/gtk-doc/
scp ../api/html/*.png $USER@$SERVER:/$LOCATION/gtk-doc/
scp ../api/html/*.css $USER@$SERVER:/$LOCATION/gtk-doc/
+docbook2pdf ../../man/pkcon.xml --output ./man
+docbook2pdf ../../man/pkmon.xml --output ./man
+docbook2pdf ../../man/pkgenpack.xml --output ./man
+scp man/*.pdf $USER@$SERVER:/$LOCATION/files/
commit 2a067286726de6438d0d6891c76570d17031ea3b
Author: Pavol Å imo <palo.simo at gmail.com>
Date: Thu Oct 9 06:32:20 2008 +0000
Updated Slovak translation
Transmitted-via: Transifex (translate.fedoraproject.org)
diff --git a/po/sk.po b/po/sk.po
index cf5aa84..4029d58 100644
--- a/po/sk.po
+++ b/po/sk.po
@@ -5,406 +5,546 @@
# Copyright (C) 2008 Lubomir Kundrak
# This file is distributed under the same license as the PackageKit package.
# Lubomir Kundrak <lkundrak at redhat.com>, 2008.
+# Pavol Å imo <palo.simo at gmail.com>, 2008.
#
msgid ""
msgstr ""
"Project-Id-Version: PackageKit\n"
"Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2008-04-18 16:49+0100\n"
-"PO-Revision-Date: 2008-04-18 20:25+0100\n"
-"Last-Translator: Lubomir Kundrak <lkundrak at redhat.com>\n"
+"POT-Creation-Date: 2008-09-25 00:31+0000\n"
+"PO-Revision-Date: 2008-10-09 08:28+0200\n"
+"Last-Translator: Pavol Å imo <palo.simo at gmail.com>\n"
"Language-Team: Fedora Project <fedora-cs-list at redhat.com>\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=utf-8\n"
-"Content-Transfer-Encoding: 8bit\n"
-"X-Poedit-Language: Slovak\n"
-"X-Poedit-Country: SLOVAKIA\n"
+"Content-Transfer-Encoding: 8bit"
-#: ../policy/org.freedesktop.packagekit.policy.in.h:1
-msgid "Accept EULA"
-msgstr "PrijaÅ¥ licenÄné podmienky"
-
-#: ../policy/org.freedesktop.packagekit.policy.in.h:2
-msgid "Authentication is required to accept a EULA"
-msgstr "Na prijatie licenÄných podmienok je nutná autentifikácia"
-
-#: ../policy/org.freedesktop.packagekit.policy.in.h:3
-msgid "Authentication is required to change software source parameters"
-msgstr "Na úpravu zdrojov softvéru je nutná autentifikácia"
-
-#: ../policy/org.freedesktop.packagekit.policy.in.h:4
-msgid "Authentication is required to install a local file"
-msgstr "Na inštaláciu z lokálneho súboru je nutná autentifikácia"
-
-#: ../policy/org.freedesktop.packagekit.policy.in.h:5
-msgid "Authentication is required to install a package"
-msgstr "Na inÅ¡taláciu balÃÄka je nutná autentifikácia"
-
-#: ../policy/org.freedesktop.packagekit.policy.in.h:6
-msgid "Authentication is required to install a security signature"
-msgstr "Na inÅ¡taláciu bezpeÄnostný podpisu je nutná autentifikácia"
-
-#: ../policy/org.freedesktop.packagekit.policy.in.h:7
-msgid "Authentication is required to refresh the package lists"
-msgstr "Na obnovenie zoznamu balÃÄkov je nutná autentifikácia"
-
-#: ../policy/org.freedesktop.packagekit.policy.in.h:8
-msgid "Authentication is required to remove packages"
-msgstr "Na odstránenie balÃÄkov je nutná autentifikácia"
-
-#: ../policy/org.freedesktop.packagekit.policy.in.h:9
-msgid "Authentication is required to rollback a transaction"
-msgstr "Na navrátenie transakcie je nutná autentifikácia"
-
-#: ../policy/org.freedesktop.packagekit.policy.in.h:10
-msgid "Authentication is required to update all packages"
-msgstr "Na aktualizáciu vÅ¡etkých balÃÄkov je nutná autentifikácia"
-
-#: ../policy/org.freedesktop.packagekit.policy.in.h:11
-msgid "Authentication is required to update packages"
-msgstr "Na aktualizáciu balÃÄkov je nutná autentifikácia"
-
-#: ../policy/org.freedesktop.packagekit.policy.in.h:12
-msgid "Change software source parameters"
-msgstr "Zmeniť parametre zdrojov softvéru"
-
-#: ../policy/org.freedesktop.packagekit.policy.in.h:13
-msgid "Install local file"
-msgstr "Inštalovať z lokálneho súboru"
-
-#: ../policy/org.freedesktop.packagekit.policy.in.h:14
-msgid "Install package"
-msgstr "InÅ¡talovaÅ¥ balÃÄek"
-
-#: ../policy/org.freedesktop.packagekit.policy.in.h:15
-msgid "Install security signature"
-msgstr "InÅ¡talovaÅ¥ bezpeÄnostný podpis"
-
-#: ../policy/org.freedesktop.packagekit.policy.in.h:16
-msgid "Refresh package lists"
-msgstr "ObnoviÅ¥ zoznam balÃÄkov"
-
-#: ../policy/org.freedesktop.packagekit.policy.in.h:17
-msgid "Remove package"
-msgstr "OdstrániÅ¥ balÃÄek"
-
-#: ../policy/org.freedesktop.packagekit.policy.in.h:18
-msgid "Rollback to a previous transaction"
-msgstr "Navrátiť sa k stavu pred transakciou"
-
-#: ../policy/org.freedesktop.packagekit.policy.in.h:19
-msgid "Update all packages"
-msgstr "AktualizovaÅ¥ vÅ¡etky balÃÄky"
-
-#: ../policy/org.freedesktop.packagekit.policy.in.h:20
-msgid "Update package"
-msgstr "AktualizovaÅ¥ balÃÄek"
-
-#: ../client/pk-console.c:208
+#: ../client/pk-console.c:274
msgid "Update detail"
-msgstr "Podrobnosti o aktualizáciÃ"
+msgstr "Podrobnosti o aktualizácii"
-#: ../client/pk-console.c:400
+#: ../client/pk-console.c:491
msgid "A system restart is required"
msgstr "Je potrebný reštart systému"
-#: ../client/pk-console.c:402
+#: ../client/pk-console.c:493
msgid "A logout and login is required"
msgstr "Je potrebné sa odhásiť a znovu prihlásiť"
-#: ../client/pk-console.c:404
+#: ../client/pk-console.c:495
msgid "An application restart is required"
msgstr "Je potrebné aplikáciu ukonÄiÅ¥ a znovu spustiÅ¥"
-#: ../client/pk-console.c:443
-#, c-format
-msgid "Please enter a number from 1 to %i: "
-msgstr "Zadajte prosÃm ÄÃslo od 1 do %i: "
-
-#: ../client/pk-console.c:493
-msgid "Could not find a package match"
-msgstr "Nebolo moÄné nájsÅ¥ zodpovedajúci balÃÄek"
-
-#: ../client/pk-console.c:507
+#: ../client/pk-console.c:588 ../client/pk-generate-pack.c:126
msgid "There are multiple package matches"
msgstr "Zadaniu vyhovuje viac balÃÄkov"
#. find out what package the user wants to use
-#: ../client/pk-console.c:514
+#: ../client/pk-console.c:595 ../client/pk-generate-pack.c:133
msgid "Please enter the package number: "
msgstr "Zadajte prosÃm ÄÃslo balÃÄka: "
-#: ../client/pk-console.c:530
-msgid "Could not find a package with that name to install, or package already installed"
-msgstr "Nebolo možné nájsÅ¥ balÃÄek zadaného mena na inÅ¡taláciu, alebo je už balÃÄek nainÅ¡talovaný"
+#: ../client/pk-console.c:629
+msgid "Could not find package to install"
+msgstr "Nebolo možné nájsÅ¥ balÃÄek na inÅ¡talovanie"
-#: ../client/pk-console.c:612
-msgid "Could not find a package with that name to remove"
-msgstr "Nebolo možné nájsÅ¥ balÃÄek zadaného mena na odstránenie"
+#: ../client/pk-console.c:735
+msgid "Could not find package to remove"
+msgstr "Nebolo možné nájsÅ¥ balÃÄek na odstránenie"
-#: ../client/pk-console.c:652
+#: ../client/pk-console.c:796
msgid "The following packages have to be removed"
msgstr "Nasledujúce balÃÄky budú musieÅ¥ byÅ¥ odstránené"
#. get user input
-#: ../client/pk-console.c:661
+#: ../client/pk-console.c:803
msgid "Okay to remove additional packages?"
-msgstr "Chcete odstrániÅ¥ dalÅ¡ie balÃÄky?"
+msgstr "Môžu sa odstrániÅ¥ doplnkové balÃÄky?"
-#: ../client/pk-console.c:665
+#: ../client/pk-console.c:807 ../client/pk-generate-pack.c:528
+#: ../client/pk-generate-pack-main.c:131
msgid "Cancelled!"
msgstr "Zrušené!"
-#: ../client/pk-console.c:687
-msgid "Could not find a package with that name to update"
-msgstr "Nebolo možné nájsÅ¥ balÃÄek zadaného mena na aktualizáciu"
+#: ../client/pk-console.c:841
+msgid "Could not find package to download"
+msgstr "Nebolo možné nájsÅ¥ balÃÄek na stiahnutie"
-#: ../client/pk-console.c:705
-msgid "Could not find what packages require this package"
-msgstr "Nebolo možné urÄiÅ¥ ktoré balÃÄky na tomto balÃÄku závisia"
+#: ../client/pk-console.c:893
+msgid "Could not find package to update"
+msgstr "Nebolo možné nájsÅ¥ balÃÄek na aktualizovanie"
-#: ../client/pk-console.c:723
-msgid "Could not get dependencies for this package"
-msgstr "Nebolo možné zÃskaÅ¥ závislosti tohoto balÃÄka"
+#: ../client/pk-console.c:915
+msgid "Could not find what packages require"
+msgstr "Nebolo možné urÄiÅ¥ Äo vyžadujú balÃÄky"
-#: ../client/pk-console.c:741
-msgid "Could not find a description for this package"
-msgstr "Nebolo možné zÃskaÅ¥ popis tohoto balÃÄka"
+#: ../client/pk-console.c:936
+msgid "Could not get dependencies for"
+msgstr "Nebolo možné zÃskaÅ¥ závislosti pre"
-#: ../client/pk-console.c:759
-#, c-format
+#: ../client/pk-console.c:957
+msgid "Could not find details for"
+msgstr "Nebolo možné zÃskaÅ¥ detaily pre"
+
+#: ../client/pk-console.c:980
msgid "Could not find the files for this package"
-msgstr "Nebolo možné zÃskaÅ¥ zoznam súborov tohoto balÃÄka"
+msgstr "Nebolo možné zÃskaÅ¥ zoznam súborov tohto balÃÄka"
+
+#: ../client/pk-console.c:987
+msgid "Could not get the file list"
+msgstr "Nebolo možné zÃskaÅ¥ zoznam súborov"
-#: ../client/pk-console.c:819
+#: ../client/pk-console.c:1006
+msgid "Could not find the update details for"
+msgstr "Nebolo možné zÃskaÅ¥ detaily aktualizácie pre"
+
+#: ../client/pk-console.c:1067
msgid "Package description"
msgstr "Popis balÃÄka"
-#: ../client/pk-console.c:842
+#: ../client/pk-console.c:1100
msgid "Package files"
msgstr "Zonam s̼borov v bal̀ku"
-#: ../client/pk-console.c:850
+#: ../client/pk-console.c:1108
msgid "No files"
msgstr "Žiadne súbory"
#. get user input
-#: ../client/pk-console.c:882
+#: ../client/pk-console.c:1140
msgid "Okay to import key?"
msgstr "ImportovaÅ¥ kľúÄ?"
-#: ../client/pk-console.c:885
+#: ../client/pk-console.c:1143
msgid "Did not import key"
-msgstr "KÄ¾ÃºÄ bol importovaný"
+msgstr "KÄ¾ÃºÄ nebol importovaný"
#. get user input
-#: ../client/pk-console.c:925
+#: ../client/pk-console.c:1183
msgid "Do you agree?"
msgstr "SúhlasÃte?"
-#: ../client/pk-console.c:928
+#: ../client/pk-console.c:1186
msgid "Did not agree to licence, task will fail"
-msgstr "Zadaná úloha neuspeje, pretože ste nesúhlasili ste s licenciou"
+msgstr "Zadaná úloha neuspeje, pretože ste nesúhlasili s licenciou"
-#: ../client/pk-console.c:957
+#: ../client/pk-console.c:1215
msgid "The daemon crashed mid-transaction!"
msgstr "Služba na pozadà neoÄakávne skonÄila poÄas transakcie!"
#. header
-#: ../client/pk-console.c:1010
+#: ../client/pk-console.c:1268
msgid "PackageKit Console Interface"
msgstr "Konzola PackageKit"
-#: ../client/pk-console.c:1010
+#: ../client/pk-console.c:1268
msgid "Subcommands:"
msgstr "PodprÃkazy:"
-#: ../client/pk-console.c:1114
-#: ../client/pk-monitor.c:100
-#: ../src/pk-main.c:189
+#: ../client/pk-console.c:1378 ../client/pk-generate-pack-main.c:64
+#: ../client/pk-monitor.c:118 ../src/pk-main.c:192
msgid "Show extra debugging information"
msgstr "ZobrazovaÅ¥ dodatoÄné ladiace informácie"
-#: ../client/pk-console.c:1116
-#: ../client/pk-monitor.c:102
+#: ../client/pk-console.c:1380 ../client/pk-monitor.c:120
msgid "Show the program version and exit"
msgstr "ZobraziÅ¥ verziu programu a skonÄiÅ¥"
-#: ../client/pk-console.c:1118
+#: ../client/pk-console.c:1382
msgid "Set the filter, e.g. installed"
msgstr "NastaviÅ¥ filter, naprÃklad \"nainÅ¡talované\""
-#: ../client/pk-console.c:1120
+#: ../client/pk-console.c:1384
msgid "Exit without waiting for actions to complete"
msgstr "NeÄakaÅ¥ na dokonÄenie úloh a skonÄiÅ¥"
-#: ../client/pk-console.c:1143
+#: ../client/pk-console.c:1407
msgid "Could not connect to system DBUS."
-msgstr "Pokus o pripojenie k systémovej DBUS neuspel."
+msgstr "Pokus o pripojenie k systémovej zbernici DBUS neuspel."
-#: ../client/pk-console.c:1231
-#, c-format
-msgid "You need to specify a search type"
-msgstr "Je potrebné urÄiÅ¥ typ vyhľadávania"
-
-#: ../client/pk-console.c:1236
-#: ../client/pk-console.c:1243
-#: ../client/pk-console.c:1250
-#: ../client/pk-console.c:1257
-#: ../client/pk-console.c:1361
-#: ../client/pk-console.c:1368
-#: ../client/pk-console.c:1375
-#: ../client/pk-console.c:1382
-#, c-format
+#: ../client/pk-console.c:1500
+msgid "You need to specify a search type, e.g. name"
+msgstr "Je potrebné urÄiÅ¥ typ vyhľadávania, naprÃklad názov"
+
+#: ../client/pk-console.c:1505 ../client/pk-console.c:1512
+#: ../client/pk-console.c:1519 ../client/pk-console.c:1526
+#: ../client/pk-console.c:1637 ../client/pk-console.c:1647
+#: ../client/pk-console.c:1654 ../client/pk-console.c:1661
msgid "You need to specify a search term"
msgstr "Je potrebné urÄiÅ¥ kľúÄové slová na vyhľadávanie"
-#: ../client/pk-console.c:1262
-#, c-format
+#: ../client/pk-console.c:1531
msgid "Invalid search type"
msgstr "Neplatný typ vyhľadávania"
-#: ../client/pk-console.c:1267
-#, c-format
+#: ../client/pk-console.c:1536
msgid "You need to specify a package or file to install"
msgstr "Je potrebné urÄiÅ¥ balÃÄek alebo súbor na inÅ¡taláciu"
-#: ../client/pk-console.c:1280
-#, c-format
+#: ../client/pk-console.c:1543
msgid "You need to specify a type, key_id and package_id"
msgstr "Je potrebné urÄiÅ¥ typ, key_id a package_id"
-#: ../client/pk-console.c:1287
-#, c-format
+#: ../client/pk-console.c:1550
msgid "You need to specify a package to remove"
msgstr "Je potrebné urÄit balÃÄek na odstránenie"
-#: ../client/pk-console.c:1294
-#, c-format
+#: ../client/pk-console.c:1556
+msgid ""
+"You need to specify the destination directory and then the packages to "
+"download"
+msgstr "Je potrebné urÄiÅ¥ cieľový prieÄinok a následne balÃÄky na stiahnutie"
+
+#: ../client/pk-console.c:1561
+msgid "Directory not found"
+msgstr "PrieÄinok nenájdený"
+
+#: ../client/pk-console.c:1567
msgid "You need to specify a eula-id"
msgstr "Je potrebné urÄiÅ¥ eula-id"
-#: ../client/pk-console.c:1309
-#, c-format
+#: ../client/pk-console.c:1583
msgid "You need to specify a package name to resolve"
-msgstr "Je potrebné urÄiÅ¥ meno balÃÄka na vyhľadanie"
+msgstr "Je potrebné urÄiÅ¥ názov balÃÄka na vyhľadanie"
-#: ../client/pk-console.c:1316
-#: ../client/pk-console.c:1323
-#, c-format
+#: ../client/pk-console.c:1592 ../client/pk-console.c:1599
msgid "You need to specify a repo name"
-msgstr "Je potrebné urÄiÅ¥ meno repozitára"
+msgstr "Je potrebné urÄiÅ¥ názov repozitára"
-#: ../client/pk-console.c:1330
-#, c-format
+#: ../client/pk-console.c:1606
msgid "You need to specify a repo name/parameter and value"
-msgstr "Je potrebné urÄiÅ¥ meno repozitára/parameter a hodnotu"
+msgstr "Je potrebné urÄiÅ¥ názov repozitára/parameter a hodnotu"
-#: ../client/pk-console.c:1343
-#, c-format
+#: ../client/pk-console.c:1619
msgid "You need to specify a time term"
msgstr "Je potrebné urÄiÅ¥ Äas"
-#: ../client/pk-console.c:1348
-#, c-format
+#: ../client/pk-console.c:1624
msgid "You need to specify a correct role"
msgstr "Je potrebné urÄiÅ¥ správnu rolu"
# XXX
-#: ../client/pk-console.c:1353
-#, c-format
+#: ../client/pk-console.c:1629
msgid "Failed to get last time"
-msgstr "Nebolo možné zÃskaÅ¥ posledného vykonania"
+msgstr "Nebolo možné zÃskaÅ¥ Äas ostatného vykonania"
-#: ../client/pk-console.c:1389
-#, c-format
-msgid "You need to specify a package to find the description for"
-msgstr "Je potrebné urÄiÅ¥ balÃÄek, ktorého popis sa má vyhľadaÅ¥"
+#: ../client/pk-console.c:1668
+msgid "You need to specify a package to find the details for"
+msgstr "Je potrebné urÄiÅ¥ balÃÄek, ktorého detaily sa majú zÃskaÅ¥"
-#: ../client/pk-console.c:1396
-#, c-format
+#: ../client/pk-console.c:1675
msgid "You need to specify a package to find the files for"
msgstr "Je potrebné urÄiÅ¥ balÃÄek, zoznam súborov ktorého sa má zÃskaÅ¥"
-#: ../client/pk-console.c:1441
+#: ../client/pk-console.c:1724
#, c-format
msgid "Option '%s' not supported"
msgstr "Voľba '%s' nie je podporovaná"
-#: ../client/pk-console.c:1452
+#: ../client/pk-console.c:1737
+msgid "You don't have the necessary privileges for this operation"
+msgstr "Na vykonanie úlohy nemáte dostatoÄné privilégiá"
+
+#: ../client/pk-console.c:1739
msgid "Command failed"
msgstr "PrÃkaz neuspel"
-#: ../client/pk-console.c:1456
-msgid "You don't have the necessary privileges for this operation"
-msgstr "Na vykonanie úlohy nemáte dostatoÄné privilégiá"
+#: ../client/pk-generate-pack.c:117
+msgid "Could not find a package match"
+msgstr "Nebolo moÄné nájsÅ¥ zodpovedajúci balÃÄek"
-#: ../client/pk-monitor.c:113
-msgid "PackageKit Monitor"
-msgstr "Monitor PackageKit"
+#: ../client/pk-generate-pack.c:151
+msgid "failed to download: invalid package_id and/or directory"
+msgstr "zÃskavanie zlyhalo: neplatné package_id a/alebo prieÄinok"
+
+#: ../client/pk-generate-pack.c:232
+msgid "Could not find a valid metadata file"
+msgstr "Nebolo možné nájsť platný súbor metadát"
+
+#. get user input
+#: ../client/pk-generate-pack.c:524
+msgid "Okay to download the additional packages"
+msgstr "Chcete stiahnuÅ¥ dodatoÄné balÃÄky"
+
+#: ../client/pk-generate-pack-main.c:66
+msgid ""
+"Set the path of the file with the list of packages/dependencies to be "
+"excluded"
+msgstr "Nastavte cestu k súboru so zoznamom balÃÄkov/závislostÃ, ktoré "
+"sa majú vynechať"
+
+#: ../client/pk-generate-pack-main.c:111
+msgid "You need to specify the pack name and packages to be packed\n"
+msgstr "Je potrebné urÄit názov archÃvu a balÃÄky, ktoré sa majú zabaliÅ¥\n"
+
+#: ../client/pk-generate-pack-main.c:117
+msgid ""
+"Invalid name for the service pack, Specify a name with .servicepack "
+"extension\n"
+msgstr "Neplatný názov pre service pack, Å¡pecifikujte názov s platnou prÃponou pre "
+"service pack\n"
+
+#: ../client/pk-generate-pack-main.c:129
+msgid "A pack with the same name already exists, do you want to overwrite it?"
+msgstr "ArchÃv s rovnakým názvom už existuje, chcete ho nahradiÅ¥?"
+
+# XXX
+#: ../client/pk-generate-pack-main.c:142
+msgid "Failed to create directory"
+msgstr "Nebolo možné vytvoriÅ¥ prieÄinok"
-#: ../client/pk-import-desktop.c:283
-#: ../client/pk-import-specspo.c:169
+# XXX
+#: ../client/pk-generate-pack-main.c:149
+msgid "Failed to create pack"
+msgstr "Nebolo možné vytvoriÅ¥ archÃv"
+
+#: ../client/pk-import-specspo.c:185
+msgid "Could not set database readonly"
+msgstr "Pokus o nastavenie databázy do režimu len pre ÄÃtanie neuspel"
+
+#: ../client/pk-import-specspo.c:192
#, c-format
msgid "Could not open database: %s"
msgstr "Pokus o otvorenie databázy neuspel: %s"
-#: ../client/pk-import-desktop.c:284
-#: ../client/pk-import-specspo.c:170
+#: ../client/pk-import-specspo.c:193
msgid "You probably need to run this program as the root user"
-msgstr "Tento program budete pravdepodobne musieÅ¥ spustiÅ¥ ako privilegovaný použÃvateľ root"
+msgstr ""
+"Tento program budete pravdepodobne musieť spustiť ako privilegovaný "
+"použÃvateľ (root)"
+
+#: ../client/pk-monitor.c:131
+msgid "PackageKit Monitor"
+msgstr "Monitor PackageKit"
+
+#: ../client/pk-tools-common.c:51
+#, c-format
+msgid "Please enter a number from 1 to %i: "
+msgstr "Zadajte prosÃm ÄÃslo od 1 do %i: "
+
+#: ../contrib/packagekit-plugin/src/contents.cpp:300
+msgid "Getting package information..."
+msgstr "ZÃskavanie informácià o balÃÄku..."
+
+#: ../contrib/packagekit-plugin/src/contents.cpp:304
+#, c-format
+msgid "<span color='#%06x' underline='single' size='larger'>Run %s</span>"
+msgstr "<span color='#%06x' underline='single' size='larger'>Spustiť %s</span>"
+
+#: ../contrib/packagekit-plugin/src/contents.cpp:308
+#: ../contrib/packagekit-plugin/src/contents.cpp:313
+#: ../contrib/packagekit-plugin/src/contents.cpp:336
+#: ../contrib/packagekit-plugin/src/contents.cpp:340
+#, c-format
+msgid "<big>%s</big>"
+msgstr "<big>%s</big>"
+
+#: ../contrib/packagekit-plugin/src/contents.cpp:310
+#, c-format
+msgid ""
+"\n"
+"<small>Installed version: %s</small>"
+msgstr ""
+"\n"
+"<small>Nainštalovaná verzia: %s</small>"
-#: ../src/pk-main.c:83
+#: ../contrib/packagekit-plugin/src/contents.cpp:316
+#, c-format
+msgid ""
+"\n"
+"<span color='#%06x' underline='single'>Run version %s now</span>"
+msgstr ""
+"\n"
+"<span color='#%06x' underline='single'>Spustiť verziu %s teraz</span>"
+
+#: ../contrib/packagekit-plugin/src/contents.cpp:321
+#, c-format
+msgid ""
+"\n"
+"<span color='#%06x' underline='single'>Run now</span>"
+msgstr ""
+"\n"
+"<span color='#%06x' underline='single'>Spustiť teraz</span>"
+
+#: ../contrib/packagekit-plugin/src/contents.cpp:325
+#, c-format
+msgid ""
+"\n"
+"<span color='#%06x' underline='single'>Upgrade to version %s</span>"
+msgstr ""
+"\n"
+"<span color='#%06x' underline='single'>Aktualizovať na verziu %s</span>"
+
+#: ../contrib/packagekit-plugin/src/contents.cpp:330
+#, c-format
+msgid ""
+"<span color='#%06x' underline='single' size='larger'>Install %s Now</span>"
+msgstr ""
+"<span color='#%06x' underline='single' size='larger'>Inštalovať %s teraz</span>"
+
+#: ../contrib/packagekit-plugin/src/contents.cpp:333
+#, c-format
+msgid ""
+"\n"
+"<small>Version: %s</small>"
+msgstr ""
+"\n"
+"<small>Verzia: %s</small>"
+
+#: ../contrib/packagekit-plugin/src/contents.cpp:337
+msgid ""
+"\n"
+"<small>No packages found for your system</small>"
+msgstr ""
+"\n"
+"<small>Pre váš systém neboli nájdené žiadne balÃÄky</small>"
+
+#: ../contrib/packagekit-plugin/src/contents.cpp:341
+msgid ""
+"\n"
+"<small>Installing...</small>"
+msgstr ""
+"\n"
+"<small>Inštalovanie...</small>"
+
+#: ../data/packagekit-catalog.xml.in.h:1
+msgid "PackageKit Catalog"
+msgstr "Katalóg PackageKit"
+
+#: ../data/packagekit-pack.xml.in.h:1
+msgid "PackageKit Service Pack"
+msgstr "Service pack PackageKit"
+
+#: ../src/pk-main.c:85
msgid "Startup failed due to security policies on this machine."
-msgstr "BezpeÄnostné politky tohoto poÄÃtaÄa zabránili spusteniu."
+msgstr "BezpeÄnostné politky tohto poÄÃtaÄa zabránili spusteniu."
-#: ../src/pk-main.c:84
+#: ../src/pk-main.c:86
msgid "This can happen for two reasons:"
-msgstr "Toto sa môže stať z dvoch dôvodov:"
+msgstr "Toto môže nastať z dvoch dôvodov:"
-#: ../src/pk-main.c:85
+#: ../src/pk-main.c:87
msgid "The correct user is not launching the executable (usually root)"
-msgstr "Je potrebné urÄiÅ¥ balÃÄek, ktorého zoznam súborov sa má vyhľadaÅ¥"
+msgstr "Program nebol spustený správnym použÃvateľom (obvykle root)"
-#: ../src/pk-main.c:86
-msgid "The org.freedesktop.PackageKit.conf file is not installed in the system /etc/dbus-1/system.d directory"
-msgstr "Súbor org.freedesktop.PackageKit.conf nieje nainštalovaný v adresári /etc/dbus-1/system.d"
+#: ../src/pk-main.c:88
+msgid ""
+"The org.freedesktop.PackageKit.conf file is not installed in the system /etc/"
+"dbus-1/system.d directory"
+msgstr ""
+"Súbor org.freedesktop.PackageKit.conf nieje nainÅ¡talovaný v prieÄinku /etc/"
+"dbus-1/system.d"
-#: ../src/pk-main.c:185
+#: ../src/pk-main.c:188
msgid "Packaging backend to use, e.g. dummy"
msgstr "Rozhranie balÃÄkoveho systému ktoré sa má použiÅ¥, naprÃklad \"dummy\""
-#: ../src/pk-main.c:187
+#: ../src/pk-main.c:190
msgid "Daemonize and detach from the terminal"
msgstr "Uvoľniť terminál a presunúť sa na pozadie"
-#: ../src/pk-main.c:191
+#: ../src/pk-main.c:194
msgid "Disable the idle timer"
msgstr "Vypnúť poÄÃtadlo neÄinnosti"
-#: ../src/pk-main.c:193
+#: ../src/pk-main.c:196
msgid "Show version and exit"
msgstr "ZobraziÅ¥ verziu a skonÄiÅ¥"
-#: ../src/pk-main.c:195
+#: ../src/pk-main.c:198
msgid "Exit after a small delay"
msgstr "SkonÄiÅ¥ po krátkej prestávke"
# XXX
-#: ../src/pk-main.c:197
+#: ../src/pk-main.c:200
msgid "Exit after the engine has loaded"
msgstr "SkonÄiÅ¥ po naÄÃtanà enginu"
-#: ../src/pk-main.c:207
+#: ../src/pk-main.c:210
msgid "PackageKit service"
msgstr "Služba PackageKit"
-#: ../src/pk-main.c:233
+#: ../src/pk-main.c:246
msgid "Cannot connect to the system bus"
msgstr "Pokus o pripojenie k systémovej zbernici neuspel"
-#: ../src/pk-main.c:273
+#: ../src/pk-main.c:286
#, c-format
msgid "Error trying to start: %s\n"
-msgstr "Chyba pri pokuse spustiť: %s\n"
+msgstr "Chyba pri pokuse o spustenie: %s\n"
+
+#~ msgid "Accept EULA"
+#~ msgstr "PrijaÅ¥ licenÄné podmienky"
+
+#~ msgid "Authentication is required to accept a EULA"
+#~ msgstr "Na prijatie licenÄných podmienok je nutná autentifikácia"
+
+#~ msgid "Authentication is required to change software source parameters"
+#~ msgstr "Na úpravu zdrojov softvéru je nutná autentifikácia"
+
+#~ msgid "Authentication is required to install a local file"
+#~ msgstr "Na inštaláciu z lokálneho súboru je nutná autentifikácia"
+
+#~ msgid "Authentication is required to install a package"
+#~ msgstr "Na inÅ¡taláciu balÃÄka je nutná autentifikácia"
+
+#~ msgid "Authentication is required to install a security signature"
+#~ msgstr "Na inÅ¡taláciu bezpeÄnostný podpisu je nutná autentifikácia"
+
+#~ msgid "Authentication is required to refresh the package lists"
+#~ msgstr "Na obnovenie zoznamu balÃÄkov je nutná autentifikácia"
+
+#~ msgid "Authentication is required to remove packages"
+#~ msgstr "Na odstránenie balÃÄkov je nutná autentifikácia"
+
+#~ msgid "Authentication is required to rollback a transaction"
+#~ msgstr "Na navrátenie transakcie je nutná autentifikácia"
+
+#~ msgid "Authentication is required to update all packages"
+#~ msgstr "Na aktualizáciu vÅ¡etkých balÃÄkov je nutná autentifikácia"
+
+#~ msgid "Authentication is required to update packages"
+#~ msgstr "Na aktualizáciu balÃÄkov je nutná autentifikácia"
+
+#~ msgid "Change software source parameters"
+#~ msgstr "Zmeniť parametre zdrojov softvéru"
+
+#~ msgid "Install local file"
+#~ msgstr "Inštalovať z lokálneho súboru"
+
+#~ msgid "Install package"
+#~ msgstr "InÅ¡talovaÅ¥ balÃÄek"
+
+#~ msgid "Install security signature"
+#~ msgstr "InÅ¡talovaÅ¥ bezpeÄnostný podpis"
+
+#~ msgid "Refresh package lists"
+#~ msgstr "ObnoviÅ¥ zoznam balÃÄkov"
+
+#~ msgid "Remove package"
+#~ msgstr "OdstrániÅ¥ balÃÄek"
+
+#~ msgid "Rollback to a previous transaction"
+#~ msgstr "Navrátiť sa k stavu pred transakciou"
+
+#~ msgid "Update all packages"
+#~ msgstr "AktualizovaÅ¥ vÅ¡etky balÃÄky"
+
+#~ msgid "Update package"
+#~ msgstr "AktualizovaÅ¥ balÃÄek"
+
+#~ msgid ""
+#~ "Could not find a package with that name to install, or package already "
+#~ "installed"
+#~ msgstr ""
+#~ "Nebolo možné nájsÅ¥ balÃÄek zadaného mena na inÅ¡taláciu, alebo je už "
+#~ "balÃÄek nainÅ¡talovaný"
+
+#~ msgid "Could not find a package with that name to update"
+#~ msgstr "Nebolo možné nájsÅ¥ balÃÄek zadaného mena na aktualizáciu"
+
+#~ msgid "Could not find a description for this package"
+#~ msgstr "Nebolo možné zÃskaÅ¥ popis tohoto balÃÄka"
+#~ msgid "You need to specify a package to find the description for"
+#~ msgstr "Je potrebné urÄiÅ¥ balÃÄek, ktorého popis sa má vyhľadaÅ¥"
commit 9e8068579d32b89b4c7f3a17c81442385bba97a5
Merge: 030ce37... 96479a8...
Author: Stefan Haas <shaas at suse.de>
Date: Tue Oct 7 16:51:38 2008 +0200
Merge branch 'master' of git+ssh://shaas@git.packagekit.org/srv/git/PackageKit
commit 030ce3745dbf5ee87b183f0d95467d4ff6cdad04
Merge: c1872d9... a569ae5...
Author: Stefan Haas <shaas at suse.de>
Date: Mon Oct 6 15:45:40 2008 +0200
Merge branch 'master' of git+ssh://shaas@git.packagekit.org/srv/git/PackageKit
commit c1872d92c22d8f75adb0df7da744272d8875d1d9
Merge: 34ad593... 36939fc...
Author: Stefan Haas <shaas at suse.de>
Date: Mon Sep 22 19:07:35 2008 +0200
Merge branch 'master' of git+ssh://shaas@git.packagekit.org/srv/git/PackageKit
commit 34ad5937c06d5ed92a150d7f5443df36cf3f8c05
Merge: afd1e8b... 09a4496...
Author: Stefan Haas <stef at adrien.philadelphia>
Date: Mon Aug 18 12:37:17 2008 +0200
Merge branch 'master' of git+ssh://shaas@git.packagekit.org/srv/git/PackageKit
commit afd1e8bc9f658273aa7a4064c4c313339d362642
Merge: 125e832... 6f5aa6e...
Author: Stefan Haas <stef at adrien.philadelphia>
Date: Mon Aug 4 20:18:41 2008 +0200
Merge branch 'master' of git+ssh://shaas@git.packagekit.org/srv/git/PackageKit
commit 125e83205c4618221014477c944080aed059645d
Merge: 0b188e4... 1792c34...
Author: Stefan Haas <shaas at suse.de>
Date: Fri Apr 25 21:15:46 2008 +0200
Merge branch 'master' of git+ssh://shaas@git.packagekit.org/srv/git/PackageKit
commit 0b188e4834e9eb101c9bc27484956ac4beb81369
Author: Stefan Haas <shaas at suse.de>
Date: Wed Apr 23 14:14:58 2008 +0200
changed for zypp 4.14.0
diff --git a/backends/zypp/pk-backend-zypp.cpp b/backends/zypp/pk-backend-zypp.cpp
index 07c5b84..d5b8f29 100644
--- a/backends/zypp/pk-backend-zypp.cpp
+++ b/backends/zypp/pk-backend-zypp.cpp
@@ -967,9 +967,9 @@ backend_get_update_detail_thread (PkBackendThread *thread, gpointer data)
if (zypp::isKind<zypp::Patch>(solvable)) {
zypp::Patch::constPtr patch = zypp::asKind<zypp::Patch>(item);
- if (patch->reboot_needed ()) {
+ if (patch->rebootSuggested ()) {
restart = PK_RESTART_ENUM_SYSTEM;
- }else if (patch->affects_pkg_manager ()) {
+ }else if (patch->restartSuggested ()) {
restart = PK_RESTART_ENUM_SESSION;
}
diff --git a/configure.ac b/configure.ac
index b084ac4..f38eec2 100755
--- a/configure.ac
+++ b/configure.ac
@@ -556,7 +556,7 @@ if test x$enable_poldek = xyes; then
fi
if test x$enable_zypp = xyes; then
- PKG_CHECK_MODULES(ZYPP, libzypp >= 4.10.0)
+ PKG_CHECK_MODULES(ZYPP, libzypp >= 4.14.0)
AC_SUBST(ZYPP_CFLAGS)
AC_SUBST(ZYPP_LIBS)
fi
More information about the PackageKit-commit
mailing list