Modify

Opened 6 years ago

Closed 6 years ago

#17462 closed enhancement (wontfix)

[webhosting enhancement] provide bsdiff of josm-snapshot jars for low bandwidth connections

Reported by: cmuelle8 Owned by: team
Priority: normal Milestone:
Component: Wiki content Version:
Keywords: josm web hosting bsdiff josm-snapshot jar Cc:

Description

If download size still matters in areas, people may appreciate the availability of bsdiff files, to build josm-latest.jar incrementally based on the file they already have.

Two simple scripts do the job, but they may need some tweaking should they be chosen to be integrated as a cron job on the web hosting service for the josm binaries.

E.g., to produce incremental bsdiff files between all josm-snapshot-*.jar files present in the script's directory and put the results below directory "bsdiff-attic/", this may work:

#!/bin/bash

P=josm-snapshot-

ls -1 ${P}*.jar \
| sort -t- -k3 -n \
| while read
  do
    if [[ -z "$last" ]]
    then last=$REPLY && continue
    fi
    rold=${last%.jar} rold=${rold##*-}
    rnew=${REPLY%.jar} rnew=${rnew##*-}
    last=$REPLY
    if ! [[ -f "${P}${rold}-to-${rnew}.bsdiff" ]]
    then bsdiff ${P}${rold}.jar ${P}${rnew}.jar bsdiff-attic/${P}${rold}-to-${rnew}.bsdiff
         ls -l bsdiff-attic/${P}${rold}-to-${rnew}.bsdiff
    fi
  done

To reproduce a full binary of a specific version from the diffs, on the client side, the following may be used. It is based on the first snapshot, but the script can easily be adjusted to start at another version or simply just the previous one:

#!/bin/bash

P=josm-snapshot-
TMP=/dev/shm/

[[ -z "$1" ]] && echo -e "usage: $0 <rev>\noutputs josm-snapshot-<rev>.jar" && exit


REV=$(ls -1 bsdiff-attic/${P}*.bsdiff \
      | sort -t- -k3 -n \
      | sed -e 's/^.*-to-//;s/\.bsdiff//;' \
      | while read
        do if [[ "$REPLY" -le "$1" ]]
           then echo $REPLY
           fi
        done \
      | tail -1
)

if [[ "$REV" != "$1" ]]
then
  echo "NOTE: ${P}$1.jar unavailable, producing ${P}${REV}.jar instead."
fi


cp -a josm-snapshot-43.jar ${TMP}base.jar

ls -1 bsdiff-attic/${P}*.bsdiff \
| sort -t- -k3 -n \
| sed -ne "1,/-${REV}.bsdiff/ p" \
| while read
  do
     bspatch ${TMP}base.jar ${TMP}patched.jar $REPLY
     mv ${TMP}patched.jar ${TMP}base.jar
  done

mv ${TMP}base.jar ./${P}${REV}.jar

Attachments (0)

Change History (1)

comment:1 by stoecker, 6 years ago

Resolution: wontfix
Status: newclosed

Like the other methods for size reduction nearly nobody would use this.

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain team.
as The resolution will be set.
The resolution will be deleted. Next status will be 'reopened'.

Add Comment


E-mail address and name can be saved in the Preferences .
 
Note: See TracTickets for help on using tickets.