File: cvs-pkginit

package info (click to toggle)
cvs-buildpackage 5.26
  • links: PTS
  • area: main
  • in suites: bookworm, bullseye, buster, sid, stretch
  • size: 248 kB
  • sloc: sh: 1,728; perl: 77; makefile: 49
file content (191 lines) | stat: -rwxr-xr-x 4,751 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
#! /usr/bin/perl -w
#                              -*- Mode: Perl -*- 
# cvs-pkginit --- 
# Author           : Manoj Srivastava ( srivasta@tiamat.datasync.com ) 
# Created On       : Wed May 28 11:38:18 1997
# Created On Node  : tiamat.datasync.com
# Last Modified By : Manoj Srivastava
# Last Modified On : Mon Nov 12 15:15:38 2001
# Last Machine Used: glaurung.green-gryphon.com
# Update Count     : 46
# Status           : Unknown, Use with caution!
# HISTORY          : 
# Description      : 
# 
# 

use strict;
use diagnostics;
use Carp;
require 5.001;

package main;

=head1 NAME

cvs-pkginit - A tool to print out steps to enter a package into cvs

=cut


=head1 SYNOPSIS

 usage: cvs-pkginit <Package Name> <Upstream Version> [<Debian revision>]

 This assumes that there is an old, non-cvs source tree, in say
 $exportdir. The printed out steps asumme the following:
 $exportdir/<Package>/<Package>-<Version>/     #debianized tree
 $exportdir/<Package>/<Package>_<Version>.orig.tar.gz

=over 2

=back

=cut

=head1 DESCRIPTION

This is a basic tutorial script, and probably needs a lot of
polishing. Suppose you want to enter package <Package Name> into CVS,
which happens to be at version <Upstream Version> and you are at
Debian Revision <Debian revision>. (For Debian only packages, the
Debian revision should be ignored). Just say
cvs-pkginit <Package Name> <Upstream Version> [<Debian revision>]
and this script will come back with a recipe to enter your package
into CVS.

=cut 

sub main {
  my $exportdir = '/usr/local/src/Packages';
  my $workdir = '/usr/local/src/Workdir';
  my $usage = '';
  my $MYNAME = '';
  my $version= '';
  my $tversion = '';
  my $deb = '';
  my $ko = '';
  my $package = '';
  
  ($MYNAME     = $0) =~ s|.*/||;

  $usage = <<EOUSAGE;
 usage: $MYNAME <Package Name> <Package Version> [<Debian revision>]

   Note: this script has been superceded by cvs-inject, that takes a
   .dsc file and does this all for you.

 This assumes that there is an old, non-cvs source tree, in say
 $exportdir. The printed out steps asumme the following:
 $exportdir/<Package>/<Package>-<Version>/     #debianized tree
 $exportdir/<Package>/<Package>_<Version>.orig.tar.gz

   This is not automated since human intervention is still required.
EOUSAGE

  # We need three arguments
  die "$usage\n" unless $#ARGV >= 1;
  
  $package = shift @ARGV;
  $version = shift @ARGV;
  $deb     =shift @ARGV;

  ($tversion = $version) =~ tr/\./_/;
  $ko = "-ko -d" if $deb;
  
  my $import_msg = "Initial Import";
  my $vendor_tag='source-dist';
  my $import_tag="upstream_version_$tversion";

  my $add_msg="Initial revision";
  my $commit_msg='Added all debian changes';
  my $final_tag="debian_version_$tversion";
  
  if ($deb) {
    $final_tag="debian_version_$tversion-$deb";
  }
  
  
  print <<"EOINPUT";
Note: this script has been superceded by cvs-inject, that takes a.dsc
  file and does this all for you. 
#
# The CVS working directory is  $workdir
# Old package tree is           $exportdir
# We expect to see
#     $exportdir/$package/$package-$version/
#     $exportdir/$package/$package\_$version.orig.tar.gz
#
# Change to the work directory, create the original sources
#
cd $workdir
tar zvvfx $exportdir/$package/$package\_$version.orig.tar.gz
cp -a $package\_$version.orig $package\_$version
mv -f $package\_$version.orig $package
# Now for the cvs import process.
cd $package
cvs import $ko -m '$import_msg' debian/$package $vendor_tag $import_tag
cd ..
rm -rf $package
cvs co $package
# There should be no changes below
diff -qBbwr $package-$version $package | grep -v CVS
#
# Now, change directory to where the debianized version exists 
# $exportdir.  
cd $exportdir/$package/$package-$version
sudo ./debian/rules clean
diff -qBbwr . $workdir/$package | grep -v CVS
#
# Add to the following definition based on the diff output above
#
FILES_DIFFERENT=debian
tar cf - \$FILES_DIFFERENT | ( cd $workdir/$package; tar xvvpf -)
cd ..
rm -rf $package-$version $package\_$version-$deb*
cd $workdir/$package
cvs add debian
cd debian
cvs add -m '$add_msg' `cvs update 2>/dev/null | egrep '^\?' |sed 's/\?//'`
cd ..
cvs update 2>/dev/null  | egrep '^M' | sed 's/^M//'
cvs commit -m '$commit_msg'
# Check to see if the tags match
cvs-buildpackage -d -n
cvs tag $final_tag
cd ..
rm -rf $package-$version

Note: this script has been superceded by cvs-inject, that takes a.dsc
  file and does this all for you. 

EOINPUT
}





=head1 CAVEATS

This is very inchoate, at the moment, and needs testing. This script
has been superceded by cvs-inject, that takes a.dsc and does this all
for you.

=cut

=head1 BUGS

None Known so far.

=cut

=head1 AUTHOR

Manoj Srivastava <srivasta@debian.org>

=cut

&main::main();

__END__