LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware
User Name
Password
Slackware This Forum is for the discussion of Slackware Linux.

Notices


Reply
  Search this Thread
Old 08-12-2010, 11:44 AM   #1
NonNonBa
Member
 
Registered: Aug 2010
Distribution: Slackware
Posts: 192

Rep: Reputation: Disabled
Experience: CPIO-based Slackware packages


Hello,

I develop and maintain Spack, a tool (one more ) dedicated to the automation of the Slackware packaging process.

In the last release of this one, I've decided to put in code some ideas I had in a corner for a long while, elaborating an alternative way to make and manage Slackware packages.

The main interest was to remove tar-1.13 from the process. This was achieved by replacing it with cpio, which has the advantage, among others, to be a maintained and widely deployed tool. I've also tried to optimize as much as it was possible the attached package manager and to think another interface for it.

Maybe the result can interest some curious and/or adventurous people here. You don't need to use Spack to test it, just install the spkcpio and spkman tools from the sources, like this:

Code:
./configure tools=spkman,spkcpio [prefix=your/prefix]
make tools [DESTDIR=/your/package/dir]
Then you replace the makepkg's line with this one in your SlackBuilds:

Code:
spkcpio . path/to/the/package
After, install the result with:

Code:
spkman -i package
Or (as an equivalent for upgradepkg --install-new):

Code:
spkman -u -i package
Plain upgrade is peformed with:

Code:
spkman -u package
And removing with:

Code:
spkman -r package
For the two last operations, you can of course use the standard pkgtools, as once installed there is no difference with a good old txz (bug except).

For safer tests, there is also a --root=/alternative/root option, which do the same as the one in the pkgtools, and a --dry-run one.

Note that the current release (2.4) has a little known bug, which will be fixed in the next one: the upgrade process wipe out all the links of the old package instead of just an old/new packages diff (the final result is the same, it's just not optimal).

Good test for those who will try it, don't hesitate to give some feedback.
 
Old 08-23-2010, 12:44 PM   #2
NonNonBa
Member
 
Registered: Aug 2010
Distribution: Slackware
Posts: 192

Original Poster
Rep: Reputation: Disabled
Hi,

As I was notified about this zero-reply thread (don't worry, I won't flood the forum about my stuff ), just a little "up" to say the previously described bug has been fixed. Moreover, spkcpio is from now on able to generate a CPIO package directly from a Slackware one.
 
Old 08-23-2010, 02:05 PM   #3
gnashley
Amigo developer
 
Registered: Dec 2003
Location: Germany
Distribution: Slackware
Posts: 4,928

Rep: Reputation: 612Reputation: 612Reputation: 612Reputation: 612Reputation: 612Reputation: 612
Uh, there's a couple of special reasons for using specifically tar-1.13.
1. tar-1.13 has a special way of listing the archive contents and of storing the contents in the archive(this is important because of the way the database files are generated. Using other tar versions to install packages created with ta-1.13 or using tar-1.13 to install packages created using other tar versions may not work correctly)
2. tar-1.13 had two non-POSIX-compliant behaviours which were very desirable -at least to PAT:
a. preservation of existing linked directories -even when the archive contains a 'real' directory the same as the linked directory on your system. This means that if you have /usr/share/doc as a link to /usr/doc, a package which contains the directory /usr/share/doc, tar-1.13 will redirect the files to /usr/doc without overwriting the link /usr/share/doc
b. meta-data for existing directories is preserved instead of being reset.

Later versions of tar do not preserve these behaviours -not even as options.

cpio has another disadvantage. In cpio archives which contain directories which do not already exist on the system, these will be create with perms of 0700 (or is it 0777??) instead of 0755. Either way, those are not sane settings for normal dirs. You'd need script lines in each doinst.sh which would properly reset the perms. Or maybe resetting the perms during the build of the package....

I'll gladly stand corrected on any of these points if anyone knows more about it than I think I do...
 
Old 08-23-2010, 03:07 PM   #4
ChrisAbela
Member
 
Registered: Mar 2008
Location: Malta
Distribution: Slackware
Posts: 572

Rep: Reputation: 154Reputation: 154
Slackware without pkgtools is like pizza without cheese.
Nevertheless, I wish you luck.

Last edited by ChrisAbela; 08-25-2010 at 01:58 AM. Reason: Thanks for NonNonBa for pointing out the typo
 
Old 08-24-2010, 07:04 AM   #5
rg3
Member
 
Registered: Jul 2007
Distribution: Fedora
Posts: 527

Rep: Reputation: Disabled
Quote:
Originally Posted by gnashley View Post
Uh, there's a couple of special reasons for using specifically tar-1.13.
1. tar-1.13 has a special way of listing the archive contents and of storing the contents in the archive(this is important because of the way the database files are generated. Using other tar versions to install packages created with ta-1.13 or using tar-1.13 to install packages created using other tar versions may not work correctly)
2. tar-1.13 had two non-POSIX-compliant behaviours which were very desirable -at least to PAT:
a. preservation of existing linked directories -even when the archive contains a 'real' directory the same as the linked directory on your system. This means that if you have /usr/share/doc as a link to /usr/doc, a package which contains the directory /usr/share/doc, tar-1.13 will redirect the files to /usr/doc without overwriting the link /usr/share/doc
b. meta-data for existing directories is preserved instead of being reset.

Later versions of tar do not preserve these behaviours -not even as options.

cpio has another disadvantage. In cpio archives which contain directories which do not already exist on the system, these will be create with perms of 0700 (or is it 0777??) instead of 0755. Either way, those are not sane settings for normal dirs. You'd need script lines in each doinst.sh which would properly reset the perms. Or maybe resetting the perms during the build of the package....

I'll gladly stand corrected on any of these points if anyone knows more about it than I think I do...
About point 2a, which is the one mentioned in the tar SlackBuild script, I found this interesting message from 2006:

http://www.mail-archive.com/bug-tar@.../msg00645.html

The question now is, why is U needed?
 
Old 08-24-2010, 11:18 AM   #6
gnashley
Amigo developer
 
Registered: Dec 2003
Location: Germany
Distribution: Slackware
Posts: 4,928

Rep: Reputation: 612Reputation: 612Reputation: 612Reputation: 612Reputation: 612Reputation: 612
Say, that's an interesting find. There is this quote:
'tar didn't have such a bug AFAIK'
maybe the responder *didn't* know about the bug or feature. I did lots of tests between tar-1.13 and newer versions and was unable to consistently(or maybe ever) get them to not overwrite linked dirs with real dirs.
After the release of tar-1.1.3, there were no releases for several years and when tar-1.14 came it had huge amounts of changes in there by many different people. Making it more POSIX-compliant was a stated goal once releases started again. Version 1.14 (and 1.15 IIRC) had transitional syntax for non-posix leftovers or other weird syntax. The -l option used with tar-1.13 is no longer used -instead it's '--one-file-system'

In the end, it doesn't matter whether it was bug or whatever -the behaviour of not overwriting linked *dirs* was seen as valuable by PatV. The -U option still unlinked *files* before writing new ones, which is/was good. But, (I assume) Pat didn't want any 'dirty' packages with /usr/share/doc directory overwriting the link which slackware uses to /usr/doc -makepkg includes a routine which warns of their presence when creating packages.

The other problem was/is about getting a proper listing of the archive when writing the database file so that removepkg works properly. Unpacking tar-1.13-created archives with later versions of tar(or maybe it's the other way around) can cause the first two characters of the files' path to be deleted from the listing. Creating archives with later tar versions will cause the files to be listed like this:
./some/path
whereas tar-1.13 would list them like this:
some/path
Using (in makepkg) 'tar * commands' instead of 'tar . commands' with later versions of tar fixes the listing problem. removepkg expects to find:
./
as the first entry, but installpkg will create the listing if not present. The real problem is mixing the version of tar used to create the packages with other versions used to extract the package. If you assume the user has tar>1.15, then the mentioned behaviours and syntax should now be consistent -just hope nobody is using tar-1.14 or tar-1.15.

I invite you to spend a few days checking it all out -I'd love to know I'm not the only one who has done it...

So, -l, -U and the difference between what 'tar -v ???' shows and what the real archive entries are. tar-1.13 stores all the entries with the leading './'. like this:
./
./some/path
but lists them like this:
./
some/path

If you use tar-1.13 to list an archive created with a later version you may get this:
./
ome/path
 
Old 08-24-2010, 12:39 PM   #7
NonNonBa
Member
 
Registered: Aug 2010
Distribution: Slackware
Posts: 192

Original Poster
Rep: Reputation: Disabled
Hello,

Quote:
Originally Posted by gnashley
1. tar-1.13 has a special way of listing the archive contents and of storing the contents in the archive(this is important because of the way the database files are generated. Using other tar versions to install packages created with ta-1.13 or using tar-1.13 to install packages created using other tar versions may not work correctly)
Maybe but, as you say in your further post, it's a problem only if you use tar-1.13 to create the package then an other tar version to install it, or the contrary. I use cpio for both creation and installation, so there is no problem here (removepkg use lists it sorts by itself to remove links, files then directories, so the order of what is written in log files does not matter).

Quote:
Originally Posted by gnashley
2. tar-1.13 had two non-POSIX-compliant behaviours which were very desirable -at least to PAT:
a. preservation of existing linked directories -even when the archive contains a 'real' directory the same as the linked directory on your system. This means that if you have /usr/share/doc as a link to /usr/doc, a package which contains the directory /usr/share/doc, tar-1.13 will redirect the files to /usr/doc without overwriting the link /usr/share/doc
The creation of the tree is managed by a dedicated script, generated during the creation of the package. When you install the package, it is first executed and initializes the directories with the right permissions and ownerships, using mkdir (-p), chown and chmod. So, the CPIO format does the same as tar-1.13 here, in a much more standard way.

Quote:
Originally Posted by gnashley
b. meta-data for existing directories is preserved instead of being reset.
Maybe I wrongly understand what you mean by meta-data, but installpkg does not seem to preserve it:
Code:
# ROOT=/home/test installpkg elvis-2.2_0-i486-2.txz
# ls -l /home/test/usr/man/
 total 4
 drwxr-xr-x 2 root root 4096 2004-02-22 07:25 man1
# chmod 0700 /home/test/usr/man/man1/
# chown :users /home/test/usr/man/man1/
# ls -l /home/test/usr/man/
 total 4
 drwx------ 2 root users 4096 2004-02-22 07:25 man1
# ROOT=/home/test installpkg gzip-1.4-i486-1.tgz
# ls -l /home/test/usr/man/ 
  total 4
  drwxr-xr-x 2 root root 4096 2010-02-09 19:38 man1
Quote:
Originally Posted by gnashley
cpio has another disadvantage. In cpio archives which contain directories which do not already exist on the system, these will be create with perms of 0700 (or is it 0777??) instead of 0755. Either way, those are not sane settings for normal dirs. You'd need script lines in each doinst.sh which would properly reset the perms. Or maybe resetting the perms during the build of the package...
You're right, CPIO doesn't know anything about directories. It just tries to do its best if you say it to initialize them, but it's not the stuff it manages (well, maybe not its best, follow the umask instead of set 0700 wouldn't hurt IMHO). But as I manage the directories apart, it's not a problem for me. On the other hand, CPIO has some interesting features like the ability to store non-regular files and to internally check file integrity in the CRC format.

Quote:
Originally Posted by ChrisAbela
Slackware with pkgtools is like pizza without cheese.
Nevertheless, I wish you luck.
I think you wanted to say "Slackware without pkgtools", didn't you ?

Well, you however will need pkgtools, because spkman does not manage the official Slackware package format. That's why under Slackware it's primarily an experience (I realize I probably made a bad translation, "experiment" would be the right term). But maybe it can also interest people who works on Slackware derivates or uses things like LFS (such a trivial package manager suits this kind of distro, IMHO). Moreover, pkgtools are not just the package manager, they are also a part of setup (there are pieces of dialog inside), so it would be hard to wipe them out without rethinking the installer.

Thanks for your good wishes.
 
Old 08-25-2010, 02:00 AM   #8
ChrisAbela
Member
 
Registered: Mar 2008
Location: Malta
Distribution: Slackware
Posts: 572

Rep: Reputation: 154Reputation: 154
Quote:
I think you wanted to say "Slackware without pkgtools", didn't you ?
That was one embarrasing typo. Thanks for pointing it out.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Improving Slackware (based) distros all to one new Slackware based distro Secu-Slack Slackware 45 02-15-2009 10:42 PM
How to use cpio to extract a cpio archive? linx win Debian 4 06-17-2005 01:53 PM
Looking for an experience Fedora individual who is based in Essex or East London wittgenstein Fedora 2 02-24-2005 01:43 AM
Hardware recommendations for router/WAP based on reliability experience. oneman00 Linux - Networking 1 06-14-2004 01:39 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware

All times are GMT -5. The time now is 06:10 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration