Commit 4d1b7a44 authored by Lisa's avatar Lisa

Added uninstall target. Removed unused C code. Removed all relative includes.

parent 2a4efec4
......@@ -3,6 +3,11 @@ project(akabeicore)
cmake_minimum_required(VERSION 2.6.0)
set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake/modules")
# Compiles with debugging symbols (Debug mode)
if (CMAKE_COMPILER_IS_GNUCC)
set(CMAKE_C_FLAGS_DEBUG "-ggdb")
endif(CMAKE_COMPILER_IS_GNUCC)
if(COMMAND cmake_policy)
cmake_policy(SET CMP0003 NEW)
endif(COMMAND cmake_policy)
......@@ -60,3 +65,12 @@ add_custom_target(dist
COMMAND git archive --prefix=${ARCHIVE_NAME}/ HEAD
| bzip2 > ${CMAKE_BINARY_DIR}/${ARCHIVE_NAME}.tar.bz2
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR})
# uninstall target
configure_file(
"${CMAKE_CURRENT_SOURCE_DIR}/cmake_uninstall.cmake.in"
"${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake"
IMMEDIATE @ONLY)
add_custom_target(uninstall
COMMAND ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake)
if (NOT EXISTS "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt")
message(FATAL_ERROR "Cannot find install manifest: \"@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt\"")
endif(NOT EXISTS "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt")
file(READ "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt" files)
string(REGEX REPLACE "\n" ";" files "${files}")
list(REVERSE files)
foreach (file ${files})
message(STATUS "Uninstalling \"$ENV{DESTDIR}${file}\"")
if (EXISTS "$ENV{DESTDIR}${file}")
execute_process(
COMMAND @CMAKE_COMMAND@ -E remove "$ENV{DESTDIR}${file}"
OUTPUT_VARIABLE rm_out
RESULT_VARIABLE rm_retval
)
if(NOT ${rm_retval} EQUAL 0)
message(FATAL_ERROR "Problem when removing \"$ENV{DESTDIR}${file}\"")
endif (NOT ${rm_retval} EQUAL 0)
else (EXISTS "$ENV{DESTDIR}${file}")
message(STATUS "File \"$ENV{DESTDIR}${file}\" does not exist.")
endif (EXISTS "$ENV{DESTDIR}${file}")
endforeach(file)
......@@ -11,7 +11,6 @@ akabeidelta.cpp
akabeidatabase.cpp
akabeierror.cpp
akabeigroup.cpp
akabeihelpers.c
akabeihelpers.cpp
akabeihook.cpp
akabeioperation.cpp
......
......@@ -10,7 +10,7 @@
*/
#include <QMutexLocker>
#include "SQLiteConnection.h"
#include <SQLiteConnection.h>
#include <akabeilog.h>
class SQLiteConnection::Private
......
......@@ -8,25 +8,25 @@
version 2 of the License, or (at your option) any later version.
*/
#include "akabeibackend_p.h"
#include "akabeiconfig.h"
#include "akabeidatabase.h"
#include "akabeigroup.h"
#include "akabeipackage_p.h"
#include "akabeihelpers_p.h"
#include "akabeidelta_p.h"
#include "akabeigroup_p.h"
#include <QtCore/QHash>
#include <QtCore/QtConcurrentRun>
#include <QtCore/QtConcurrentMap>
#include <QtCore/QDir>
#include <QtCore/QFutureWatcher>
#include <akabeibackend_p.h>
#include <akabeiconfig.h>
#include <akabeidatabase.h>
#include <akabeigroup.h>
#include <akabeipackage_p.h>
#include <akabeihelpers_p.h>
#include <akabeidelta_p.h>
#include <akabeigroup_p.h>
#include <QHash>
#include <QtConcurrentRun>
#include <QtConcurrentMap>
#include <QDir>
#include <QFutureWatcher>
#include <QVariant>
#include "libarchive++/archivehandler.h"
#include "akabeihook.h"
#include <libarchive++/archivehandler.h>
#include <akabeihook.h>
Q_DECLARE_METATYPE(QUuid)
Q_DECLARE_METATYPE(QList< Akabei::Package* >)
......
......@@ -11,9 +11,9 @@
#ifndef AKABEIBACKEND_H
#define AKABEIBACKEND_H
#include <QtCore/QObject>
#include <QObject>
#include "akabeicore_global.h"
#include <akabeicore_global.h>
class QUuid;
namespace Akabei {
......
......@@ -11,12 +11,12 @@
#ifndef AKABEIBACKEND_P_H
#define AKABEIBACKEND_P_H
#include "akabeibackend.h"
#include <akabeibackend.h>
#include <akabeioperationrunner.h>
#include <QtCore/QFileSystemWatcher>
#include <QtCore/QFutureWatcher>
#include <QtCore/QUuid>
#include "akabeioperationrunner.h"
#include <QFileSystemWatcher>
#include <QFutureWatcher>
#include <QUuid>
namespace Akabei
{
......
......@@ -10,10 +10,10 @@
version 2 of the License, or (at your option) any later version.
*/
#include "akabeicache.h"
#include "akabeidatabase.h"
#include "akabeipackage.h"
#include "akabeiconfig.h"
#include <akabeicache.h>
#include <akabeidatabase.h>
#include <akabeipackage.h>
#include <akabeiconfig.h>
/*
* This is an utility class we use for sorting the cache entries according to some date/time.
......
......@@ -19,7 +19,7 @@
#include <QDateTime>
#include <QDebug>
#include "akabeibackend.h"
#include <akabeibackend.h>
/*
* This enum describes what to do when the cache reaches the maximum size allowed by the user
......
......@@ -8,13 +8,12 @@
version 2 of the License, or (at your option) any later version.
*/
#include "akabeiconfig.h"
#include "akabeibackend.h"
#include "akabeibackend_p.h"
#include <akabeiconfig.h>
#include <akabeibackend.h>
#include <akabeibackend_p.h>
#include <qglobal.h>
#include <QtCore/QDir>
#include <QDir>
namespace Akabei
{
......
......@@ -11,7 +11,7 @@
#ifndef AKABEICORE_GLOBAL_H
#define AKABEICORE_GLOBAL_H
#include <QtCore/qglobal.h>
#include <qglobal.h>
#include <QUrl>
#if defined(AKABEICORE_LIBRARY)
......
......@@ -8,14 +8,14 @@
version 2 of the License, or (at your option) any later version.
*/
#include "akabeidatabase_p.h"
#include "akabeipackage_p.h"
#include "akabeigroup_p.h"
#include "akabeibackend_p.h"
#include "akabeihelpers_p.h"
#include "akabeidelta_p.h"
#include "akabeihook_p.h"
#include <akabeidatabase_p.h>
#include <akabeipackage_p.h>
#include <akabeigroup_p.h>
#include <akabeibackend_p.h>
#include <akabeihelpers_p.h>
#include <akabeidelta_p.h>
#include <akabeihook_p.h>
namespace Akabei {
//TODO: Only open local database readwrite
......
......@@ -11,10 +11,10 @@
#ifndef AKABEIDATABASE_H
#define AKABEIDATABASE_H
#include "akabeicore_global.h"
#include "akabeipackage.h"
#include <akabeicore_global.h>
#include <akabeipackage.h>
#include <QtCore/QObject>
#include <QObject>
namespace Akabei {
......
......@@ -11,11 +11,10 @@
#ifndef AKABEIDATABASE_P_H
#define AKABEIDATABASE_P_H
#include "akabeidatabase.h"
#include <akabeidatabase.h>
#include <SQLiteConnection.h>
#include <QtCore/QHash>
#include "SQLiteConnection.h" /* TODO: change path */
#include <QHash>
class QMutex;
namespace Akabei {
......
......@@ -9,13 +9,14 @@
version 2 of the License, or (at your option) any later version.
*/
#include "akabeidelta_p.h"
#include "akabeihelpers_p.h"
#include "akabeiconfig.h"
#include "libarchive++/archivehandler.h"
#include <qdir.h>
#include <qtemporaryfile.h>
#include <qdebug.h>
#include <akabeidelta_p.h>
#include <akabeihelpers_p.h>
#include <akabeiconfig.h>
#include <libarchive++/archivehandler.h>
#include <QDir>
#include <QTemporaryFile>
#include <QDebug>
namespace Akabei
{
......
......@@ -12,7 +12,7 @@
#ifndef AKABEI_AKABEIDELTA_H
#define AKABEI_AKABEIDELTA_H
#include <QtCore/QObject>
#include <QObject>
namespace Akabei {
......
......@@ -12,7 +12,7 @@
#ifndef AKABEI_AKABEIDELTA_P_H
#define AKABEI_AKABEIDELTA_P_H
#include "akabeidelta.h"
#include <akabeidelta.h>
namespace Akabei {
......
......@@ -8,7 +8,7 @@
version 2 of the License, or (at your option) any later version.
*/
#include "akabeierror.h"
#include <akabeierror.h>
namespace Akabei
{
......
......@@ -11,11 +11,12 @@
#ifndef AKABEI_AKABEIERROR_H
#define AKABEI_AKABEIERROR_H
#include <QtCore/QMetaType>
#include <QtCore/QString>
#include <QtCore/QList>
#include <QtCore/QSharedDataPointer>
#include "akabeipackage.h"
#include <QMetaType>
#include <QString>
#include <QList>
#include <QSharedDataPointer>
#include <akabeipackage.h>
namespace Akabei {
class Operation;
......
......@@ -8,10 +8,10 @@
version 2 of the License, or (at your option) any later version.
*/
#include "akabeigroup_p.h"
#include <akabeigroup_p.h>
#include "akabeibackend.h"
#include "akabeihelpers.h"
#include <akabeibackend.h>
#include <akabeihelpers.h>
namespace Akabei
{
......
......@@ -11,9 +11,9 @@
#ifndef AKABEI_AKABEIGROUP_H
#define AKABEI_AKABEIGROUP_H
#include <QtCore/QObject>
#include <QObject>
#include "akabeicore_global.h"
#include <akabeicore_global.h>
namespace Akabei {
......
......@@ -8,7 +8,7 @@
version 2 of the License, or (at your option) any later version.
*/
#include "akabeigroup.h"
#include <akabeigroup.h>
namespace Akabei
{
......
/* This file is part of the Chakra project
Copyright (C) 2010 Dario Freddi <drf@chakra-project.org>
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.
A big portion of this code was taken from ArchLinux's pacman
Copyright (c) 2006-2009 Pacman Development Team <pacman-dev@archlinux.org>
Copyright (c) 2002-2006 by Judd Vinet <jvinet@zeroflux.org>
*/
#include "akabeihelpers_c.h"
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <sqlite3.h>
#include "md5.h"
#include <ctype.h>
/** Compare two version strings and determine which one is 'newer'.
* Returns a value comparable to the way strcmp works. Returns 1
* if a is newer than b, 0 if a and b are the same version, or -1
* if b is newer than a.
*
* This function has been adopted from libalpm, which reports:
* This function has been adopted from the rpmvercmp function located
* at lib/rpmvercmp.c, and was most recently updated against rpm
* version 4.4.2.3. Small modifications have been made to make it more
* consistent with the libalpm coding style.
*
* Keep in mind that the pkgrel is only compared if it is available
* on both versions handed to this function. For example, comparing
* 1.5-1 and 1.5 will yield 0; comparing 1.5-1 and 1.5-2 will yield
* -1 as expected. This is mainly for supporting versioned dependencies
* that do not include the pkgrel.
*/
int __c_compare_versions(const char *a, const char *b)
{
char oldch1, oldch2;
char *str1, *str2;
char *ptr1, *ptr2;
char *one, *two;
int rc;
int isnum;
int ret = 0;
/* libalpm added code. ensure our strings are not null */
if(!a) {
if(!b) return(0);
return(-1);
}
if(!b) return(1);
/* easy comparison to see if versions are identical */
if(strcmp(a, b) == 0) return(0);
str1 = strdup(a);
str2 = strdup(b);
one = str1;
two = str2;
/* loop through each version segment of str1 and str2 and compare them */
while(*one && *two) {
while(*one && !isalnum((int)*one)) one++;
while(*two && !isalnum((int)*two)) two++;
/* If we ran to the end of either, we are finished with the loop */
if(!(*one && *two)) break;
ptr1 = one;
ptr2 = two;
/* grab first completely alpha or completely numeric segment */
/* leave one and two pointing to the start of the alpha or numeric */
/* segment and walk ptr1 and ptr2 to end of segment */
if(isdigit((int)*ptr1)) {
while(*ptr1 && isdigit((int)*ptr1)) ptr1++;
while(*ptr2 && isdigit((int)*ptr2)) ptr2++;
isnum = 1;
} else {
while(*ptr1 && isalpha((int)*ptr1)) ptr1++;
while(*ptr2 && isalpha((int)*ptr2)) ptr2++;
isnum = 0;
}
/* save character at the end of the alpha or numeric segment */
/* so that they can be restored after the comparison */
oldch1 = *ptr1;
*ptr1 = '\0';
oldch2 = *ptr2;
*ptr2 = '\0';
/* this cannot happen, as we previously tested to make sure that */
/* the first string has a non-null segment */
if (one == ptr1) {
ret = -1; /* arbitrary */
goto cleanup;
}
/* take care of the case where the two version segments are */
/* different types: one numeric, the other alpha (i.e. empty) */
/* numeric segments are always newer than alpha segments */
/* XXX See patch #60884 (and details) from bugzilla #50977. */
if (two == ptr2) {
ret = isnum ? 1 : -1;
goto cleanup;
}
if (isnum) {
/* this used to be done by converting the digit segments */
/* to ints using atoi() - it's changed because long */
/* digit segments can overflow an int - this should fix that. */
/* throw away any leading zeros - it's a number, right? */
while (*one == '0') one++;
while (*two == '0') two++;
/* whichever number has more digits wins */
if (strlen(one) > strlen(two)) {
ret = 1;
goto cleanup;
}
if (strlen(two) > strlen(one)) {
ret = -1;
goto cleanup;
}
}
/* strcmp will return which one is greater - even if the two */
/* segments are alpha or if they are numeric. don't return */
/* if they are equal because there might be more segments to */
/* compare */
rc = strcmp(one, two);
if (rc) {
ret = rc < 1 ? -1 : 1;
goto cleanup;
}
/* restore character that was replaced by null above */
*ptr1 = oldch1;
one = ptr1;
*ptr2 = oldch2;
two = ptr2;
/* libalpm added code. check if version strings have hit the pkgrel
* portion. depending on which strings have hit, take correct action.
* this is all based on the premise that we only have one dash in
* the version string, and it separates pkgver from pkgrel. */
if(*ptr1 == '-' && *ptr2 == '-') {
/* no-op, continue comparing since we are equivalent throughout */
} else if(*ptr1 == '-') {
/* ptr1 has hit the pkgrel and ptr2 has not. continue version
* comparison after stripping the pkgrel from ptr1. */
*ptr1 = '\0';
} else if(*ptr2 == '-') {
/* ptr2 has hit the pkgrel and ptr1 has not. continue version
* comparison after stripping the pkgrel from ptr2. */
*ptr2 = '\0';
}
}
/* this catches the case where all numeric and alpha segments have */
/* compared identically but the segment separating characters were */
/* different */
if ((!*one) && (!*two)) {
ret = 0;
goto cleanup;
}
/* the final showdown. we never want a remaining alpha string to
* beat an empty string. the logic is a bit weird, but:
* - if one is empty and two is not an alpha, two is newer.
* - if one is an alpha, two is newer.
* - otherwise one is newer.
* */
if ( ( !*one && !isalpha((int)*two) )
|| isalpha((int)*one) ) {
ret = -1;
} else {
ret = 1;
}
cleanup:
free(str1);
free(str2);
return(ret);
}
......@@ -13,12 +13,17 @@
Copyright (c) 2002-2006 by Judd Vinet <jvinet@zeroflux.org>
*/
#include "akabeihelpers_p.h"
#include "akabeiconfig.h"
#include "akabeidatabase_p.h"
#include "akabeipackage_p.h"
#include "akabeigroup.h"
#include <akabeihelpers_p.h>
#include <akabeiconfig.h>
#include <akabeigroup.h>
#include <akabeihook.h>
#include <akabeidelta.h>
#include <libarchive++/archivehandler.h>
#include <SQLiteConnection.h>
#include <md5.h>
#include <akabeidatabase_p.h>
#include <akabeipackage_p.h>
#include <QDir>
#include <QUrl>
......@@ -26,14 +31,6 @@
#include <stdlib.h>
#include "libarchive++/archivehandler.h"
#include "SQLiteConnection.h"
#include "md5.h"
#include "akabeihelpers_c.h"
#include "akabeihook.h"
#include "akabeidelta.h"
namespace Akabei
{
......
......@@ -11,13 +11,12 @@
#ifndef AKABEI_HELPERS_H
#define AKABEI_HELPERS_H
#include <QtCore/QEventLoop>
#include <QtCore/QUuid>
#include <QtCore/QHash>
#include <QEventLoop>
#include <QUuid>
#include <QHash>
#include "SQLiteConnection.h"
#include "akabeicore_global.h"
#include <SQLiteConnection.h>
#include <akabeicore_global.h>
struct sqlite3;
......
/* This file is part of the Chakra project
Copyright (C) 2010 Dario Freddi <drf@chakra-project.org>
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.
*/
#ifndef AKABEI_HELPERS_C_H
#define AKABEI_HELPERS_C_H
#include <archive.h>
#ifdef __cplusplus
extern "C" {
#endif
int __c_compare_versions(const char *a, const char *b);
#ifdef __cplusplus
}
#endif
#endif
......@@ -11,18 +11,17 @@
#ifndef AKABEI_HELPERS_P_H
#define AKABEI_HELPERS_P_H
#include "akabeihelpers.h"
#include <archive.h>
#include <akabeihelpers.h>
#include <SQLiteConnection.h>
#include <QStringList>
namespace Akabei
{
namespace Helpers
{
char *archive_file_readline(archive* a, char* line);
int compare_versions(QString const& a, QString const& b);
QStringList stringlistFromDb(const QString &);
int compare_versions(QString const& a, QString const& b);
QStringList stringlistFromDb(const QString &);
}
}
......
......@@ -8,11 +8,11 @@
version 2 of the License, or (at your option) any later version.
*/
#include "akabeihook.h"
#include "akabeihook_p.h"
#include <akabeihook.h>
#include <akabeihook_p.h>
#include <QTemporaryFile>
#include <qtextstream.h>
#include <QTextStream>
#include <QDebug>
Akabei::Hook::Hook(const QString& name, const QString &content, QList<Akabei::Package*> pkgs)
......
......@@ -11,7 +11,7 @@
#ifndef AKABEIHOOK_H
#define AKABEIHOOK_H
#include <QtCore/QObject>
#include <QObject>
namespace Akabei {
class HookPrivate;
......
......@@ -12,7 +12,7 @@
#ifndef AKABEI_AKABEIHOOK_P_H
#define AKABEI_AKABEIHOOK_P_H
#include "akabeihook.h"
#include <akabeihook.h>
#include <QTemporaryFile>
......
......@@ -9,7 +9,7 @@
version 2 of the License, or (at your option) any later version.
*/
#include "akabeilog.h"
#include <akabeilog.h>
#include <iostream>
#include <fstream>
......
......@@ -8,14 +8,14 @@
version 2 of the License, or (at your option) any later version.
*/
#include "akabeioperation_p.h"
#include <akabeioperation_p.h>
#include "akabeioperationrunner_p.h"
#include "akabeibackend.h"
#include <akabeioperationrunner_p.h>
#include <akabeibackend.h>
#include <akabeilog.h>
#include <QEventLoop>
#include <QDebug>
#include "akabeilog.h"
namespace Akabei {
......
......@@ -12,10 +12,10 @@
#ifndef AKABEIOPERATION_H
#define AKABEIOPERATION_H
#include <QtCore/QObject>
#include <QObject>
#include "akabeicore_global.h"
#include "akabeierror.h"
#include <akabeicore_global.h>
#include <akabeierror.h>
class QUuid;
class QStringList;
......
......@@ -11,12 +11,13 @@
#ifndef AKABEIOPERATION_P_H
#define AKABEIOPERATION_P_H
#include "akabeioperation.h"
#include <akabeioperation.h>
#include <QWeakPointer>
#include <QtCore/QHash>
#include <qmetaobject.h>
#include <QtCore/QUuid>