summaryrefslogtreecommitdiff
path: root/import-rpm.sh
blob: 37eb5377f19e6f2f56dc96a45dac59232384b339 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#!/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