cpp-d1064d i686-linux-gnu-4.7-cross_0.1-1
authorMichael Wagner <michael@wagnertech.de>
Sat, 13 Mar 2021 22:15:45 +0000 (23:15 +0100)
committerMichael Wagner <michael@wagnertech.de>
Sat, 13 Mar 2021 22:15:45 +0000 (23:15 +0100)
bin/load-dependency [new file with mode: 0755]
bin/unpack [new file with mode: 0755]
debian/global.changelog [new file with mode: 0644]
debian/i686-linux-gnu-4.7-cross.changelog [new symlink]
debian/i686-linux-gnu-4.7-cross.control [new file with mode: 0644]
debian/i686-linux-gnu-4.7-cross.cp [new file with mode: 0755]

diff --git a/bin/load-dependency b/bin/load-dependency
new file mode 100755 (executable)
index 0000000..2c6781e
--- /dev/null
@@ -0,0 +1,97 @@
+#!/bin/bash
+set -ex
+
+# Konzept:
+#   - Schiebe Paket in required.ld
+#   - Schleife über Inhalt von required.ld
+#     x Hole Paket
+#     x Packe Abhängigkeiten des Pakets nach dependencies.ld
+#   - Leere required.ld
+#   - Schleife über dependencies.ld
+#     x Ist Paket im Verzeichnis
+#       ja: tunix
+#       nein:
+#         - Ist Paket in required.ld?
+#           ja: tunix
+#           nein: Füge Paket zu required.ld
+#   - Ist required.ld leer?
+#     ja: Ende
+#     nein: springe nach oben
+
+usage="load-dependency [PAKET | DEBFILE]"
+
+function get_deb_name {
+       pkg=$1
+       deb_name=$(ls ${pkg}_*.deb || true) 2>/dev/null
+}
+
+# Lösche Hilfsdateien
+rm dependencies.ld required.ld || true 2>/dev/null
+
+# Prüfe Parameter
+if [ -n "$1" ]
+then
+       if [ "${1##*.}" == "deb" ]
+       then
+               # prüfe deb
+               dpkg-deb -I $1 |grep "Depends:" |sed "s/Depends://" |tr ',' '\n' >> dependencies.ld
+       else
+               # Schiebe Paket in required.ld
+               echo "$1" >required.ld
+       fi
+else
+       echo "Prüfung aller deb files noch nicht implementiert."
+       exit 1
+fi
+
+while true
+do
+       if [ -f required.ld ]
+       then
+               # Schleife über Inhalt von required.ld
+               rm dependencies.ld || true 2>/dev/null
+               while read reqline
+               do
+                       # Hole Paket
+                       pkg_version=$(echo $reqline |sed "s/ (//" |sed "s/= /=/" |sed "s/)//" |sed "s/>.*//")
+                       apt-get download $pkg_version
+                       
+                       # Packe Abhängigkeiten des Pakets nach dependencies.ld
+                       pkg=${pkg_version##=*}
+                       get_deb_name $pkg
+                       dpkg-deb -I $deb_name |grep "Depends:" |sed "s/Depends://" |tr ',' '\n' >> dependencies.ld
+               done <required.ld
+       fi
+
+       # Leere required.ld
+       rm required.ld || true 2>/dev/null
+
+       # Schleife über dependencies.ld
+       while read depline
+       do
+               # Ist Paket im Verzeichnis
+               pkg=$depline
+               get_deb_name $pkg
+               if [ -z "$deb_name" ]
+               then 
+                       # nein:
+                       # Ist Paket in required.ld?
+                       if ! grep "${pkg}_" required.ld 1>/dev/null
+                       then
+                               # nein: Füge Paket zu required.ld
+                               echo $depline >>required.ld
+                       fi
+               fi
+       done <dependencies.ld
+
+       # Ist required.ld leer?
+       if [ ! -f required.ld ]
+       then
+               # ja: Ende
+               echo "finished."
+               exit
+       fi
+       #     nein: springe nach oben
+done
+
+
diff --git a/bin/unpack b/bin/unpack
new file mode 100755 (executable)
index 0000000..0630995
--- /dev/null
@@ -0,0 +1,23 @@
+#!/bin/bash
+
+usage="unpack SOURCE_DIR [TARGET_DIR]"
+
+if [ $# -lt 2 ]
+then
+       echo $usage
+       exit 1
+fi
+
+source_dir=$1
+target_dir=.
+if [ -n "$2" ]
+then
+       target_dir=$2
+fi
+
+for deb in $(ls $source_dir/*.deb)
+do
+       echo "extract $deb"
+       dpkg-deb -x $deb $target_dir
+done
+
diff --git a/debian/global.changelog b/debian/global.changelog
new file mode 100644 (file)
index 0000000..f18b8d0
--- /dev/null
@@ -0,0 +1,4 @@
+cross (0.1-%BUILD%) unstable; urgency=medium
+  * initial version
+ -- Michael Wagner <info@wagnertech.de>  Sun, 22 Jan 2021 20:03:04 +0100
+
diff --git a/debian/i686-linux-gnu-4.7-cross.changelog b/debian/i686-linux-gnu-4.7-cross.changelog
new file mode 120000 (symlink)
index 0000000..af28268
--- /dev/null
@@ -0,0 +1 @@
+global.changelog
\ No newline at end of file
diff --git a/debian/i686-linux-gnu-4.7-cross.control b/debian/i686-linux-gnu-4.7-cross.control
new file mode 100644 (file)
index 0000000..1c32453
--- /dev/null
@@ -0,0 +1,10 @@
+Source: cross
+Section: main
+Priority: optional
+Maintainer: Michael Wagner <michael@wagnertech.de>
+Build-Depends: git, mbuild
+
+Package: i686-linux-gnu-4.7-cross
+Architecture: amd64
+Description: i686-linux-gnu-4.7 cross compiler
+
diff --git a/debian/i686-linux-gnu-4.7-cross.cp b/debian/i686-linux-gnu-4.7-cross.cp
new file mode 100755 (executable)
index 0000000..ad92b41
--- /dev/null
@@ -0,0 +1,5 @@
+#!/bin/bash
+
+mkdir -p $1/opt/cross/i686-linux-gnu-4.7
+rsync -a i686-linux-gnu-4.7 $1/opt/cross
+