summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorAaron Griffin <aaron@archlinux.org>2006-10-16 00:25:42 +0200
committerAaron Griffin <aaron@archlinux.org>2006-10-16 00:25:42 +0200
commit6f46645e772563f05836838c8a787c4ea4b20f27 (patch)
tree3ff36a23622f384aa091d5264261c6bf1b701662 /src
parent416d576ced9887038539d983301c1e82e30c4740 (diff)
downloadpacman-6f46645e772563f05836838c8a787c4ea4b20f27.tar.gz
pacman-6f46645e772563f05836838c8a787c4ea4b20f27.tar.xz
Removed convertdb
Diffstat (limited to 'src')
-rw-r--r--src/util/Makefile.am2
-rw-r--r--src/util/convertdb.c148
2 files changed, 0 insertions, 150 deletions
diff --git a/src/util/Makefile.am b/src/util/Makefile.am
index 8fd81471..5f30f3ef 100644
--- a/src/util/Makefile.am
+++ b/src/util/Makefile.am
@@ -5,7 +5,5 @@ AM_CFLAGS = \
-I$(top_srcdir)/src/pacman
vercmp_SOURCES = vercmp.c
-convertdb_SOURCES = convertdb.c
vercmp_LDADD = $(top_srcdir)/lib/libalpm/libalpm.la
-convertdb_LDADD = $(top_srcdir)/lib/libalpm/libalpm.la
diff --git a/src/util/convertdb.c b/src/util/convertdb.c
deleted file mode 100644
index 3fe3de83..00000000
--- a/src/util/convertdb.c
+++ /dev/null
@@ -1,148 +0,0 @@
-/*
- * convertdb.c
- *
- * Copyright (c) 2002-2006 by Judd Vinet <jvinet@zeroflux.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.
- *
- * 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 <stdio.h>
-#include <stdlib.h>
-#include <ctype.h>
-#include <limits.h>
-#include <string.h>
-#include <libgen.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <unistd.h>
-
-#include <alpm.h>
-#include <list.h>
-#include <util.h>
-
-/*#ifndef PATH_MAX
-#define PATH_MAX 512
-#endif*/
-
-int main(int argc, char* argv[])
-{
- FILE* db = NULL;
- FILE* fp = NULL;
- char* ptr = NULL;
- char name[256];
- char ver[256];
- char line[PATH_MAX+1];
- char topdir[PATH_MAX+1];
- char path[PATH_MAX+1];
- mode_t oldumask;
- struct stat buf;
- char dbdir[PATH_MAX];
-
- sprintf(dbdir, "/%s", PM_DBPATH);
-
- if(argc < 2) {
- printf("converts a pacman 1.x database to a pacman 2.0 format\n");
- printf("usage: %s <target_dir>\n\n", basename(argv[0]));
- printf("convertdb will convert all package data from /var/lib/pacman/pacman.db\n");
- printf("to a 2.0 format and place it in target_dir.\n\n");
- return(0);
- }
-
- db = fopen(dbdir, "r");
- if(db == NULL) {
- perror(dbdir);
- return(1);
- }
-
- oldumask = umask(0000);
- while(fgets(name, 255, db)) {
- PMList *backup = NULL;
- PMList *lp;
-
- if(!fgets(ver, 255, db)) {
- perror(dbdir);
- return(1);
- }
- _alpm_strtrim(name);
- _alpm_strtrim(ver);
- fprintf(stderr, "converting %s\n", name);
- /* package directory */
- snprintf(topdir, PATH_MAX, "%s/%s-%s", argv[1], name, ver);
- mkdir(topdir, 0755);
-
- /* DESC */
- snprintf(path, PATH_MAX, "%s/desc", topdir);
- if(!(fp = fopen(path, "w"))) {
- perror(path);
- return(1);
- }
- fputs("%NAME%\n", fp);
- fprintf(fp, "%s\n\n", name);
- fputs("%VERSION%\n", fp);
- fprintf(fp, "%s\n\n", ver);
- fputs("%DESC%\n\n", fp);
- fclose(fp);
-
- /* DEPENDS */
- snprintf(path, PATH_MAX, "%s/depends", topdir);
- if(!(fp = fopen(path, "w"))) {
- perror(path);
- return(1);
- }
- fputs("%DEPENDS%\n\n", fp);
- fputs("%REQUIREDBY%\n\n", fp);
- fputs("%CONFLICTS%\n\n", fp);
- fclose(fp);
-
- /* FILES */
- snprintf(path, PATH_MAX, "%s/files", topdir);
- if(!(fp = fopen(path, "w"))) {
- perror(path);
- return(1);
- }
- fputs("%FILES%\n", fp);
- while(fgets(line, 255, db) && strcmp(_alpm_strtrim(line), "")) {
- ptr = line;
-
- /* check for backup designation and frontslashes that shouldn't be there */
- if(line[0] == '*') ptr++;
- if(*ptr == '/') ptr++;
- if(line[0] == '*') backup = _alpm_list_add(backup, strdup(ptr));
-
- fprintf(fp, "%s\n", ptr);
- }
- fprintf(fp, "\n");
- fputs("%BACKUP%\n", fp);
- for(lp = backup; lp; lp = lp->next) {
- /* print the filename and a bad md5 hash. we just use 32 f's cuz we can't
- * md5 the original file since we don't have it
- */
- fprintf(fp, "%s\tffffffffffffffffffffffffffffffff\n", (char*)lp->data);
- }
- fputs("\n", fp);
- fclose(fp);
- snprintf(path, PATH_MAX, "/var/lib/pacman/scripts/%s", name);
- if(!stat(path, &buf)) {
- snprintf(line, PATH_MAX, "/bin/cp %s %s/install", path, topdir);
- system(line);
- }
- _alpm_list_free(backup, free);
- }
- umask(oldumask);
- return(0);
-}
-
-/* vim: set ts=2 sw=2 noet: */