#282 [releng] rpkg deployment into COPR - basic start
Merged 5 years ago by clime. Opened 6 years ago by clime.

@@ -1,17 +0,0 @@ 

- #!/bin/bash

- 

- pushd `dirname $0`/.. >/dev/null

- PROJECT=$1

- if [ -z "$PROJECT" ]; then

- 	echo "usage: build-missing-builds.sh TARGET"

-     echo "       where TARGET is either @copr or @copr-dev"

-     exit 1

- fi

- 

- for package in $(cat .tito/packages/*| cut -d' ' -f2); do

- 	pushd $package

-     tito release $PROJECT

-     popd

- done

- 

- popd >/dev/null

@@ -1,46 +0,0 @@ 

- #!/usr/bin/perl

- 

- use strict;

- use warnings FATAL => 'all';

- use File::Basename ();

- 

- my ($self_dir) = ($0 =~ m!(.*/)!);

- if (not $self_dir) {

- 	$self_dir = './';

- }

- 

- my $cdup = `git rev-parse --show-cdup`;

- if (defined $cdup) {

- 	$cdup =~ s/\n.*//s;

- }

- 

- my @files;

- if (@ARGV) {

- 	for my $name (@ARGV) {

- 		my $path = "${self_dir}packages/$name";

- 		if (-f $path) {

- 			push @files, $path;

- 		} else {

- 			print STDERR "$name: file ${self_dir}packages/$name does not exist.\n";

- 		}

- 	}

- } else {

- 	@files = sort < ${self_dir}packages/* >;

- }

- for my $file (@files) {

- 	local *FILE;

- 	open FILE, $file or die "Error reading [$file]: $!\n";

- 	my $line = <FILE>;

- 	close FILE;

- 	my $name = File::Basename::basename($file);

- 	my ($version, $dir) = split /\s/, $line;

- 	my @changes =

- 		grep { not /^\S+\s([Bb]umping package versions for|%defattr is not needed since rpm 4\.4|Purging %changelog entries|replace legacy name of Tagger with new one|fixed tito build warning)/ }

- 		`git log --pretty=format:'%h %s (%ae)' $name-$version..HEAD -- $cdup$dir`;

- 	if (@changes) {

- 		print "$name-$version..HEAD:\n";

- 		print @changes, "\n";

- 		print "------------------------------------------\n";

- 	}

- }

- 

file removed
-3
@@ -1,3 +0,0 @@ 

- the .tito/packages directory contains metadata files

- named after their packages. Each file has the latest tagged

- version and the project's relative directory.

@@ -1,1 +0,0 @@ 

- 1.114-1 backend/

@@ -1,1 +0,0 @@ 

- 1.67-1 cli/

@@ -1,1 +0,0 @@ 

- 0.40-1 dist-git/

@@ -1,1 +0,0 @@ 

- 1.129-1 frontend/

@@ -1,1 +0,0 @@ 

- 1.71-1 keygen/

@@ -1,1 +0,0 @@ 

- 1.10-1 mocks/

@@ -1,1 +0,0 @@ 

- 0.17-1 rpmbuild/

@@ -1,1 +0,0 @@ 

- 1.48-1 selinux/

@@ -1,1 +0,0 @@ 

- 1.11-1 prunerepo/

@@ -1,1 +0,0 @@ 

- 1.87-1 python/

@@ -1,1 +0,0 @@ 

- 0.2-1 common/

file removed
-44
@@ -1,44 +0,0 @@ 

- [fedora-git]

- # this is for frontend, backend and few others

- releaser = tito.release.FedoraGitReleaser

- branches = master f28 f27 f26

- 

- [fedora-git-master]

- releaser = tito.release.FedoraGitReleaser

- branches = master

- 

- [fedora-git-keygen]

- # this is for keygen

- releaser = tito.release.FedoraGitReleaser

- branches = master f28 f27 f26

- 

- [fedora-git-epel7]

- releaser = tito.release.FedoraGitReleaser

- branches = epel7

- 

- [fedora-git-all]

- # this is for client packages

- releaser = tito.release.FedoraGitReleaser

- branches = master f28 f27 f26 el6 epel7

- 

- [fedora-git-selinux]

- releaser = tito.release.FedoraGitReleaser

- branches = master f28 f27 f26

- 

- [copr-msuchy-test]

- releaser = tito.release.CoprReleaser

- project_name = copr-dev

- builder.test = 1

- 

- [@copr]

- releaser = tito.release.CoprReleaser

- project_name = @copr/copr

- 

- [@copr-dev]

- releaser = tito.release.CoprReleaser

- project_name = @copr/copr-dev

- builder.test = 1

- 

- [@copr-ppc-builders]

- releaser = tito.release.CoprReleaser

- project_name = @copr/ppc-builders

file removed
-5
@@ -1,5 +0,0 @@ 

- [buildconfig]

- builder = tito.builder.Builder

- tagger = tito.tagger.VersionTagger

- changelog_do_not_remove_cherrypick = 0

- changelog_format = %s

file removed
-384
@@ -1,384 +0,0 @@ 

- # -*- mode: ruby -*-

- # vi: set ft=ruby :

- 

- Vagrant.configure(2) do |config|

- 

-   ###  FRONTEND  ###################################################

-   config.vm.define "frontend" do |frontend|

-     frontend.vm.box = "fedora/25-cloud-base"

- 

-     frontend.vm.network "forwarded_port", guest: 80, host: 5000

- 

-     #frontend.vm.synced_folder ".", "/vagrant", type: "nfs"

-     frontend.vm.synced_folder ".", "/vagrant", type: "rsync" # nfs sync does not with f25 currently due to Bug 1415496 - rpcbind fails at boot

- 

-     frontend.vm.network "private_network", ip: "192.168.242.51"

- 

-     # Update the system

-     frontend.vm.provision "shell",

-       inline: "sudo dnf clean all && sudo dnf -y update || true" # || true cause dnf might return non-zero status (probly delta rpm rebuilt failed)

- 

-     # Install packages to support Copr and building RPMs

-     frontend.vm.provision "shell",

-       inline: "sudo dnf -y install dnf-plugins-core tito wget"

- 

-     # Enable the Copr repository for dependencies

-     #frontend.vm.provision "shell",

-       # inline: "sudo dnf -y copr enable msuchy/copr"

-       # WORKAROUND: old DNF plugin uses outdated .repo URL

-     #  inline: "sudo wget https://copr.fedoraproject.org/coprs/msuchy/copr/repo/fedora-21/msuchy-copr-fedora-21.repo -P /etc/yum.repos.d/"

- 

-     frontend.vm.provision "shell",

-       inline: "sudo dnf -y copr enable @copr/copr"

- 

-     frontend.vm.provision "shell",

-       inline: "sudo dnf -y copr enable @modularity/modulemd"

- 

-     # Install build dependencies for Copr Frontend

-     frontend.vm.provision "shell",

-       inline: "sudo dnf -y builddep /vagrant/frontend/copr-frontend.spec"

- 

-     # Remove previous build, if any

-     frontend.vm.provision "shell",

-       inline: "sudo rm -rf /tmp/tito",

-       run: "always"

- 

-     # WORKAROUND: install redis which is needed for %check in spec

-     frontend.vm.provision "shell",

-       inline: "sudo dnf -y install redis"

- 

-     # WORKAROUND: start redis

-     frontend.vm.provision "shell",

-       inline: "sudo systemctl start redis",

-       run: "always"

- 

-     # Build Copr Frontend

-     frontend.vm.provision "shell",

-       inline: "cd /vagrant/frontend/ && tito build --test --rpm --rpmbuild-options='--nocheck'",

-       run: "always"

- 

-     # Install the Copr Frontend build

-     frontend.vm.provision "shell",

-       inline: "sudo dnf -y install /tmp/tito/noarch/copr-frontend*.noarch.rpm",

-       run: "always"

- 

-     # Configure dist git url

-     frontend.vm.provision "shell",

-       inline: "sed -e 's/^DIST_GIT_URL.*/DIST_GIT_URL = \"http:\\/\\/192.168.242.52\\/cgit\\/\"/' /etc/copr/copr.conf | sudo tee /etc/copr/copr.conf"

- 

-     # Configure dist git url

-     frontend.vm.provision "shell",

-       inline: "sed -e \"s/^#BACKEND_PASSWORD.*/BACKEND_PASSWORD = \\'1234\\'/\" /etc/copr/copr.conf | sudo tee /etc/copr/copr.conf"

- 

-     # Configure backend base url

-     frontend.vm.provision "shell",

-       inline: "sed -e 's/^BACKEND_BASE_URL.*/BACKEND_BASE_URL = \"http:\\/\\/localhost:5002\"/' /etc/copr/copr.conf | sudo tee /etc/copr/copr.conf",

-       run: "always"

- 

-     # Configure import logs url

-     frontend.vm.provision "shell",

-       inline: "sed -e 's/^COPR_DIST_GIT_LOGS_URL.*/COPR_DIST_GIT_LOGS_URL = \"http:\\/\\/192.168.242.52\\/per-task-logs\"/' /etc/copr/copr.conf | sudo tee /etc/copr/copr.conf",

-       run: "always"

- 

-     # ..

-     frontend.vm.provision "shell",

-       inline: "sudo dnf -y install copr-selinux postgresql-server"

- 

-     # ..

-     frontend.vm.provision "shell",

-       inline: "sudo postgresql-setup initdb"

- 

-     # ..

-     frontend.vm.provision "shell",

-       inline: "sudo systemctl start postgresql",

-       run: "always"

- 

-     # ..

-     frontend.vm.provision "shell",

-       inline: "sudo su - postgres -c 'PGPASSWORD=coprpass ; createdb -E UTF8 coprdb ; yes $PGPASSWORD | createuser -P -sDR copr-fe'"

- 

-     # I want to prepend some lines to a file - I'll do it in three steps

-     # 1.  backup the database config file

-     frontend.vm.provision "shell",

-       inline: "sudo mv /var/lib/pgsql/data/pg_hba.conf /tmp/pg_hba.conf"

- 

-     # 2.  write the lines

-     frontend.vm.provision "shell",

-       inline: "printf 'local coprdb copr-fe md5\nhost  coprdb copr-fe 127.0.0.1/8 md5\nhost  coprdb copr-fe ::1/128 md5\nlocal coprdb postgres  ident\n' | sudo tee /var/lib/pgsql/data/pg_hba.conf"

- 

-     # 3.  write the file back after those lines

-     frontend.vm.provision "shell",

-       inline: "sudo cat /tmp/pg_hba.conf | sudo tee -a  /var/lib/pgsql/data/pg_hba.conf"

- 

-     # ..

-     frontend.vm.provision "shell",

-       inline: "sudo systemctl reload postgresql"

- 

-     # ..

-     frontend.vm.provision "shell",

-       inline: "cd /usr/share/copr/coprs_frontend/ && sudo ./manage.py create_db --alembic alembic.ini"

- 

-     # ..

-     frontend.vm.provision "shell",

-       inline: "sudo /usr/share/copr/coprs_frontend/manage.py create_chroot fedora-{22,23,rawhide}-{i386,x86_64,ppc64le} epel-{6,7}-x86_64 epel-6-i386"

- 

-     # ..

-     frontend.vm.provision "shell",

-       inline: "echo 'PEERDNS=no' | sudo tee -a /etc/sysconfig/network"

- 

-     # ..

-     frontend.vm.provision "shell",

-       inline: "echo 'nameserver 8.8.8.8' | sudo tee -a /etc/resolv.conf"

- 

-     # ..

-     frontend.vm.provision "shell",

-       inline: "sudo systemctl restart network"

- 

-     # ..

-     frontend.vm.provision "shell", inline: <<-FOO

-   echo \"

-   <VirtualHost 0.0.0.0>

- 

-       WSGIPassAuthorization On

-       WSGIDaemonProcess 127.0.0.1 user=copr-fe group=copr-fe threads=5

-       WSGIScriptAlias / /usr/share/copr/coprs_frontend/application

-       WSGIProcessGroup 127.0.0.1

-       <Directory /usr/share/copr>

-           WSGIApplicationGroup %{GLOBAL}

-           Require all granted

-       </Directory>

-   </VirtualHost>

-   \" | sudo tee /etc/httpd/conf.d/copr.conf

-   FOO

- 

-     # ..

-     frontend.vm.provision "shell",

-       inline: "sudo chown -R copr-fe:copr-fe /usr/share/copr"

- 

-     # selinux: make data dir writeable for httpd

-     # TODO: probly correct solution is to uncomment first four lines in

-     # coprs_frontend/config/copr.conf so that data are stored under /var/lib

-     # and not under /usr/share/copr. copr-selinux does not account for storing

-     # data under /usr/share/copr/. Discuss this with peers.

-     frontend.vm.provision "shell",

-       inline: "chcon -R -t httpd_sys_rw_content_t /usr/share/copr/data",

-       run: "always"

- 

-     # ..

-     frontend.vm.provision "shell",

-       inline: "sudo chown -R copr-fe:copr-fe /var/log/copr-frontend"

- 

-     # ..

-     frontend.vm.provision "shell",

-       inline: "sudo systemctl restart httpd",

-       run: "always"

- 

-     frontend.vm.provision "shell", run: "always", inline: <<-EOF

-       echo "#########################################################"

-       echo "###   Your development instance of Copr Frontend      ###"

-       echo "###   is now running at: http://localhost:5000        ###"

-       echo "#########################################################"

-     EOF

- 

-     # workaround

-     frontend.vm.provision "shell",

-       inline: "sudo setenforce 0 && sudo systemctl restart httpd",

-       run: "always"

- 

-   end

-   ###  DIST-GIT  ###################################################

-   config.vm.define "distgit" do |distgit|

- 

-     distgit.vm.box = "fedora/25-cloud-base"

- 

-     distgit.vm.network "forwarded_port", guest: 80, host: 5001

- 

-     #distgit.vm.synced_folder ".", "/vagrant", type: "nfs"

-     distgit.vm.synced_folder ".", "/vagrant", type: "rsync" # nfs sync does not with f25 currently due to Bug 1415496 - rpcbind fails at boot

- 

-     distgit.vm.network "private_network", ip: "192.168.242.52"

- 

-     distgit.vm.provision "shell",

-       inline: "sudo dnf -y copr enable clime/dist-git"

- 

-     # Update the system

-     distgit.vm.provision "shell",

-       inline: "sudo dnf clean all && sudo dnf -y update || true" # || true cause dnf might return non-zero status (probly delta rpm rebuilt failed)

- 

-     # ...

-     distgit.vm.provision "shell",

-       inline: "sudo dnf -y install tito cgit dist-git dist-git-selinux pyrpkg || sudo dnf -y upgrade tito cgit dist-git dist-git-selinux pyrpkg"

- 

-     # ...

-     distgit.vm.provision "shell",

-       inline: "sudo dnf builddep -y /vagrant/dist-git/copr-dist-git.spec"

- 

-     # ...

-     distgit.vm.provision "shell",

-       inline: "sudo rm -rf /tmp/tito/*",

-       run: "always"

- 

-     # ...

-     distgit.vm.provision "shell",

-       inline: "cd /vagrant/dist-git/ && tito build --test --rpm --rpmbuild-options='--nocheck'",

-       run: "always"

- 

-     # ...

-     distgit.vm.provision "shell",

-       inline: "sudo dnf -y install /tmp/tito/noarch/copr-dist-git*.noarch.rpm || sudo dnf -y upgrade /tmp/tito/noarch/copr-dist-git*.noarch.rpm || sudo dnf -y downgrade /tmp/tito/noarch/copr-dist-git*.noarch.rpm",

-       run: "always"

- 

-     # ...

-     distgit.vm.provision "shell", inline: <<-EOF

- echo \"[dist-git]

- frontend_base_url=http://192.168.242.51

- frontend_auth=1234

- \" | sudo tee /etc/copr/copr-dist-git.conf && sudo chmod 644 /etc/copr/copr-dist-git.conf

-     EOF

- 

-     # ...

-     distgit.vm.provision "shell", inline: <<-EOF

- echo \" [user]

-         email = copr-devel@lists.fedorahosted.org

-         name = Copr dist git\" | sudo tee /home/copr-dist-git/.gitconfig && sudo chown copr-dist-git:copr-dist-git /home/copr-dist-git/.gitconfig

-     EOF

- 

-     # ...

-     distgit.vm.provision "shell", inline: <<-EOF

- echo \"

- AliasMatch \\"/repo(/.*)/md5(/.*)\\" \\"/var/lib/dist-git/cache/lookaside\\$1\\$2\\"

- Alias /repo/ /var/lib/dist-git/cache/lookaside/

- \" | sudo tee /etc/httpd/conf.d/dist-git/lookaside-copr.conf

-     EOF

- 

-     # ...

-     distgit.vm.provision "shell",

-       inline: "systemctl restart httpd && systemctl enable httpd"

- 

-     # ...

-     distgit.vm.provision "shell",

-       inline: "sudo sed -i s/^cache-size.*// /etc/cgitrc"

- 

-     # ...

-     distgit.vm.provision "shell",

-       inline: "echo 'scan-path=/var/lib/dist-git/git/rpms' | sudo tee -a /etc/cgitrc"

- 

-     # ...

-     distgit.vm.provision "shell",

-       inline: "sudo systemctl start dist-git.socket && sudo systemctl enable dist-git.socket"

- 

-     # ...

-     distgit.vm.provision "shell",

-       inline: "sudo systemctl start copr-dist-git && sudo systemctl enable copr-dist-git"

- 

-     #...

-     distgit.vm.provision "shell",

-       inline: "sudo systemctl daemon-reload",

-       run: "always"

- 

-     #...

-     distgit.vm.provision "shell",

-       inline: "sudo systemctl restart copr-dist-git",

-       run: "always"

- 

-     distgit.vm.provision "shell", run: "always", inline: <<-EOF

-       echo "#########################################################"

-       echo "###   Your development instance of Copr Dist Git      ###"

-       echo "###   is now running at: http://localhost:5001/cgit   ###"

-       echo "#########################################################"

-     EOF

-   end

- 

-   ###  BACKEND   ###################################################

-   config.vm.define "backend" do |backend|

- 

-     backend.vm.box = "fedora/25-cloud-base"

- 

-     backend.vm.network "forwarded_port", guest: 5002, host: 5002

- 

-     #backend.vm.synced_folder ".", "/vagrant", type: "nfs"

-     backend.vm.synced_folder ".", "/vagrant", type: "rsync" # nfs sync does not with f25 currently due to Bug 1415496 - rpcbind fails at boot

- 

-     backend.vm.network "private_network", ip: "192.168.242.53"

- 

-     backend.vm.provision "shell",

-       inline: <<-SHELL

-         sudo dnf -y copr enable @copr/copr-dev

-         sudo dnf -y copr enable @modularity/modulemd

-         sudo rpm --nodeps -e vim-minimal

-         sudo dnf -y install dnf-plugins-core htop tito wget net-tools iputils vim mlocate git sudo python-nova openssh-server supervisor psmisc tmux

- 

-         # Builder packages

-         sudo dnf -y install fedpkg-copr packagedb-cli fedora-cert mock mock-lvm createrepo yum-utils pyliblzma rsync openssh-clients libselinux-python libsemanage-python rpm glib2 ca-certificates scl-utils-build ethtool copr-keygen nginx

- 

-         echo '127.0.0.1 keygen' >> /etc/hosts

-       SHELL

- 

-     backend.vm.provision "shell", run: "always", inline: <<-SHELL

-         sudo dnf builddep -y /vagrant/backend/copr-backend.spec --allowerasing

-         sudo rm -rf /tmp/tito/*

-         cd /vagrant/backend/ && tito build --test --rpm --rpmbuild-options='--nocheck'

-         sudo dnf -y install /tmp/tito/noarch/copr-backend*.noarch.rpm || sudo dnf -y upgrade /tmp/tito/noarch/copr-backend*.noarch.rpm || sudo dnf -y downgrade /tmp/tito/noarch/copr-backend*.noarch.rpm

-     SHELL

- 

-     backend.vm.provision "shell",

-       inline: <<-SHELL

-         echo 'root:passwd' | sudo chpasswd

-         sudo mkdir /root/.ssh &&  sudo chmod 700 /root /root/.ssh

-         sudo touch /root/.ssh/authorized_keys && sudo chmod 600 /root/.ssh/authorized_keys

-         sudo ssh-keygen -f /root/.ssh/id_rsa -N '' -q -C root@locahost

-         sudo bash -c "cat /root/.ssh/id_rsa.pub >> /root/.ssh/authorized_keys"

- 

-         echo 'copr:passwd' | sudo chpasswd

-         sudo bash -c "echo 'copr ALL=(ALL:ALL) NOPASSWD:ALL' >> /etc/sudoers"

-         sudo mkdir -p /home/copr/.ssh && sudo chmod 700 /home/copr /home/copr/.ssh

-         sudo ssh-keygen -f /home/copr/.ssh/id_rsa -N '' -q -C copr@locahost

-         sudo touch /home/copr/.ssh/authorized_keys && sudo chmod 600 /home/copr/.ssh/authorized_keys

-         sudo bash -c "cat /home/copr/.ssh/id_rsa.pub >> /root/.ssh/authorized_keys"

-         sudo bash -c "cat /home/copr/.ssh/id_rsa.pub >> /home/copr/.ssh/authorized_keys"

-         sudo chown copr:copr -R /home/copr

-         sudo usermod -a -G mock copr

- 

-         sudo dnf install -y uwsgi uwsgi-plugin-python

-         sudo mkdir /var/log/uwsgi

-         sudo chown apache:apache /var/log/uwsgi

-         sudo chmod 775 /var/log/uwsgi

-         sudo chown apache:apache /var/run/uwsgi

-         sudo chmod 775 /var/run/uwsgi

-         sudo usermod copr-signer -G apache

- 

-         sudo cp -r /vagrant/backend/docker/files/* /

-         sudo chmod 700 /root && sudo chmod 700 /home/copr && sudo chown copr:copr /home/copr # fix permission after COPY

- 

-         sudo chown copr-signer:apache /etc/uwsgi.d/copr-keygen.ini

-         sudo chown copr-signer:copr-signer /var/log/copr-keygen/main.log

- 

-         sudo dnf -y downgrade fedpkg # temporary fix cause fedpkg-copr doesn't work with the new version of fedpkg

-         sudo dnf -y install ansible1.9 --allowerasing # copr does not support ansible2 yet

-       SHELL

- 

-     backend.vm.provision "shell",

-       inline: <<-SHELL

-         sudo sed -i s/localhost:5000/192.168.242.51/ /etc/copr/copr-be.conf

-         sudo sed -i s/localhost:5001/192.168.242.52/ /etc/copr/copr-be.conf

-         sudo sed -i s/localhost:5001/192.168.242.52/ /etc/rpkg/fedpkg-copr.conf

-       SHELL

- 

-     backend.vm.provision "shell",

-       inline: "sudo echo 4096 > /proc/sys/net/core/somaxconn",

-       run: "always"

- 

-     backend.vm.provision "shell",

-       inline: "sudo /usr/bin/supervisord -c /etc/supervisord.conf",

-       run: "always"

- 

-     backend.vm.provision "shell", run: "always", inline: <<-EOF

-       echo "#########################################################"

-       echo "###   Your development instance of Copr Backend       ###"

-       echo "###   is now running at: http://localhost:5002        ###"

-       echo "#########################################################"

-     EOF

- 

-   end

- 

- end

file modified
+8 -6
@@ -2,18 +2,19 @@ 

  %global _pkgdocdir %{_docdir}/%{name}-%{version}

  %endif

  

- Name:       copr-backend

- Version:    1.114

+ Name:       {{{ git_dir_name }}}

+ Version:    {{{ git_dir_version lead=1 }}}

  Release:    1%{?dist}

  Summary:    Backend for Copr

  

  License:    GPLv2+

  URL:        https://pagure.io/copr/copr

- # Source is created by

+ # Source is created by:

  # git clone https://pagure.io/copr/copr.git

+ # git checkout {{{ cached_git_name_version }}}

  # cd copr/backend

- # tito build --tgz

- Source0: %{name}-%{version}.tar.gz

+ # rpkg spec --sources

+ Source0:    {{{ git_dir_pack }}}

  

  BuildArch:  noarch

  BuildRequires: asciidoc
@@ -95,7 +96,6 @@ 

  %prep

  %setup -q

  

- 

  %build

  

  %if 0%{?fedora}
@@ -220,6 +220,8 @@ 

  %exclude %{_pkgdocdir}/playbooks

  

  %changelog

+ {{{ git_dir_changelog since_tag=copr-backend-1.115-1 }}}

+ 

  * Mon Feb 26 2018 clime <clime@redhat.com> 1.114-1

  - add possibility for copr_log_hitcounter to ignore multiple subnets

  

file modified
+17 -42
@@ -1,11 +1,11 @@ 

  FROM fedora:26

  MAINTAINER clime@redhat.com

  

+ RUN dnf -y install dnf-plugins-core && dnf -y copr enable @copr/copr

+ 

  # base packages

  RUN dnf -y update && \

-     dnf -y install dnf-plugins-core \

-                    htop \

-                    tito \

+     dnf -y install htop \

                     wget \

                     net-tools \

                     iputils \
@@ -40,8 +40,8 @@ 

  # to get more entropy for generation of gpg keys

                     rng-tools \

  # for unbuffer package

-                    expect && \

-     dnf clean all

+                    expect \

+                    rpkg

  

  # needed to be able to ping

  RUN setcap cap_net_raw,cap_net_admin+p /usr/bin/ping
@@ -70,16 +70,6 @@ 

  # setup user for web access

  RUN useradd -r apache

  

- # decides if we should install released or latest (git) versions of COPR packages

- ARG RELEASETEST

- 

- # enable appropriate copr repos

- RUN dnf -y copr enable @copr/copr && \

-     if [ ! $RELEASETEST ]; then dnf -y copr enable @copr/copr-dev; fi

- 

- # additional builder packages from COPR repos

- RUN dnf -y install copr-rpmbuild && dnf clean all

- 

  # preinstall copr-keygen and its builddeps to utilize most of Docker cache

  RUN cd `mktemp -d` && dnf -y download --source copr-keygen && \

      dnf -y builddep *.src.rpm --allowerasing && \
@@ -115,43 +105,28 @@ 

  COPY . /copr

  

  # build copr-backend from sources

- RUN dnf -y builddep /copr/backend/copr-backend.spec --allowerasing && \

-     cd /copr/backend && \

+ RUN rpkg --path /copr/backend spec --outdir /tmp/rpkg && \

+     dnf -y builddep /tmp/rpkg/copr-backend.spec --allowerasing && \

      export LANG=en_US.UTF-8 && \

-     if [ ! $RELEASETEST ]; then \

-         tito build --test --rpm; \

-     else \

-         tito build --rpm; \

-     fi && \

+     rpkg --path /copr/backend local --outdir /tmp/rpkg && \

  # upgrade the already pre-installed package if possible

-     dnf -y upgrade /tmp/tito/noarch/copr-backend*.noarch.rpm || true && \

-     dnf clean all

+     dnf -y upgrade /tmp/rpkg/noarch/copr-backend*.noarch.rpm || true

  

  # build copr-keygen from sources

- RUN dnf -y builddep /copr/keygen/copr-keygen.spec --allowerasing && \

-     cd /copr/keygen && \

+ RUN rpkg --path /copr/keygen spec --outdir /tmp/rpkg && \

+     dnf -y builddep /tmp/rpkg/copr-keygen.spec --allowerasing && \

      export LANG=en_US.UTF-8 && \

-     if [ ! $RELEASETEST ]; then \

-         tito build --test --rpm; \

-     else \

-         tito build --rpm; \

-     fi && \

+     rpkg --path /copr/keygen local --outdir /tmp/rpkg && \

  # upgrade the already pre-installed package if possible

-     dnf -y upgrade /tmp/tito/noarch/copr-keygen*.noarch.rpm || true && \

-     dnf clean all

+     dnf -y upgrade /tmp/rpkg/noarch/copr-keygen*.noarch.rpm || true

  

  # build copr-rpmbuild from sources

- RUN dnf -y builddep /copr/rpmbuild/copr-rpmbuild.spec --allowerasing && \

-     cd /copr/rpmbuild && \

+ RUN rpkg --path /copr/rpmbuild spec --outdir /tmp/rpkg && \

+     dnf -y builddep /tmp/rpkg/copr-rpmbuild.spec --allowerasing && \

      export LANG=en_US.UTF-8 && \

-     if [ ! $RELEASETEST ]; then \

-         tito build --test --rpm; \

-     else \

-         tito build --rpm; \

-     fi && \

+     rpkg --path /copr/rpmbuild local --outdir /tmp/rpkg && \

  # upgrade the already pre-installed package if possible

-     dnf -y upgrade /tmp/tito/noarch/copr-rpmbuild*.noarch.rpm || true && \

-     dnf clean all

+     dnf -y upgrade /tmp/rpkg/noarch/copr-rpmbuild*.noarch.rpm || true

  

  # copy filesystem setup and setup ownership and permissions

  COPY backend/docker/files/ /

file modified
+1 -1
@@ -1,5 +1,5 @@ 

  build:

- 	docker build -t copr-backend-image --build-arg=RELEASETEST="${RELEASETEST}" -f Dockerfile ../../

+ 	docker build -t copr-backend-image -f Dockerfile ../../

  

  run:

  	docker run --privileged --name="copr-backend" -dit --net="host" copr-backend-image

file modified
+1 -1
@@ -3,7 +3,7 @@ 

  

  # You can set these variables from the command line.

  SPHINXOPTS    =

- SPHINXBUILD   = sphinx-build

+ SPHINXBUILD   = sphinx-build-3

  PAPER         =

  BUILDDIR      = build

  

file modified
+19 -12
@@ -3,24 +3,31 @@ 

  

  1. Obtain rpms:

  

- Get rpm either from upstream copr: https://copr.fedoraproject.org/coprs/msuchy/copr/ ::

+ Get rpm either from upstream copr: https://copr.fedorainfracloud.org/coprs/g/copr/copr/ ::

  

-     dnf copr enable msuchy/copr

+     dnf copr enable @copr/copr

      dnf install -y copr-backend copr-selinux

  

+ or checkout git repo and build with rpkg::

  

- 

- or checkout git repo and build latest release with tito::

+     dnf install rpkg

  

      git clone https://pagure.io/copr/copr.git

-     yum install -y tito yum-utils

-     yum-builddep backend/copr-backend.spec

-     yum-builddep selinux/copr-selinux.spec

-     yum-builddep python/python-copr.spec

-     cd backend && tito build --rpm && cd ..

-     cd selinux && tito build --rpm && cd ..

-     cd python && tito build --rpm && cd ..

-     yum localinstall <path to the built rpms>

+     cd copr

+ 

+     rpkg --path backend spec --outdir /tmp/rpkg

+     rpkg --path selinux spec --outdir /tmp/rpkg

+     rpkg --path python spec --outdir /tmp/rpkg

+ 

+     dnf builddep /tmp/rpkg/copr-backend.spec

+     dnf builddep /tmp/rpkg/copr-selinux.spec

+     dnf builddep /tmp/rpkg/python-copr.spec

+ 

+     cd backend && rpkg local && cd ..

+     cd selinux && rpkg local && cd ..

+     cd python && rpkg local && cd ..

+ 

+     dnf install -C <path to the built rpms>

  

  

  2. Prepare ansible playbooks to spawn and terminate VM builders using your VM provider.

@@ -14,7 +14,8 @@ 

  rm -f /lib/systemd/system/anaconda.target.wants/*;

  VOLUME ["/sys/fs/cgroup"]

  

- RUN dnf -y install htop tito wget net-tools iputils vim mlocate git sudo openssh-server dnf-plugins-core psmisc python-jedi procps-ng

+ RUN dnf -y install dnf-plugins-core && dnf -y copr enable @copr/copr

+ RUN dnf -y install htop wget net-tools iputils vim mlocate git sudo openssh-server psmisc python-jedi procps-ng

  

  # Sanity tests

  RUN wget https://beaker-project.org/yum/beaker-client-Fedora.repo -P /etc/yum.repos.d
@@ -28,6 +29,4 @@ 

  RUN echo 'root:passwd' | chpasswd

  RUN echo 'export LANG=en_US.UTF-8' >> /root/.bashrc

  

- RUN dnf -y copr enable @copr/copr-dev

- 

  CMD ["/usr/sbin/init"]

@@ -3,8 +3,7 @@ 

  export SCRIPTPATH="$( builtin cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"

  export LANG=en_US.utf8

  

- # primarily install git for the setup below

- dnf -y install git

+ dnf -y install git dnf-plugins-core

  

  if [[ `pwd` =~ ^/mnt/tests.*$ ]]; then

      echo "Setting up native beaker environment."
@@ -19,7 +18,8 @@ 

  cp -rT $SCRIPTPATH/files /

  

  # install stuff needed for the test

- dnf -y install docker vagrant vagrant-libvirt jq tito wget rsync

+ dnf copr enable -y @copr/copr

+ dnf -y install docker vagrant vagrant-libvirt jq wget rsync rpkg

  

  # enable libvirtd for Vagrant (distgit)

  systemctl enable libvirtd && systemctl start libvirtd
@@ -68,10 +68,8 @@ 

  cd $COPRROOTDIR/mocks

  dnf -y install python3-flask

  dnf -y install python3-flask-script

- dnf -y builddep copr-mocks.spec

- if [[ ! $RELEASETEST ]]; then

- 	tito build -i --test --rpm

- else

- 	tito build -i --offline --rpm

- fi

+ rpkg spec --outdir /tmp/rpkg

+ dnf -y builddep /tmp/rpkg/copr-mocks.spec

+ rpkg local --outdir /tmp/rpkg

+ dnf install -C -y /tmp/rpkg/noarch/copr-mocks*noarch.rpm --best

  cd $SCRIPTPATH

@@ -1,4 +1,11 @@ 

- [distgit]

- lookaside = http://localhost/repo/pkgs/%(ns2)s/%(ns1)s/%(pkg)s/%(filename)s/%(hashtype)s/%(hash)s/%(filename)s

- anongiturl = http://localhost/git/%(module)s

+ [rpkg]

+ preprocess_spec = True

+ 

+ # auto-packing is deprecated:

+ auto_pack = False

  

+ base_output_path = /tmp/rpkg

+ 

+ [git]

+ lookaside = http://localhost/repo/pkgs/%(ns2)s/%(ns1)s/%(name)s/%(filename)s/%(hashtype)s/%(hash)s/%(filename)s

+ anongiturl = http://localhost/git/%(module)s

@@ -1,6 +1,9 @@ 

  #!/bin/bash

  

  export SCRIPTPATH="$( builtin cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"

+ export LANG=en_US.utf8

+ 

+ dnf -y install git dnf-plugins-core

  

  if [[ `pwd` =~ ^/mnt/tests.*$ ]]; then

      echo "Setting up native beaker environment."
@@ -12,37 +15,25 @@ 

  fi

  

  dnf -y copr enable @copr/copr

- if [[ ! $RELEASETEST ]]; then

- 	dnf -y copr enable @copr/copr-dev

- fi

+ dnf -y install jq copr-mocks dist-git dist-git-selinux rpkg

  

- dnf -y update

- dnf -y install git python2-rpkg jq copr-mocks dist-git dist-git-selinux rpkg

- 

- export LANG=en_US.UTF-8

+ # cleanup

+ rm -r /tmp/rpkg/

  

  # install copr-mocks from sources

  cd $COPRROOTDIR/mocks

- dnf -y builddep copr-mocks.spec

- rm -rf /tmp/tito/noarch/

- if [[ ! $RELEASETEST ]]; then

- 	tito build --test --rpm

- else

- 	tito build --offline --rpm

- fi

- dnf install -y /tmp/tito/noarch/copr-mocks*noarch.rpm --best

+ rpkg spec --outdir /tmp/rpkg

+ dnf -y builddep /tmp/rpkg/copr-mocks.spec

+ rpkg local --outdir /tmp/rpkg

+ dnf install -y /tmp/rpkg/noarch/copr-mocks*noarch.rpm --best

  cd -

  

  # install copr-dist-git from sources

  cd $COPRROOTDIR/dist-git

- dnf -y builddep copr-dist-git.spec --allowerasing

- rm -rf /tmp/tito/noarch/

- if [[ ! $RELEASETEST ]]; then

- 	tito build --test --rpm

- else

- 	tito build --offline --rpm

- fi

- dnf install -y /tmp/tito/noarch/copr-dist-git*noarch.rpm --best

+ rpkg spec --outdir /tmp/rpkg

+ dnf -y builddep /tmp/rpkg/copr-dist-git.spec --allowerasing

+ rpkg local --outdir /tmp/rpkg

+ dnf install -y /tmp/rpkg/noarch/copr-dist-git*noarch.rpm --best

  cd -

  

  # root user settings
@@ -93,7 +84,7 @@ 

  cat /root/.ssh/id_rsa.pub >> /home/git/.ssh/authorized_keys

  cat /home/copr-dist-git/.ssh/id_rsa.pub >> /home/git/.ssh/authorized_keys

  

- # copy test suite file

+ # copy test suite files

  cp -rT files/ /

  

  # setting correct permissions

@@ -36,7 +36,7 @@ 

                  rlRun "git checkout $git_hash" 0

                  rlRun "ls *.spec sources" 0

                  rlRun "ls *.src.rpm" 2

-                 rlRun "rpkg srpm" 0

+                 rlRun "rpkg srpm --outdir ." 0

                  rlRun "ls *.src.rpm" 0

              fi

              cd $TESTPATH && rm -r $MYTMPDIR

@@ -3,8 +3,7 @@ 

  export SCRIPTPATH="$( builtin cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"

  export LANG=en_US.utf8

  

- # primarily install git for the setup below

- dnf -y install git

+ dnf -y install git dnf-plugins-core

  

  if [[ `pwd` =~ ^/mnt/tests.*$ ]]; then

      echo "Setting up native beaker environment."
@@ -16,13 +15,10 @@ 

  fi

  

  # install files from 'files'

- #cp -rT $SCRIPTPATH/files /

+ cp -rT $SCRIPTPATH/files /

  

- # install stuff needed for the test

- dnf -y install vagrant

- dnf -y install vagrant-libvirt

- dnf -y install jq

- dnf -y install tito

+ dnf -y copr enable @copr/copr

+ dnf -y install vagrant vagrant-libvirt jq rpkg

  

  # enable libvirtd for Vagrant (distgit)

  systemctl enable libvirtd && systemctl start libvirtd

file modified
+12 -9
@@ -12,18 +12,19 @@ 

  %global __python %{__python3}

  %endif

  

- Name:       copr-cli

- Version:    1.67

+ Name:       {{{ git_dir_name }}}

+ Version:    {{{ git_dir_version lead=1 }}}

  Release:    1%{?dist}

  Summary:    Command line interface for COPR

  

  License:    GPLv2+

  URL:        https://pagure.io/copr/copr

- # Source is created by

+ # Source is created by:

  # git clone https://pagure.io/copr/copr.git

+ # git checkout {{{ cached_git_name_version }}}

  # cd copr/cli

- # tito build --tgz

- Source0: %{name}-%{version}.tar.gz

+ # rpkg spec --sources

+ Source0:    {{{ git_dir_pack }}}

  

  BuildArch:  noarch

  BuildRequires: asciidoc
@@ -96,9 +97,9 @@ 

  

  %build

  %if 0%{?use_python3}

- %{__python3} setup.py build

+ version="%{version}" %{__python3} setup.py build

  %else

- %{__python2} setup.py build

+ version="%{version}" %{__python2} setup.py build

  %endif

  

  mv copr_cli/README.rst ./
@@ -109,9 +110,9 @@ 

  %install

  install -d %{buildroot}%{_pkgdocdir}/

  %if 0%{?use_python3}

- %{__python3} setup.py install --root %{buildroot}

+ version="%{version}" %{__python3} setup.py install --root %{buildroot}

  %else

- %{__python2} setup.py install --root %{buildroot}

+ version="%{version}" %{__python2} setup.py install --root %{buildroot}

  %endif

  

  ln -sf %{_bindir}/copr-cli %{buildroot}%{_bindir}/copr
@@ -153,6 +154,8 @@ 

  %endif

  

  %changelog

+ {{{ git_dir_changelog since_tag=copr-cli-1.68-1 }}}

+ 

  * Fri Feb 23 2018 clime <clime@redhat.com> 1.67-1

  - remove Group tag

  

file modified
+1 -17
@@ -19,23 +19,7 @@ 

      'jinja2'

  ]

  

- 

- def read(*parts):

-     return codecs.open(os.path.join(os.path.dirname(__file__), *parts),

-                        encoding='utf8').read()

- 

- 

- def find_version(*file_paths):

-     version_file = read(*file_paths)

-     version_match = re.search(r"^Version: (.*)$",

-                               version_file, re.M)

-     if version_match:

-         return version_match.group(1)

-     raise RuntimeError("Unable to find version string.")

- 

- 

  __name__ = 'copr-cli'

- __version__ = find_version('copr-cli.spec')

  __description__ = "CLI tool to run copr"

  __author__ = "Pierre-Yves Chibon"

  __author_email__ = "pingou@pingoured.fr"
@@ -44,7 +28,7 @@ 

  

  setup(

      name=__name__,

-     version=__version__,

+     version=os.getenv('version'),

      description=__description__,

      long_description=long_description,

      author=__author__,

@@ -1,4 +1,5 @@ 

- %global srcname copr-common

+ {{{ export srcname=copr-common }}}

+ %global srcname {{{ printf "$srcname" }}}

  

  %if 0%{?rhel} < 7 && 0%{?rhel} > 0

  %global _pkgdocdir %{_docdir}/%{name}-%{version}
@@ -17,8 +18,8 @@ 

  %global with_python2 1

  %endif

  

- Name:       python-%{srcname}

- Version:    0.2

+ Name:       {{{ git_name name="python-$srcname" }}}

+ Version:    {{{ git_version }}}

  Release:    1%{?dist}

  Summary:    Python code used by Copr

  
@@ -26,9 +27,10 @@ 

  URL:        https://pagure.io/copr/copr

  # Source is created by

  # git clone https://pagure.io/copr/copr.git

+ # git checkout {{{ cached_git_name_version }}}

  # cd copr/common

- # tito build --tgz

- Source0: %{name}-%{version}.tar.gz

+ # rpkg spec --sources

+ Source0:    {{{ git_dir_pack }}}

  

  BuildArch: noarch

  
@@ -70,20 +72,20 @@ 

  %setup -q

  %build

  %if 0%{?with_python3}

- %py3_build

+ version="%{version}" %py3_build

  %endif # with_python3

  

  %if 0%{?with_python2}

- %py2_build

+ version="%{version}" %py2_build

  %endif # with_python2

  

  %install

  %if 0%{?with_python2}

- %py2_install

+ version="%{version}" %py2_install

  %endif # with_python2

  

  %if 0%{?with_python3}

- %py3_install

+ version="%{version}" %py3_install

  %endif # with_python3

  

  %if 0%{?with_python3}
@@ -99,6 +101,8 @@ 

  %endif # with_python2

  

  %changelog

+ {{{ git_changelog since_tag="python-$srcname-0.3-1" }}}

+ 

  * Thu Mar 22 2018 Dominik Turecek <dturecek@redhat.com> 0.2-1

  - [common] fix spec file

  

file modified
+1 -16
@@ -12,21 +12,6 @@ 

  useful for developers only."""

  

  

- def read(*parts):

-     return codecs.open(os.path.join(os.path.dirname(__file__), *parts),

-                        encoding='utf8').read()

- 

- 

- def find_version(*file_paths):

-     version_file = read(*file_paths)

-     version_match = re.search(r"^Version: (.*)$",

-                               version_file, re.M)

-     if version_match:

-         return version_match.group(1).strip()

-     raise RuntimeError("Unable to find version string.")

- 

- 

- __version__ = find_version("python-copr-common.spec")

  __description__ = "Common python code used by Copr."

  __author__ = "Dominik Turecek"

  __author_email__ = "dturecek@redhat.com"
@@ -35,7 +20,7 @@ 

  

  setup(

      name='copr_common',

-     version=__version__,

+     version=os.getenv('version'),

      description=__description__,

      long_description=long_description,

      author=__author__,

file modified
+7 -4
@@ -1,5 +1,5 @@ 

- Name:       copr-dist-git

- Version:    0.40

+ Name:       {{{ git_dir_name }}}

+ Version:    {{{ git_dir_version }}}

  Release:    1%{?dist}

  Summary:    Copr services for Dist Git server

  
@@ -7,9 +7,10 @@ 

  URL:        https://pagure.io/copr/copr

  # Source is created by

  # git clone https://pagure.io/copr/copr.git

+ # git checkout {{{ cached_git_name_version }}}

  # cd copr/dist-git

- # tito build --tgz

- Source0: %{name}-%{version}.tar.gz

+ # rpkg sources --spec

+ Source0:    {{{ git_dir_pack }}}

  

  BuildArch:  noarch

  
@@ -131,6 +132,8 @@ 

  %ghost %{_var}/log/copr-dist-git/*.log

  

  %changelog

+ {{{ git_changelog since_tag=copr-dist-git-0.41-1 }}}

+ 

  * Fri Feb 23 2018 clime <clime@redhat.com> 0.40-1

  - remove Group tag

  

file modified
+3 -2
@@ -106,7 +106,8 @@ 

      </job>

  

  

- If something is failing and you want to debug, you can speed up the process by running the tests locally. 

+ You can also run the tests locally.

+ 

  You can do so in a docker environment that is ready to use for running the tests in isolation from your host::

  

  	$ cd DockerTestEnv
@@ -120,4 +121,4 @@ 

  that these options are not (yet) present for tests in 'Sanity' subdirectory, only for ones in 'Regression'

  subdir.

  

- At the end whole test-suite (as specified at beginning) has to pass.

+ At the end whole test-suite should pass.

file modified
+28 -22
@@ -3,50 +3,56 @@ 

  Building package

  ================

  

- First - go to root directory of your copr.git checkout.

+ First - go to root directory of your copr.git checkout. Then checkout

+ a particular commit from which you would like to build the packages.

  

- Install `Tito <https://github.com/dgoodwin/tito>`_ and Copr build dependencies::

+ Install `rpkg <https://pagure.io/rpkg-util>`_, render spec files and

+ install Copr build dependencies::

  

-     dnf builddep frontend/copr-frontend.spec

+     sudo dnf install rpkg

  

-     dnf builddep backend/copr-backend.spec

+     rpkg --path frontend spec --outdir /tmp/rpkg

+     sudo dnf builddep /tmp/rpkg/copr-frontend.spec

  

-     dnf builddep cli/copr-cli.spec

+     rpkg --path backend spec --outdir /tmp/rpkg

+     sudo dnf builddep /tmp/rpkg/copr-backend.spec

  

-     dnf builddep selinux/copr-selinux.spec

+     rpkg --path cli spec --outdir /tmp/rpkg

+     sudo dnf builddep /tmp/rpkg/copr-cli.spec

  

+     rpkg --path selinux spec --outdir /tmp/rpkg

+     sudo dnf builddep /tmp/rpkg/copr-selinux.spec

  

- Now you can build the package itself::

+ Now you can build the packages themselves::

  

-     cd frontend && tito build --rpm && cd ..

+     cd frontend && rpkg local && cd ..

  

-     cd backend && tito build --rpm && cd ..

+     cd backend && rpkg local && cd ..

  

-     cd cli && tito build --rpm && cd ..

- 

-     cd selinux && tito build --rpm && cd ..

+     cd cli && rpkg local && cd ..

  

+     cd selinux && local && cd ..

  

  If you want just src.rpm, run::

  

-     cd frontend && tito build --srpm && cd ..

+     cd frontend && rpkg srpm && cd ..

  

-     cd backend && tito build --srpm && cd ..

+     cd backend && rpkg srpm && cd ..

  

-     cd cli && tito build --srpm && cd ..

+     cd cli && rpkg srpm && cd ..

  

-     cd selinux && tito build --srpm && cd ..

+     cd selinux && rpkg srpm && cd ..

  

- If you are developer and want to test your changes, commit them and run (don't forget to `cd` to particular package)::

+ If you are developer and want to test your changes, run (don't forget to `cd` to particular package)::

  

-     tito build --test --rpm

+     rpkg local

  

      # or

  

-     tito build --test --srpm

+     rpkg srpm

  

- For more information see ``man tito``.

+ For more information see ``man rpkg``.

  

- If you have write access to copr.git, you may create new release by::

+ If you have write access to copr.git, you may create a new release by::

  

-     tito tag

+     rpkg tag

file modified
+32 -55
@@ -9,104 +9,78 @@ 

  

  More about coding is in :ref:`developer_documentation`

  

+ 

  Local Development Environment

  -----------------------------

  

- We support Vagrant to create frontend and dist-git parts of the local development environment and docker to create the backend (the actual building engine). 

+ We support docker-compose to spawn the whole docker stack, including builder, on a local machine:

  

- - `Learn more about Vagrant on Fedora <https://developer.fedoraproject.org/tools/vagrant/about.html>`_

+ - `Read the original blog post about COPR docker stack <https://frostyx.cz/posts/copr-stack-dockerized>`_

  - `Learn more about docker on Fedora <https://developer.fedoraproject.org/tools/docker/about.html>`_

  

- Starting the frontend and dist-git

- ----------------------------------

  

- To start your developer environment, simply run ``vagrant up`` command in the repository::

+ Spawning the stack

+ ------------------

+ 

+ To start your developer environment, simply run ``docker-compose up`` command in the repository

+ 

+ ::

  

      $ git clone https://pagure.io/copr/copr.git

  

      $ cd copr

  

-     $ vagrant up

+     $ docker-compose up -d

  

- The ``vagrant up`` command will take several minutes to complete.

+ The ``docker-compose up`` command will take several minutes to complete.

  

  You should be now able to access the frontend on http://localhost:5000.

  

+ 

  Testing your changes

  --------------------

  

- To test your changes in frontend or copr-dist-git, commit them to your local git repo and run ``vagrant reload``::

- 

-     $ git add .

- 

-     $ git commit -m "my test"

+ To test your in frontend or backend, you should restart the respective container for the changes to take effect, e.g.:

  

-     $ vagrant reload

+ ::

  

+      $ docker-compose restart frontend

  

- The ``vagrant reload`` command reboots both machines, builds the copr packages from the actual commit (HEAD) and installs them on the machines.

  

  Stopping the machines

  ---------------------

  

  ::

  

-     $ vagrant halt

+     $ docker-compose stop

+ 

  

  Removing the machines

  ---------------------

  

- To completely remove the machines, run the following command::

- 

-     $ vagrant destroy

- 

- 

- Build docker backend image

- --------------------------

- 

- In the cloned backend repository run::

- 

-     $ cd backend/docker

- 

-     $ make

- 

- Run the backend docker image

- ----------------------------

+ To remove the machines, run the following command

  

  ::

  

-     $ make run

+     $ docker-compose rm

  

  

- Now, if you have already started frontend and dist-git by using the provided Vagrantfile, you are done and the full COPR stack is running directly on your machine. 

- You can try to build something and browse the build results at url http://localhost:5002/results.

+ Debugging machines

+ ------------------

  

- Debugging backend

- -----------------

+ You can get shell to the e.g. backend container and see the logs

  

- You can get shell to the COPR backend container and see the logs::

+ ::

  

-     $ make sh

+     $ docker exec -it docker_backend_1 /bin/bash

+     # tail -f /var/log/copr-backend/backend.log

  

-     # tail -f /var/log/copr/worker.log

+ If something went wrong, you can also try to restart all the backend services and see if that helped

  

- If something went wrong, you can also try to restart all the backend services and see if that helped::

+ ::

  

      # supervisorctl restart all

  

- Update backend image and re-run it

- ----------------------------------

- 

- If you make any changes to the backend source and you want to run the new backend version, run the following command in the backend/docker directory::

- 

-     $ make update

- 

- Note that the changes in the COPR git repo must be **committed** at this point.

- 

- Testing

- -------

- 

- After you develop (or even better before) a sparkling, new feature, it is not a bad idea to ship it with a test. There are two kinds of tests available: unit ones and regression (behavioral) ones.

  

  Unit tests

  ^^^^^^^^^^
@@ -123,7 +97,9 @@ 

  Behavioral tests

  ^^^^^^^^^^^^^^^^

  

- Currently, there are three test-suites: integration, backend and dist-git. Apart from being useful as an actual feature specification, these test suites are also used to verify COPR functionality before making a new release. The following code snippet shows the steps needed run the dist-git test-suite as an example::

+ Currently, there are three test-suites: integration, backend and dist-git. Apart from being useful as an actual feature specification, these test suites are also used to verify COPR functionality before making a new release. The following code snippet shows the steps needed run the dist-git test-suite as an example

+ 

+ ::

  

      $ cd copr/beaker-tests/DockerTestEnv    # this is good for running the test in isolation (setup phase installs packages etc.)

  
@@ -135,12 +111,13 @@ 

  

      $ ./runtest.sh                          # run the test-suite (this will start with calling the setup.sh script), in the end you should see lots of GREEN checks saying: 'PASS'

  

+ 

  Documentation

  -------------

  

  We need to document our code, write documentation for users. Do you want to write it?

  

- We need general documentation of Copr. You did not find documentation for the task you are currently doing? Just create a new wiki page and document what it is you did. Some existing documentation is outdated and you may review it and update it. 

+ We need general documentation of Copr. You did not find documentation for the task you are currently doing? Just create a new wiki page and document what it is you did. Some existing documentation is outdated and you may review it and update it.

  

  

  Help others

@@ -1,5 +1,6 @@ 

  .. _developer_documentation:

  

+ 

  Developer Documentation

  =======================

  

file modified
+18 -16
@@ -488,11 +488,16 @@ 

  

  Here is an example workflow where we are working on a spec file and testing with::

  

-     tito build --test --srpm

+     rpkg srpm

+     rpkg lint

  

- For readability we will name different SHA1 number as SHA1-A, SHA1-B, ... You can find tito in the rel-eng/bin directory of your git checkout, and it can be called relatively or added to your path.

+ You need to have `rpkg` installed or install it with::

  

- When we begin, the tree has SHA1-A::

+     dnf install rpkg

+ 

+ on Fedora.

+ 

+ For readability we will name different SHA1 number as SHA1-A, SHA1-B. When we begin, the tree has SHA1-A::

  

      git commit -a -m # edit spec to comply with fedora guidelines

  
@@ -506,7 +511,8 @@ 

  

  The tree now has SHA1-C::

  

-     tito build --test --srpm

+     rpkg srpm

+     rpkg lint

  

  We still find errors, re-edit the spec file::

  
@@ -514,7 +520,8 @@ 

  

  The tree now has SHA1-D::

  

-     tito build --test --srpm

+     rpkg srpm

+     rpkg lint

  

  Again, still more errors, edit the spec file::

  
@@ -522,7 +529,8 @@ 

  

  The tree now has SHA1-E::

  

-     tito build --test --srpm

+     rpkg srpm

+     rpkg lint

  

  Finally, ``rpmlint`` is silent. We will reject all our previous commits,

  
@@ -547,7 +555,9 @@ 

  

  Confirm this is what we wanted and we are ready to merge and push::

  

-     tito build --test --srpm

+     rpkg srpm

+     rpkg lint

+     rpkg push

Can we have a short explanation here, why it is not enough to use just git push please?

clime commented 5 years ago

It's ok to use git push here. But we are using here some other rpkg commands so I thought rpkg push could be used here as well..

Okay. In case that we actually need rpkg push somewhere, I would like to have described the difference between git push and rpkg push there. If not, I think that it would be nice to say here, that simple git push can be used too, so we know that it doesn't do some magic.

  

  Other Resources

  ---------------
@@ -556,19 +566,11 @@ 

  

  * `The Git User's Manual <http://www.kernel.org/pub/software/scm/git/docs/user-manual.html>`_

  

- * `Another awesome Git Guide <http://wiki.sourcemage.org/Git_Guide>`_

Just a note for other reviewers - These URLs seems to be dead.

clime commented 5 years ago

Ye, I did some additional cleaning in the docs. I should have done that in the separate PR/commit but I thought removing those dead links is ok.

- 

- * `Git tutorials as screen casts <http://www.gitcasts.com/>`_

- 

  * `Tutorial Introduction to Git <http://www.kernel.org/pub/software/scm/git/docs/gittutorial.html>`_

  

- * `Jbowes' Instructional Blog Post on git-bisect <http://jbowes.dangerouslyinc.com/2007/02/18/git-bisect-a-practical-example-with-yum/>`_

- 

- * `Jbowes' Instructional Blog Post on git-rebase <http://jbowes.dangerouslyinc.com/2007/01/26/git-rebase-keeping-your-branches-current/>`_

- 

  * `- Dealing with remote branches ..  <http://www.zorched.net/2008/04/14/start-a-new-branch-on-your-remote-git-repository/>`_

  

  Credits

  -------

  

- * Stolen from Git guide in spacewalk project

+ * Originally stolen from Git guide in Spacewalk project

file modified
+34 -46
@@ -5,23 +5,26 @@ 

  

  Go through this page well before you will do the release. Maybe you will want to do some steps in different order, and in any case, it's good to know what's ahead.

  

- Keep amending this page if you find something not matching reality or expectations. 

+ Keep amending this page if you find something not matching reality or expectations.

  

  Tag untagged packages that have changes in them

  -----------------------------------------------

  

  Run::

  

-     tito report --untagged-commits

+     releng/show-untagged-commits

  

- and walk the directories of packages listed and tito tag them and push them. 

+ and walk the directories of packages listed. In each directory, call::

+ 

+     rpkg tag

+     rpkg push

  

  Build packages

  --------------

  

- Build all outstanding packages::

+ Build all packages::

  

-     ./.tito/build-missing-builds.sh @copr-dev

+     releng/build-packages @copr/copr-dev

  

  Upgrade -dev machines

  ---------------------
@@ -60,73 +63,58 @@ 

  Build packages for production

  -----------------------------

  

- Build all outstanding packages for @copr projects::

+ Build all packages for @copr projects::

  

-     ./.tito/build-missing-builds.sh @copr

+     releng/build-packages @copr/copr

  

  Release python-copr to PyPi

  ---------------------------

  

  Make sure you have `~/.pypirc` correctly set up and run::

  

-     /usr/bin/python setup.py sdist --format=gztar upload

+     version=<current_pkg_version> /usr/bin/python setup.py sdist --format=gztar upload

+ 

+ Substitute `<current_pkg_version>` with the current package version.

  

- Or tell somebody with access to run that (msuchy has access).

+ If you cannot run that, tell somebody with access to run that (msuchy has access).

  

  Release package to Fedora

  -------------------------

  

- Make sure that `./.tito/releasers.conf` has up to date list of branches.

+ Make sure that ``releng/releasers.conf`` has up to date list of branches.

  

  Make sure you are co-maintainer of those packages in Fedora.

  

  Run::

  

-     cd python

- 

-     tito release fedora-git-all

- 

-     cd ..

- 

-     cd cli

- 

-     tito release fedora-git-all

- 

-     cd ..

- 

-     cd frontend

- 

-     tito release fedora-git

- 

-     cd ..

- 

-     cd backend

- 

-     tito release fedora-git

- 

-     cd ..

- 

-     cd dist-git

- 

-     tito release fedora-git

+     rm -r /tmp/rpkg

  

-     cd..

+     rpkg --path python srpm --outdir /tmp/rpkg

+     releng/fedora-release git-all /tmp/rpkg/python-copr*.src.rpm

  

-     cd keygen

+     rpkg --path cli srpm --outdir /tmp/rpkg

+     releng/fedora-release git-all /tmp/rpkg/copr-cli*.src.rpm

  

-     tito release fedora-git-keygen

+     rpkg --path frontend srpm --outdir /tmp/rpkg

+     releng/fedora-release git /tmp/rpkg/copr-frontend*.src.rpm

  

-     cd selinux

+     rpkg --path backend srpm --outdir /tmp/rpkg

+     releng/fedora-release git /tmp/rpkg/copr-backend*.src.rpm

  

-     tito release fedora-git-selinux

+     rpkg --path dist-git srpm --outdir /tmp/rpkg

+     releng/fedora-release git /tmp/rpkg/copr-dist-git*.src.rpm

  

-     cd ..

+     rpkg --path keygen srpm --outdir /tmp/rpkg

+     releng/fedora-release git /tmp/rpkg/copr-keygen*.src.rpm

  

-     cd prunerepo

+     rpkg --path selinux srpm --outdir /tmp/rpkg

+     releng/fedora-release git /tmp/rpkg/copr-selinux*.src.rpm

  

-     tito release fedora-git

+     rpkg --path prunerepo srpm --outdir /tmp/rpkg

+     releng/fedora-release git /tmp/rpkg/prunerepo*.src.rpm

  

-     cd ..

+     rpkg --path common srpm --outdir /tmp/rpkg

+     releng/fedora-release git /tmp/rpkg/python-copr-common*.src.rpm

  

  And create erratas in Bodhi.

  

file modified
+43 -18
@@ -3,38 +3,63 @@ 

  Populate DB with pruduction-like data

  =====================================

  

- This article assumes that you have access to copr-fe-dev machine.

+ This article assumes that you have an access to copr-fe-dev machine.

  

- While setting your local development environment you might want to populate your database with production-like data.

+ While setting your local development environment, you might want to populate your database with production-like data.

  

- First, obtain some SQL dump from copr-fe-dev (i.e. coprdb-2015-06-02.dump). This assumes that you are a Copr developer.

+ First, obtain some SQL dump from copr-fe-dev (i.e. ``coprdb-2015-06-02.sql``). This assumes that you are a Copr developer.

  

- Then stop your httpd service because copr-frontend holds session to your database::

+ Then, if you are using docker-compose stack provided together with Copr source code (see :ref:`contribute`),

+ you can import the db dump into the Postgresql database used by copr-frontend container.

  

-     sudo service httpd stop

+ First see what's the name of the copr-frontend container e.g. by looking at ``docker ps`` output.

  

- If you are using Vagrantfile provided together with Copr source code, you already have a database created and if the dump creates the whole DB, you need to drop it first. Then import the dump::

+ Let's say it is ``copr_frontend_1``.

  

-     [vagrant@localhost ~]$ sudo su - postgres

+ Copy the db dump into the copr-frontend container:

  

-     -bash-4.3$ psql

+ ::

  

-     postgres=# drop database coprdb;

+     $ docker cp coprdb-2015-06-02.sql copr_frontend_1:/tmp/

  

-     postgres=# \q

+ Then log into the machine:

  

-     -bash-4.3$ psql < /vagrant/coprdb-2015-06-02.dump

+ ::

  

-     -bash-4.3$ exit

+     $ docker exec -it copr_frontend_1 /bin/bash

  

- To keep your database schema up-to-date, use alembic::

+ Stop your httpd service because it holds a session to your database:

  

-     [vagrant@localhost ~]$ sudo su - copr-fe

+ ::

  

-     -bash-4.3$ alembic upgrade head

+     [root@frontend /]# systemctl stop httpd

  

-     -bash-4.3$ exit

+ And continue with the import:

  

- Finally start the httpd service again::

+ ::

  

-     [vagrant@localhost ~]$ sudo service httpd start

+     [root@frontend ~]# su - postgres

+ 

+     -bash-4.4$ dropdb coprdb

+ 

+     -bash-4.4$ psql < /tmp/coprdb-2015-06-02.sql

+ 

+     -bash-4.4$ exit

+ 

+ To keep your database schema up-to-date, use alembic:

+ 

+ ::

+ 

+     [root@frontend ~]$ cd /usr/share/copr/coprs_frontend/

+ 

+     [root@frontend ~]$ su - copr-fe

+ 

+     -bash-4.4$ alembic upgrade head

+ 

+     -bash-4.4$ exit

+ 

+ Finally start the httpd service again:

+ 

+ ::

+ 

+     [root@frontend ~]# systemctl start httpd

file modified
+3 -3
@@ -17,7 +17,7 @@ 

  4) copy the generated auth token into ``~/.config/copr``

  5) install copr-cli tool: ``sudo dnf install copr-cli`` (if you are on Fedora)

  6) run ``copr-cli create first-project --chroot fedora-rawhide-x86_64`` to create your first project

- 7) run ``copr-cli build first-project <path to your srpm>``

+ 7) run ``copr-cli build first-project <path to your srpm>`` to run your first build

  

  If you don't have an srpm yet, see https://pagure.io/rpkg-util on how to build one.

  
@@ -75,7 +75,7 @@ 

  **rpkg**: The default choice and the most versatile one. Apart from building packages from any Git or SVN repository,

  it also supports building directly from any `DistGit <https://clime.github.io/2017/05/20/DistGit-1.0.html>`_ repository.

  Note that **rpkg** (as well as **tito**) is not only a tool to generate SRPMs but, in fact, it is also a full-fledged package manager

- that you can use from your command-line to maintain your packages. You can read more about this tool `here <https://pagure.io/rpkg-client>`_.

+ that you can use from your command-line to maintain your packages. You can read more about this tool `here <https://pagure.io/rpkg-util>`_.

  

  **tito**: is a robust RPM package manager with lots of features and if your project is managed with Tito, this is the tool you want to pick for SRPM generation (which is

  one of the many package manager's features). When this option is selected, the latest package GIT tag will be used to build an SRPM. Note that this utility has currently
@@ -89,7 +89,7 @@ 

  

  .. _`make_srpm`:

  

- **make srpm**: With this method, the user himself will provide the executable script to be used for SRPM generation. If you

+ **make srpm**: With this method, the user himself/herself will provide the executable script to be used for SRPM generation. If you

  would like to use this method, you need to provide ``.copr/Makefile`` (path being relative to the repository root) with ``srpm`` target

  in your repository. Into that ``srpm`` target, you can put whatever it takes to generate the SRPM. You can use network and clone another

  repository, you can install new packages, and you can do pretty much everything as this is script is run with root privileges inside

file modified
+16 -32
@@ -1,11 +1,11 @@ 

  FROM fedora:26

  MAINTAINER clime@redhat.com

  

+ RUN dnf -y install dnf-plugins-core && dnf -y copr enable @copr/copr

+ 

  # base packages

  RUN dnf -y update && \

-     dnf -y install dnf-plugins-core \

-                    htop \

-                    tito \

+     dnf -y install htop \

                     wget \

                     net-tools \

                     iputils \
@@ -23,7 +23,8 @@ 

  # to get more entropy for generation of gpg keys

                     rng-tools \

  # for unbuffer package

-                    expect && \

+                    expect \

+                    rpkg && \

      dnf clean all

  

  # needed to be able to ping
@@ -50,14 +51,6 @@ 

  # setup user for web access

  RUN useradd -r apache

  

- # decides if we should install released or latest (git) versions of COPR packages

- ARG RELEASETEST

- 

- # enable appropriate copr repos

- RUN dnf -y copr enable @copr/copr && \

-     dnf -y copr enable @modularity/modulemd && \

-     if [ ! $RELEASETEST ]; then dnf -y copr enable @copr/copr-dev; fi

- 

  # preinstall copr-keygen and its builddeps to utilize most of Docker cache

  RUN cd `mktemp -d` && dnf -y download --source copr-keygen && \

      dnf -y builddep *.src.rpm --allowerasing && \
@@ -86,29 +79,20 @@ 

  COPY . /copr

  

  # build copr-backend from sources

- # fix for python-requests package (the cmd is failing python2-requests is already installed)

- RUN dnf -y builddep /copr/backend/copr-backend.spec --allowerasing && \

-     cd /copr/backend && \

+ RUN rpkg --path /copr/backend spec --outdir /tmp/rpkg && \

+     dnf -y builddep /tmp/rpkg/copr-backend.spec --allowerasing && \

      export LANG=en_US.UTF-8 && \

-     if [ ! $RELEASETEST ]; then \

-         tito build --test --rpm; \

-     else \

-         tito build --rpm; \

-     fi && \

+     rpkg --path /copr/backend local --outdir /tmp/rpkg && \

  # upgrade the already pre-installed package if possible

-     dnf -y upgrade /tmp/tito/noarch/copr-backend*.noarch.rpm || true && \

+     dnf -y upgrade /tmp/rpkg/noarch/copr-backend*.noarch.rpm || true

+ 

  # build copr-keygen from sources

-     dnf -y builddep /copr/keygen/copr-keygen.spec --allowerasing && \

-     cd /copr/keygen && \

+ RUN rpkg --path /copr/keygen spec --outdir /tmp/rpkg && \

+     dnf -y builddep /tmp/rpkg/copr-keygen.spec --allowerasing && \

      export LANG=en_US.UTF-8 && \

-     if [ ! $RELEASETEST ]; then \

-         tito build --test --rpm; \

-     else \

-         tito build --rpm; \

-     fi && \

+     rpkg --path /copr/keygen local --outdir /tmp/rpkg && \

  # upgrade the already pre-installed package if possible

-     dnf -y upgrade /tmp/tito/noarch/copr-keygen*.noarch.rpm || true && \

-     dnf clean all

+     dnf -y upgrade /tmp/rpkg/noarch/copr-keygen*.noarch.rpm || true

  

  # copy filesystem setup and setup ownership and permissions

  COPY docker/backend/files/ /
@@ -116,10 +100,10 @@ 

      chmod 400 /root/.ssh/id_rsa && \

      chmod 700 /home/copr && \

      chown copr:copr /home/copr && \

-     chown copr-signer:apache /etc/uwsgi.d/copr-keygen.ini && \

+     chown copr-signer:apache /etc/uwsgi.d/copr-keygen.ini

  # fix permissions on /var/log/copr-keygen/main.log which is

  # owned by root after copr-keygen installation tests are run

-     chown copr-signer:copr-signer /var/log/copr-keygen/main.log

+ #    chown copr-signer:copr-signer /var/log/copr-keygen/main.log

  

  # fix permissions for .ssh

  RUN chmod 700 /root/.ssh

file modified
+9 -20
@@ -1,18 +1,16 @@ 

  FROM fedora:26

  MAINTAINER jkadlcik@redhat.com

  

+ RUN dnf -y install dnf-plugins-core && dnf -y copr enable @copr/copr

  

  # base packages

  RUN dnf -y update && \

-     dnf -y install dnf-plugins-core \

-                    htop \

+     dnf -y install htop \

                     which \

-                    tito \

                     wget \

                     vim \

                     supervisor \

  # builder packages

-                    copr-rpmbuild \

                     openssh-server \

                     packagedb-cli \

                     fedora-cert \
@@ -29,14 +27,8 @@ 

                     glib2 \

                     ca-certificates \

                     scl-utils-build \

-                    ethtool && \

-     dnf clean all

- 

- RUN dnf -y copr enable @copr/copr

- 

- # upgrade rpkg, otherwise an outdated 0.8 version is installed

- RUN dnf -y upgrade rpkg && \

-     dnf clean all

+                    ethtool \

+                    rpkg

  

  COPY . /copr

  COPY docker/builder/files/ /
@@ -51,15 +43,12 @@ 

      touch /root/.ssh/authorized_keys && chmod 600 /root/.ssh/authorized_keys && \

      cat /root/.ssh/id_backend.pub >> /root/.ssh/authorized_keys

  

- 

- RUN dnf builddep -y /copr/rpmbuild/copr-rpmbuild.spec && dnf clean all

- 

- RUN rm -rf /tmp/tito/*

- RUN cd /copr/rpmbuild/ && tito build --test --rpm --rpmbuild-options='--nocheck'

- RUN dnf -y install /tmp/tito/noarch/copr-rpmbuild*.noarch.rpm || dnf -y upgrade /tmp/tito/noarch/copr-rpmbuild*.noarch.rpm || dnf -y downgrade /tmp/tito/noarch/copr-rpmbuild*.noarch.rpm

- 

+ RUN rm -rf /tmp/rpkg/* && \

+     rpkg --path /copr/rpmbuild spec --outdir /tmp/rpkg && \

+     dnf builddep -y /tmp/rpkg/copr-rpmbuild.spec && \

+     rpkg --path /copr/rpmbuild local --outdir /tmp/rpkg && \

+     dnf -y install /tmp/rpkg/noarch/copr-rpmbuild*.noarch.rpm

  

  RUN echo 'config_opts["use_nspawn"] = False' >> /etc/mock/site-defaults.cfg

  

- 

  CMD ["/bin/run.sh"]

@@ -1,27 +1,28 @@ 

  [main]

  frontend_url = http://frontend

+ enabled_source_protocols = https ftps

  

  [distgit0]

  distgit_hostname_pattern = src.fedoraproject.org

- distgit_lookaside_url = https://src.fedoraproject.org/repo/pkgs/%(ns1)s/%(pkg)s/%(filename)s/%(hashtype)s/%(hash)s/%(filename)s

+ distgit_lookaside_url = https://src.fedoraproject.org/repo/pkgs/%(ns1)s/%(name)s/%(filename)s/%(hashtype)s/%(hash)s/%(filename)s

  distgit_clone_url = https://src.fedoraproject.org/%(module)s

  

  [distgit1]

  distgit_hostname_pattern = copr-dist-git.fedorainfracloud.org

- distgit_lookaside_url = http://copr-dist-git.fedorainfracloud.org/repo/pkgs/%(ns2)s/%(ns1)s/%(pkg)s/%(filename)s/%(hashtype)s/%(hash)s/%(filename)s

+ distgit_lookaside_url = http://copr-dist-git.fedorainfracloud.org/repo/pkgs/%(ns2)s/%(ns1)s/%(name)s/%(filename)s/%(hashtype)s/%(hash)s/%(filename)s

  distgit_clone_url = http://copr-dist-git.fedorainfracloud.org/git/%(module)s

  

  [distgit2]

  distgit_hostname_pattern = pkgs.fedoraproject.org

- distgit_lookaside_url = https://src.fedoraproject.org/repo/pkgs/%(ns1)s/%(pkg)s/%(filename)s/%(hashtype)s/%(hash)s/%(filename)s

+ distgit_lookaside_url = https://src.fedoraproject.org/repo/pkgs/%(ns1)s/%(name)s/%(filename)s/%(hashtype)s/%(hash)s/%(filename)s

  distgit_clone_url = git://pkgs.fedoraproject.org/%(module)s

  

  [distgit3]

  distgit_hostname_pattern = src.stg.fedoraproject.org

- distgit_lookaside_url = https://src.stg.fedoraproject.org/repo/pkgs/%(ns1)s/%(pkg)s/%(filename)s/%(hashtype)s/%(hash)s/%(filename)s

+ distgit_lookaside_url = https://src.stg.fedoraproject.org/repo/pkgs/%(ns1)s/%(name)s/%(filename)s/%(hashtype)s/%(hash)s/%(filename)s

  distgit_clone_url = https://src.stg.fedoraproject.org/%(module)s

  

  [distgit4]

  distgit_hostname_pattern = distgit

- distgit_lookaside_url = http://distgit/repo/pkgs/%(ns2)s/%(ns1)s/%(pkg)s/%(filename)s/%(hash)s/%(filename)s

+ distgit_lookaside_url = http://distgit/repo/pkgs/%(ns2)s/%(ns1)s/%(name)s/%(filename)s/%(hash)s/%(filename)s

  distgit_clone_url = http://distgit/git/%(module)s

file modified
+2 -3
@@ -1,13 +1,12 @@ 

  FROM fedora:26

  MAINTAINER jkadlcik@redhat.com

  

+ RUN dnf -y install dnf-plugins-core && dnf -y copr enable @copr/copr

  

  # base packages

  RUN dnf -y update && \

-     dnf -y install dnf-plugins-core \

-                    htop \

+     dnf -y install htop \

                     which \

-                    tito \

                     wget \

                     vim \

                     supervisor \

file modified
+9 -13
@@ -1,32 +1,28 @@ 

  FROM fedora:26

  MAINTAINER jkadlcik@redhat.com

  

+ RUN dnf -y install dnf-plugins-core && dnf -y copr enable @copr/copr

  

  # base packages

  RUN dnf -y update && \

-     dnf -y install dnf-plugins-core \

-                    htop \

+     dnf -y install htop \

                     which \

-                    tito \

                     wget \

                     vim \

                     supervisor \

                     copr-selinux \

                     cgit \

-                    pyrpkg

- 

- RUN dnf -y copr enable @copr/copr

- RUN dnf -y copr enable clime/dist-git

+                    python2-rpkg \

+                    rpkg

  

  COPY . /copr

  COPY docker/distgit/files/ /

  

- 

- RUN dnf builddep -y /copr/dist-git/copr-dist-git.spec

- 

- RUN rm -rf /tmp/tito/*

- RUN cd /copr/dist-git/ && tito build --test --rpm --rpmbuild-options='--nocheck'

- RUN dnf -y install /tmp/tito/noarch/copr-dist-git*.noarch.rpm || dnf -y upgrade /tmp/tito/noarch/copr-dist-git*.noarch.rpm || dnf -y downgrade /tmp/tito/noarch/copr-dist-git*.noarch.rpm

+ RUN rm -rf /tmp/rpkg/* && \

+     rpkg --path /copr/dist-git spec --outdir /tmp/rpkg && \

+     dnf builddep -y /tmp/rpkg/copr-dist-git.spec && \

+     rpkg --path /copr/dist-git local --outdir /tmp/rpkg && \

+     dnf -y install /tmp/rpkg/noarch/copr-dist-git*.noarch.rpm

  

  RUN mkdir /tmp/copr-dist-git

  RUN chown copr-dist-git:packager /tmp/copr-dist-git

file modified
+10 -21
@@ -1,42 +1,31 @@ 

  FROM fedora:26

  MAINTAINER jkadlcik@redhat.com

  

+ RUN dnf -y install dnf-plugins-core && dnf -y copr enable @copr/copr

  

  # base packages

- # ad. python-alembic: https://bugzilla.redhat.com/show_bug.cgi?id=1536058

  RUN dnf -y update && \

-     dnf -y install dnf-plugins-core \

-                    htop \

+     dnf -y install htop \

                     which \

-                    tito \

                     wget \

                     vim \

                     yum \

                     supervisor \

                     copr-selinux \

-                    python-alembic \

                     python3-alembic \

                     postgresql-server \

-                    redis

- 

- RUN dnf -y copr enable @copr/copr

- RUN dnf -y copr enable @modularity/modulemd

+                    redis \

+                    rpkg

  

  COPY . /copr

  COPY docker/frontend/files/ /

  

- 

- # Install build dependencies for Copr Frontend

- RUN dnf -y builddep /copr/frontend/copr-frontend.spec

- 

- # Remove previous build, if any

- RUN rm -rf /tmp/tito

- 

- # Build Copr Frontend

- RUN cd /copr/frontend/ && tito build --test --rpm --rpmbuild-options='--nocheck --without doc'

- 

- # Install the Copr Frontend build

- RUN dnf -y install /tmp/tito/noarch/copr-frontend*.noarch.rpm

+ # build and install copr-frontend

+ RUN rm -rf /tmp/rpkg && \

+     rpkg --path /copr/frontend srpm --without doc --outdir /tmp/rpkg && \

+     dnf -y builddep /tmp/rpkg/copr-frontend*.src.rpm && \

+     rpkg --path /copr/frontend local --without doc --outdir /tmp/rpkg && \

+     dnf -y install /tmp/rpkg/noarch/copr-frontend*.noarch.rpm

  

  RUN echo 'nameserver 8.8.8.8' | tee -a /etc/resolv.conf

  

file modified
+8 -5
@@ -30,18 +30,19 @@ 

     end

  }

  

- Name:       copr-frontend

- Version:    1.129

+ Name:       {{{ git_dir_name }}}

+ Version:    {{{ git_dir_version lead=1 }}}

  Release:    1%{?dist}

  Summary:    Frontend for Copr

  

  License:    GPLv2+

  URL:        https://pagure.io/copr/copr

- # Source is created by

+ # Source is created by:

  # git clone https://pagure.io/copr/copr.git

+ # git checkout {{{ cached_git_name_version }}}

  # cd copr/frontend

- # tito build --tgz

- Source0:    %{name}-%{version}.tar.gz

+ # rpkg spec --sources 

I still think, that command for generating sources should be rpkg sources. It's consistent with rpkg srpm for generating a SRPM file and rpkg spec for generating a .spec file from a template. rpkg spec --sources feels very cryptic to me.

clime commented 5 years ago

Ye, I understand it might feel like it but once you actually see in the code how it woks I think it will start making sense to you. Anyway, I wanted to keep rpkg sources pretty much untouched so that it is just a subcommand that works with a DistGit lookaside cache and nothing more. It actually does not even reads the spec file. It just read the sources file.

I should read the code soon, but still. As a user, I don't really care about how the code is written and expect a user-friendly interface. Which IMHO rpkg spec --sources is not. Also, "just a subcommand that works with a DistGit lookaside cache and nothing more" is IMHO not valid argument, since the whole rpkg tool is now something more than a DistGit client.

In the end, it is your decision but I wanted to provide a different opinion (as a user who is not dev).

+ Source0:    {{{ git_dir_pack }}}

  

  BuildArch:  noarch

  
@@ -334,6 +335,8 @@ 

  

  

  %changelog

+ {{{ git_dir_changelog since_tag=copr-frontend-1.130-1 }}}

+ 

  * Wed Feb 28 2018 clime <clime@redhat.com> 1.129-1

  - several tweaks for graphs of utilization

  - fix copr_update after user and group routes merge

file modified
+8 -5
@@ -4,18 +4,19 @@ 

  %global __python2 %{__python}

  %endif

  

- Name:       copr-keygen

- Version:    1.71

+ Name:       {{{ git_dir_name }}}

+ Version:    {{{ git_dir_version lead=1 }}}

  Release:    1%{?dist}

  Summary:    Part of Copr build system. Aux service that generate keys for signd

  

  License:    GPLv2+

  URL:        https://pagure.io/copr/copr

- # Source is created by

+ # Source is created by:

  # git clone https://pagure.io/copr/copr.git

+ # git checkout {{{ cached_git_name_version }}}

  # cd copr/keygen

- # tito build --tgz

- Source0: %{name}-%{version}.tar.gz

+ # rpkg spec --sources

+ Source0:    {{{ git_dir_pack }}}

  

  BuildArch:  noarch

  BuildRequires: util-linux
@@ -180,6 +181,8 @@ 

  

  

  %changelog

+ {{{ git_dir_changelog since_tag=copr-keygen-1.72-1 }}}

+ 

  * Fri Feb 23 2018 clime <clime@redhat.com> 1.71-1

  - remove Group tag

  

file modified
+8 -5
@@ -1,13 +1,14 @@ 

+ Name:    {{{ git_dir_name }}}

+ Version: {{{ git_dir_version lead=1 }}}

  Summary: COPR system components mocks

- Name: copr-mocks

- Version: 1.10

  Release: 1%{?dist}

  

  # Source is created by:

  # git clone https://pagure.io/copr/copr.git

- # cd copr/mocks/frontend

- # tito build --tgz

- Source0: %{name}-%{version}.tar.gz

+ # git checkout {{{ cached_git_name_version }}}

+ # cd copr/mocks

+ # rpkg spec --sources

+ Source0: {{{ git_dir_pack }}}

  

  License: GPLv2+

  BuildArch: noarch
@@ -49,6 +50,8 @@ 

  %{_unitdir}/copr-mocks-frontend.service

  

  %changelog

+ {{{ git_changelog since_tag=copr-mocks-1.11-1 }}}

+ 

  * Fri Feb 23 2018 clime <clime@redhat.com> 1.10-1

  - change in interface between copr-frontend and copr-backend

  - fix for new copr-dist-git interface

file modified
+9 -6
@@ -1,13 +1,14 @@ 

+ Name:    {{{ git_name name=prunerepo }}}

+ Version: {{{ git_version lead=1 }}}

  Summary: Remove old packages from rpm-md repository

- Name: prunerepo

- Version: 1.11

  Release: 1%{?dist}

  

  # Source is created by:

  # git clone https://pagure.io/copr/copr.git

+ # git checkout {{{ cached_git_name_version }}}

  # cd copr/prunerepo

- # tito build --tgz

- Source0: %{name}-%{version}.tar.gz

+ # rpkg spec --sources

+ Source0: {{{ git_dir_pack }}}

  

  License: GPLv2+

  BuildArch: noarch
@@ -47,11 +48,11 @@ 

  tests/run.sh

  

  %build

- %py3_build

+ name="%{name}" version="%{version}" summary="%{summary}" %py3_build

  a2x -d manpage -f manpage man/prunerepo.1.asciidoc

  

  %install

- %py3_install

+ name="%{name}" version="%{version}" summary="%{summary}" %py3_install

  

  install -d %{buildroot}%{_mandir}/man1

  install -p -m 644 man/prunerepo.1 %{buildroot}/%{_mandir}/man1/
@@ -64,6 +65,8 @@ 

  %{_mandir}/man1/prunerepo.1*

  

  %changelog

+ {{{ git_changelog since_tag=prunerepo-1.12-1 }}}

+ 

  * Wed Jan 24 2018 clime <clime@redhat.com> 1.11-1

  - do not recreate repo if there was no change in data unless

    --alwayscreaterepo is specified

file modified
+5 -9
@@ -1,17 +1,13 @@ 

  #!/usr/bin/env python3

  

- import rpm

- from setuptools import setup

- 

- spec_file = rpm.ts().parseSpec('prunerepo.spec')

+ import os

  

- print(spec_file.sourceHeader.version)

+ from setuptools import setup

  

  setup(

-     name=spec_file.sourceHeader.name.decode("utf-8"),

-     version=spec_file.sourceHeader.version.decode("utf-8"),

-     description=spec_file.sourceHeader.summary.decode("utf-8"),

-     long_description=spec_file.sourceHeader.description.decode("utf-8"),

+     name=os.getenv('name'),

+     version=os.getenv('version'),

+     description=os.getenv('summary'),

      author='clime',

      author_email='clime@redhat.com',

      download_url='https://pagure.io/copr/copr.git',

file modified
+12 -9
@@ -15,18 +15,19 @@ 

  %global with_python2 1

  %endif

  

- Name:       python-copr

- Version:    1.87

+ Name:       {{{ git_name name=python-copr }}}

+ Version:    {{{ git_version lead=1 }}}

  Release:    1%{?dist}

  Summary:    Python interface for Copr

  

  License:    GPLv2+

  URL:        https://pagure.io/copr/copr

- # Source is created by

+ # Source is created by:

  # git clone https://pagure.io/copr/copr.git

+ # git checkout {{{ cached_git_name_version }}}

  # cd copr/python

- # tito build --tgz

- Source0: %{name}-%{version}.tar.gz

+ # rpkg spec --sources

+ Source0:    {{{ git_dir_pack }}}

  

  BuildArch:  noarch

  
@@ -152,12 +153,12 @@ 

  %build

  %if 0%{?with_python3}

  pushd %{py3dir}

- CFLAGS="%{optflags}" %{__python3} setup.py build

+ CFLAGS="%{optflags}" version="%{version}" %{__python3} setup.py build

  popd

  %endif # with_python3

  

  %if 0%{?with_python2}

- CFLAGS="%{optflags}" %{__python2} setup.py build

+ CFLAGS="%{optflags}" version="%{version}" %{__python2} setup.py build

  %endif # with_python2

  

  mv copr/README.rst ./
@@ -173,13 +174,13 @@ 

  

  %if 0%{?with_python3}

  pushd %{py3dir}

- %{__python3} setup.py install --skip-build --root %{buildroot}

+ version="%{version}" %{__python3} setup.py install --skip-build --root %{buildroot}

  find %{buildroot}%{python3_sitelib} -name '*.exe' | xargs rm -f

  popd

  %endif # with_python3

  

  %if 0%{?with_python2}

- %{__python2} setup.py install --skip-build --root %{buildroot}

+ version="%{version}" %{__python2} setup.py install --skip-build --root %{buildroot}

  find %{buildroot}%{python2_sitelib} -name '*.exe' | xargs rm -f

  %endif # with_python2

  
@@ -225,6 +226,8 @@ 

  %endif

  

  %changelog

+ {{{ git_changelog since_tag=python-copr-1.88-1 }}}

+ 

  * Wed Feb 28 2018 clime <clime@redhat.com> 1.87-1

  - add missing frontend states to clientv2

  

file modified
+1 -18
@@ -13,21 +13,6 @@ 

  

  This part is a python client to the copr service."""

  

- 

- def read(*parts):

-     return codecs.open(os.path.join(os.path.dirname(__file__), *parts),

-                        encoding='utf8').read()

- 

- 

- def find_version(*file_paths):

-     version_file = read(*file_paths)

-     version_match = re.search(r"^Version: (.*)$",

-                               version_file, re.M)

-     if version_match:

-         return version_match.group(1).strip()

-     raise RuntimeError("Unable to find version string.")

- 

- 

  requires = [

      'marshmallow',

      'requests',
@@ -35,8 +20,6 @@ 

      'six'

  ]

  

- 

- __version__ = find_version('python-copr.spec')

  __description__ = "Python client for copr service."

  __author__ = "Valentin Gologuzov"

  __author_email__ = "vgologuz@redhat.com"
@@ -45,7 +28,7 @@ 

  

  setup(

      name='copr',

-     version=__version__,

+     version=os.getenv('version'),

      description=__description__,

      long_description=long_description,

      author=__author__,

@@ -0,0 +1,23 @@ 

+ #!/bin/bash

+ 

+ export SCRIPTDIR="$(builtin cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"

+ source $SCRIPTDIR/lib.sh

+ 

+ PROJECT=$1

+ if [ -z "$PROJECT" ]; then

+ 	echo "usage: build-packages project"

+     echo "       where TARGET is either @copr/copr or @copr/copr-dev"

+     exit 1

+ fi

+ 

+ for package in $(get_all_packages); do

+     echo "##############################"

+     echo "Building $(basename $package):"

+     echo "##############################"

+     pushd $package >/dev/null

+     rpkg build $PROJECT

+     popd >/dev/null

+     echo

+ done

+ 

+ popd >/dev/null

@@ -0,0 +1,97 @@ 

+ #!/usr/bin/python3

+ 

+ import re

+ import os

+ import configparser

+ import sys

+ import argparse

+ import tempfile

+ import subprocess

+ import glob

+ 

+ from subprocess import check_call, call, check_output

+ 

+ 

+ parser = argparse.ArgumentParser(description='Release package into Fedora.')

+ 

+ parser.add_argument('releaser', action='store',

+                     help='Release configuration from releasers.ini.')

+ parser.add_argument('srpm_path', action='store',

+                     help='Path to the srpm package to be released into Fedora.')

+ 

+ args = parser.parse_args()

+ 

+ config = configparser.ConfigParser()

+ config.read(os.path.join(os.path.dirname(__file__), 'releasers.ini'))

+ 

+ 

+ def update_branch(branch, commit, message):

+     """

+     Set the branch to the particular commit.

+     """

+     check_call(['git', 'checkout', branch])

+ 

+     if call(['git', 'merge', commit, '--ff-only']) == 0:

+         print('Merged {0} fast forward into {1} or noop.'.format(commit, branch))

+         return

+ 

+     print('Resetting branch {0} to contents of {1}.'.format(branch, commit))

+     check_call(['git', 'read-tree', '-m', '-u', commit])

+ 

+     if call(['git', 'diff', '--cached', '--exit-code']) != 0:

+         date = check_output(['git', 'show', commit, '-q', '--format=%ai']).strip()

+         check_call(['git', 'commit', '--no-verify', '-m', message, '--date', date])

+     else:

+         print('Nothing to commit into branch {0}.'.format(branch))

+ 

+ 

+ def string2list(string):

+     return [elem.strip() for elem in re.split(r'\s*,\s*|\s+', string) if elem]

+ 

+ 

+ if __name__ == '__main__':

+     branches = string2list(config[args.releaser]['branches'])

+     first_branch = branches[0]

+ 

+     full_package_name = re.sub(r'(.*).src.rpm', r'\1', os.path.basename(args.srpm_path))

+     full_package_name_split = full_package_name.rsplit('-', 2)

+ 

+     package_name = full_package_name_split[0]

+     package_verrel = full_package_name_split[1] + '-' + full_package_name_split[2]

+ 

+     commit_message = 'Update {} to {}'.format(package_name, package_verrel)

+ 

+     repo_tempdir = tempfile.mkdtemp()

+     fedora_repodir = os.path.join(repo_tempdir, package_name)

+     check_call(['fedpkg', 'clone', package_name, fedora_repodir])

+ 

+     print('>>> Working in {}:'.format(fedora_repodir))

+     os.chdir(fedora_repodir)

+ 

+     print('>>> Updating local branch {}:'.format(first_branch))

+     check_call(['fedpkg', 'switch-branch', first_branch])

+     check_call(['fedpkg', 'import', args.srpm_path])

+ 

+     if call(['git', 'diff', '--cached', '--exit-code']) != 0:

+         check_call(['fedpkg', 'commit', '-m', commit_message])

+     else:

+         print('Nothing to commit into branch {0}.'.format(first_branch))

+ 

+     commit = check_output(['git', 'rev-parse', 'HEAD']).strip()

+     for branch in branches[1:]:

+         check_call(['fedpkg', 'switch-branch', branch])

+         print('>>> Updating local branch {}:'.format(branch))

+         update_branch(branch, commit, commit_message)

+ 

+     for branch in branches:

+         check_call(['fedpkg', 'switch-branch', branch])

+         print('>>> Pushing branch {}:'.format(branch))

+         check_call(['fedpkg', 'push'])

+ 

+     for branch in branches:

+         check_call(['fedpkg', 'switch-branch', branch])

+         print('>>> Building branch {}:'.format(branch))

+         check_call(['fedpkg', 'build', '--nowait'])

+ 

+     shutil.rmtree(srpm_tempdir)

+     shutil.rmtree(repo_tempdir)

file added
+6
@@ -0,0 +1,6 @@ 

+ #!/bin/bash

+ 

+ function get_all_packages {

+     gitroot=$(git rev-parse --show-toplevel)

+     echo "$(find $gitroot -maxdepth 2 -path '*spec' -exec dirname {} \;)"

+ }

@@ -0,0 +1,9 @@ 

+ [git]

+ branches = master f28 f27 f26

+ 

+ [git-master]

+ branches = master

+ 

+ [git-all]

+ # this is for client packages

+ branches = master f28 f27 f26 el6 epel7

@@ -0,0 +1,33 @@ 

+ #!/bin/bash

+ 

+ export SCRIPTDIR="$(builtin cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"

+ source $SCRIPTDIR/lib.sh

+ 

+ function filter_tags {

+     grep -E "^$1-[^-]+-[^-]+$"

+ }

+ 

+ for package in $(get_all_packages); do

+     cd $package

+ 

+     nvr="$(rpkg -q verrel 2>/dev/null)"

+     name="$(echo $nvr | sed -E -n "s/^(.*)-[^-]+-[^-]+$/\1/p")"

+ 

+     mapfile -t tags < <(git tag --list --sort=taggerdate:unix "$name*" --merged 2>/dev/null | filter_tags "$name")

+ 

+     if [ ${#tags[@]} -gt 0 ]; then

+         revexpr="${tags[-1]}..HEAD"

+     else

+         revexpr="HEAD"

+     fi

+ 

+     log=$(git log --pretty=format:'%h %s (%ae)' $revexpr -- $package)

+     if [ -z "$log" ]; then

+         continue

+     fi

+ 

+     echo "Listing $revexpr for package $name:"

+     echo "------------------------------------------------------------"

+     echo "$log"

+     echo

+ done

file added
+2
@@ -0,0 +1,2 @@ 

+ [rpkg]

+ module_name = @copr/copr-dev

file modified
+10 -7
@@ -1,16 +1,17 @@ 

- Name: copr-rpmbuild

+ Name:    {{{ git_dir_name }}}

+ Version: {{{ git_dir_version }}}

  Summary: Run COPR build tasks

- Version: 0.17

  Release: 1%{?dist}

  URL: https://pagure.io/copr/copr

+ License: GPLv2+

  

  # Source is created by:

  # git clone https://pagure.io/copr/copr.git

+ # git checkout {{{ cached_git_name_version }}}

  # cd copr/rpmbuild

- # tito build --tgz

- Source0: %{name}-%{version}.tar.gz

+ # rpkg spec --sources

+ Source0: {{{ git_dir_pack }}}

  

- License: GPLv2+

  BuildArch: noarch

  BuildRequires: python3-devel

  BuildRequires: python3-rpm
@@ -39,7 +40,7 @@ 

  %setup -q

  

  %build

- %py3_build

+ name="%{name}" version="%{version}" summary="%{summary}" %py3_build

  a2x -d manpage -f manpage man/copr-rpmbuild.1.asciidoc

  

  %install
@@ -58,7 +59,7 @@ 

  install -p -m 644 man/copr-rpmbuild.1 %{buildroot}/%{_mandir}/man1/

  install -p -m 755 bin/copr-sources-custom %buildroot%_bindir

  

- %py3_install

+ name="%{name}" version="%{version}" summary="%{summary}" %py3_install

  

  %files

  %license LICENSE
@@ -79,6 +80,8 @@ 

  %config(noreplace) %{_sysconfdir}/copr-rpmbuild/make_srpm_mock.cfg

  

  %changelog

+ {{{ git_dir_changelog since_tag=copr-rpmbuild-0.18-1 }}}

+ 

  * Fri Feb 23 2018 clime <clime@redhat.com> 0.17-1

  - remove unused requires and rename rpm-python3 to python3-rpm

  - switch copr-sources-custom to python3 shebang

file modified
+6 -8
@@ -1,15 +1,13 @@ 

- #!/usr/bin/env python3

+ #!/usr/bin/python3

  

- import rpm

- from setuptools import setup, find_packages

+ import os

  

- spec_file = rpm.ts().parseSpec('copr-rpmbuild.spec')

+ from setuptools import setup, find_packages

  

  setup(

-     name=spec_file.sourceHeader.name.decode("utf-8"),

-     version=spec_file.sourceHeader.version.decode("utf-8"),

-     description=spec_file.sourceHeader.summary.decode("utf-8"),

-     long_description=spec_file.sourceHeader.description.decode("utf-8"),

+     name=os.getenv('name'),

+     version=os.getenv('version'),

+     description=os.getenv('summary'),

      author='clime',

      author_email='clime@redhat.com',

      download_url='https://pagure.io/rpkg-client.git',

file modified
+8 -7
@@ -9,20 +9,19 @@ 

  %global file_context_file %{_sysconfdir}/selinux/targeted/contexts/files/file_contexts

  %global file_context_file_pre %{_localstatedir}/lib/rpm-state/file_contexts.pre

  

- Name:       copr-selinux

- Version:    1.48

+ Name:       {{{ git_dir_name }}}

+ Version:    {{{ git_dir_version lead=1 }}}

  Release:    1%{?dist}

  Summary:    SELinux module for COPR

  

  License:    GPLv2+

  URL:        https://pagure.io/copr/copr

- # Source is created by

+ # Source is created by:

  # git clone https://pagure.io/copr/copr.git

+ # git checkout {{{ cached_git_name_version }}}

  # cd copr/selinux

- # tito build --tgz

- # content is same as https://pagure.io/copr/copr.git/snapshot/%{name}-%{version}-1.tar.gz

- # but checksum does not match due different metadata

- Source0: %{name}-%{version}.tar.gz

+ # rpkg spec --sources

+ Source0:    {{{ git_dir_pack }}}

  

  BuildArch:  noarch

  BuildRequires: asciidoc
@@ -124,6 +123,8 @@ 

  %dir %{_datadir}/selinux/mls

  

  %changelog

+ {{{ git_dir_changelog since_tag=copr-selinux-1.49-1 }}}

+ 

  * Fri Feb 23 2018 clime <clime@redhat.com> 1.48-1

  - remove Group tag

  

Hello,

this PR tracks progress on rpkg deployment into COPR.

It's incomplete at the moment.

It's incomplete at the moment.

Will you ping us, once it is ready for review? :-)

For sure, we will need to update

Also, I would like to ask you if you could make a "migration" table or some cheat with tito command next to the rpkg alternative, which we could use until we get used to rpkg commands. I mean, it's like 10 commands tops, so you can write it really fast and it will be helpful. :-)

1 new commit added

  • rpkg deployment into COPR - containers + releng continuation
6 years ago

2 new commits added

  • [doc] more updates as for rpkg deployment and removed Vagrant env
  • [doc] update documentation
6 years ago

2 new commits added

  • [doc] fix in releasing procedure
  • [beaker-tests] fixes
6 years ago

1 new commit added

  • update frontend Dockerfile to use new rpkg --with/--without options
6 years ago

Will you ping us, once it is ready for review? :-)

Hello, It should be now ready for review.

For sure, we will need to update

https://docs.pagure.org/copr.copr/how_to_release_copr.html#how-to-release-copr
docker/*

Ye, updated. Tested that the docker stack is working. Release howto also updated.

Also, I would like to ask you if you could make a "migration" table or some cheat with tito >command next to the rpkg alternative, which we could use until we get used to rpkg >commands. I mean, it's like 10 commands tops, so you can write it really fast and it will be >helpful. :-)

Yeah,

tito build --test --srpm       ->           rpkg srpm
tito build --srpm              ->          [git checkout latest tag] && rpkg srpm

rpkg does not have the tito feature that it can look up the latest tag from git history and build from them even though the current branch tip is placed not on the tag. rpkg always builds from HEAD and if HEAD is on a tag, rpkg macros take in into account.

It's not something that could not be implement (e.g. rpkg srpm --latest-tag) if we find it useful but currently the feature is not there. Manual checkout of the latest tag is needed. Then return back with git checkout master.

 tito tag       ->           rpkg tag

Tito tags by:

1) updating the spec file (like bumping version, adding changelog)
2) committing changes
3) creating tag on the commit

rpkg tags by:

1) creating a tag

For pushing the changes and tags afterward with tito:

 git push --follow-tags

For rpkg (rpkg follows annotated tags when pushing):

 rpkg push

Building rpms:

 tito build --test --rpm        ->           rpkg local

Building rpms with/without certain feature (e.g. copr-frontend without docs)

tito build --test --rpm --rpmbuild-options="--without doc"   ->   rpkg local --without doc

For building a package in @copr/copr

tito release @copr       ->           rpkg build @copr/copr

For building a package in @copr/copr-dev

tito release @copr-dev    ->          rpkg build @copr/copr-dev

You actually can only write rpkg build thanks to module_name setting in rpkg.conf placed in Git rootdir in this PR.

Note that in the underlying rpkg lib they plan to change the --module-name argument to --name --namespace pair. rpkg-util might go the same way at some point because it brings some advantages (i.e. fixed group but variable project name). For the time being, I am keeping the original module_name interface (you can see the setting in the rpkg.conf file).

Let me know if you are missing anything.

1 new commit added

  • update module name to @copr/copr-dev at least for the time being
6 years ago

I think that this will not work because the copr-backend.spec is a template, so dnf builddep will fail.

Not saying, that it is wrong, but for curiosity, why can't it be just
%global srcname {{{ $srcname }}} without printf?

These tito commands build from latest tagged version, but the rpkg ones build a package from last commit.

Can we have a short explanation here, why it is not enough to use just git push please?

Just a note for other reviewers - These URLs seems to be dead.

Personally, I would like to see some file extension like releng/show-untagged-commits.sh, so it is more clear.

Same thing about the extension here.

This rpkg alternative looks quite complicated when compared to the tito one. It isn't such a big deal since everyone will copy-paste the commands, but maybe some simplification could be made. However, I am quite skeptic to the asterisk here. What if someone forgets to rm -r /tmp/rpkg for some reason and release something unexpected. Personally, I would prefer this step to be atomic (i.e. building a srpm and then submitting it, in one command)

Yes, I will need to fix it. thank you!

The {{{}}} braces capure standard output of the command. {{{ $srcname }}} would be trying to execute $srcname content as a command, which would fail. The behavior in the braces is exactly the same as on bash shell.

I still think, that command for generating sources should be rpkg sources. It's consistent with rpkg srpm for generating a SRPM file and rpkg spec for generating a .spec file from a template. rpkg spec --sources feels very cryptic to me.

Right. I will add the note here that you should first checkout in the particular commit in the repository if you want an earlier version of the packages. It's not exactly equivalent to the tito commands because they can find tags across multiple commits in the repo but I personally think checking out a particular single commit in the repo and building all the packages from it is not that bad (I think it is sufficient for us).

...for us and for other people it could be as well. But the rpkg local --latest-tag command could be added at some point if needed.

It's ok to use git push here. But we are using here some other rpkg commands so I thought rpkg push could be used here as well..

There is a build-all.sh in the usage, but the script name is build-packages. Also, please consider the note above about having an extension in the file name.

Ye, I did some additional cleaning in the docs. I should have done that in the separate PR/commit but I thought removing those dead links is ok.

We don't want to hardcode the version here. It's another place that we will need to care about it.

Right, well sometimes the scripts are just without extension and the scripting language is just specified by a shebang inside the file (e.g. prunerepo is an example or even things like /usr/bin/alembic which is python instead). I don't think the ext is required there for those scripts..do you think it is ok to keep it like that?

rpkg is more complicated here yes. I first started to write a script that would fully replaced tito release fedora-git but then I realized it would be better to make it more the commands more granular. I am not sure why one We can later put the srpm generation command into the fedora-release script. Currently the fedora-release expects already prebuilt srpm as input (and you can even build by some other means than just by rpkg. As for the forgottenrm -r /tmp/rpkg`, normally rpkg builds into temporary dirs under /tmp/rpkg/ not directly into /tmp/rpkg so nothing should really happen. We can make it more error-prone by using a completely new directory instead of of /tmp/rpkg. Do you think it would be more solid?

Ye, I understand it might feel like it but once you actually see in the code how it woks I think it will start making sense to you. Anyway, I wanted to keep rpkg sources pretty much untouched so that it is just a subcommand that works with a DistGit lookaside cache and nothing more. It actually does not even reads the spec file. It just read the sources file.

Will fix the the help. But I would like to keep the scripts without extensions if possible. I think it is ok not to have them there.

Yes, that's true. I would like to fix this at some point so that the version is only on a single place but it needs to be first figured out how exactly. I would leave it of later though if you agree. Maybe this would deserve a small note in the docs that the versions in setup.py should be bumped as well.

Given that fedora-release script is pretty strict about its command line (it accepts just exactly two arguments and otherwise it errors) and given that /tmp/rpkg/*.src.rpm only expands src.rpm files directly under /tmp/rpkg (under which rpkg does not directly put files now), I would just keep this as it is. I don't see what could possibly happen there.

Okay. In case that we actually need rpkg push somewhere, I would like to have described the difference between git push and rpkg push there. If not, I think that it would be nice to say here, that simple git push can be used too, so we know that it doesn't do some magic.

I think that those examples are not exactly the same thing. Those packages put their executable into /usr/bin so you run them just by alembic or prunerepo. But now I see, that there are bash scripts as well as python scripts in the releng directory, so there would be a bit chaos in it. Therefore I don't insist on extensions.

Hello, I've fixed:

backend/docs/source/INSTALL.rst

to builddep from the renderred spec files.

doc/building_package.rst

to mention that you should checkout a desired commit first before building packages from it.

 doc/how_to_release_copr.rst

to mention that we will now need to bump the version in setup.py manually.

 releng/build-packages

to use build-packages name in the help.

Are these changes sufficient?

I am aware there are slight regressions in simplicity when compared to the previous release process but I also think we can pretty much solve all of it if we want to. I think we can do it later though. Apart from that, rpkg should feel quite good given its very compact command-line option set and some extra features it offers when compared to tito (spec templates or builtin rpm linting, which might also come handy).

1 new commit added

  • [doc] fixes according to review
5 years ago

I should read the code soon, but still. As a user, I don't really care about how the code is written and expect a user-friendly interface. Which IMHO rpkg spec --sources is not. Also, "just a subcommand that works with a DistGit lookaside cache and nothing more" is IMHO not valid argument, since the whole rpkg tool is now something more than a DistGit client.

In the end, it is your decision but I wanted to provide a different opinion (as a user who is not dev).

I am ok with scripts without filename extensions. Please see my comment above.

Well, I am all for figuring it out and doing it properly later, but I really don't like the hardcoded version here. IMHO everything else would be better. Personally, I would rather see something as horrible as using subprocess for generating the spec file and then reading it to get the version, if necessary. But I think that there will be a good enough solution, that won't be that awful - e.g. seeing the latest rpkg tag.

I think it supposed to be "a particular tag" or something like that.

1 new commit added

  • [doc] build->commit
5 years ago

2 new commits added

  • fix git packing for python-copr, copr-common
  • fix reading spec file values from setup.py
5 years ago

Well, I am all for figuring it out and doing it properly later, but I really don't like the hardcoded version here. IMHO everything else would be better. Personally, I would rather see something as horrible as using subprocess for generating the spec file and then reading it to get the version, if necessary. But I think that there will be a good enough solution, that won't be that awful - e.g. seeing the latest rpkg tag.

In the end, I needed to pass the spec variables on the command-line for the python setup.py invocations.

Nothing else really works well because at the moment the setup.py is being invoked during build, the original git data are no longer avaiiable so we cannot re-render the spec template to get the name or version. The values need to passed down to setup.py as environment from the already renderred spec file which is being evaluated by rpmbuild.

Not much I could do about it but the way it was solved is the same way how e.g. CFLAGS are passed down for python3 build (see the original python-copr spec file) so I think this should be ok.

I have git packing to operate only on directory level for python-copr, python-copr-common, and prunerepo.

I have also updated doc to reflect that manual bumps of version in setup.py scripts is no longer needed.

1 new commit added

  • update docs - manual setting version in setup.py files is no longer needed
5 years ago

1 new commit added

  • [doc] fix docs for python-copr to PyPI uploading
5 years ago

Okay. Although there are some drawbacks compared to the current solution with tito, review from my perspective is done :thumbsup: .

Pull-Request has been merged by clime

5 years ago
Metadata
Changes Summary 63
-17
file removed
.tito/build-missing-builds.sh
-46
file removed
.tito/git-untagged-commits.pl
-3
file removed
.tito/packages/.readme
-1
file removed
.tito/packages/copr-backend
-1
file removed
.tito/packages/copr-cli
-1
file removed
.tito/packages/copr-dist-git
-1
file removed
.tito/packages/copr-frontend
-1
file removed
.tito/packages/copr-keygen
-1
file removed
.tito/packages/copr-mocks
-1
file removed
.tito/packages/copr-rpmbuild
-1
file removed
.tito/packages/copr-selinux
-1
file removed
.tito/packages/prunerepo
-1
file removed
.tito/packages/python-copr
-1
file removed
.tito/packages/python-copr-common
-44
file removed
.tito/releasers.conf
-5
file removed
.tito/tito.props
-384
file removed
Vagrantfile
+8 -6
file changed
backend/copr-backend.spec
+17 -42
file changed
backend/docker/Dockerfile
+1 -1
file changed
backend/docker/Makefile
+1 -1
file changed
backend/docs/Makefile
+19 -12
file changed
backend/docs/source/INSTALL.rst
+2 -3
file changed
beaker-tests/DockerTestEnv/Dockerfile
+7 -9
file changed
beaker-tests/Regression/backend/setup.sh
+10 -3
file changed
beaker-tests/Regression/dist-git/files/etc/rpkg.conf
+15 -24
file changed
beaker-tests/Regression/dist-git/setup.sh
+1 -1
file changed
beaker-tests/Regression/dist-git/tests/batch1/run.sh
+4 -8
file changed
beaker-tests/Regression/frontend/setup.sh
+12 -9
file changed
cli/copr-cli.spec
+1 -17
file changed
cli/setup.py
+13 -9
file changed
common/python-copr-common.spec
+1 -16
file changed
common/setup.py
+7 -4
file changed
dist-git/copr-dist-git.spec
+3 -2
file changed
doc/beaker_tests.rst
+28 -22
file changed
doc/building_package.rst
+32 -55
file changed
doc/contribute.rst
+1 -0
file changed
doc/developer_documentation.rst
+18 -16
file changed
doc/git_guide.rst
+34 -46
file changed
doc/how_to_release_copr.rst
+43 -18
file changed
doc/seeddb.rst
+3 -3
file changed
doc/user_documentation.rst
+16 -32
file changed
docker/backend/Dockerfile
+9 -20
file changed
docker/builder/Dockerfile
+6 -5
file changed
docker/builder/files/etc/copr-rpmbuild/main.ini
+2 -3
file changed
docker/database/Dockerfile
+9 -13
file changed
docker/distgit/Dockerfile
+10 -21
file changed
docker/frontend/Dockerfile
+8 -5
file changed
frontend/copr-frontend.spec
+8 -5
file changed
keygen/copr-keygen.spec
+8 -5
file changed
mocks/copr-mocks.spec
+9 -6
file changed
prunerepo/prunerepo.spec
+5 -9
file changed
prunerepo/setup.py
+12 -9
file changed
python/python-copr.spec
+1 -18
file changed
python/setup.py
+23
file added
releng/build-packages
+97
file added
releng/fedora-release
+6
file added
releng/lib.sh
+9
file added
releng/releasers.ini
+33
file added
releng/show-untagged-commits
+2
file added
rpkg.conf
+10 -7
file changed
rpmbuild/copr-rpmbuild.spec
+6 -8
file changed
rpmbuild/setup.py
+8 -7
file changed
selinux/copr-selinux.spec