6 Commits

Author SHA1 Message Date
Syed-Shahrukh-OSSRevival
4d8ec3bf09 Updated readme, fixes #10 2026-01-20 16:09:28 +05:00
Anton Farygin
decc4d75c8 fix: handle spaces in working directory path
Buildroot in spec file doesn't support spaces in some RPM versions
(ALT Linux). Removed it from spec since --buildroot is already passed
on command line. Also quoted cd argument.
2025-12-25 12:51:36 +05:00
Anton Farygin
de7aa3b0f8 fix: handle Description field with empty first line
Some packages (e.g. vk-messenger.deb) have Description with text
starting on the next line:

  Description:
   Actual description text here

The regex required at least one character after colon, causing
summary to be empty. This broke conversion to RPM with error
"Empty tag: Summary".

Now uses first line of extended description as summary when the
initial Description line is empty.
2025-12-25 12:49:40 +05:00
Anton Farygin
5836229bae fix: Escape percent signs in plaintext scripts for RPM spec
Scripts (preinst, postinst, prerm, postrm) may contain literal '%'
characters (e.g., in printf format strings). When these scripts are
written directly into the RPM spec file, rpmbuild interprets '%' as
the start of a macro, causing build failures.
2025-12-23 23:51:55 +05:00
Anton Farygin
8bba6dfdc5 fix: restore tar fallback when makepkg is not available
Commit 32f04ae removed the tar fallback in Tgz::build(), requiring
/sbin/makepkg (Slackware-specific) for --to-tgz conversion. This broke
alien on all non-Slackware systems.

Restore the fallback using the same method as the original makepkg
script.

Fixes: https://github.com/Project-OSS-Revival/alien/issues/4
2025-12-23 18:54:23 +05:00
Syed-Shahrukh-OSSRevival
04a9c4fa04 Copied debian/changelog to Changelog #3.
* To make the ChangeLog generic removed debian specific information from each version header.
 * Updated the Makefile.PL to utilize the new ChangeLog file for the version number.
2025-12-23 08:03:27 +05:00
6 changed files with 2858 additions and 14 deletions

View File

@@ -254,19 +254,27 @@ sub scan {
for (my $i=0; $i <= $#control; $i++) {
$_ = $control[$i];
chomp;
if (/^(\w.*?):\s+(.*)/) {
if (/^(\w.*?):\s*(.*)/) {
# Really old debs might have oddly capitalized
# field names.
$field=ucfirst(lc($1));
if (exists $fieldtrans{$field}) {
$field=$fieldtrans{$field};
$this->$field($2);
my $value = $2;
# Only set field if value is non-empty.
# For Description, empty first line means
# the actual text starts on next line.
$this->$field($value) if length $value;
}
}
elsif (/^ / && $field eq 'summary') {
# Handle extended description.
s/^ //g;
$_="" if $_ eq ".";
# If summary is empty, use first line of extended description
if (!defined $this->summary || !length $this->summary) {
$this->summary($_);
}
$description.="$_\n";
}
}

View File

@@ -463,9 +463,8 @@ sub prep {
# Write out the spec file.
my $spec="$dir/".$this->name."-".$this->version."-".$this->release.".spec";
open (OUT, ">$spec") || die "$spec: $!";
my $pwd=`pwd`;
chomp $pwd;
print OUT "Buildroot: $pwd/$dir\n"; # must be absolute dirname
# Note: Buildroot is passed via --buildroot command line option
# to handle paths with spaces correctly
print OUT "Name: ".$this->name."\n";
print OUT "Version: ".$this->version."\n";
print OUT "Release: ".$this->release."\n";
@@ -483,22 +482,22 @@ sub prep {
if ($this->usescripts) {
if ($this->preinst) {
print OUT "\%pre\n";
print OUT $this->preinst."\n";
print OUT escape_percents($this->preinst)."\n";
print OUT "\n";
}
if ($this->postinst) {
print OUT "\%post\n";
print OUT $this->postinst."\n";
print OUT escape_percents($this->postinst)."\n";
print OUT "\n";
}
if ($this->prerm) {
print OUT "\%preun\n";
print OUT $this->prerm."\n";
print OUT escape_percents($this->prerm)."\n";
print OUT "\n";
}
if ($this->postrm) {
print OUT "\%postun\n";
print OUT $this->postrm."\n";
print OUT escape_percents($this->postrm)."\n";
print OUT "\n";
}
}
@@ -574,7 +573,7 @@ sub build {
$opts.=" $ENV{RPMBUILDOPT}" if exists $ENV{RPMBUILDOPT};
my $pwd=`pwd`;
chomp $pwd;
my $command="cd $dir; $buildcmd --buildroot='$pwd/$dir' -bb $opts '".$this->name."-".$this->version."-".$this->release.".spec'";
my $command="cd '$dir'; $buildcmd --buildroot='$pwd/$dir' -bb $opts '".$this->name."-".$this->version."-".$this->release.".spec'";
my $log=$this->runpipe(1, "$command 2>&1");
if ($?) {
die "Package build failed. Here's the log of the command ($command):\n", $log;
@@ -659,6 +658,7 @@ sub _script_helper {
$this->{$script} = $value;
}
$this->{$script} = shift if @_;
return $this->{$script};
# get
return unless defined wantarray; # optimization
@@ -694,6 +694,11 @@ sub prerm {
my $this=shift;
$this->_script_helper('prerm', @_);
}
sub escape_percents {
my $s=shift;
$s =~ s/\%/\%\%/g;
return $s;
}
=item arch

View File

@@ -489,7 +489,10 @@ sub build {
$Alien::Package::verbose=$v;
}
else {
die "Sorry, I cannot generate the .tgz file because /sbin/makepkg is not present.\n"
# Fallback to plain tar when makepkg is not available
# Use same method as makepkg: strip ./ prefix via sed to match Slackware format
$this->do("cd ".$this->unpacked_tree."; find ./ | LC_COLLATE=C sort | sed '2,\$s,^\\./,,' | tar --no-recursion -T - -czf ../$tgz")
or die "Package build failed";
}
return $tgz;
}

2828
ChangeLog Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -15,7 +15,7 @@ sub MY::libscan {
sub MY::postamble {
return q{
VER=$(shell perl -e '$$_=<>;print m/\((.*?)\)/'<debian/changelog)
VER=$(shell perl -e '$$_=<>;print m/\((.*?)\)/'<ChangeLog)
all:: extra_build
clean:: extra_build

4
README
View File

@@ -51,8 +51,8 @@ Note:
Programs that use alien:
I know of one program that acts as a frontend to alien - kpackviewer is a
package viewer that can convert between package formats by using alien. Its
homepage is at http://www.momentus.com.br/users/hook/kpackviewer.html
package viewer that can convert between package formats by using alien. Can
be downloaded from https://download.kde.org/Attic/stable/stable/apps/KDE1.x/utils/kpackviewer-0.70.tar.gz
Corel also appears to have (or had) something in Corel linux that
uses alien.