CFLAGS = -Wall -g -O2
-LDLIBS = -lexpat -lz -g -lrpm
+LDLIBS = -lexpat -lz -g -lrpm -lcurl
razor : razor.o import.o sha1.o main.o
-import : razor primary.xml.gz
- zcat primary.xml.gz | ./razor import-yum
-
-primary.xml.gz :
- wget http://download.fedora.redhat.com/pub/fedora/linux/development/i386/os/repodata/primary.xml.gz
-
clean :
rm -f *.o razor
- merge file lists when merging package sets
-- import filelist.xml.gz too in yum importer
-
- download (libcurl?)
- figure out how to canonically represent empty string... ~0?
maybe the effective set is the on-disk representation and the
overlay can be computed when needed, we just keep a link back to the
base.
+
+- incremental rawhide repo updates? instead of downloading 10MB zipped
+ repo every time, download a diff repo?
+++ /dev/null
-#!/bin/sh
-
-import_rpm() {
- echo "<package name=\"$1\" version=\"$2\" build=\"$3\">"
- echo " <properties>"
-
- rpm -q --provides $p | sort -u | while read name ignore version; do
- if test -z $version; then
- echo " <provides name=\"$name\"/>"
- else
- echo " <provides name=\"$name\" version=\"$version\"/>"
- fi
- done
-
- rpm -q --requires $p | sort -u | while read name ignore version; do
- if test -z $version; then
- echo " <requires name=\"$name\"/>"
- else
- echo " <requires name=\"$name\" version=\"$version\"/>"
- fi
- done
-
- echo " </properties>"
- echo "</package>"
-}
-
-mkdir -p pkgs
-rpm -qa | while read p; do
- name=${p%-*-*}
- vr=${p#$name-}
- version=${vr%-*}
- release=${vr#*-}
-
- echo $name - $version - $release
- import_rpm $name $version $release > pkgs/$name.rzr
-done
#include <string.h>
#include <unistd.h>
+#include <curl/curl.h>
#include "razor.h"
static const char *repo_filename = "system.repo";
return 0;
}
+#define REPO_URL "http://download.fedora.redhat.com" \
+ "/pub/fedora/linux/development/i386/os/repodata"
+
static int
command_import_yum(int argc, const char *argv[])
{
struct razor_set *set;
+ CURL *curl;
+ CURLcode res;
+ FILE *fp;
+
+ curl = curl_easy_init();
+ if (curl == NULL)
+ return 1;
+
+ curl_easy_setopt(curl, CURLOPT_NOPROGRESS, 0);
+ fp = fopen("primary.xml.gz", "w");
+ curl_easy_setopt(curl, CURLOPT_WRITEDATA, fp);
+ curl_easy_setopt(curl, CURLOPT_URL, REPO_URL "/primary.xml.gz");
+ res = curl_easy_perform(curl);
+ fclose(fp);
+
+ fp = fopen("filelists.xml.gz", "w");
+ curl_easy_setopt(curl, CURLOPT_WRITEDATA, fp);
+ curl_easy_setopt(curl, CURLOPT_URL, REPO_URL "/filelists.xml.gz");
+ res = curl_easy_perform(curl);
+ fclose(fp);
+
+ curl_easy_cleanup(curl);
set = razor_set_create_from_yum();
if (set == NULL)