2015-05-27

Slitaz -- cookutils / bundle.tar.lzma / IDs


Getting "bundle.tar.lzma"...

1.
root@slitaz:/home/tux# tazpkg recharge

Recharging repository "Main"
================================================================================
Database timestamp: 05/24/2015 00:01
Creating backup of the last packages list...                           [ Failed ]
Getting "bundle.tar.lzma"...                                                     [ Done ]
Getting "files-list.lzma"...                                                         [ Done ]
================================================================================
Last database is ready to use.


2.
root@slitaz:/home/tux# ls -l /var/lib/tazpkg/ID*
-rw-r--r--    1 root     root            33 May 25  2015 /var/lib/tazpkg/ID
-rw-r--r--    1 root     root            44 May 25  2015 /var/lib/tazpkg/IDs

root@slitaz:/home/tux# cat /var/lib/tazpkg/ID*
28b4d51b105dfca6be5201742bc78de5
28b4d51b105dfca6be5201742bc78de5 1432425688

root@slitaz:/home/tux# date -d @1432425688
Sun May 24 00:01:28 UTC 2015
root@slitaz:/home/tux#


3.
cookutils changeset 725:2cf877e5b167

http://hg.slitaz.org/cookutils/raw-rev/2cf877e5b167
# HG changeset patch
# User Aleksej Bobylev <al.bobylev@gmail.com>
# Date 1430654849 -10800
# Node ID 2cf877e5b1677e2c7d6a3870bf4cc1985dab3ee2
# Parent  851a2b8075dc6c67c36ddec39e2e7b60470f2bd6
cook pkgdb: provide new mechanism of recharging: IDs contains "old" ID plus timestamp, bundle.tar.lzma contains all "old" recharge files plus files.list.md5 to determine whether to download massive files.list.lzma or not.

diff -r 851a2b8075dc -r 2cf877e5b167 cook
--- a/cook    Fri Apr 17 14:10:59 2015 +0200
+++ b/cook    Sun May 03 15:07:29 2015 +0300
@@ -1348,20 +1348,26 @@
         echo "cook:pkgdb" > $command
         _ "Cook pkgdb: Creating all packages lists" | log
         newline; _ "Creating lists for: \$PKGS"; separator
+
         datenow=$(date "$(_ '+%Y-%m-%d %H:%M')")
         _ "Cook pkgdb started: \$datenow"
+
         cd $PKGS
         rm -f packages.* extra.list
         ln -s ../get.list extra.list
+
         _ "Creating: packages.list"
         ls -1 *.tazpkg | sed s'/.tazpkg//' > $PKGS/packages.list
+
         _ "Creating: packages.md5"
         md5sum *.tazpkg > $PKGS/packages.md5
+
         md5sum packages.md5 | cut -f1 -d' ' > ID
+        ( cat ./ID | tr $'\n' ' '; date -ur ./ID +%s ) > IDs    # md5 and timestamp
+
         _ "Creating lists from: \$WOK"
         cd $WOK
-        for pkg in *
-        do
+        for pkg in *; do
             unset_receipt
             . $pkg/receipt
             # PACKED_SIZE and UNPACKED_SIZE are only in built receipt
@@ -1420,15 +1426,25 @@
         # files.list.lzma
         _ "Creating: files.list.lzma"
         touch $PKGS/files.list
-        cd $PKGS; lzma e files.list files.list.lzma
-        rm -f files.list
+        # Pre-sorting filenames causes 10% smaller resulting lzma file
+        cat $PKGS/files.list | sort -k2 -o $PKGS/files.list.sorted
+        cd $PKGS; lzma e files.list.sorted files.list.lzma
+        rm -f files.list files.list.sorted
+
+        md5sum files.list.lzma | cut -d' ' -f1 | tr -d $'\n' > files.list.md5

         # packages.info.lzma
         PI=packages.info
         _ 'Creating: packages.info.lzma'
         touch $PKGS/$PI
         cd $PKGS; lzma e $PI $PI.lzma
-        rm -f $PI
+
+        # Make bundle to fast recharge
+        _ 'Creating: bundle.tar.lzma'
+        [ -f bundle.tar.lzma ] && rm bundle.tar.lzma
+        busybox tar -caf bundle.tar.lzma \
+            extra.list mirrors files.list.md5 packages.info \
+            packages.desc packages.md5 packages.txt packages.list packages.equiv

         # Display some info.
         separator