Showing posts with label scripts. Show all posts
Showing posts with label scripts. Show all posts

Tuesday, April 18, 2017

make-theme-image: a script to make yourself an idea of a icon theme

I created some time ago a utils repository on github to publish miscellaneous scripts, but it's only recently that I have started to really populate it. One of my recent work is make-theme-image script, that downloads an icon them package, grabs relevant, user-specifiable, icons, and arrange them in a neat montage. The images displayed are the results of running

~ make-theme-image gnome-icon-theme moblin-icon-theme

This is quite useful to get a good idea of the icons available in a package. You can select the icons you want to display using the -w option. The following command should provide you with a decent overview of the icon themes present in Debian:

apt search -- -icon-theme | grep / | cut -d/ -f1 | xargs make-theme-image

I hope you find it useful ! In any case, it's on github, so feel free to patch and share.

Monday, April 3, 2017

Variations around ls -lrt

I have been using almost compulsively ls -lrt for a long time now. As per the ls man page, this command lists the files of the current directory, with the latest files at the end, so that they are the ones that show up just above your next command-line. This is very convenient to work with, hmmm, not-so-well-organized directories, because it just shows what you're working on, and you can safely ignore the rest. Typical example is a big Downloads directory, for instance, but I use it everywhere. I quickly used alias lrt="ls -lrt" to make it easier, but... I though I might have as well a reliable way to directly use what I saw. So I came up with the following shell function (zsh, but probably works with most Bourne-like shells):
lrt() {
    ls -lrt "$@"
    lrt="$(ls -rt "$@" | tail -n1)"
}
This small function runs ls -lrt as usual, but also sets the $lrt shell variable to the latest file, so you can use it in your next commands ! Especially useful for complex file names. Demonstration:
22:05 vincent@ashitaka ~/Downloads lrt
[...]
-rw-r--r-- 1 vincent vincent   1490027 Apr  2 15:44 k.zip
-rw-r--r-- 1 vincent vincent    668566 Apr  3 22:05 1-s2.0-S0013468617305947-main.pdf
22:06 vincent@ashitaka ~/Downloads cp -v $lrt ~/nice-paper.pdf
'1-s2.0-S0013468617305947-main.pdf' -> '/home/vincent/nice-paper.pdf'
This saves typing the name of the 1-s2.0-S0013468617305947-main.pdf: in this case, automatic completion doesn't help much, since many files in my Downloads directory start with the same orefix... I hope this helps !

Thursday, April 3, 2008

mk-build-deps: create a dummy package depending on a package's build-deps

When I work on a package, I often find that I want to have build-deps installed in a way that I remember why I did install them in the first place. apt-get build-dep is not a proper solution for me for two reasons:

  • It marks the packages as automatically installed (at least, last time I checked, it did), which does not play nice with aptitude, who wants to remove them immediately. Marking them manually installed would not be a solution either (since I would not remember why I did install them).
  • It does not work for package whose build-deps changed since the last upload (or that were never uploaded).

As I'm starting to work on vegastrike, who's in great need of tender care, I though time had to find a more decent solution. The answer is mk-build-deps, a small Perl script that takes a control file or a package name and uses equivs to create a dummy package depending on its build-deps. Pretty useful (for me at least). Maybe it would be worth including in the devscipts package ?

Saturday, March 22, 2008

Improvements for the machine-readable debian/copyright emacs mode

Since the last post, I have significantly improved debian-mr-copyright-mode, that now provides an interactive function, debian-mr-copyright-scan-files that shows which files are covered by which clause of the debian/copyright file. I've also significantly improved my understanding of font lock and emacs lisp in general...

As a demonstration, the attached picture represents the results of debian-mr-copyright-scan-files on the monsterz source package (Sam's original example). The output clearly shows that some files are not covered yet...

You can get the emacs mode there. Its is starting to be good, but of course, many more improvements are still planned - in particular, quotes for files probably don't work yet. By the way, imenu now works. A debian package should probably come soon.

Saturday, March 15, 2008

Emacs mode for machine-readable copyrights

I've been thinking that something that might help a wider adoption of the machine-readable copyright format is a proper emacs major mode for it. Well, at least, it does for me... So I started to write one. It is loosely based on debian-control-mode, although there is hardly any code left from it now. It only features syntax highlighting for now (including warning for licenses which were not on the wiki page at the time of the writing, or were marked as needing more discussions) but, after all, this is only my first emacs major mode...

The code can either be downloaded there, or from my bzr repository, in the debian-mr-copyright-mode directory

bzr branch http://people.debian.org/~fourmond/bzr/scripts

No debian package for that for now, as anyways it really should integrate dpkg-dev when it has matured somehow. Hope this helps !

Tuesday, January 8, 2008

A bzr repository for my debian-related works

I'm always scripting quite a lot, and I always store them in SVN in my personal backed-up server. However, it is not very convenient for sharing, as it is not always on and completely locked anyway. So I thought I could rather use a bzr repository on people.debian.org. I did set it up yesterday. There probably will be several branches in the future, but there currently is only one:

bzr branch http://people.debian.org/~fourmond/bzr/scripts

It currently contains one script, rdebsums that runs debsums on one package and on all its dependencies. It is the answer to a wishlist bug I submitted long ago against debsums. Enjoy !

Saturday, January 5, 2008

Find all package from a repository that install a file somewhere

As I'm trying to provide a much cleaner way to wrap java programs into scripts for Debian, I need to know how many of the package maintained by the Debian Java Team install scripts in /usr/bin/. I first thought that the way to go was to use apt-file for doing so, running apt-file show on each package found in the repository. Bad idea: it takes, say, 10 seconds to run apt-file show on my machine. Mutliply that by around 600 binary packages, it takes some time.

So, I wrote a script based on the same idea (using Contents files, see apt-file(1)) that does the both the lookup of all binary packages produced by source trees present in the current directory and looking up a pattern in the Contents file. You can download it here. Typical uses:

  • find all binary packages generated from source tree in the current directory:
    find-packages
    
  • find all of them that install a file in /usr/bin:
    find-packages usr/bin ~/.apt-file/ftp.fr.debian.org_debian_dists_unstable_Contents-amd64.gz
    
    The file ~/.apt-file/ftp.fr.debian.org_..._Contents-amd64.gz or a similar one can be found in apt-file's cache.

Meanwhile, out of nearly 600 packages, there are only 61 binaries out of 35 packages. Java packages are mostly libraries, then.