Fix repropro

This commit is contained in:
ferrreo 2023-09-05 14:48:09 +01:00
parent ad2790bc3e
commit 88f367dcdb
3 changed files with 64 additions and 5 deletions

BIN
ppp

Binary file not shown.

View File

@ -21,6 +21,11 @@ func main() {
return
}
if os.Args[1] == "repoadd" {
repoAdd(os.Args[2], os.Args[3])
return
}
config := config{
Source: os.Args[1],
Target: os.Args[2],
@ -132,6 +137,53 @@ func compare(basePackages map[string]packageInfo, targetPackages map[string]pack
return output
}
func repoAdd(path string, args string) {
dir, err := os.Open(path)
if err != nil {
panic(err)
}
defer dir.Close()
files, err := dir.Readdirnames(-1)
if err != nil {
panic(err)
}
addQueue := make(chan string, 1)
var wg sync.WaitGroup
for i := 0; i < 1; i++ {
wg.Add(1)
go func() {
defer wg.Done()
for {
select {
case path, ok := <-addQueue:
if !ok {
return
}
ch := make(chan bool)
go func() {
add(ch, path, args)
}()
<-ch
default:
// No more files to add, exit the goroutine
return
}
}
}()
}
for _, file := range files {
addQueue <- path + file
}
close(addQueue)
wg.Wait()
}
func signFiles(path string) {
dir, err := os.Open(path)
@ -179,6 +231,17 @@ func signFiles(path string) {
wg.Wait()
}
func add(ch chan bool, path string, args string) {
fmt.Printf("Adding %s \n", path)
cmd := exec.Command("/bin/bash", "-c", "reprepro", args, path)
err := cmd.Run()
if err != nil {
panic(err)
}
ch <- true
}
func sign(ch chan bool, path string) {
if strings.HasSuffix(path, ".deb") {
fmt.Printf("Signing %s \n", path)

View File

@ -18,28 +18,24 @@ apt install dpkg-sig wget rsync ssh -y
# Get ubuntu main pool
echo "Getting ubuntu main pool 32bit"
../../ppp https://ppa.pika-os.com/dists/lunar/ubuntu/binary-i386/Packages.gz http://archive.ubuntu.com/ubuntu/dists/lunar/main/binary-i386/Packages.xz http://archive.ubuntu.com/ubuntu/ ./
rm -rfv ./*all.deb
echo "Getting ubuntu main pool 64bit"
../../ppp https://ppa.pika-os.com/dists/lunar/ubuntu/binary-amd64/Packages.gz http://archive.ubuntu.com/ubuntu/dists/lunar/main/binary-amd64/Packages.xz http://archive.ubuntu.com/ubuntu/ ./
# Get ubuntu multiverse pool
echo "Getting ubuntu multiverse pool 32bit"
../../ppp https://ppa.pika-os.com/dists/lunar/ubuntu/binary-i386/Packages.gz http://archive.ubuntu.com/ubuntu/dists/lunar/multiverse/binary-i386/Packages.xz http://archive.ubuntu.com/ubuntu/ ./
rm -rfv ./*all.deb
echo "Getting ubuntu multiverse pool 64bit"
../../ppp https://ppa.pika-os.com/dists/lunar/ubuntu/binary-amd64/Packages.gz http://archive.ubuntu.com/ubuntu/dists/lunar/multiverse/binary-amd64/Packages.xz http://archive.ubuntu.com/ubuntu/ ./
# Get ubuntu restricted pool
echo "Getting ubuntu restricted pool 32bit"
../../ppp https://ppa.pika-os.com/dists/lunar/ubuntu/binary-i386/Packages.gz http://archive.ubuntu.com/ubuntu/dists/lunar/restricted/binary-i386/Packages.xz http://archive.ubuntu.com/ubuntu/ ./
rm -rfv ./*all.deb
echo "Getting ubuntu restricted pool 64bit"
../../ppp https://ppa.pika-os.com/dists/lunar/ubuntu/binary-amd64/Packages.gz http://archive.ubuntu.com/ubuntu/dists/lunar/restricted/binary-amd64/Packages.xz http://archive.ubuntu.com/ubuntu/ ./
# Get ubuntu universe pool
echo "Getting ubuntu universe pool 32bit"
../../ppp https://ppa.pika-os.com/dists/lunar/ubuntu/binary-i386/Packages.gz http://archive.ubuntu.com/ubuntu/dists/lunar/universe/binary-i386/Packages.xz http://archive.ubuntu.com/ubuntu/ ./
rm -rfv ./*all.deb
echo "Getting ubuntu universe pool 64bit"
../../ppp https://ppa.pika-os.com/dists/lunar/ubuntu/binary-amd64/Packages.gz http://archive.ubuntu.com/ubuntu/dists/lunar/universe/binary-amd64/Packages.xz http://archive.ubuntu.com/ubuntu/ ./
@ -69,7 +65,7 @@ wget -nv https://launchpad.net/ubuntu/+archive/primary/+files/reprepro_5.3.0-1.4
apt install -y ./reprepro_5.3.0-1.4_amd64.deb
# Add the new packages to the repo
reprepro -C ubuntu -V --basedir ./output/repo/ includedeb lunar ./output/*.deb
../ppp repoadd ./output/ "-C ubuntu -V --basedir ./output/repo/ includedeb lunar"
# Push the updated ppa repo to the server
rsync -azP ./output/repo/ ferreo@direct.pika-os.com:/srv/www/pikappa/