pkgsrc-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[pkgsrc/trunk]: pkgsrc/pkgtools/url2pkg/files pkgtools/url2pkg: remove Perl i...
details: https://anonhg.NetBSD.org/pkgsrc/rev/8a443e3ead23
branches: trunk
changeset: 402277:8a443e3ead23
user: rillig <rillig%pkgsrc.org@localhost>
date: Sun Oct 06 12:52:13 2019 +0000
description:
pkgtools/url2pkg: remove Perl implementation
The Python implementation has received more bugfixes, new features and
handles all kinds of edge cases better. All previous features have been
either copied or intentionally omitted.
diffstat:
pkgtools/url2pkg/files/url2pkg.pl | 907 --------------------------------------
pkgtools/url2pkg/files/url2pkg.t | 370 ---------------
2 files changed, 0 insertions(+), 1277 deletions(-)
diffs (truncated from 1285 to 300 lines):
diff -r 89a8246d7be1 -r 8a443e3ead23 pkgtools/url2pkg/files/url2pkg.pl
--- a/pkgtools/url2pkg/files/url2pkg.pl Sun Oct 06 12:50:41 2019 +0000
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,907 +0,0 @@
-#! @PERL5@
-# $NetBSD: url2pkg.pl,v 1.77 2019/10/03 09:31:36 rillig Exp $
-#
-
-# Copyright (c) 2010 The NetBSD Foundation, Inc.
-# All rights reserved.
-#
-# This code is derived from software contributed to The NetBSD Foundation
-# by Roland Illig.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-# 1. Redistributions of source code must retain the above copyright
-# notice, this list of conditions and the following disclaimer.
-# 2. Redistributions in binary form must reproduce the above copyright
-# notice, this list of conditions and the following disclaimer in the
-# documentation and/or other materials provided with the distribution.
-#
-# THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
-# ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
-# TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
-# BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
-# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
-# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
-# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
-# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
-# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
-# POSSIBILITY OF SUCH DAMAGE.
-
-use strict;
-use warnings;
-
-use Getopt::Long;
-
-my $make = '@MAKE@';
-my $libdir = '@LIBDIR@';
-my $pythonbin = '@PYTHONBIN@';
-my $pkgsrcdir = '@PKGSRCDIR@';
-
-use constant true => 1;
-use constant false => 0;
-
-our $verbose = false;
-
-sub run_editor($$) {
- my ($fname, $lineno) = @_;
-
- my $editor = $ENV{"PKGEDITOR"} || $ENV{"EDITOR"} || "vi";
-
- my @args;
- push(@args, $editor);
- push(@args, "+$lineno") if $editor =~ qr"(^|/)(mcedit|nano|pico|vi|vim)$";
- push(@args, $fname);
-
- system { $args[0] } (@args);
-}
-
-sub get_maintainer() {
-
- return $ENV{"PKGMAINTAINER"} || $ENV{"REPLYTO"} || "INSERT_YOUR_MAIL_ADDRESS_HERE";
-}
-
-sub var($$$) {
- my ($name, $op, $value) = @_;
-
- return [$name, $op, $value];
-}
-
-sub find_package($) {
- my ($pkgbase) = @_;
-
- my @candidates = <$pkgsrcdir/*/$pkgbase>;
- return "" unless @candidates == 1;
- return $candidates[0] =~ s/\Q$pkgsrcdir\E/..\/../r;
-}
-
-sub make(@) {
- my @args = @_;
-
- (system { $make } ($make, @args)) == 0 or die;
-}
-
-package Lines;
-
-use constant false => 0;
-use constant true => 1;
-
-sub new($@) {
- my ($class, @lines) = @_;
- my $lines = \@lines;
- bless($lines, $class);
- return $lines;
-}
-
-sub read_from($$) {
- my ($class, $filename) = @_;
-
- my $lines = Lines->new();
- open(F, "<", $filename) or die;
- while (defined(my $line = <F>)) {
- chomp($line);
- $lines->add($line);
- }
- close(F) or die;
- return $lines;
-}
-
-sub write_to($@) {
- my ($lines, $filename) = @_;
-
- open(F, ">", "$filename.tmp") or die;
- foreach my $line (@$lines) {
- print F "$line\n";
- }
- close(F) or die;
- rename("$filename.tmp", $filename) or die;
-}
-
-sub add($@) {
- my ($lines, @lines) = @_;
-
- push(@$lines, @lines);
-}
-
-# appends the given variable assignments to the lines, aligning the
-# variable values vertically.
-sub add_vars($@) {
- my ($lines, @vars) = @_;
-
- return if @vars == 0;
-
- my $width = 0;
- foreach my $var (@vars) {
- my ($name, $op, $value) = @$var;
- next if $value eq "";
- my $len = (length("$name$op\t") + 7) & -8;
- $width = $len if $len > $width;
- }
-
- foreach my $var (@vars) {
- my ($name, $op, $value) = @$var;
- next if $value eq "";
- my $tabs = "\t" x (($width - length("$name$op") + 7) / 8);
- $lines->add("$name$op$tabs$value");
- }
-
- $lines->add("");
-}
-
-# changes the value of an existing variable in the lines.
-sub set($$$) {
- my ($lines, $varname, $new_value) = @_;
-
- my $i = 0;
- foreach my $line (@$lines) {
- if ($line =~ qr"^#?\Q$varname\E(\+?=)([ \t]*)([^#\\]*?)(\s*)(#.*|)$") {
- my ($op, $indent, $old_value, $space_after_value, $comment) = ($1, $2, $3, $4, $5);
-
- $lines->[$i] = "$varname$op$indent$new_value";
- return true;
- }
- $i++;
- }
-
- return false;
-}
-
-# appends to the value of an existing variable in the lines.
-sub append($$$) {
- my ($lines, $varname, $value) = @_;
-
- return if $value eq "";
-
- my $i = 0;
- foreach my $line (@$lines) {
- if ($line =~ qr"^\Q$varname\E(\+?=)([ \t]*)([^#\\]*?)(\s*)(#.*|)$") {
- my ($op, $indent, $old_value, $space_after_value, $comment) = ($1, $2, $3, $4, $5);
-
- my $before = $old_value =~ qr"\S$" ? " " : "";
- my $after = $comment eq "" ? "" : " ";
- $lines->[$i] = "$varname$op$indent$old_value$before$value$after$comment";
- return true;
- }
- $i++;
- }
-
- return false;
-}
-
-# removes a variable assignment from the lines.
-sub remove($$) {
- my ($lines, $varname) = @_;
-
- my $i = 0;
- foreach my $line (@$lines) {
- if ($line =~ qr"^\Q$varname\E(\+?=)") {
- splice(@$lines, $i, 1);
- return true;
- }
- $i++;
- }
-
- return false;
-}
-
-# returns the variable value from the only variable assignment, or an empty
-# string.
-sub get($$) {
- my ($lines, $varname) = @_;
-
- my $only_value = "";
- foreach my $line (@$lines) {
- if ($line =~ qr"^\Q$varname\E(\+?=)([ \t]*)([^#\\]*?)(\s*)(#.*|)$") {
- my ($op, $indent, $value, $space_after_value, $comment) = ($1, $2, $3, $4, $5);
-
- return "" if $only_value ne "";
- $only_value = $value;
- }
- }
- return $only_value;
-}
-
-# removes a variable assignment from the lines if its value is the
-# expected one.
-sub remove_if($$$) {
- my ($lines, $varname, $expected_value) = @_;
-
- my $i = 0;
- foreach my $line (@$lines) {
- if ($line =~ qr"^\Q$varname\E(\+?=)([ \t]*)([^#\\]*?)(\s*)(#.*|)$") {
- my ($op, $indent, $old_value, $space_after_value, $comment) = ($1, $2, $3, $4, $5);
-
- if ($old_value eq $expected_value) {
- splice(@$lines, $i, 1);
- return true;
- }
- }
- $i++;
- }
-
- return false;
-}
-
-sub index($$) {
- my ($lines, $re) = @_;
-
- foreach my $i (0 .. $#$lines) {
- return $i if $lines->[$i] =~ $re;
- }
- return -1;
-}
-
-1;
-
-package main;
-
-# The following adjust_* subroutines are called after the distfiles have
-# been downloaded and extracted. They inspect the extracted files
-# and adjust the variable definitions in the package Makefile.
-
-#
-# The following variables may be used in the adjust_* subroutines:
-#
-
-# the package name, including the version number.
-our $distname;
-
-# the absolute pathname to the working directory, containing
-# the extracted distfiles.
-our $abs_wrkdir;
-
-# the absolute pathname to a subdirectory of $abs_wrkdir, typically
-# containing package-provided Makefiles or configure scripts.
-our $abs_wrksrc;
-
-our @wrksrc_files;
-our @wrksrc_dirs;
-# the regular files and directories relative to abs_wrksrc.
-
-#
-# The following variables may be set by the adjust_* subroutines and
-# will later appear in the package Makefile:
-#
-
-# categories for the package, in addition to the usual
-# parent directory.
-our @categories;
-
-# the dependencies of the package, in the form
-# "package>=version:../../category/package".
-our @depends;
-our @build_depends;
-our @test_depends;
-
Home |
Main Index |
Thread Index |
Old Index