1
0
forked from ports/contrib

clink: translated from python2 to python3, new dependency help2man

This commit is contained in:
John McQuah 2023-02-04 09:40:26 -05:00
parent 1d95aded0e
commit 7135a594d8
4 changed files with 43 additions and 23 deletions

View File

@ -1,3 +1,7 @@
drwxr-xr-x root/root usr/
drwxr-xr-x root/root usr/bin/
-rwxr-xr-x root/root usr/bin/clink
drwxr-xr-x root/root usr/share/
drwxr-xr-x root/root usr/share/man/
drwxr-xr-x root/root usr/share/man/man1/
-rw-r--r-- root/root usr/share/man/man1/clink.1.gz

View File

@ -1,5 +1,6 @@
untrusted comment: verify with /etc/ports/contrib.pub
RWSagIOpLGJF3xgsHIjBs1MGa9nLriklhHchyr3Ao5QP8GpsHZsKBEFnxkpIeyMxf+ILolWmLxpqv0eCXEVW9keEq2B8OeLaHww=
SHA256 (Pkgfile) = 8773196309e6b47935cd75db5713e372cdeb76d019b7082dc630f78fd73a1dbf
SHA256 (.footprint) = 7ed11f444c8b2940681f86daa6ac9333f285eff0f7335df4f42a4e330e041b5f
RWSagIOpLGJF3zgKV+Jl5jBPK0NRouxzUcGTird8wZVvLPSClVPZCQMChKd6RBXhklj5kmJ5Souuu3Q28TuWxdIrr2MqNX80bAY=
SHA256 (Pkgfile) = e14e28fc725f7b731956cd1a3ceaf5639a932454afccbb06eddead30c75dfc7d
SHA256 (.footprint) = 928464b1f7e96e1e10b32513ef72521da0b5e9629ccd0d1bbb80410bc0162b1f
SHA256 (clink-1.1.1) = c25762dbd7e95bcc61d4c4ac5d0ae6e903838f7b2b2419b0569eaeed871e60c5
SHA256 (README) = dce6cb8584d935839ceab36e79df9d04a1c7234b36647103037762c0252ac408

View File

@ -1,13 +1,37 @@
# Description: Compacts directories by replacing duplicate files by symbolic links and placing the origional files in ./common-files
# Description: Compacts directories by replacing duplicate files by symbolic links and placing the origional files in ${parent_dir}/common-files/
# URL: https://bootlin.com/blog/clink/
# Maintainer: Danny Rawlins, crux at romster dot me
# Depends on: python
# Depends on: help2man
name=clink
version=1.1.1
release=2
source=(https://bootlin.com/pub/utils/clink/clink-$version)
release=3
source=(https://bootlin.com/pub/utils/clink/clink-$version README)
build() {
# purge the source code of any idiosyncratic indentation
REINDENT="/$(prt-get cat python3 .footprint | grep reindent.py$ | cut -f3)"
[ -x "$REINDENT" ] && $REINDENT clink-$version \
|| { error "reindent.py unavailable, aborting."; return 1; }
# tranlate module names and dictionary lookups from python2 to python3
sed -i -e "s|^#!/usr/bin/env python|#!/usr/bin/env python3|" \
-e "/^import/ s/md5, sha/hashlib/" \
-e "s/sha\.new/hashlib.sha256/; s/md5\.new/hashlib.md5/" \
-e "/fid = open/ s/'r'/'rb'/" \
-e "/while.*line/ s/= ''/= b''/" \
-e "/fid\.readline/ s/readline()/read(8192)/" \
-e "s/shasums\.has_key.*:/shsum in shasums:/" \
clink-$version
# parenthesize all arguments to the print function
sed -i -E "s/^(\s*)print (.*)/\1print(\2)/" clink-$version
install -D -m755 clink-$version $PKG/usr/bin/clink
# generate a man-page from the inline help and the README
mkdir -p $PKG/usr/share/man/man1
help2man -n"mitigate redundant disk usage" -N -s1 \
-S"CRUX-contrib" -m"User Commands" -I $SRC/README \
-o $PKG/usr/share/man/man1/clink.1 $PKG/usr/bin/clink
}

View File

@ -1,17 +1,8 @@
REQUIREMENTS:
PRECAUTION:
PRE-INSTALL:
POST-INSTALL:
PRE-REMOVE:
POST-REMOVE:
NOTES:
Creates a directory called "common-files" and moves the common file there and
then creates symlinks to that file in the current directory.
[>DESCRIPTION]
.B clink
compares the sha256 and md5 hashes of each regular file found under the
paths passed as arguments, so as to identify duplicate files and move them to
<parent_dir>\fB/common-files\fP (this directory will be created as needed,
possibly with a numerical suffix to avoid overwriting an existing path).
Symlinks are placed in the original directories pointing to the new location.