Mailinglist Archive: zypp-commit (301 mails)

< Previous Next >
[zypp-commit] r7531 - /trunk/sat-solver/tools/repo2solv.sh
  • From: matz@xxxxxxxxxxxxxxxx
  • Date: Mon, 15 Oct 2007 02:58:32 -0000
  • Message-id: <20071015025832.6EBBD4565A@xxxxxxxxxxxxxxxx>
Author: matz
Date: Mon Oct 15 04:58:32 2007
New Revision: 7531

URL: http://svn.opensuse.org/viewcvs/zypp?rev=7531&view=rev
Log:
Simple shell script accepting a directory with local repository data,
detecting which type the repo is, and emitting exactly one SOLV file
for the whole thing.

Added:
    trunk/sat-solver/tools/repo2solv.sh   (with props)

Added: trunk/sat-solver/tools/repo2solv.sh
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/sat-solver/tools/repo2solv.sh?rev=7531&view=auto
==============================================================================
--- trunk/sat-solver/tools/repo2solv.sh (added)
+++ trunk/sat-solver/tools/repo2solv.sh Mon Oct 15 04:58:32 2007
@@ -0,0 +1,83 @@
+#! /bin/sh
+# repo2solv
+#
+# give it a directory of a local mirror of a repo and this
+# tries to detect the repo type and generate one SOLV file on stdout
+
+LANG=C
+
+dir="$1"
+cd "$dir" || exit 1
+if test -d repodata; then
+  cd repodata || exit 2
+
+  # This contains a primary.xml* and maybe patches
+  for i in primary.xml*; do
+    case $i in
+      *.gz) cmd="gzip -dc" ;;
+      *.bz2) cmd="bzip2 -dc" ;;
+      *) cmd="cat" ;;
+    esac
+    # only check the first primary.xml*, in case there are more
+    break
+  done
+  primfile="/nonexist"
+  if test -n "$cmd"; then
+    # we have some primary.xml*
+    primfile=`mktemp` || exit 3
+    $cmd $i | rpmmd2solv > $primfile
+  fi
+
+  patchfile="/nonexist"
+  if test -f patches.xml; then
+    patchfile=`mktemp` || exit 3
+    (
+     echo '<patches>'
+     for i in patch-*.xml*; do
+       case $i in
+         *.gz) gzip -dc "$i" ;;
+        *.bz2) bzip2 -dc "$i" ;;
+        *) cat "$i" ;;
+       esac
+     done
+     echo '</patches>'
+    ) | grep -v '\?xml' | patchxml2solv > $patchfile
+  fi
+
+  # Now merge primary and patches
+  if test -s $primfile && test -s $patchfile; then
+    mergesolv $primfile $patchfile
+  elif test -s $primfile; then
+    cat $primfile
+  elif test -s $patchfile; then
+    cat $patchfile
+  fi
+  rm -f $primfile $patchfile
+elif test -d suse/setup/descr; then
+  cd suse/setup/descr || exit 2
+  (
+    # First packages
+    if test -s packages.gz; then
+      gzip -dc packages.gz
+    elif test -s packages.bz2; then
+      bzip2 -dc packages.bz2
+    elif test -s packages; then
+      cat packages
+    fi
+
+    # XXX need to do something with packages.DU and packages.{lang}
+
+    # Now patterns.  Not simply those files matching *.pat{,.gz,bz2},
+    # but only those mentioned in the file 'patterns'
+    if test -f patterns; then
+      for i in `cat patterns`; do
+        test -s "$i" || continue
+        case $i in
+          *.gz) gzip -dc "$i" ;;
+         *.bz2) bzip2 -dc "$i" ;;
+         *) cat "$i" ;;
+       esac
+      done
+    fi
+  ) | susetags2solv
+fi

--
To unsubscribe, e-mail: zypp-commit+unsubscribe@xxxxxxxxxxxx
For additional commands, e-mail: zypp-commit+help@xxxxxxxxxxxx

< Previous Next >
This Thread
  • No further messages