development/dfsimage: Added (BBC micro floppy disk images utility)

Signed-off-by: bedlam <dave@slackbuilds.org>

Signed-off-by: Willy Sudiarto Raharjo <willysr@slackbuilds.org>
This commit is contained in:
B. Watson 2023-05-08 18:26:18 +01:00 committed by Willy Sudiarto Raharjo
parent 67a6accbaa
commit 42cbc93313
No known key found for this signature in database
GPG key ID: 3F617144D7238786
6 changed files with 387 additions and 0 deletions

View file

@ -0,0 +1,10 @@
dfsimage (utility for BBC micro floppy disk images)
dfsimage is a command-line utility and a Python module dedicated to
maintenance of BBC Micro disk image files. These files usually have
extensions .ssd for single sided disk images, or .dsd for double sided
disk images.
dfsimage allows indexing contents of the disk images, importing files
to and exporting from the disk images, and modifying disk images in
place, such as renaming files or changing the disk title.

View file

@ -0,0 +1,69 @@
#!/bin/bash
# Slackware build script for dfsimage
# Written by B. Watson (urchlay@slackware.uk)
# Licensed under the WTFPL. See http://www.wtfpl.net/txt/copying/ for details.
# In theory, the full docs can be generated with Sphinx. However, I'm
# unwilling to make it a dependency. The only thing missing is the API
# doc, which 99% of users would never read anyway. The user's manual
# is the important bit, we install it as a man page.
cd $(dirname $0) ; CWD=$(pwd)
PRGNAM=dfsimage
VERSION=${VERSION:-0.9rc3_20210220_de24cf0}
BUILD=${BUILD:-1}
TAG=${TAG:-_SBo}
PKGTYPE=${PKGTYPE:-tgz}
if [ -z "$ARCH" ]; then
case "$( uname -m )" in
i?86) ARCH=i586 ;;
arm*) ARCH=arm ;;
*) ARCH=$( uname -m ) ;;
esac
fi
if [ ! -z "${PRINT_PACKAGE_NAME}" ]; then
echo "$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE"
exit 0
fi
TMP=${TMP:-/tmp/SBo}
PKG=$TMP/package-$PRGNAM
OUTPUT=${OUTPUT:-/tmp}
# No C, so no C flags. No lib(64)? stuffs needed either.
set -e
rm -rf $PKG
mkdir -p $TMP $PKG $OUTPUT
cd $TMP
rm -rf $PRGNAM-$VERSION
tar xvf $CWD/$PRGNAM-$VERSION.tar.xz
cd $PRGNAM-$VERSION
chown -R root:root .
find -L . -perm /111 -a \! -perm 755 -a -exec chmod 755 {} \+ -o \
\! -perm /111 -a \! -perm 644 -a -exec chmod 644 {} \+
python3 setup.py install --root=$PKG
# Format readme.rst as a man page, not HTML.
patch -p1 < $CWD/man_page.diff
mkdir -p $PKG/usr/man/man1
rst2man.py readme.rst | gzip -9c > $PKG/usr/man/man1/$PRGNAM.1.gz
PKGDOC=$PKG/usr/doc/$PRGNAM-$VERSION
mkdir -p $PKGDOC
sed 's,\r,,' LICENSE > $PKGDOC/LICENSE
cat $CWD/$PRGNAM.SlackBuild > $PKGDOC/$PRGNAM.SlackBuild
mkdir -p $PKG/install
cat $CWD/slack-desc > $PKG/install/slack-desc
cd $PKG
/sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE

View file

@ -0,0 +1,10 @@
PRGNAM="dfsimage"
VERSION="0.9rc3_20210220_de24cf0"
HOMEPAGE="https://github.com/monkeyman79/dfsimage"
DOWNLOAD="https://slackware.uk/~urchlay/src/dfsimage-0.9rc3_20210220_de24cf0.tar.xz"
MD5SUM="bdb14121c1e573632ca34c273d6c816d"
DOWNLOAD_x86_64=""
MD5SUM_x86_64=""
REQUIRES=""
MAINTAINER="B. Watson"
EMAIL="urchlay@slackware.uk"

View file

@ -0,0 +1,47 @@
#!/bin/sh
# Create source tarball from git repo
# There's stuff in here specific to dfsimage, don't use this as a template.
# Note that this script doesn't need to be run as root. It does need to
# be able to write to the current directory it's run from.
# Takes one optional argument, which is the commit or tag to create a
# tarball of. With no arg, HEAD is used.
PRGNAM=dfsimage
CLONE_URL=https://github.com/monkeyman79/dfsimage
set -e
GITDIR=$( mktemp -dt $PRGNAM.git.XXXXXX )
rm -rf $GITDIR
git clone $CLONE_URL $GITDIR
CWD="$( pwd )"
cd $GITDIR
if [ "$1" != "" ]; then
git reset --hard "$1" || exit 1
fi
GIT_SHA=$( git rev-parse --short HEAD )
DATE=$( git log --date=format:%Y%m%d --format=%cd | head -1 )
# Upstream doesn't use tags, but does have a version number.
MAKEVER="$( grep ^VERSION makefile | cut -d= -f2 )"
VERSION=${MAKEVER}_${DATE}_${GIT_SHA}
find . -name .git\* -print0 | xargs -0 rm -rf
cd "$CWD"
rm -rf $PRGNAM-$VERSION $PRGNAM-$VERSION.tar.xz
mv $GITDIR $PRGNAM-$VERSION
tar cvfJ $PRGNAM-$VERSION.tar.xz $PRGNAM-$VERSION
echo
echo "Created tarball: $PRGNAM-$VERSION.tar.xz"
echo "VERSION=$VERSION"

View file

@ -0,0 +1,232 @@
diff -Naur dfsimage/readme.rst dfsimage.patched/readme.rst
--- dfsimage/readme.rst 2023-05-04 17:38:19.198961496 -0400
+++ dfsimage.patched/readme.rst 2023-05-06 01:58:17.771007300 -0400
@@ -1,33 +1,21 @@
+.. |version| replace:: 0.9rc3_20210220_de24cf0
+.. |date| date::
+
========
dfsimage
========
-**BBC Micro Acorn DFS floppy disk image maintenance utility**
-
-This package contains a command-line utility and a Python module dedicated for
-maintenance of **BBC Micro** disk image files. Those files usually have extensions
-*.ssd* - for single sided disk image, or *.dsd* - for double sided disk image.
-
-This package allows indexing contents of the disk images, importing files to and
-exporting from the disk images, modifying disk images in place, such as
-renaming files or changing disk title and transferring data between disk images.
+---------------------------------------------------------
+BBC Micro Acorn DFS floppy disk image maintenance utility
+---------------------------------------------------------
+
+:Manual section: 1
+:Manual group: SlackBuilds.org
+:Date: |date|
+:Version: |version|
-The ``dfsimage`` module also supports *MMB* files. *MMB* files are containers for
-large number of *.ssd* disk images, designed for storing disk images on a
-MMC or SD card. All commands that work with *.ssd* FILES can be also used on a disk
-image contained within an MMB file. Index of a disk image within an MMB file can be
-either specified using `index`__ option, or appended to the MMB file name, following
-a colon character, e.g. ``beeb.mmb:12``. Commands |list|_, |dump|_ and |digest|_ can
-take a range of disk images, e.g. ``beeb.mmb:10-20`` or an entire *MMB* file. In that
-case command will be applied to all *initialized* disk image in the specified range.
-
-There are few commands intended specially for MMB files, such as |donboot|_ or
-|drecat|_.
-
-__ index-opt_
-
-usage
-=====
+SYNOPSIS
+========
.. code-block:: shell-session
@@ -36,121 +24,31 @@
dfsimage --help-options
dfsimage --help-format
-**examples**:
-
-Index all floppy images with contents from the 'images' directory to 'index.json' file
-
-.. code-block:: shell-session
-
- dfsimage index -f json images/*.ssd images/*.dsd > index.json
-
-Covert a linear double sided image to a '.dsd' file
-
-.. code-block:: shell-session
-
- dfsimage convert --from -D -L linear.img --to inter.dsd
-
-Import all files from the 'files' directory to a new image 'games.ssd'
-
-.. code-block:: shell-session
-
- dfsimage import --new games.ssd --title="GAMES" files/*
-
-Export all files from the disk image at index 12 in 'beeb.mmb' file to the 'files' directory
-
-.. code-block:: shell-session
-
- dfsimage export beeb.mmb:12 -o files/
+DESCRIPTION
+===========
-Index all floppy image contents from the 'images' directory to text table file
-
-.. code-block:: shell-session
-
- dfsimage index --only-files -f table images/*.ssd images/*.dsd > files.csv
-
-installation
-============
-
-At this point the package is not yet available in the PyPI repository, so
-it has to be build and installed manually:
-
-Linux
------
-
-Make sure that pip and dependencies are installed.
-If you are running Debian, Ubuntu or derived Linux distribution,
-install the python3-pip package like this.
-
-.. code-block:: shell-session
-
- ~$ sudo apt-get install python3-pip
-
-Upgrade pip to latest version.
-
-.. code-block:: shell-session
-
- ~$ python -m pip install --upgrade pip
-
-Clone the repository
-
-.. code-block:: shell-session
+**dfsimage** is a command-line utility and a Python module dedicated for
+maintenance of **BBC Micro** disk image files. These files usually have extensions
+*.ssd* for a single sided disk image, or *.dsd* for a double sided disk image.
- ~/src$ git clone https://github.com/monkeyman79/dfsimage.git
- ~/src$ cd dfsimage
-
-Build and install package
-
-.. code-block:: shell-session
-
- ~/src/dfsimage$ python -m pip install .
-
-Windows
--------
-
-Before installing this package on a Windows machine, make sure that
-both Python and Git are installed on your system.
-
-* Python can be downloaded from here: https://www.python.org/downloads/
-* Git for Windows can be downloaded from here: https://gitforwindows.org/
-
-Make sure to add both Python and Git to your PATH when asked by the installer.
-
-Execute steps below in either Command Prompt or Windows PowerShell.
-
-.. code-block:: ps1con
-
- PS C:\Users\you> mkdir Documents\src
- PS C:\Users\you> cd Documents\src
- PS C:\Users\you\Documents\src> git clone "https://github.com/monkeyman79/dfsimage.git"
- PS C:\Users\you\Documents\src> cd dfsimage
- PS C:\Users\you\Documents\src\dfsimage> python -m pip install --user .
-
-During installation, you may see the following warning message:
-
- **WARNING**: The script dfsimage.exe is installed in ``'C:\Users\you\AppData\Local\Packages\...\Scripts'``
- which is not on PATH.
-
- Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.
-
-This means that the ``'dfsimage'`` command will not be directly available. There are two options here:
-
-* Always execute dfsimage via ``python -m dfsimage COMMAND...``
-* Add the Scripts directory to your PATH variable
-
-**Adding Scripts directory to your PATH variable**
-
-We can combine powers of Python and PowerShell to automatically add your local
-Scripts directory to PATH.
-Execute the steps below in the Windows PowerShell:
+**dfsimage** allows indexing contents of the disk images, importing files to and
+exporting from the disk images, modifying disk images in place, such as
+renaming files or changing disk title, and transferring data between disk images.
-.. code-block:: ps1con
+The ``dfsimage`` module also supports *MMB* files. *MMB* files are containers for
+large number of *.ssd* disk images, designed for storing disk images on a
+MMC or SD card. All commands that work with *.ssd* FILES can be also used on a disk
+image contained within an MMB file. Index of a disk image within an MMB file can be
+either specified using the `index` option, or appended to the MMB file name, following
+a colon character, e.g. beeb.mmb:12. Commands **list**, **dump** and **digest** can
+take a range of disk images, e.g. beeb.mmb:10-20 or an entire *MMB* file. In that
+case the command will be applied to all *initialized* disk image in the specified range.
- PS C:\Users\you> $USER_SITE = python -m site --user-site
- PS C:\Users\you> $USER_SCRIPTS = (Get-ChildItem (Split-Path -Path $USER_SITE -Parent) Scripts).FullName
- PS C:\Users\you> [Environment]::SetEnvironmentVariable("PATH",
- >> [Environment]::GetEnvironmentVariable("PATH", "User") + ";$USER_SCRIPTS", "User")
+There are few commands intended specially for MMB files, such as **donboot** or
+**drecat**.
-Now close your console window and open it again to make the change take effect.
+OPTIONS
+=======
command list
============
@@ -1123,6 +1021,39 @@
* ``mmb_status_byte`` - Raw MMB status byte value in the MMB catalog.
* ``sha1`` - SHA1 digest of the entire disk image file.
+EXAMPLES
+========
+
+Index all floppy images with contents from the 'images' directory to 'index.json' file
+
+.. code-block:: shell-session
+
+ dfsimage index -f json images/*.ssd images/*.dsd > index.json
+
+Covert a linear double sided image to a '.dsd' file
+
+.. code-block:: shell-session
+
+ dfsimage convert --from -D -L linear.img --to inter.dsd
+
+Import all files from the 'files' directory to a new image 'games.ssd'
+
+.. code-block:: shell-session
+
+ dfsimage import --new games.ssd --title="GAMES" files/*
+
+Export all files from the disk image at index 12 in 'beeb.mmb' file to the 'files' directory
+
+.. code-block:: shell-session
+
+ dfsimage export beeb.mmb:12 -o files/
+
+Index all floppy image contents from the 'images' directory to text table file
+
+.. code-block:: shell-session
+
+ dfsimage index --only-files -f table images/*.ssd images/*.dsd > files.csv
+
development status
==================

View file

@ -0,0 +1,19 @@
# HOW TO EDIT THIS FILE:
# The "handy ruler" below makes it easier to edit a package description.
# Line up the first '|' above the ':' following the base package name, and
# the '|' on the right side marks the last column you can put a character in.
# You must make exactly 11 lines for the formatting to be correct. It's also
# customary to leave one space after the ':' except on otherwise blank lines.
|-----handy-ruler------------------------------------------------------|
dfsimage: dfsimage (utility for BBC micro floppy disk images)
dfsimage:
dfsimage: dfsimage is a command-line utility and a Python module dedicated to
dfsimage: maintenance of BBC Micro disk image files. These files usually have
dfsimage: extensions .ssd for single sided disk images, or .dsd for double sided
dfsimage: disk images.
dfsimage:
dfsimage: dfsimage allows indexing contents of the disk images, importing files
dfsimage: to and exporting from the disk images, and modifying disk images in
dfsimage: place, such as renaming files or changing the disk title.
dfsimage: