This commit is contained in:
ferrreo 2023-09-05 11:31:16 +01:00
parent 0d7f340471
commit 23756954d2
3 changed files with 2 additions and 65 deletions

BIN
ppp

Binary file not shown.

View File

@ -20,11 +20,6 @@ func main() {
return return
} }
if os.Args[1] == "repoadd" {
repoAdd(os.Args[2], os.Args[3])
return
}
config := config{ config := config{
Source: os.Args[1], Source: os.Args[1],
Target: os.Args[2], Target: os.Args[2],
@ -124,52 +119,6 @@ func compare(basePackages map[string]packageInfo, targetPackages map[string]pack
return output 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) { func signFiles(path string) {
dir, err := os.Open(path) dir, err := os.Open(path)
@ -229,18 +178,6 @@ func sign(ch chan bool, path string) {
ch <- true ch <- true
} }
func add(ch chan bool, path string, args string) {
if strings.HasSuffix(path, ".deb") {
fmt.Printf("Adding to repo %s \n", path)
cmd := exec.Command("reprepro", args, path)
err := cmd.Run()
if err != nil {
panic(err)
}
}
ch <- true
}
func download(packages map[string]packageInfo, url string, output string) { func download(packages map[string]packageInfo, url string, output string) {
// Create a buffered channel to store the packages to be downloaded // Create a buffered channel to store the packages to be downloaded
packageQueue := make(chan packageInfo, 10) packageQueue := make(chan packageInfo, 10)

View File

@ -55,8 +55,8 @@ apt remove reprepro -y
wget -nv https://launchpad.net/ubuntu/+archive/primary/+files/reprepro_5.3.0-1.4_amd64.deb wget -nv https://launchpad.net/ubuntu/+archive/primary/+files/reprepro_5.3.0-1.4_amd64.deb
apt install -y ./reprepro_5.3.0-1.4_amd64.deb apt install -y ./reprepro_5.3.0-1.4_amd64.deb
# Add the new package to the repo # Add the new packages to the repo
../ppp repoadd ./output/ "-C ubuntu -V --basedir ./output/repo/ includedeb lunar" reprepro -C ubuntu -V --basedir ./output/repo/ includedeb lunar ./output/*.deb
# Push the updated ppa repo to the server # Push the updated ppa repo to the server
rsync -azP ./output/repo/ ferreo@direct.pika-os.com:/srv/www/pikappa/ rsync -azP ./output/repo/ ferreo@direct.pika-os.com:/srv/www/pikappa/