create a slack-desc file also learning in prep for use of makepkg
Some nice threads are onboard here and at linuxpackages -- I've been studying them about getting it together (accomplish the needed steps) so that makepkg can then be run to get the package created.
I wanted an auto sort of a way to get a slack-desc file created.
I made a Perl script that works for this task. I'm not particularly proud of it. It could be shorter than what it is. It's my first crack at it. But it does works good though.
The script has no (me or you, the computer operator) error checking. Therefore the script should still be considered as being in the experimental stage (do not issue the wrong command to this script).
Anyways, I thought I'd share the script as well as propose how do others get their slack-desc file properly formatted?
I wouldn't call this from a build script -- but just for me tinkering around and learning the mechanics of the needed ingredients and the needed steps to accomplish in order to run makepkg and get a built Slackware package.
Here's the Perl script slack-desc maker/formatter
use it at your own risk and/or don't use it unless you at least somewhat understand the under-pinnings of what is going on.
If anyone tries the script -- have I correctly grasped what a slack-desc file needs to look like?
source_file.txt only needs your description (nothing else) -- since the formatting and inserting of
at the beginning of each line are done by the Perl script. Also your name is inserted by the Perl script.
I like your little script -I sure would like to see this is in BASH...
First, you got it right that it should be 11 lines. It may be better to not have a space after the ':' on lines which have no comments.
The first line is okay, but the second line should have no comments.
And the pkg signature should go on the last line.
Here's an example:
linpopup: LinPopUp-1.2.0 WinPopUp for Linux
linpopup: LinPopUp is an X window port of Winpopup, running over
linpopup: Samba. It permits communication with a Windows computer
linpopup: that runs Winpopup, sending or receiving messages. (It
linpopup: also provides an alternative way to communicate between
linpopup: Linux computers that run Samba).
linpopup: Note that LinPopUp is not only a port, as it includes
linpopup: several enhanced features not in the Windows program.
linpopup: Packaged by amigolinux.org
I may use your code in PkgBuild, my package building software. It includes routines which try to validate an existing slack-desc or create one for you. I started once to include some code to do what you are doing and just the last few days started getting the urge again to do so.
Most people don't realize just how important it is for the slack-desc to be exactly right. When you install with installpkg, the slack-desc gets read and the description lines are added to the package database file in /var/log/packages. But,if the name in the slack-desc doesn't match that of the package, these lines do not get written. There can be problems also if there are lines without comments that have spaces (particularly if more than one). You wind up with a database file with lines missing.
This is important because when you remove the package using removepkg it expects those 11 lines to be in the database file. expects to skip over those lines to find the start of the list of installed files. When those lines are not there, removepkg will fail to properly remove the listed files, but it will remove the database file making you think the package was deleted.
You might look at anything special needed in order to get the text from standard description files such as debian control files or rpm .spec files.
Well, I admit, I do have fun with Perl. This script is OK. But I can do even better. I was having a rough night the other night when I first hacked it out. Sometimes everything just falls together from the beginning. Other times it's fight fight fight, debug debug debug. It was the latter when I first hacked out this one. Sometimes *brain* rocks and rolls -- other times it seems like *brain_dead*.
Or, perhaps it is that sometimes brain gets out of the way and creativity takes over (rock n roll) while at other times brain doesn't get out of the way (fight fight fight, debug debug debug).
Anyways, whatever is going on -- it is all fun.
I did mods to the script. It now outputs exactly as per your shared example slack-desc. I likely will do further improvements, mods, error checking, etc.
But for now, here's the script again it's now as I've just said that I have updated it so far. Perl is fun (for me).
Removepkg doesn't rely on fixed 11 lines long header of installed package record but seeks for the file-list by line starting with "./" string or by "FILE LIST:" record. So checks are very sane and slack-desc may be empty or contain almost anything :)
From removepkg (Slackware 11.0):
My goal is I'm investigating/learning right now about the description file(s) ingredient of when it comes to later on the use of pkgbuild.
So, about just the one ingredient to a package that involves the description, on the next am I missing something? Or do I have it correct about that there's the two mentioned files involved with the description?
Inside that, in the .tgz package is a file named slack-desc
slack-desc must be a template because it begins with the next:
# HOW TO EDIT THIS FILE:
# The "handy ruler" below makes it easier to edit a package description. Line
but it also has the next:
k3b: k3b (The CD Creator)
k3b: K3b makes writing cds under Linux easy. It has an easy to use
That file has only the eleven lines description. (BTW that file also has a *12th line* which is a *blank* or empty line).
Is the latter file listed at #2 the actual description file while the slack-desc mentioned at #1 above is the template?
And I now see that two files need to be created, the pkg_name.txt *and* the slack-desc
I did not realize until now that there's two files that are involved with the description inside a Slackware package.
(I'm still learning, inch by inch) but formerly I'd (and evidently mistakenly) thought that when preparing to build a package that there's to be one description file that needs to be created.
That's the package named "units"
I just now DL it. And in it has only one slack-desc
units: Units - Unit conversion and calculation
units: The program converts quantities expressed in various scales to
units: their equivalents in other scales. The units are defined
units: externally in an extensive, well annotated data file that
units: defines over 2000 units. You can also provide your own data
units: Package created by Miha Ulanov
So, all I need is a slack-desc containing a format like the above (my Perl script listed up above in this thread already creates this for me).
I don't know what those other files of the official (k3b in the extra folder) Slackware 11.0 are for. Sorry for the confusion.
Once again, learning. Thanks.
Lines that begin with '#' are comments and ignored. Usually there's a line or two including a 'handy ruler' for formatting the text in the description lines.
Supposedly the slack-desc can contain from 9-13 description lines (name:), but official ones always have 11.
NAME.txt files you see are just copies of the slack-desc description lines. They are for directory browsing convenience and don't have anything to do with installpkg.
I tried using your script with some long lines of text and it didn't parse them quite right, though the slack-desc would be valid.
See at bottom of code how to the source_file.txt
$ txtwrap source_file.txt
is the new (less typing) command that creates a slack-desc file.
my $source = 'source_file.txt';
I may put that at the top of the script which would reduce the command to:
I also did some other mods.
if the former slack-desc hadn't been deleted in between invocations of the script then sometimes the slack-desc might not updated.
I just tried the next code on a two line source_file.txt where the second line is 719 characters long and it properly formatted a slack-desc file.
Supported first lines of source_file.txt now include:
pkg_name_here for Linux
pkg_name_here-1.2.1 for Linux
pkg_name_here1.2.1 for Linux
pkg_name_here.1.2.1 for Linux
The for Linux part can be substituted with typical slack-desc 1st line text.
The script leaves that 1st line intact and inserts pkg_name: at the beginning of said 1st line in the slack-desc
I'm wondering if this is simple/practical enough: to support the stripping of dash digit or dot which results in the pkg_name: in the left hand column of the slack-desc -- or if a part of those are not need to be supported.
Not that it overly matters but I don't think the slack-desc file has to have 11 lines anymore. installpkg and/or makepkg had some changes about a year ago that allows for a lower line count. It does have to be X number of lines tho. I forget how many. Saw a comment in one of the pkgtool scripts that said as much if I'm not mistaken.
Yes, there can be from 9-13 lines, but all Pat's have 11 description lines.
|All times are GMT -5. The time now is 01:52 PM.|