Git-Url: http://git.frugalware.org/gitweb/gitweb.cgi?p=pacman-g2.git;a=commitdiff;h=db3d88d44fd48aa821a269b33aa602a33c7ffabc
commit db3d88d44fd48aa821a269b33aa602a33c7ffabc Author: Michel Hermier <[email protected]> Date: Sat Nov 9 08:04:15 2013 +0100 libpacman: Merge backup.{c,h} in package.{c,h}, it contained only one method that was hidding the fact it was acting on list instead of package. diff --git a/lib/libpacman/Makefile.am b/lib/libpacman/Makefile.am index 5b2197a..33af0f2 100644 --- a/lib/libpacman/Makefile.am +++ b/lib/libpacman/Makefile.am @@ -43,7 +43,6 @@ TARGETS = \ conflict.c \ deps.c \ versioncmp.c \ - backup.c \ packages_transaction.c \ trans.c \ trans_sysupgrade.c \ diff --git a/lib/libpacman/add.c b/lib/libpacman/add.c index 838299e..1f1cd13 100644 --- a/lib/libpacman/add.c +++ b/lib/libpacman/add.c @@ -54,7 +54,6 @@ #include "cache.h" #include "deps.h" #include "versioncmp.h" -#include "backup.h" #include "package.h" #include "db.h" #include "conflict.h" diff --git a/lib/libpacman/backup.c b/lib/libpacman/backup.c deleted file mode 100644 index 71858e6..0000000 --- a/lib/libpacman/backup.c +++ /dev/null @@ -1,71 +0,0 @@ -/* - * backup.c - * - * Copyright (c) 2005 by Judd Vinet <[email protected]> - * Copyright (c) 2005 by Aurelien Foret <[email protected]> - * Copyright (c) 2005 by Christian Hamar <[email protected]> - * Copyright (c) 2006 by Miklos Vajna <[email protected]> - * - * 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. - */ - -#include "config.h" -#include <stdlib.h> -#include <string.h> - -/* pacman-g2 */ -#include "backup.h" - -#include "util/list.h" -#include "util.h" - -/* Look for a filename in a pmpkg_t.backup list. If we find it, - * then we return the md5 or sha1 hash (parsed from the same line) - */ -char *_pacman_needbackup(const char *file, const pmlist_t *backup) -{ - const pmlist_t *lp; - - if(_pacman_strempty(file) || backup == NULL) { - return(NULL); - } - - /* run through the backup list and parse out the md5 or sha1 hash for our file */ - for(lp = backup; lp; lp = lp->next) { - char *str = strdup(lp->data); - char *ptr; - - /* tab delimiter */ - ptr = strchr(str, '\t'); - if(ptr == NULL) { - free(str); - continue; - } - *ptr = '\0'; - ptr++; - /* now str points to the filename and ptr points to the md5 or sha1 hash */ - if(!strcmp(file, str)) { - char *hash = strdup(ptr); - free(str); - return hash; - } - free(str); - } - - return(NULL); -} - -/* vim: set ts=2 sw=2 noet: */ diff --git a/lib/libpacman/backup.h b/lib/libpacman/backup.h deleted file mode 100644 index 605f195..0000000 --- a/lib/libpacman/backup.h +++ /dev/null @@ -1,30 +0,0 @@ -/* - * backup.h - * - * Copyright (c) 2002-2006 by Judd Vinet <[email protected]> - * - * 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 _PACMAN_BACKUP_H -#define _PACMAN_BACKUP_H - -#include "pacman.h" - -char *_pacman_needbackup(const char *file, const pmlist_t *backup); - -#endif /* _PACMAN_BACKUP_H */ - -/* vim: set ts=2 sw=2 noet: */ diff --git a/lib/libpacman/package.c b/lib/libpacman/package.c index 2703c1b..8913155 100644 --- a/lib/libpacman/package.c +++ b/lib/libpacman/package.c @@ -520,4 +520,40 @@ int _pacman_pkg_filename(char *str, size_t size, const pmpkg_t *pkg) pkg->name, pkg->version, pkg->arch, PM_EXT_PKG); } +/* Look for a filename in a pmpkg_t.backup list. If we find it, + * then we return the md5 or sha1 hash (parsed from the same line) + */ +char *_pacman_needbackup(const char *file, const pmlist_t *backup) +{ + const pmlist_t *lp; + + if(_pacman_strempty(file) || backup == NULL) { + return(NULL); + } + + /* run through the backup list and parse out the md5 or sha1 hash for our file */ + for(lp = backup; lp; lp = lp->next) { + char *str = strdup(lp->data); + char *ptr; + + /* tab delimiter */ + ptr = strchr(str, '\t'); + if(ptr == NULL) { + free(str); + continue; + } + *ptr = '\0'; + ptr++; + /* now str points to the filename and ptr points to the md5 or sha1 hash */ + if(!strcmp(file, str)) { + char *hash = strdup(ptr); + free(str); + return hash; + } + free(str); + } + + return(NULL); +} + /* vim: set ts=2 sw=2 noet: */ diff --git a/lib/libpacman/package.h b/lib/libpacman/package.h index be3cb34..287aeb7 100644 --- a/lib/libpacman/package.h +++ b/lib/libpacman/package.h @@ -108,6 +108,7 @@ void *_pacman_pkg_getinfo(pmpkg_t *pkg, unsigned char parm); pmlist_t *_pacman_pkg_getowners(char *filename); int _pacman_pkg_filename(char *str, size_t size, const pmpkg_t *pkg); +char *_pacman_needbackup(const char *file, const pmlist_t *backup); #endif /* _PACMAN_PACKAGE_H */ diff --git a/lib/libpacman/pacman.c b/lib/libpacman/pacman.c index 31f0a31..5044534 100644 --- a/lib/libpacman/pacman.c +++ b/lib/libpacman/pacman.c @@ -54,7 +54,6 @@ #include "db.h" #include "cache.h" #include "conflict.h" -#include "backup.h" #include "add.h" #include "remove.h" #include "sync.h" diff --git a/lib/libpacman/remove.c b/lib/libpacman/remove.c index 4ef2da1..ecfd930 100644 --- a/lib/libpacman/remove.c +++ b/lib/libpacman/remove.c @@ -51,7 +51,6 @@ #include "error.h" #include "deps.h" #include "versioncmp.h" -#include "backup.h" #include "package.h" #include "db.h" #include "cache.h" _______________________________________________ Frugalware-git mailing list [email protected] http://frugalware.org/mailman/listinfo/frugalware-git
