Skip to content

Commit 46831d6

Browse files
committed
build_pkgs: adapt to work with a git repo
1 parent b52ef1f commit 46831d6

File tree

1 file changed

+17
-2
lines changed

1 file changed

+17
-2
lines changed

scripts/build_pkgs

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,8 @@ my $debug = 0;
2424
my $help = 0;
2525
my $ignore_cache = 0;
2626
my $quiet = 0;
27-
my $repo = "/repos/sudo";
28-
my $rev = "tip";
27+
my $repo = "/repos/sudo.git";
28+
my $rev = "main";
2929
my $sudo_tmpdir;
3030
my $tarball;
3131
my $tarball_base;
@@ -50,6 +50,9 @@ pod2usage(1) if $help;
5050
$verbose = 1 if $debug;
5151
$quiet = 0 if $verbose;
5252

53+
# Make sure files are created with a reasonable mode.
54+
umask(022);
55+
5356
# Read config data (using Parse::CPAN::Meta is cheating a bit).
5457
my @yaml = Parse::CPAN::Meta->load_file($conf_file) ||
5558
die "$0: unable to read $conf_file: $!\n";
@@ -903,12 +906,22 @@ sub wait_for_ssh {
903906

904907
# Create a tarball from an archive $repo
905908
sub create_tarball {
909+
return create_tarball_hg() if -d "$repo/.hg";
910+
return create_tarball_git();
911+
}
912+
913+
sub create_tarball_hg {
906914
die "$0: unable to create directory $sudo_tmpdir/sudo: $!\n"
907915
unless mkdir("$sudo_tmpdir/sudo", 0755);
908916
system("hg archive -R $repo -r $rev --type=files $sudo_tmpdir/sudo && hg log -R $repo --template=changelog -r 'sort(branch(.) or follow(), -date)' > $sudo_tmpdir/sudo/ChangeLog && cd $sudo_tmpdir && sed -e 's/^/sudo\\//' -e 's/[ ].*//' sudo/MANIFEST | GZIP=-9 pax -wz -x ustar -f sudo.tar.gz && rm -rf sudo");
909917
return $? ? undef : "$sudo_tmpdir/sudo.tar.gz";
910918
}
911919

920+
sub create_tarball_git {
921+
system("cd $sudo_tmpdir && git --git-dir=$repo archive --format=tar --prefix=sudo/ $rev | pax -r && ./sudo/scripts/log2cl.pl -R $repo $rev > sudo/ChangeLog && sed -e 's/^/sudo\\//' -e 's/[ ].*//' sudo/MANIFEST | GZIP=-9 pax -wz -x ustar -f sudo.tar.gz && rm -rf sudo");
922+
return $? ? undef : "$sudo_tmpdir/sudo.tar.gz";
923+
}
924+
912925
sub start_ssh_agent {
913926
# Use existing agent if possible
914927
if (exists $ENV{'SSH_AUTH_SOCK'} && -S $ENV{'SSH_AUTH_SOCK'}) {
@@ -1026,6 +1039,8 @@ sub grep_log {
10261039
next if /warning: (Installed .but unpackaged. file.s. found:|Deprecated external dependency generator is used!|absolute symlink)/;
10271040
# Solaris ld may warn about the gcc dwarf2 unwinder
10281041
next if /warning: unwind table: .* suspicious InitialLoc value 0: binary search table will be incomplete if section requires runtime relocation/;
1042+
# GNU Hurd has no 64-bit glob()
1043+
next if /warning: glob64 is not implemented and will always fail/;
10291044
# Solaris Studio compiler warns about anonymous unions
10301045
next if /warning: anonymous union declaration/;
10311046
# HP-UX shl_t uses type-punning

0 commit comments

Comments
 (0)