侠义书生 před 3 roky
rodič
revize
c547e85754

+ 95 - 0
debootstrap/apt_list/package.list.md

@@ -0,0 +1,95 @@
+# libpam-runtime
+
+```yml
+Package: libpam-runtime
+Source: pam
+Version: 1.3.1-5kylin4k33
+Architecture: all
+Maintainer: Ubuntu Developers <ubuntu-devel-discuss@lists.ubuntu.com>
+Installed-Size: 1056
+Depends: debconf (>= 0.5) | debconf-2.0, debconf (>= 1.5.19) | cdebconf, libpam-modules (>= 1.0.1-6)
+Conflicts: libpam0g-util
+Replaces: libpam0g-dev, libpam0g-util
+Multi-Arch: foreign
+Homepage: http://www.linux-pam.org/
+Priority: required
+Section: admin
+Filename: pool/main/p/pam/libpam-runtime_1.3.1-5kylin4k33_all.deb
+Size: 197476
+SHA256: 43286ce32d94888fb0f656571f19cc64e2f5ad63cfa51f573cd3449c1490b240
+SHA1: 792f5425561ea09ad6a88fcd3f543ae699c8200f
+MD5sum: 1db25a10bc69c4771689356226585795
+Description: Runtime support for the PAM library
+  Contains configuration files and  directories required for
+  authentication  to work on Debian systems.  This package is required
+  on almost all installations.
+Original-Maintainer: Steve Langasek <vorlon@debian.org>
+```
+
+# mawk
+
+```yml
+Package: mawk
+Version: 1.3.4.20200120-2kylin1k1
+Architecture: amd64
+Maintainer: Ubuntu Developers <ubuntu-devel-discuss@lists.ubuntu.com>
+Original-Maintainer: Boyuan Yang <byang@debian.org>
+Installed-Size: 233
+Depends: libc6 (>= 2.29)
+Provides: awk
+Multi-Arch: foreign
+Homepage: https://invisible-island.net/mawk/
+Priority: required
+Section: interpreters
+Filename: pool/main/m/mawk/mawk_1.3.4.20200120-2kylin1k1_amd64.deb
+Size: 101300
+SHA256: 04e6633e4a5e7e256e94add3ab75b2c4d25840688d0adb8edafee61d3855e964
+SHA1: 6dda82f8931ef51e58ad4c5cf0732d6e97e893e2
+MD5sum: 7176351749ee6e28f8a98467c0b37db9
+Description: Pattern scanning and text processing language
+  Mawk is an interpreter for the AWK Programming Language. The AWK
+  language is useful for manipulation of data files, text retrieval and
+  processing, and for prototyping and experimenting with algorithms. Mawk
+  is a new awk meaning it implements the AWK language as defined in Aho,
+  Kernighan and Weinberger, The AWK Programming Language, Addison-Wesley
+  Publishing, 1988. (Hereafter referred to as the AWK book.) Mawk conforms
+  to the POSIX 1003.2 (draft 11.3) definition of the AWK language
+  which contains a few features not described in the AWK book, and mawk
+  provides a small number of extensions.
+  .
+  Mawk is smaller and much faster than gawk. It has some compile-time
+  limits such as NF = 32767 and sprintf buffer = 1020.
+```
+
+# perl-base
+
+```yml
+Package: perl-base
+Source: perl
+Version: 5.30.0-9build1kylin0k2
+Architecture: amd64
+Essential: yes
+Maintainer: Niko Tyni <ntyni@debian.org>
+Installed-Size: 10778
+Pre-Depends: libc6 (>= 2.29), libcrypt1 (>= 1:4.1.0), libkysec, dpkg (>= 1.17.17)
+Suggests: perl, sensible-utils
+Conflicts: defoma (<< 0.11.12), doc-base (<< 0.10.3), mono-gac (<< 2.10.8.1-3), safe-rm (<< 0.8), update-inetd (<< 4.41)
+Breaks: amanda-common (<< 1:3.3.9-2), backuppc (<< 3.3.1-2), debconf (<< 1.5.61), dh-haskell (<< 0.3), intltool (<< 0.51.0-4), libexception-class-perl (<< 1.42), libfile-path-perl (<< 2.16), libfile-spec-perl (<< 3.7800), libfile-temp-perl (<< 0.2309), libio-socket-ip-perl (<< 0.39), libsbuild-perl (<< 0.67.0-1), libscalar-list-utils-perl (<< 1:1.50), libsocket-perl (<< 2.027), libxsloader-perl (<< 0.30), mailagent (<< 1:3.1-81-2), perl (<< 5.30.0~), perl-modules (<< 5.30.0~), slic3r (<< 1.2.9+dfsg-6.1), slic3r-prusa (<< 1.37.0+dfsg-1.1), texinfo (<< 6.1.0.dfsg.1-8)
+Replaces: libfile-path-perl (<< 2.16), libfile-temp-perl (<< 0.2309), libio-socket-ip-perl (<< 0.39), libscalar-list-utils-perl (<< 1:1.50), libsocket-perl (<< 2.027), libxsloader-perl (<< 0.30), perl (<< 5.10.1-12), perl-modules (<< 5.20.1-3)
+Provides: libfile-path-perl (= 2.16), libfile-temp-perl (= 0.2309), libio-socket-ip-perl (= 0.39), libscalar-list-utils-perl (= 1:1.50), libsocket-perl (= 2.027), libxsloader-perl (= 0.30), perlapi-5.30.0
+Homepage: http://dev.perl.org/perl5/
+Priority: required
+Section: perl
+Filename: pool/main/p/perl/perl-base_5.30.0-9build1kylin0k2_amd64.deb
+Size: 1576540
+SHA256: 26304da5223e39c6345d136d0bfe583708afa0fe356723c01e4ff54fc2c42f52
+SHA1: 489b7679efc67bb481b8f5227b6de3053774ae8b
+MD5sum: 3d892f2b8bf376eeca153a5e96d7e08e
+Description: minimal Perl system
+  Perl is a scripting language used in many system scripts and utilities.
+  .
+  This package provides a Perl interpreter and the small subset of the
+  standard run-time library required to perform basic tasks. For a full
+  Perl installation, install "perl" (and its dependencies, "perl-modules-5.30"
+  and "perl-doc").
+```

+ 56 - 108
debootstrap/apt_list/test2.sh

@@ -12,95 +12,34 @@ mylog() {
     fi
 }
 
-mylog2() {
-    echo "---> $@" >>${MY_LOG_FILE}
-}
-
 # 查找依赖 pkgname 的包
-function t1() {
+function find_who_depend() {
     pkgname="bash"
-    result=$(awk -v SEARCH_STR="${pkgname}" -f depends.awk /var/tmp/indices/172.29.220.242/mirror/kylin/dists/v101/main/binary-amd64/Packages)
-    # echo "${result}"
-}
-
-# 查找 Priority 对应的包
-function t2() {
-    PRIO="required"
-    required=$(awk -v SEARCH_STR="${PRIO}" -f analysis.awk /var/tmp/indices/172.29.220.242/mirror/kylin/dists/v101/main/binary-amd64/Packages)
-    mylog "01-required.txt2" "${required}"
-
-    PRIO="important"
-    base=$(awk -v SEARCH_STR="${PRIO}" -f analysis.awk /var/tmp/indices/172.29.220.242/mirror/kylin/dists/v101/main/binary-amd64/Packages)
-    mylog "02-important.txt2" "${base}"
+    result=$(awk -v SEARCH_STR="${pkgname}" -f depends.awk ${TARGET_DIR}/172.29.220.242/mirror/kylin/dists/v101/main/binary-amd64/Packages)
+    echo "${result}"
 }
 
-# apt list 分析
-function t3() {
-    MIRROR="/var/tmp/indices/172.29.220.242/mirror/kylin/dists"
-
-    # analysis.sh --repo ${MIRROR} --prio required | awk '{print $1}' |
-    #     xargs -i analysis.sh --repo ${MIRROR} --pkg {} |
-    #     grep -E "^Depends:|^Pre-Depends" | sed 's/^.*Depends://' | tr ',' '\n' | tr '|' '\n' | sed 's#(.*)##g' | xargs | tr ' ' '\n' | sort | uniq
+# 获取依赖
+function get_deps() {
+    ## 带有 | 的包
+    # tr ',' '\n' | tr '|' '\n' | sed 's#(.*)##g' | xargs | tr ' ' '\n' | sort | uniq
+    ## 去除 | 后面的包
+    # tr ',' '\n' | sed 's/|.*//' | sed 's#(.*)##g' | xargs | tr ' ' '\n' | sort | uniq
 
-    analysis.sh --repo ${MIRROR} --prio required | awk '{print $1}' |
-        xargs -i analysis.sh --repo ${MIRROR} --pkg {} |
+    analysis.sh --repo "${TARGET_DIR}/172.29.220.242/mirror/kylin/dists" --prio required | awk '{print $1}' |
+        xargs -i analysis.sh --repo "${TARGET_DIR}/172.29.220.242/mirror/kylin/dists" --pkg {} |
         grep -E "^Depends:|^Pre-Depends" | sed 's/^.*Depends://' |
-        tr ',' '\n' | sed 's/|.*//' | sed 's#(.*)##g' | xargs | tr ' ' '\n' | sort | uniq >/var/tmp/newpkgs.txt1
+        tr ',' '\n' | sed 's/|.*//' | sed 's#(.*)##g' | xargs | tr ' ' '\n' | sort | uniq |
+        >/var/tmp/newpkgs.txt1
 }
 
-# 查找单个包
-function t4() {
+# 单个包的依赖
+function get_pkg_deps() {
     . analysis.sh
-    analysis_sigle_file2 /var/tmp/indices/172.29.220.242/mirror/kylin/dists/v101/main/binary-amd64/Packages libpam-runtime |
-        grep -E "^Depends:|^Pre-Depends" | sed 's/^.*Depends://' | tr ',' '\n' | sed 's/|.*//' | sed 's#(.*)##g' | xargs | tr ' ' '\n' | sort | uniq
-}
-
-pkgdetails_field() {
-    # uniq field mirror Packages values...
-    perl -le '
-$unique = shift @ARGV; $field = lc(shift @ARGV); $mirror = shift @ARGV;
-%fields = map { $_, 0 } @ARGV;
-$prevpkg = "";
-$chksumfield = lc($ENV{DEBOOTSTRAP_CHECKSUM_FIELD}).":";
-while (<STDIN>) {
-	if (/^([^:]*:)\s*(.*)$/) {
-		$f = lc($1); $v = $2;
-		if ($f eq "package:") {
-			$last = 0;
-			$pkg = $v;
-			if ($pkg ne $prevpkg) {
-				print $output if defined $output;
-				if ($unique && defined $output_val) {
-					delete $fields{$output_val};
-					$last = 1 unless keys %fields;
-				}
-				$prevpkg = $pkg;
-			}
-			undef $output;
-			undef $output_val;
-			last if $last;
-		}
-		$ver = $v if ($f eq "version:");
-		$arc = $v if ($f eq "architecture:");
-		$fil = $v if ($f eq "filename:");
-		$chk = $v if ($f eq $chksumfield);
-		$siz = $v if ($f eq "size:");
-		$val = $v if ($f eq $field);
-	} elsif (/^$/) {
-		if (defined $val && defined $fields{$val}) {
-			$output = sprintf "%s %s %s %s %s %s %s",
-			 $pkg, $ver, $arc, $mirror, $fil, $chk, $siz;
-			$output_val = $val;
-		}
-		undef $val;
-	}
-}
-print $output if defined $output;
-delete $fields{$output_val} if $unique && defined $output_val;
-for $v (keys %fields) {
-	printf ("%s -\n", $v) if ($unique);
-}
-' "$@"
+    pkgname="libpam-runtime"
+    analysis_sigle_file2 ${TARGET_DIR}/172.29.220.242/mirror/kylin/dists/v101/main/binary-amd64/Packages ${pkgname} |
+        grep -E "^Depends:|^Pre-Depends" | sed 's/^.*Depends://' |
+        tr ',' '\n' | sed 's/|.*//' | sed 's#(.*)##g' | xargs | tr ' ' '\n' | sort | uniq
 }
 
 without() {
@@ -112,23 +51,23 @@ without() {
     echo
 }
 
-resolve_deps() {
-    MIRROR="/var/tmp/indices/172.29.220.242/mirror/kylin/dists"
+# 从 文件1 中排除 文件2
+without2() {
+    (
+        cat $1
+        cat $2
+        cat $2
+    ) | sort | uniq -u | tr '\n' ' '
+}
 
+resolve_deps() {
     local PKGS="$*"
     local ALLPKGS="$PKGS"
     local ALLPKGS2=""
     while [ "$PKGS" != "" ]; do
+        # 查找依赖包
         local NEWPKGS=""
-        # for s in $SUITE $EXTRA_SUITES; do
-        #     for c in ${COMPONENTS:-$(echo ${USE_COMPONENTS} | tr '|' ' ')}; do
-        #         local path="dists/$s/$c/binary-$ARCH/Packages"
-        #         local pkgdest="${TARGET_DIR}/172.29.220.242/mirror/kylin/dists/v101/main/binary-amd64/Packages"
-        #         NEWPKGS="$NEWPKGS $(pkgdetails_perl GETDEPS "$pkgdest" $PKGS)"
-        #     done
-        # done
-
-        NEWPKGS=$(echo "${PKGS}" | tr ' ' '\n' | xargs -i analysis.sh --repo ${MIRROR} --pkg {} |
+        NEWPKGS=$(echo "${PKGS}" | tr ' ' '\n' | xargs -i analysis.sh --repo "${TARGET_DIR}/172.29.220.242/mirror/kylin/dists" --pkg {} |
             grep -E "^Depends:|^Pre-Depends" | sed 's/^.*Depends://' |
             tr ',' '\n' | sed 's/|.*//' | sed 's#(.*)##g' | xargs | tr ' ' '\n' | sort | uniq)
 
@@ -136,19 +75,20 @@ resolve_deps() {
 
         PKGS=$(echo "$PKGS $NEWPKGS" | tr ' ' '\n' | sort | uniq)
 
+        # 真实的包
         local REALPKGS=""
-        # for s in $SUITE $EXTRA_SUITES; do
-        #     for c in ${COMPONENTS:-$(echo ${USE_COMPONENTS} | tr '|' ' ')}; do
-        #         local path="dists/$s/$c/binary-$ARCH/Packages"
-        #         local pkgdest="${TARGET_DIR}/172.29.220.242/mirror/kylin/dists/v101/main/binary-amd64/Packages"
-        #         REALPKGS="$REALPKGS $(pkgdetails_perl PKGS REAL "$pkgdest" $PKGS | sed -n 's/ .*REAL.*$//p')"
-        #     done
-        # done
-
         p="${TARGET_DIR}/172.29.220.242/mirror/kylin/dists/v101/main/binary-amd64/Packages"
-        m="REAL"
-        REALPKGS="$REALPKGS $(LC_ALL=C egrep '^$|^Architecture:|^Filename:|^MD5sum:|^Package:|^Priority:|^SHA256:|^Size:|^Version:|^Depends:|^Pre-Depends:' "$p" |
-            pkgdetails_field 1 Package: "$m" $PKGS | sed -n 's/ .*REAL.*$//p')"
+        for i in $PKGS; do
+            if grep -q "^Package: ${i}$" ${p}; then
+                # echo ${i}
+                if [ -n "${REALPKGS}" ]; then
+                    REALPKGS="${REALPKGS} ${i}"
+                else
+                    REALPKGS="${i}"
+                fi
+            fi
+        done
+
         mylog "realpkgs.txt2" "$(echo ${REALPKGS} | xargs | tr ' ' '\n')"
 
         PKGS="$REALPKGS"
@@ -161,15 +101,23 @@ resolve_deps() {
 }
 
 TARGET_DIR="/var/tmp/indices"
-
 SHELL_DIR=$(dirname $(readlink -f $0))
 
-# PRIO="required"
-# required=$(awk -v SEARCH_STR="${PRIO}" -f ${SHELL_DIR}/analysis.awk /var/tmp/indices/172.29.220.242/mirror/kylin/dists/v101/main/binary-amd64/Packages)
-# required_deps=$(resolve_deps "${required}")
-# mylog "01-required@deps.txt2" "$(echo ${required_deps} | xargs | tr ' ' '\n')"
+# bash包依赖
+# resolve_deps bash
+
+PRIO="required"
+required=$(awk -v SEARCH_STR="${PRIO}" -f ${SHELL_DIR}/analysis.awk ${TARGET_DIR}/172.29.220.242/mirror/kylin/dists/v101/main/binary-amd64/Packages)
+mylog "01-required.txt2" "${required}"
+
+required_deps=$(resolve_deps "${required}")
+mylog "01-required@deps.txt2" "$(echo ${required_deps} | xargs | tr ' ' '\n')"
 
 PRIO="important"
-important=$(awk -v SEARCH_STR="${PRIO}" -f ${SHELL_DIR}/analysis.awk /var/tmp/indices/172.29.220.242/mirror/kylin/dists/v101/main/binary-amd64/Packages)
+important=$(awk -v SEARCH_STR="${PRIO}" -f ${SHELL_DIR}/analysis.awk ${TARGET_DIR}/172.29.220.242/mirror/kylin/dists/v101/main/binary-amd64/Packages)
+mylog "02-important.txt2" "${important}"
+
 important_deps=$(resolve_deps "${important}")
 mylog "02-important@deps.txt2" "$(echo ${important_deps} | xargs | tr ' ' '\n')"
+
+echo "${required_deps} ${important_deps}"

+ 1 - 1
debootstrap/my_debootstrap.sh

@@ -314,7 +314,7 @@ for $v (keys %fields) {
 }
 
 pkgdetails_perl() {
-    mylog2 "$@"
+    # mylog2 "$@"
     if [ "$1" = "WGET%" ]; then
         shift
         perl -e '